netsync crumblestate
This commit is contained in:
1 parent
5b7720fe65
commit
dbdbe95164
1 file changed
+39
-14
+39
-14
@@ -468,10 +468,14 @@ static void P_NetUnArchivePlayers(void)
|
||||
#define SD_FYOFFS 0x02
|
||||
#define SD_CXOFFS 0x04
|
||||
#define SD_CYOFFS 0x08
|
||||
#define SD_TAG 0x10
|
||||
#define SD_FLOORANG 0x20
|
||||
#define SD_CEILANG 0x40
|
||||
#define SD_TAGLIST 0x80
|
||||
#define SD_FLOORANG 0x10
|
||||
#define SD_CEILANG 0x20
|
||||
#define SD_TAG 0x40
|
||||
#define SD_DIFF3 0x80
|
||||
|
||||
// diff3 flags
|
||||
#define SD_TAGLIST 0x01
|
||||
#define SD_CRUMBLESTATE 0x04
|
||||
|
||||
#define LD_FLAG 0x01
|
||||
#define LD_SPECIAL 0x02
|
||||
@@ -503,7 +507,7 @@ static void P_NetArchiveWorld(void)
|
||||
mapsidedef_t *msd;
|
||||
maplinedef_t *mld;
|
||||
const sector_t *ss = sectors;
|
||||
UINT8 diff, diff2;
|
||||
UINT8 diff, diff2, diff3;
|
||||
|
||||
WRITEUINT32(save_p, ARCHIVEBLOCK_WORLD);
|
||||
put = save_p;
|
||||
@@ -530,7 +534,7 @@ static void P_NetArchiveWorld(void)
|
||||
|
||||
for (i = 0; i < numsectors; i++, ss++, ms++)
|
||||
{
|
||||
diff = diff2 = 0;
|
||||
diff = diff2 = diff3 = 0;
|
||||
if (ss->floorheight != SHORT(ms->floorheight)<<FRACBITS)
|
||||
diff |= SD_FLOORHT;
|
||||
if (ss->ceilingheight != SHORT(ms->ceilingheight)<<FRACBITS)
|
||||
@@ -564,7 +568,9 @@ 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;
|
||||
diff3 |= SD_TAGLIST;
|
||||
if (ss->crumblestate)
|
||||
diff3 |= SD_CRUMBLESTATE;
|
||||
|
||||
// Check if any of the sector's FOFs differ from how they spawned
|
||||
if (ss->ffloors)
|
||||
@@ -580,6 +586,9 @@ static void P_NetArchiveWorld(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (diff3)
|
||||
diff2 |= SD_DIFF3;
|
||||
|
||||
if (diff2)
|
||||
diff |= SD_DIFF2;
|
||||
@@ -590,6 +599,8 @@ static void P_NetArchiveWorld(void)
|
||||
WRITEUINT8(put, diff);
|
||||
if (diff & SD_DIFF2)
|
||||
WRITEUINT8(put, diff2);
|
||||
if (diff2 & SD_DIFF3)
|
||||
WRITEUINT8(put, diff3);
|
||||
if (diff & SD_FLOORHT)
|
||||
WRITEFIXED(put, ss->floorheight);
|
||||
if (diff & SD_CEILHT)
|
||||
@@ -610,17 +621,20 @@ static void P_NetArchiveWorld(void)
|
||||
WRITEFIXED(put, ss->ceiling_xoffs);
|
||||
if (diff2 & SD_CYOFFS)
|
||||
WRITEFIXED(put, ss->ceiling_yoffs);
|
||||
if (diff2 & SD_TAG) // save only the tag
|
||||
WRITEINT16(put, ss->tag);
|
||||
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
|
||||
if (diff2 & SD_TAG) // save only the tag
|
||||
WRITEINT16(put, ss->tag);
|
||||
if (diff3 & 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);
|
||||
}
|
||||
|
||||
if (diff3 & SD_CRUMBLESTATE)
|
||||
WRITEINT32(put, ss->crumblestate);
|
||||
|
||||
// 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
|
||||
@@ -658,7 +672,7 @@ static void P_NetArchiveWorld(void)
|
||||
// do lines
|
||||
for (i = 0; i < numlines; i++, mld++, li++)
|
||||
{
|
||||
diff = diff2 = 0;
|
||||
diff = diff2 = diff3 = 0;
|
||||
|
||||
if (li->special != SHORT(mld->special))
|
||||
diff |= LD_SPECIAL;
|
||||
@@ -749,7 +763,7 @@ static void P_NetUnArchiveWorld(void)
|
||||
line_t *li;
|
||||
side_t *si;
|
||||
UINT8 *get;
|
||||
UINT8 diff, diff2;
|
||||
UINT8 diff, diff2, diff3;
|
||||
|
||||
if (READUINT32(save_p) != ARCHIVEBLOCK_WORLD)
|
||||
I_Error("Bad $$$.sav at archive block World");
|
||||
@@ -772,6 +786,11 @@ static void P_NetUnArchiveWorld(void)
|
||||
else
|
||||
diff2 = 0;
|
||||
|
||||
if (diff2 & SD_DIFF3)
|
||||
diff3 = READUINT8(get);
|
||||
else
|
||||
diff3 = 0;
|
||||
|
||||
if (diff & SD_FLOORHT)
|
||||
sectors[i].floorheight = READFIXED(get);
|
||||
if (diff & SD_CEILHT)
|
||||
@@ -799,9 +818,9 @@ static void P_NetUnArchiveWorld(void)
|
||||
sectors[i].ceiling_xoffs = READFIXED(get);
|
||||
if (diff2 & SD_CYOFFS)
|
||||
sectors[i].ceiling_yoffs = READFIXED(get);
|
||||
if (diff2 & SD_TAG)
|
||||
if (diff3 & SD_TAG)
|
||||
sectors[i].tag = READINT16(get); // DON'T use P_ChangeSectorTag
|
||||
if (diff2 & SD_TAGLIST)
|
||||
if (diff3 & SD_TAGLIST)
|
||||
{
|
||||
sectors[i].firsttag = READINT32(get);
|
||||
sectors[i].nexttag = READINT32(get);
|
||||
@@ -810,6 +829,9 @@ static void P_NetUnArchiveWorld(void)
|
||||
sectors[i].floorpic_angle = READANGLE(get);
|
||||
if (diff2 & SD_CEILANG)
|
||||
sectors[i].ceilingpic_angle = READANGLE(get);
|
||||
|
||||
if (diff3 & SD_CRUMBLESTATE)
|
||||
sectors[i].crumblestate = READINT32(get);
|
||||
|
||||
if (diff & SD_FFLOORS)
|
||||
{
|
||||
@@ -868,6 +890,9 @@ static void P_NetUnArchiveWorld(void)
|
||||
diff2 = READUINT8(get);
|
||||
else
|
||||
diff2 = 0;
|
||||
|
||||
diff3 = 0;
|
||||
|
||||
if (diff & LD_FLAG)
|
||||
li->flags = READINT16(get);
|
||||
if (diff & LD_SPECIAL)
|
||||
|
||||
Reference in new issue
Block a user