diff --git a/source/duke3d/src/actors.cpp b/source/duke3d/src/actors.cpp index 9273d8dc3..b9c420ead 100644 --- a/source/duke3d/src/actors.cpp +++ b/source/duke3d/src/actors.cpp @@ -309,12 +309,12 @@ next_sprite: // : 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; diff --git a/source/duke3d/src/actors.h b/source/duke3d/src/actors.h index 95acc9450..0fdc816ec 100644 --- a/source/duke3d/src/actors.h +++ b/source/duke3d/src/actors.h @@ -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; diff --git a/source/duke3d/src/duke3d.h b/source/duke3d/src/duke3d.h index 77b65deec..811a37358 100644 --- a/source/duke3d/src/duke3d.h +++ b/source/duke3d/src/duke3d.h @@ -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 diff --git a/source/duke3d/src/game.cpp b/source/duke3d/src/game.cpp index ac7d826b5..a676d3f3d 100644 --- a/source/duke3d/src/game.cpp +++ b/source/duke3d/src/game.cpp @@ -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) diff --git a/source/duke3d/src/global.h b/source/duke3d/src/global.h index be35e3b30..2649c210c 100644 --- a/source/duke3d/src/global.h +++ b/source/duke3d/src/global.h @@ -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; diff --git a/source/duke3d/src/savegame.cpp b/source/duke3d/src/savegame.cpp index 496402db2..bff403c5b 100644 --- a/source/duke3d/src/savegame.cpp +++ b/source/duke3d/src/savegame.cpp @@ -1680,24 +1680,24 @@ static void sv_postscript_once() static void sv_preactordatasave() { - int32_t i; - - for (i=0; i