mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-31 05:30:48 +00:00
Savegame netsync for mobj->floorrover and ceilingrrover
This commit is contained in:
parent
f33f9dd284
commit
dd35871699
1 changed files with 73 additions and 27 deletions
100
src/p_saveg.c
100
src/p_saveg.c
|
@ -972,11 +972,13 @@ typedef enum
|
||||||
MD2_EXTVAL1 = 1<<5,
|
MD2_EXTVAL1 = 1<<5,
|
||||||
MD2_EXTVAL2 = 1<<6,
|
MD2_EXTVAL2 = 1<<6,
|
||||||
MD2_HNEXT = 1<<7,
|
MD2_HNEXT = 1<<7,
|
||||||
#ifdef ESLOPE
|
|
||||||
MD2_HPREV = 1<<8,
|
MD2_HPREV = 1<<8,
|
||||||
MD2_SLOPE = 1<<9
|
MD2_FLOORROVER = 1<<9,
|
||||||
|
#ifdef ESLOPE
|
||||||
|
MD2_CEILINGROVER = 1<<10,
|
||||||
|
MD2_SLOPE = 1<<11
|
||||||
#else
|
#else
|
||||||
MD2_HPREV = 1<<8
|
MD2_CEILINGROVER = 1<<10
|
||||||
#endif
|
#endif
|
||||||
} mobj_diff2_t;
|
} mobj_diff2_t;
|
||||||
|
|
||||||
|
@ -1170,6 +1172,10 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
|
||||||
diff2 |= MD2_HNEXT;
|
diff2 |= MD2_HNEXT;
|
||||||
if (mobj->hprev)
|
if (mobj->hprev)
|
||||||
diff2 |= MD2_HPREV;
|
diff2 |= MD2_HPREV;
|
||||||
|
if (mobj->floorrover)
|
||||||
|
diff2 |= MD2_FLOORROVER;
|
||||||
|
if (mobj->ceilingrover)
|
||||||
|
diff2 |= MD2_CEILINGROVER;
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
if (mobj->standingslope)
|
if (mobj->standingslope)
|
||||||
diff2 |= MD2_SLOPE;
|
diff2 |= MD2_SLOPE;
|
||||||
|
@ -1193,12 +1199,45 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
|
||||||
WRITEFIXED(save_p, mobj->floorz);
|
WRITEFIXED(save_p, mobj->floorz);
|
||||||
WRITEFIXED(save_p, mobj->ceilingz);
|
WRITEFIXED(save_p, mobj->ceilingz);
|
||||||
|
|
||||||
// \todo netsync for floorrover
|
if (diff & MD2_FLOORROVER)
|
||||||
|
{
|
||||||
|
ffloor_t *rover;
|
||||||
|
size_t i = 0;
|
||||||
|
INT32 roverindex = -1;
|
||||||
|
|
||||||
// WRITEUINT32(save_p, (UINT32)mobj->floor_sectornum);
|
for (rover = mobj->floorrover->target->ffloors; rover; rover = rover->next)
|
||||||
// WRITEUINT32(save_p, (UINT32)mobj->floor_rovernum);
|
{
|
||||||
// WRITEUINT32(save_p, (UINT32)mobj->ceiling_sectornum);
|
if (rover == mobj->floorrover)
|
||||||
// WRITEUINT32(save_p, (UINT32)mobj->ceiling_rovernum);
|
{
|
||||||
|
roverindex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
WRITEUINT32(save_p, (UINT32)(mobj->floorrover->target - sectors));
|
||||||
|
WRITEUINT32(save_p, (UINT32)roverindex);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (diff & MD2_CEILINGROVER)
|
||||||
|
{
|
||||||
|
ffloor_t *rover;
|
||||||
|
size_t i = 0;
|
||||||
|
INT32 roverindex = -1;
|
||||||
|
|
||||||
|
for (rover = mobj->ceilingrover->target->ffloors; rover; rover = rover->next)
|
||||||
|
{
|
||||||
|
if (rover == mobj->ceilingrover)
|
||||||
|
{
|
||||||
|
roverindex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
WRITEUINT32(save_p, mobj->ceilingrover->target - sectors);
|
||||||
|
WRITEUINT32(save_p, roverindex);
|
||||||
|
}
|
||||||
|
|
||||||
if (diff & MD_SPAWNPOINT)
|
if (diff & MD_SPAWNPOINT)
|
||||||
{
|
{
|
||||||
|
@ -1996,7 +2035,7 @@ static void LoadMobjThinker(actionf_p1 thinker)
|
||||||
UINT16 diff2;
|
UINT16 diff2;
|
||||||
INT32 i;
|
INT32 i;
|
||||||
fixed_t z, floorz, ceilingz;
|
fixed_t z, floorz, ceilingz;
|
||||||
//size_t floor_sectornum, floor_rovernum, ceiling_sectornum, ceiling_rovernum;
|
ffloor_t *floorrover = NULL, *ceilingrover = NULL;
|
||||||
|
|
||||||
diff = READUINT32(save_p);
|
diff = READUINT32(save_p);
|
||||||
if (diff & MD_MORE)
|
if (diff & MD_MORE)
|
||||||
|
@ -2010,25 +2049,37 @@ static void LoadMobjThinker(actionf_p1 thinker)
|
||||||
floorz = READFIXED(save_p);
|
floorz = READFIXED(save_p);
|
||||||
ceilingz = READFIXED(save_p);
|
ceilingz = READFIXED(save_p);
|
||||||
|
|
||||||
// \todo netsync for floorrover
|
if (diff2 & MD2_FLOORROVER)
|
||||||
#if 0
|
|
||||||
// Find FOF referenced by floorz
|
|
||||||
if (old_sectornum)
|
|
||||||
{
|
{
|
||||||
|
size_t floor_sectornum = (size_t)READUINT32(save_p);
|
||||||
|
size_t floor_rovernum = (size_t)READUINT32(save_p);
|
||||||
|
ffloor_t *rover = NULL;
|
||||||
size_t rovernum = 0;
|
size_t rovernum = 0;
|
||||||
for (rover = sectors[old_sectornum].ffloors; rover; rover = rover->next)
|
|
||||||
|
for (rover = sectors[floor_sectornum].ffloors; rover; rover = rover->next)
|
||||||
{
|
{
|
||||||
if (rovernum == old_rovernum)
|
if (rovernum == floor_rovernum)
|
||||||
break;
|
break;
|
||||||
rovernum++;
|
rovernum++;
|
||||||
}
|
}
|
||||||
|
floorrover = rover;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// floor_sectornum = (size_t)READUINT32(save_p);
|
if (diff2 & MD2_CEILINGROVER)
|
||||||
// floor_rovernum = (size_t)READUINT32(save_p);
|
{
|
||||||
// ceiling_sectornum = (size_t)READUINT32(save_p);
|
size_t ceiling_sectornum = (size_t)READUINT32(save_p);
|
||||||
// ceiling_rovernum = (size_t)READUINT32(save_p);
|
size_t ceiling_rovernum = (size_t)READUINT32(save_p);
|
||||||
|
ffloor_t *rover = NULL;
|
||||||
|
size_t rovernum = 0;
|
||||||
|
|
||||||
|
for (rover = sectors[ceiling_sectornum].ffloors; rover; rover = rover->next)
|
||||||
|
{
|
||||||
|
if (rovernum == ceiling_rovernum)
|
||||||
|
break;
|
||||||
|
rovernum++;
|
||||||
|
}
|
||||||
|
ceilingrover = rover;
|
||||||
|
}
|
||||||
|
|
||||||
if (diff & MD_SPAWNPOINT)
|
if (diff & MD_SPAWNPOINT)
|
||||||
{
|
{
|
||||||
|
@ -2054,13 +2105,8 @@ static void LoadMobjThinker(actionf_p1 thinker)
|
||||||
mobj->z = z;
|
mobj->z = z;
|
||||||
mobj->floorz = floorz;
|
mobj->floorz = floorz;
|
||||||
mobj->ceilingz = ceilingz;
|
mobj->ceilingz = ceilingz;
|
||||||
|
mobj->floorrover = floorrover;
|
||||||
// \todo netsync for floorrover
|
mobj->ceilingrover = ceilingrover;
|
||||||
|
|
||||||
// mobj->floor_sectornum = floor_sectornum;
|
|
||||||
// mobj->floor_rovernum = floor_rovernum;
|
|
||||||
// mobj->ceiling_sectornum = ceiling_sectornum;
|
|
||||||
// mobj->ceiling_rovernum = ceiling_rovernum;
|
|
||||||
|
|
||||||
if (diff & MD_TYPE)
|
if (diff & MD_TYPE)
|
||||||
mobj->type = READUINT32(save_p);
|
mobj->type = READUINT32(save_p);
|
||||||
|
|
Loading…
Reference in a new issue