From caf8f383ad180e4e5c401d20c36a3e498ad32136 Mon Sep 17 00:00:00 2001 From: Alug Date: Fri, 19 Apr 2024 03:38:55 +0200 Subject: [PATCH] Revert "change a few things" This reverts commit c5c61f76928c1c9753905bb4952bd2bef3e54b93. --- src/lua_mobjlib.c | 6 +++--- src/p_polyobj.c | 5 +++++ src/p_polyobj.h | 3 +++ src/p_saveg.c | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/lua_mobjlib.c b/src/lua_mobjlib.c index 78f55a2a7..7b1db5327 100644 --- a/src/lua_mobjlib.c +++ b/src/lua_mobjlib.c @@ -480,8 +480,8 @@ int mobj_hnext_setter(lua_State *L) { mobj_t *mo = GETMO(); - if ((mo->hnext && P_MobjWasRemoved(mo->hnext)) || lua_isnil(L, 2)) - P_SetTarget(&mo->hnext, NULL); + if (lua_isnil(L, 2)) + P_SetTarget(&mo->hnext, NULL); else { mobj_t *hnext = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ)); @@ -495,7 +495,7 @@ int mobj_hprev_setter(lua_State *L) { mobj_t *mo = GETMO(); - if ((mo->hprev && P_MobjWasRemoved(mo->hprev)) || lua_isnil(L, 2)) + if (lua_isnil(L, 2)) P_SetTarget(&mo->hprev, NULL); else { diff --git a/src/p_polyobj.c b/src/p_polyobj.c index f2ee7fb09..55fcbba10 100644 --- a/src/p_polyobj.c +++ b/src/p_polyobj.c @@ -1547,6 +1547,11 @@ void Polyobj_InitLevel(void) qitem = (mobjqitem_t *)M_QueueIterator(&spawnqueue); Polyobj_spawnPolyObj(i, qitem->mo, qitem->mo->spawnpoint->angle); + + PolyObjects[i].origx = qitem->mo->x; + PolyObjects[i].origy = qitem->mo->y; + PolyObjects[i].origz = qitem->mo->z; + PolyObjects[i].origangle = qitem->mo->spawnpoint->angle; } // move polyobjects to spawn points diff --git a/src/p_polyobj.h b/src/p_polyobj.h index 9a47cd150..cb526d74a 100644 --- a/src/p_polyobj.h +++ b/src/p_polyobj.h @@ -103,6 +103,9 @@ typedef struct polyobj_s // these are saved for netgames, so do not let Lua touch these! INT32 spawnflags; // Flags the polyobject originally spawned with + + fixed_t origx, origy, origz; + INT16 origangle; } polyobj_t; // diff --git a/src/p_saveg.c b/src/p_saveg.c index e4b01ee30..1d958ba54 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -2998,7 +2998,7 @@ static inline void P_UnArchivePolyObj(polyobj_t *po) return; // rotate and translate polyobject - Polyobj_MoveOnLoad(po, angle, x, y); + Polyobj_MoveOnLoad(po, angle + (po->origangle - po->angle), x + (po->origx - po->spawnSpot.x), y + (po->origy - po->spawnSpot.y)); } static inline void P_ArchivePolyObjects(void)