mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-27 21:01:04 +00:00
Sync sector tags and tag list variables properly
Dunno who thought it was a good idea to lump tag, nexttag and firsttag together in $$$.sav, but that meant changing sector tags caused SRB2 to stop responding since it lead to the tag lists being broken
This commit is contained in:
parent
a0d095e707
commit
b768c4b961
4 changed files with 15 additions and 8 deletions
|
@ -460,6 +460,7 @@ static void P_NetUnArchivePlayers(void)
|
|||
#define SD_TAG 0x10
|
||||
#define SD_FLOORANG 0x20
|
||||
#define SD_CEILANG 0x40
|
||||
#define SD_TAGLIST 0x80
|
||||
|
||||
#define LD_FLAG 0x01
|
||||
#define LD_SPECIAL 0x02
|
||||
|
@ -535,6 +536,8 @@ static void P_NetArchiveWorld(void)
|
|||
|
||||
if (ss->tag != SHORT(ms->tag))
|
||||
diff2 |= SD_TAG;
|
||||
if (ss->nexttag != ss->spawn_nexttag || ss->firsttag != ss->spawn_firsttag)
|
||||
diff2 |= SD_TAGLIST;
|
||||
|
||||
// Check if any of the sector's FOFs differ from how they spawned
|
||||
if (ss->ffloors)
|
||||
|
@ -582,16 +585,17 @@ static void P_NetArchiveWorld(void)
|
|||
WRITEFIXED(put, ss->ceiling_xoffs);
|
||||
if (diff2 & SD_CYOFFS)
|
||||
WRITEFIXED(put, ss->ceiling_yoffs);
|
||||
if (diff2 & SD_TAG)
|
||||
{
|
||||
if (diff2 & SD_TAG) // save only the tag
|
||||
WRITEINT16(put, ss->tag);
|
||||
WRITEINT32(put, ss->firsttag);
|
||||
WRITEINT32(put, ss->nexttag);
|
||||
}
|
||||
if (diff2 & SD_FLOORANG)
|
||||
WRITEANGLE(put, ss->floorpic_angle);
|
||||
if (diff2 & SD_CEILANG)
|
||||
WRITEANGLE(put, ss->ceilingpic_angle);
|
||||
if (diff2 & SD_TAGLIST) // save both firsttag and nexttag
|
||||
{ // either of these could be changed even if tag isn't
|
||||
WRITEINT32(put, ss->firsttag);
|
||||
WRITEINT32(put, ss->nexttag);
|
||||
}
|
||||
|
||||
// Special case: save the stats of all modified ffloors along with their ffloor "number"s
|
||||
// we don't bother with ffloors that haven't changed, that would just add to savegame even more than is really needed
|
||||
|
@ -774,12 +778,11 @@ static void P_NetUnArchiveWorld(void)
|
|||
if (diff2 & SD_CYOFFS)
|
||||
sectors[i].ceiling_yoffs = READFIXED(get);
|
||||
if (diff2 & SD_TAG)
|
||||
sectors[i].tag = READINT16(get); // DON'T use P_ChangeSectorTag
|
||||
if (diff2 & SD_TAGLIST)
|
||||
{
|
||||
INT16 tag;
|
||||
tag = READINT16(get);
|
||||
sectors[i].firsttag = READINT32(get);
|
||||
sectors[i].nexttag = READINT32(get);
|
||||
P_ChangeSectorTag(i, tag);
|
||||
}
|
||||
if (diff2 & SD_FLOORANG)
|
||||
sectors[i].floorpic_angle = READANGLE(get);
|
||||
|
|
|
@ -614,6 +614,7 @@ static void P_LoadSectors(lumpnum_t lumpnum)
|
|||
ss->special = SHORT(ms->special);
|
||||
ss->tag = SHORT(ms->tag);
|
||||
ss->nexttag = ss->firsttag = -1;
|
||||
ss->spawn_nexttag = ss->spawn_firsttag = -1;
|
||||
|
||||
memset(&ss->soundorg, 0, sizeof(ss->soundorg));
|
||||
ss->validcount = 0;
|
||||
|
|
|
@ -1519,6 +1519,8 @@ static inline 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--)
|
||||
|
|
|
@ -383,6 +383,7 @@ typedef struct sector_s
|
|||
#endif
|
||||
|
||||
// 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;
|
||||
|
|
Loading…
Reference in a new issue