diff --git a/src/d_clisrv.c b/src/d_clisrv.c index d20c0e5ea..7852a0a22 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -517,9 +517,9 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i) rsp->thokitem = (UINT32)LONG(players[i].thokitem); //mobjtype_t rsp->spinitem = (UINT32)LONG(players[i].spinitem); //mobjtype_t rsp->revitem = (UINT32)LONG(players[i].revitem); //mobjtype_t - rsp->actionspd = LONG(players[i].actionspd); - rsp->mindash = LONG(players[i].mindash); - rsp->maxdash = LONG(players[i].maxdash); + rsp->actionspd = (fixed_t)LONG(players[i].actionspd); + rsp->mindash = (fixed_t)LONG(players[i].mindash); + rsp->maxdash = (fixed_t)LONG(players[i].maxdash); rsp->jumpfactor = (fixed_t)LONG(players[i].jumpfactor); rsp->speed = (fixed_t)LONG(players[i].speed); @@ -531,6 +531,7 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i) rsp->deadtimer = players[i].deadtimer; rsp->exiting = (tic_t)LONG(players[i].exiting); rsp->homing = players[i].homing; + rsp->skidtime = (tic_t)LONG(players[i].skidtime); rsp->cmomx = (fixed_t)LONG(players[i].cmomx); rsp->cmomy = (fixed_t)LONG(players[i].cmomy); rsp->rmomx = (fixed_t)LONG(players[i].rmomx); @@ -590,7 +591,7 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i) rsp->tics = LONG(players[i].mo->tics); rsp->statenum = (statenum_t)LONG(players[i].mo->state-states); // :( - rsp->eflags = (UINT32)LONG(players[i].mo->eflags); + rsp->eflags = (UINT16)SHORT(players[i].mo->eflags); rsp->flags = LONG(players[i].mo->flags); rsp->flags2 = LONG(players[i].mo->flags2); @@ -642,9 +643,9 @@ static void resynch_read_player(resynch_pak *rsp) players[i].thokitem = (UINT32)LONG(rsp->thokitem); //mobjtype_t players[i].spinitem = (UINT32)LONG(rsp->spinitem); //mobjtype_t players[i].revitem = (UINT32)LONG(rsp->revitem); //mobjtype_t - players[i].actionspd = LONG(rsp->actionspd); - players[i].mindash = LONG(rsp->mindash); - players[i].maxdash = LONG(rsp->maxdash); + players[i].actionspd = (fixed_t)LONG(rsp->actionspd); + players[i].mindash = (fixed_t)LONG(rsp->mindash); + players[i].maxdash = (fixed_t)LONG(rsp->maxdash); players[i].jumpfactor = (fixed_t)LONG(rsp->jumpfactor); players[i].speed = (fixed_t)LONG(rsp->speed); @@ -656,6 +657,7 @@ static void resynch_read_player(resynch_pak *rsp) players[i].deadtimer = rsp->deadtimer; players[i].exiting = (tic_t)LONG(rsp->exiting); players[i].homing = rsp->homing; + players[i].skidtime = (tic_t)LONG(rsp->skidtime); players[i].cmomx = (fixed_t)LONG(rsp->cmomx); players[i].cmomy = (fixed_t)LONG(rsp->cmomy); players[i].rmomx = (fixed_t)LONG(rsp->rmomx); @@ -713,7 +715,7 @@ static void resynch_read_player(resynch_pak *rsp) //At this point, the player should have a body, whether they were respawned or not. P_UnsetThingPosition(players[i].mo); players[i].mo->angle = (angle_t)LONG(rsp->angle); - players[i].mo->eflags = (UINT32)LONG(rsp->eflags); + players[i].mo->eflags = (UINT16)SHORT(rsp->eflags); players[i].mo->flags = LONG(rsp->flags); players[i].mo->flags2 = LONG(rsp->flags2); players[i].mo->friction = LONG(rsp->friction); diff --git a/src/d_clisrv.h b/src/d_clisrv.h index 6bc06f13a..246447ed6 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -177,9 +177,9 @@ typedef struct UINT32 thokitem; //mobjtype_t UINT32 spinitem; //mobjtype_t UINT32 revitem; //mobjtype_t - INT32 actionspd; - INT32 mindash; - INT32 maxdash; + fixed_t actionspd; + fixed_t mindash; + fixed_t maxdash; fixed_t jumpfactor; fixed_t speed; @@ -191,6 +191,7 @@ typedef struct INT32 deadtimer; tic_t exiting; UINT8 homing; + tic_t skidtime; fixed_t cmomx; fixed_t cmomy; fixed_t rmomx; @@ -241,11 +242,11 @@ typedef struct fixed_t friction; fixed_t movefactor; - INT16 tics; + INT32 tics; statenum_t statenum; UINT32 flags; UINT32 flags2; - UINT8 eflags; + UINT16 eflags; fixed_t radius; fixed_t height; diff --git a/src/lua_mathlib.c b/src/lua_mathlib.c index fd00180d5..a55e3a0e4 100644 --- a/src/lua_mathlib.c +++ b/src/lua_mathlib.c @@ -100,7 +100,11 @@ static int lib_fixedint(lua_State *L) static int lib_fixeddiv(lua_State *L) { - lua_pushfixed(L, FixedDiv(luaL_checkfixed(L, 1), luaL_checkfixed(L, 2))); + fixed_t i = luaL_checkfixed(L, 1); + fixed_t j = luaL_checkfixed(L, 2); + if (j == 0) + return luaL_error(L, "divide by zero"); + lua_pushfixed(L, FixedDiv(i, j)); return 1; } @@ -112,7 +116,10 @@ static int lib_fixedrem(lua_State *L) static int lib_fixedsqrt(lua_State *L) { - lua_pushfixed(L, FixedSqrt(luaL_checkfixed(L, 1))); + fixed_t i = luaL_checkfixed(L, 1); + if (i < 0) + return luaL_error(L, "square root domain error"); + lua_pushfixed(L, FixedSqrt(i)); return 1; } diff --git a/src/p_saveg.c b/src/p_saveg.c index e0112bb79..952e567d7 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -613,7 +613,7 @@ static void P_NetArchiveWorld(void) WRITEUINT16(put, j); // save ffloor "number" WRITEUINT8(put, fflr_diff); if (fflr_diff & 1) - WRITEUINT16(put, rover->flags); + WRITEUINT32(put, rover->flags); if (fflr_diff & 2) WRITEINT16(put, rover->alpha); } @@ -815,7 +815,7 @@ static void P_NetUnArchiveWorld(void) fflr_diff = READUINT8(get); if (fflr_diff & 1) - rover->flags = READUINT16(get); + rover->flags = READUINT32(get); if (fflr_diff & 2) rover->alpha = READINT16(get); diff --git a/src/r_segs.c b/src/r_segs.c index 0e2b9ea5c..bac90eb16 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -1421,7 +1421,7 @@ static void R_RenderSegLoop (void) for (i = 0; i < dc_numlights; i++) { dc_lightlist[i].height += dc_lightlist[i].heightstep; - if (dc_lightlist[i].flags & FF_SOLID) + if (dc_lightlist[i].flags & FF_CUTSOLIDS) dc_lightlist[i].botheight += dc_lightlist[i].botheightstep; } } @@ -2508,7 +2508,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) #endif rlight->flags = light->flags; - if (light->caster && light->caster->flags & FF_SOLID) + if (light->caster && light->caster->flags & FF_CUTSOLIDS) { #ifdef ESLOPE if (*light->caster->b_slope) { diff --git a/src/r_things.c b/src/r_things.c index 5616c2224..2ec2f6ead 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -964,7 +964,7 @@ static void R_SplitSprite(vissprite_t *sprite, mobj_t *thing) cutfrac = (INT16)((centeryfrac - FixedMul(testheight - viewz, sprite->scale))>>FRACBITS); if (cutfrac < 0) continue; - if (cutfrac > vid.height) + if (cutfrac > viewheight) return; // Found a split! Make a new sprite, copy the old sprite to it, and