Further reorganization of actor_t. BYTEVERSION bumped.

git-svn-id: https://svn.eduke32.com/eduke32@6239 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2017-06-23 03:59:39 +00:00
parent 4a7806150c
commit b73c449f31
7 changed files with 36 additions and 45 deletions

View file

@ -309,12 +309,12 @@ next_sprite:
// <fromunderp>: below->above change?
static int32_t Proj_MaybeDoTransport(int32_t spriteNum, const uspritetype * const pSEffector, int32_t fromunderp, int32_t daz)
{
if (totalclock <= actor[spriteNum].lasttransport)
if ((totalclock & (UINT8_MAX-1)) <= actor[spriteNum].lasttransport)
return 0;
spritetype *const pSprite = &sprite[spriteNum];
const uspritetype *const otherse = (uspritetype *)&sprite[pSEffector->owner];
actor[spriteNum].lasttransport = totalclock + (TICSPERFRAME << 2);
actor[spriteNum].lasttransport = (totalclock + (TICSPERFRAME << 2)) & (UINT8_MAX-1);
pSprite->x += (otherse->x - pSEffector->x);
pSprite->y += (otherse->y - pSEffector->y);
@ -3483,7 +3483,7 @@ ACTOR_STATIC void G_MoveTransports(void)
case STAT_FALLER:
case STAT_DUMMYPLAYER:
{
if (totalclock > actor[sectSprite].lasttransport)
if ((totalclock & (UINT8_MAX-1)) > actor[sectSprite].lasttransport)
{
int const zvel = sprite[sectSprite].zvel;
int const absZvel = klabs(zvel);
@ -3558,7 +3558,7 @@ ACTOR_STATIC void G_MoveTransports(void)
A_SetSprite(newSprite, CLIPMASK0);
}
actor[sectSprite].lasttransport = totalclock + (TICSPERFRAME << 2);
actor[sectSprite].lasttransport = (totalclock + (TICSPERFRAME << 2)) & (UINT8_MAX-1);
sprite[sectSprite].x += sprite[OW(spriteNum)].x - SX(spriteNum);
sprite[sectSprite].y += sprite[OW(spriteNum)].y - SY(spriteNum);
@ -5664,7 +5664,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
j = pSprite->owner;
if (sprite[j].lotag == UINT16_MAX)
if (sprite[j].lotag == UINT8_MAX)
DELETE_SPRITE_AND_CONTINUE(spriteNum);
q = pSector->extra>>3;

View file

@ -150,6 +150,7 @@ typedef struct { int32_t id; struct action ac; } con_action_t;
#endif
// (+ 40 16 16 4 8 6 8 6 4 20)
#pragma pack(push, 1)
typedef struct
{
int32_t t_data[10]; // 40b sometimes used to hold offsets to con code
@ -166,28 +167,25 @@ typedef struct
vec3_t bpos; // 12b
int32_t floorz, ceilingz; // 8b
vec2_t lastv; // 8b
int32_t lasttransport; // 4b
int16_t picnum, ang, extra, owner; // 8b
int16_t movflag, tempang, timetosleep; // 6b
int16_t actorstayput;
#ifdef LUNATIC
// Movement flags, sprite[i].hitag in C-CON:
uint16_t movflags;
#endif
uint8_t cgg, lightcount;
int16_t lightId, lightmaxrange; // 4b
uint8_t cgg, lasttransport;
// NOTE: 'dispicnum' is updated every frame, not in sync with game tics!
int16_t dispicnum;
#ifdef POLYMER
_prlight *lightptr; // 4b/8b
#else
void * lightptr;
int16_t lightId, lightmaxrange; // 4b
uint8_t lightcount, filler[3];
#endif
} actor_t;
#pragma pack(push, 1)
// this struct needs to match the beginning of actor_t above
typedef struct
{
@ -203,15 +201,14 @@ typedef struct
vec3_t bpos; // 12b
int32_t floorz, ceilingz; // 8b
vec2_t lastv; // 8b
int32_t lasttransport; // 4b
int16_t picnum, ang, extra, owner; // 8b
int16_t movflag, tempang, timetosleep; // 6b
int16_t actorstayput;
#ifdef LUNATIC
uint16_t movflags;
#endif
uint8_t cgg;
uint8_t cgg, lasttransport;
spritetype sprite;
int16_t netIndex;

View file

@ -66,10 +66,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// increase by 3, because atomic GRP adds 1, and Shareware adds 2
#ifdef LUNATIC
// Lunatic
# define BYTEVERSION_EDUKE32 309
# define BYTEVERSION_EDUKE32 312
#else
// Non-Lua build
# define BYTEVERSION_EDUKE32 309
# define BYTEVERSION_EDUKE32 312
#endif
//#define BYTEVERSION_13 27

View file

@ -1322,7 +1322,10 @@ int32_t A_InsertSprite(int16_t whatsect,int32_t s_x,int32_t s_y,int32_t s_z,int1
actor[i].ceilingz = actor[s_ow].ceilingz;
}
actor[i].actorstayput = actor[i].extra = actor[i].lightId = -1;
actor[i].actorstayput = actor[i].extra -1;
#ifdef POLYMER
actor[i].lightId = -1;
#endif
actor[i].owner = s_ow;
G_InitActor(i, s_pn, 1);
@ -1415,7 +1418,10 @@ int A_Spawn(int spriteNum, int tileNum)
actor[newSprite].floorz = sector[SECT(newSprite)].floorz;
actor[newSprite].ceilingz = sector[SECT(newSprite)].ceilingz;
actor[newSprite].actorstayput = actor[newSprite].lightId = actor[newSprite].extra = -1;
actor[newSprite].actorstayput = actor[newSprite].extra = -1;
#ifdef POLYMER
actor[newSprite].lightId = -1;
#endif
if ((CS(newSprite) & 48)
&& PN(newSprite) != SPEAKER
@ -2156,11 +2162,13 @@ int A_Spawn(int spriteNum, int tileNum)
break;
case EXPLOSION2__STATIC:
#ifdef POLYMER
if (pSprite->yrepeat > 32)
{
G_AddGameLight(0, newSprite, ((pSprite->yrepeat*tilesiz[pSprite->picnum].y)<<1), 32768, 255+(95<<8),PR_LIGHT_PRIO_MAX_GAME);
actor[newSprite].lightcount = 2;
}
#endif
case EXPLOSION2BOT__STATIC:
case BURNING__STATIC:
case BURNING2__STATIC:
@ -6081,7 +6089,7 @@ int G_FPSLimit(void)
}
// TODO: reorder (net)actor_t to eliminate slop and update assertion
// EDUKE32_STATIC_ASSERT(sizeof(actor_t)==128);
EDUKE32_STATIC_ASSERT(sizeof(actor_t)%4 == 0);
EDUKE32_STATIC_ASSERT(sizeof(DukePlayer_t)%4 == 0);
int app_main(int argc, char const * const * argv)

View file

@ -65,10 +65,12 @@ enum DUKE3D_GLOBALFLAGS {
};
G_EXTERN DukeStatus_t sbar;
#pragma pack(push,1)
G_EXTERN actor_t actor[MAXSPRITES];
// g_tile: tile-specific data THAT DOES NOT CHANGE during the course of a game
G_EXTERN tiledata_t g_tile[MAXTILES];
G_EXTERN animwalltype animwall[MAXANIMWALLS];
#pragma pack(pop)
G_EXTERN char *apStrings[MAXQUOTES],*apXStrings[MAXQUOTES];
G_EXTERN char *label;
G_EXTERN int32_t g_musicIndex;

View file

@ -1680,24 +1680,24 @@ static void sv_postscript_once()
static void sv_preactordatasave()
{
int32_t i;
for (i=0; i<MAXSPRITES; i++)
#ifdef POLYMER
for (bssize_t i=0; i<MAXSPRITES; i++)
{
actor[i].lightptr = NULL;
actor[i].lightId = -1;
}
#endif
}
static void sv_postactordata()
{
int32_t i;
for (i=0; i<MAXSPRITES; i++)
#ifdef POLYMER
for (bssize_t i=0; i<MAXSPRITES; i++)
{
actor[i].lightptr = NULL;
actor[i].lightId = -1;
}
#endif
}
static void sv_preanimateptrsave()
@ -2217,24 +2217,7 @@ static void postloadplayer(int32_t savegamep)
//9
if (getrendermode() == REND_POLYMER)
polymer_loadboard();
#elif 0
if (getrendermode() == REND_POLYMER)
{
int32_t i = 0;
polymer_loadboard();
while (i < MAXSPRITES)
{
if (actor[i].lightptr)
{
polymer_deletelight(actor[i].lightId);
actor[i].lightptr = NULL;
actor[i].lightId = -1;
}
i++;
}
}
#endif
// this light pointer nulling needs to be outside the getrendermode check
// because we might be loading the savegame using another renderer but
// change to Polymer later
@ -2243,6 +2226,7 @@ static void postloadplayer(int32_t savegamep)
actor[i].lightptr = NULL;
actor[i].lightId = -1;
}
#endif
}
////////// END GENERIC SAVING/LOADING SYSTEM //////////

View file

@ -1191,10 +1191,10 @@ int P_ActivateSwitch(int playerNum, int wallOrSprite, int switchType)
if (switchType == SWITCH_SPRITE) // A wall sprite
{
if (actor[wallOrSprite].lasttransport == totalclock)
if (actor[wallOrSprite].lasttransport == (totalclock & (UINT8_MAX-1)))
return 0;
actor[wallOrSprite].lasttransport = totalclock;
actor[wallOrSprite].lasttransport = (totalclock & (UINT8_MAX-1));
if (sprite[wallOrSprite].lotag == 0)
return 0;