From 0b478b7a91d4bc2e4a7bbfa384351eb710861223 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 15 Sep 2025 20:00:39 +0200 Subject: [PATCH] get rid of "spawn_" sector_t fields we now make copies of lines, sectors and vertices on mapload that have the spawn state, so those fields are redundant now also fix copy paste that made ceiling flat angle check if its differs from the floor flat angle on netsave saves a whopping 32bytes per sector_t entry! --- src/p_saveg.c | 16 ++++++++-------- src/p_setup.c | 2 -- src/p_spec.c | 12 ++---------- src/r_defs.h | 11 ----------- 4 files changed, 10 insertions(+), 31 deletions(-) diff --git a/src/p_saveg.c b/src/p_saveg.c index 586e42084..e1e280e4b 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -601,22 +601,22 @@ static void ArchiveSectors(savebuffer_t *save) if (ss->special != spawnss->special) diff |= SD_SPECIAL; - if (ss->floor_xoffs != ss->spawn_flr_xoffs) + if (ss->floor_xoffs != spawnss->floor_xoffs) diff2 |= SD_FXOFFS; - if (ss->floor_yoffs != ss->spawn_flr_yoffs) + if (ss->floor_yoffs != spawnss->floor_yoffs) diff2 |= SD_FYOFFS; - if (ss->ceiling_xoffs != ss->spawn_ceil_xoffs) + if (ss->ceiling_xoffs != spawnss->ceiling_xoffs) diff2 |= SD_CXOFFS; - if (ss->ceiling_yoffs != ss->spawn_ceil_yoffs) + if (ss->ceiling_yoffs != spawnss->ceiling_yoffs) diff2 |= SD_CYOFFS; - if (ss->floorpic_angle != ss->spawn_flrpic_angle) + if (ss->floorpic_angle != spawnss->floorpic_angle) diff2 |= SD_FLOORANG; - if (ss->ceilingpic_angle != ss->spawn_flrpic_angle) + if (ss->ceilingpic_angle != spawnss->ceilingpic_angle) diff2 |= SD_CEILANG; if (ss->tag != spawnss->tag) diff2 |= SD_TAG; - if (ss->nexttag != ss->spawn_nexttag || ss->firsttag != ss->spawn_firsttag) + if (ss->nexttag != spawnss->nexttag || ss->firsttag != spawnss->firsttag) diff2 |= SD_TAGLIST; if (ss->ffloors && CheckFFloorDiff(ss)) @@ -3609,7 +3609,7 @@ FUNCINLINE static ATTRINLINE boolean P_NetUnArchiveMisc(savebuffer_t *save, bool // gamemap changed; we assume that its map header is always valid, // so make it so - if(!mapheaderinfo[gamemap-1]) + if (!mapheaderinfo[gamemap-1]) P_AllocMapHeader(gamemap-1); // tell the sound code to reset the music since we're skipping what diff --git a/src/p_setup.c b/src/p_setup.c index 5e1bca43e..bd432e09f 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -774,8 +774,6 @@ INT32 P_CheckLevelFlat(const char *flatname) static const sector_t sector_default = { .nexttag = -1, .firsttag = -1, - .spawn_nexttag = -1, - .spawn_firsttag = -1, .heightsec = -1, .camsec = -1, .floorlightsec = -1, diff --git a/src/p_spec.c b/src/p_spec.c index 1e1396df9..f9073c026 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -1242,8 +1242,6 @@ void P_InitTagLists(void) size_t j = (unsigned)sectors[i].tag % numsectors; sectors[i].nexttag = sectors[j].firsttag; sectors[j].firsttag = (INT32)i; - sectors[i].spawn_nexttag = sectors[i].nexttag; - sectors[j].spawn_firsttag = sectors[j].firsttag; } for (i = numlines - 1; i != (size_t)-1; i--) @@ -5519,22 +5517,16 @@ void P_SpawnSpecials(INT32 fromnetsave, boolean reloadinggamestate) { if (!(lines[i].flags & ML_NOSONIC)) // Modify floor flat alignment unless NOSONIC flag is set { - sectors[s].spawn_flrpic_angle = sectors[s].floorpic_angle = flatangle; + sectors[s].floorpic_angle = flatangle; sectors[s].floor_xoffs += xoffs; sectors[s].floor_yoffs += yoffs; - // saved for netgames - sectors[s].spawn_flr_xoffs = sectors[s].floor_xoffs; - sectors[s].spawn_flr_yoffs = sectors[s].floor_yoffs; } if (!(lines[i].flags & ML_NOTAILS)) // Modify ceiling flat alignment unless NOTAILS flag is set { - sectors[s].spawn_ceilpic_angle = sectors[s].ceilingpic_angle = flatangle; + sectors[s].ceilingpic_angle = flatangle; sectors[s].ceiling_xoffs += xoffs; sectors[s].ceiling_yoffs += yoffs; - // saved for netgames - sectors[s].spawn_ceil_xoffs = sectors[s].ceiling_xoffs; - sectors[s].spawn_ceil_yoffs = sectors[s].ceiling_yoffs; } } } diff --git a/src/r_defs.h b/src/r_defs.h index 01d01c99d..62156e3d2 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -396,17 +396,6 @@ typedef struct sector_s // Eternity engine slope boolean hasslope; // The sector, or one of its visible FOFs, contains a slope - - // these are saved for netgames, so do not let Lua touch these! - INT32 spawn_nexttag, spawn_firsttag; // the actual nexttag/firsttag values may differ if the sector's tag was changed - - // offsets sector spawned with (via linedef type 7) - fixed_t spawn_flr_xoffs, spawn_flr_yoffs; - fixed_t spawn_ceil_xoffs, spawn_ceil_yoffs; - - // flag angles sector spawned with (via linedef type 7) - angle_t spawn_flrpic_angle; - angle_t spawn_ceilpic_angle; } sector_t; //