mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 01:01:33 +00:00
Sync mobj->standingslope in netgames
This commit is contained in:
parent
51284c01d8
commit
14ea936f74
3 changed files with 26 additions and 1 deletions
|
@ -30,6 +30,9 @@
|
|||
#include "r_sky.h"
|
||||
#include "p_polyobj.h"
|
||||
#include "lua_script.h"
|
||||
#ifdef ESLOPE
|
||||
#include "p_slopes.h"
|
||||
#endif
|
||||
|
||||
savedata_t savedata;
|
||||
UINT8 *save_p;
|
||||
|
@ -921,7 +924,8 @@ typedef enum
|
|||
MD2_EXTVAL1 = 1<<5,
|
||||
MD2_EXTVAL2 = 1<<6,
|
||||
MD2_HNEXT = 1<<7,
|
||||
MD2_HPREV = 1<<8
|
||||
MD2_HPREV = 1<<8,
|
||||
MD2_SLOPE = 1<<9
|
||||
} mobj_diff2_t;
|
||||
|
||||
typedef enum
|
||||
|
@ -1109,6 +1113,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
|
|||
diff2 |= MD2_HNEXT;
|
||||
if (mobj->hprev)
|
||||
diff2 |= MD2_HPREV;
|
||||
if (mobj->standingslope)
|
||||
diff2 |= MD2_SLOPE;
|
||||
if (diff2 != 0)
|
||||
diff |= MD_MORE;
|
||||
|
||||
|
@ -1221,6 +1227,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
|
|||
WRITEUINT32(save_p, mobj->hnext->mobjnum);
|
||||
if (diff2 & MD2_HPREV)
|
||||
WRITEUINT32(save_p, mobj->hprev->mobjnum);
|
||||
if (diff2 & MD2_SLOPE)
|
||||
WRITEUINT16(save_p, mobj->standingslope->id);
|
||||
|
||||
WRITEUINT32(save_p, mobj->mobjnum);
|
||||
}
|
||||
|
@ -2068,6 +2076,9 @@ static void LoadMobjThinker(actionf_p1 thinker)
|
|||
mobj->hnext = (mobj_t *)(size_t)READUINT32(save_p);
|
||||
if (diff2 & MD2_HPREV)
|
||||
mobj->hprev = (mobj_t *)(size_t)READUINT32(save_p);
|
||||
if (diff2 & MD2_SLOPE)
|
||||
mobj->standingslope = P_SlopeById(READUINT16(save_p));
|
||||
|
||||
|
||||
if (diff & MD_REDFLAG)
|
||||
{
|
||||
|
|
|
@ -484,6 +484,18 @@ void P_CopySectorSlope(line_t *line)
|
|||
line->special = 0; // Linedef was use to set slopes, it finished its job, so now make it a normal linedef
|
||||
}
|
||||
|
||||
//
|
||||
// P_SlopeById
|
||||
//
|
||||
// Looks in the slope list for a slope with a specified ID. Mostly useful for netgame sync
|
||||
//
|
||||
pslope_t *P_SlopeById(UINT16 id)
|
||||
{
|
||||
pslope_t *ret;
|
||||
for (ret = slopelist; ret && ret->id != id; ret = ret->next);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef SPRINGCLEAN
|
||||
#include "byteptr.h"
|
||||
|
||||
|
|
|
@ -63,6 +63,8 @@ typedef enum
|
|||
//
|
||||
void P_CopySectorSlope(line_t *line);
|
||||
|
||||
pslope_t *P_SlopeById(UINT16 id);
|
||||
|
||||
// Returns the height of the sloped plane at (x, y) as a fixed_t
|
||||
fixed_t P_GetZAt(pslope_t *slope, fixed_t x, fixed_t y);
|
||||
|
||||
|
|
Loading…
Reference in a new issue