Put tm* variables into a struct

This makes it significantly easier to save/restore the state of these variables, whenever we need to do so for calling movement functions in the middle of other movement functions. This will also make it easier to move it out of global variable hell if desired later.
This commit is contained in:
Sally Coolatta 2022-11-20 19:27:34 -05:00
parent fa3feeb44a
commit b31aa1bbb0
14 changed files with 830 additions and 868 deletions

View file

@ -2729,7 +2729,7 @@ void F_EndTextPrompt(boolean forceexec, boolean noexec)
// \todo net safety, maybe loop all player thinkers? // \todo net safety, maybe loop all player thinkers?
if ((promptwasactive || forceexec) && !noexec && promptpostexectag) if ((promptwasactive || forceexec) && !noexec && promptpostexectag)
{ {
if (tmthing) // edge case where starting an invalid prompt immediately on level load will make P_MapStart fail if (tm.thing) // edge case where starting an invalid prompt immediately on level load will make P_MapStart fail
P_LinedefExecute(promptpostexectag, promptmo, NULL); P_LinedefExecute(promptpostexectag, promptmo, NULL);
else else
{ {

View file

@ -655,12 +655,12 @@ boolean K_BubbleShieldCollide(mobj_t *t1, mobj_t *t2)
{ {
// Counter desyncs // Counter desyncs
/*mobj_t *oldthing = thing; /*mobj_t *oldthing = thing;
mobj_t *oldtmthing = tmthing; mobj_t *oldtm.thing = tm.thing;
P_Thrust(tmthing, R_PointToAngle2(thing->x, thing->y, tmthing->x, tmthing->y), 4*thing->scale); P_Thrust(tm.thing, R_PointToAngle2(thing->x, thing->y, tm.thing->x, tm.thing->y), 4*thing->scale);
thing = oldthing; thing = oldthing;
P_SetTarget(&tmthing, oldtmthing);*/ P_SetTarget(&tm.thing, oldtm.thing);*/
if (P_PlayerInPain(t2->player) if (P_PlayerInPain(t2->player)
|| t2->player->flashing || t2->player->hyudorotimer || t2->player->flashing || t2->player->hyudorotimer

View file

@ -1004,108 +1004,108 @@ static int lib_pRemoveFloorSpriteSlope(lua_State *L)
static int lib_pRailThinker(lua_State *L) static int lib_pRailThinker(lua_State *L)
{ {
mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
mobj_t *ptmthing = tmthing; tm_t ptm = tm;
NOHUD NOHUD
INLEVEL INLEVEL
if (!mobj) if (!mobj)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
lua_pushboolean(L, P_RailThinker(mobj)); lua_pushboolean(L, P_RailThinker(mobj));
P_SetTarget(&tmthing, ptmthing); tm = ptm;
return 1; return 1;
} }
static int lib_pXYMovement(lua_State *L) static int lib_pXYMovement(lua_State *L)
{ {
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
mobj_t *ptmthing = tmthing; tm_t ptm = tm;
NOHUD NOHUD
INLEVEL INLEVEL
if (!actor) if (!actor)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
P_XYMovement(actor); P_XYMovement(actor);
P_SetTarget(&tmthing, ptmthing); tm = ptm;
return 0; return 0;
} }
static int lib_pRingXYMovement(lua_State *L) static int lib_pRingXYMovement(lua_State *L)
{ {
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
mobj_t *ptmthing = tmthing; tm_t ptm = tm;
NOHUD NOHUD
INLEVEL INLEVEL
if (!actor) if (!actor)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
P_RingXYMovement(actor); P_RingXYMovement(actor);
P_SetTarget(&tmthing, ptmthing); tm = ptm;
return 0; return 0;
} }
static int lib_pSceneryXYMovement(lua_State *L) static int lib_pSceneryXYMovement(lua_State *L)
{ {
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
mobj_t *ptmthing = tmthing; tm_t ptm = tm;
NOHUD NOHUD
INLEVEL INLEVEL
if (!actor) if (!actor)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
P_SceneryXYMovement(actor); P_SceneryXYMovement(actor);
P_SetTarget(&tmthing, ptmthing); tm = ptm;
return 0; return 0;
} }
static int lib_pZMovement(lua_State *L) static int lib_pZMovement(lua_State *L)
{ {
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
mobj_t *ptmthing = tmthing; tm_t ptm = tm;
NOHUD NOHUD
INLEVEL INLEVEL
if (!actor) if (!actor)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
lua_pushboolean(L, P_ZMovement(actor)); lua_pushboolean(L, P_ZMovement(actor));
P_CheckPosition(actor, actor->x, actor->y); P_CheckPosition(actor, actor->x, actor->y);
P_SetTarget(&tmthing, ptmthing); tm = ptm;
return 1; return 1;
} }
static int lib_pRingZMovement(lua_State *L) static int lib_pRingZMovement(lua_State *L)
{ {
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
mobj_t *ptmthing = tmthing; tm_t ptm = tm;
NOHUD NOHUD
INLEVEL INLEVEL
if (!actor) if (!actor)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
P_RingZMovement(actor); P_RingZMovement(actor);
P_CheckPosition(actor, actor->x, actor->y); P_CheckPosition(actor, actor->x, actor->y);
P_SetTarget(&tmthing, ptmthing); tm = ptm;
return 0; return 0;
} }
static int lib_pSceneryZMovement(lua_State *L) static int lib_pSceneryZMovement(lua_State *L)
{ {
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
mobj_t *ptmthing = tmthing; tm_t ptm = tm;
NOHUD NOHUD
INLEVEL INLEVEL
if (!actor) if (!actor)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
lua_pushboolean(L, P_SceneryZMovement(actor)); lua_pushboolean(L, P_SceneryZMovement(actor));
P_CheckPosition(actor, actor->x, actor->y); P_CheckPosition(actor, actor->x, actor->y);
P_SetTarget(&tmthing, ptmthing); tm = ptm;
return 1; return 1;
} }
static int lib_pPlayerZMovement(lua_State *L) static int lib_pPlayerZMovement(lua_State *L)
{ {
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
mobj_t *ptmthing = tmthing; tm_t ptm = tm;
NOHUD NOHUD
INLEVEL INLEVEL
if (!actor) if (!actor)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
P_PlayerZMovement(actor); P_PlayerZMovement(actor);
P_CheckPosition(actor, actor->x, actor->y); P_CheckPosition(actor, actor->x, actor->y);
P_SetTarget(&tmthing, ptmthing); tm = ptm;
return 0; return 0;
} }
@ -1307,13 +1307,13 @@ static int lib_pGivePlayerLives(lua_State *L)
static int lib_pMovePlayer(lua_State *L) static int lib_pMovePlayer(lua_State *L)
{ {
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
mobj_t *ptmthing = tmthing; tm_t ptm = tm;
NOHUD NOHUD
INLEVEL INLEVEL
if (!player) if (!player)
return LUA_ErrInvalid(L, "player_t"); return LUA_ErrInvalid(L, "player_t");
P_MovePlayer(player); P_MovePlayer(player);
P_SetTarget(&tmthing, ptmthing); tm = ptm;
return 0; return 0;
} }
@ -1385,7 +1385,7 @@ static int lib_pNukeEnemies(lua_State *L)
static int lib_pCheckPosition(lua_State *L) static int lib_pCheckPosition(lua_State *L)
{ {
mobj_t *ptmthing = tmthing; tm_t ptm = tm;
mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
fixed_t x = luaL_checkfixed(L, 2); fixed_t x = luaL_checkfixed(L, 2);
fixed_t y = luaL_checkfixed(L, 3); fixed_t y = luaL_checkfixed(L, 3);
@ -1394,14 +1394,14 @@ static int lib_pCheckPosition(lua_State *L)
if (!thing) if (!thing)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
lua_pushboolean(L, P_CheckPosition(thing, x, y)); lua_pushboolean(L, P_CheckPosition(thing, x, y));
LUA_PushUserdata(L, tmthing, META_MOBJ); LUA_PushUserdata(L, tm.thing, META_MOBJ);
P_SetTarget(&tmthing, ptmthing); tm = ptm;
return 2; return 2;
} }
static int lib_pTryMove(lua_State *L) static int lib_pTryMove(lua_State *L)
{ {
mobj_t *ptmthing = tmthing; tm_t ptm = tm;
mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
fixed_t x = luaL_checkfixed(L, 2); fixed_t x = luaL_checkfixed(L, 2);
fixed_t y = luaL_checkfixed(L, 3); fixed_t y = luaL_checkfixed(L, 3);
@ -1411,14 +1411,14 @@ static int lib_pTryMove(lua_State *L)
if (!thing) if (!thing)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
lua_pushboolean(L, P_TryMove(thing, x, y, allowdropoff)); lua_pushboolean(L, P_TryMove(thing, x, y, allowdropoff));
LUA_PushUserdata(L, tmthing, META_MOBJ); LUA_PushUserdata(L, tm.thing, META_MOBJ);
P_SetTarget(&tmthing, ptmthing); tm = ptm;
return 2; return 2;
} }
static int lib_pMove(lua_State *L) static int lib_pMove(lua_State *L)
{ {
mobj_t *ptmthing = tmthing; tm_t ptm = tm;
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
fixed_t speed = luaL_checkfixed(L, 2); fixed_t speed = luaL_checkfixed(L, 2);
NOHUD NOHUD
@ -1426,14 +1426,14 @@ static int lib_pMove(lua_State *L)
if (!actor) if (!actor)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
lua_pushboolean(L, P_Move(actor, speed)); lua_pushboolean(L, P_Move(actor, speed));
LUA_PushUserdata(L, tmthing, META_MOBJ); LUA_PushUserdata(L, tm.thing, META_MOBJ);
P_SetTarget(&tmthing, ptmthing); tm = ptm;
return 2; return 2;
} }
static int lib_pTeleportMove(lua_State *L) static int lib_pTeleportMove(lua_State *L)
{ {
mobj_t *ptmthing = tmthing; tm_t ptm = tm;
mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
fixed_t x = luaL_checkfixed(L, 2); fixed_t x = luaL_checkfixed(L, 2);
fixed_t y = luaL_checkfixed(L, 3); fixed_t y = luaL_checkfixed(L, 3);
@ -1444,14 +1444,14 @@ static int lib_pTeleportMove(lua_State *L)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
LUA_Deprecated(L, "P_TeleportMove", "P_SetOrigin\" or \"P_MoveOrigin"); LUA_Deprecated(L, "P_TeleportMove", "P_SetOrigin\" or \"P_MoveOrigin");
lua_pushboolean(L, P_MoveOrigin(thing, x, y, z)); lua_pushboolean(L, P_MoveOrigin(thing, x, y, z));
LUA_PushUserdata(L, tmthing, META_MOBJ); LUA_PushUserdata(L, tm.thing, META_MOBJ);
P_SetTarget(&tmthing, ptmthing); tm = ptm;
return 2; return 2;
} }
static int lib_pSetOrigin(lua_State *L) static int lib_pSetOrigin(lua_State *L)
{ {
mobj_t *ptmthing = tmthing; tm_t ptm = tm;
mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
fixed_t x = luaL_checkfixed(L, 2); fixed_t x = luaL_checkfixed(L, 2);
fixed_t y = luaL_checkfixed(L, 3); fixed_t y = luaL_checkfixed(L, 3);
@ -1461,14 +1461,14 @@ static int lib_pSetOrigin(lua_State *L)
if (!thing) if (!thing)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
lua_pushboolean(L, P_SetOrigin(thing, x, y, z)); lua_pushboolean(L, P_SetOrigin(thing, x, y, z));
LUA_PushUserdata(L, tmthing, META_MOBJ); LUA_PushUserdata(L, tm.thing, META_MOBJ);
P_SetTarget(&tmthing, ptmthing); tm = ptm;
return 2; return 2;
} }
static int lib_pMoveOrigin(lua_State *L) static int lib_pMoveOrigin(lua_State *L)
{ {
mobj_t *ptmthing = tmthing; tm_t ptm = tm;
mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
fixed_t x = luaL_checkfixed(L, 2); fixed_t x = luaL_checkfixed(L, 2);
fixed_t y = luaL_checkfixed(L, 3); fixed_t y = luaL_checkfixed(L, 3);
@ -1478,8 +1478,8 @@ static int lib_pMoveOrigin(lua_State *L)
if (!thing) if (!thing)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
lua_pushboolean(L, P_MoveOrigin(thing, x, y, z)); lua_pushboolean(L, P_MoveOrigin(thing, x, y, z));
LUA_PushUserdata(L, tmthing, META_MOBJ); LUA_PushUserdata(L, tm.thing, META_MOBJ);
P_SetTarget(&tmthing, ptmthing); tm = ptm;
return 2; return 2;
} }

View file

@ -722,7 +722,7 @@ static int sector_set(lua_State *L)
return luaL_error(L, "sector_t field " LUA_QS " cannot be set.", sector_opt[field]); return luaL_error(L, "sector_t field " LUA_QS " cannot be set.", sector_opt[field]);
case sector_floorheight: { // floorheight case sector_floorheight: { // floorheight
boolean flag; boolean flag;
mobj_t *ptmthing = tmthing; tm_t ptm = tm;
fixed_t lastpos = sector->floorheight; fixed_t lastpos = sector->floorheight;
sector->floorheight = luaL_checkfixed(L, 3); sector->floorheight = luaL_checkfixed(L, 3);
flag = P_CheckSector(sector, true); flag = P_CheckSector(sector, true);
@ -731,12 +731,12 @@ static int sector_set(lua_State *L)
sector->floorheight = lastpos; sector->floorheight = lastpos;
P_CheckSector(sector, true); P_CheckSector(sector, true);
} }
P_SetTarget(&tmthing, ptmthing); tm = ptm;
break; break;
} }
case sector_ceilingheight: { // ceilingheight case sector_ceilingheight: { // ceilingheight
boolean flag; boolean flag;
mobj_t *ptmthing = tmthing; tm_t ptm = tm;
fixed_t lastpos = sector->ceilingheight; fixed_t lastpos = sector->ceilingheight;
sector->ceilingheight = luaL_checkfixed(L, 3); sector->ceilingheight = luaL_checkfixed(L, 3);
flag = P_CheckSector(sector, true); flag = P_CheckSector(sector, true);
@ -745,7 +745,7 @@ static int sector_set(lua_State *L)
sector->ceilingheight = lastpos; sector->ceilingheight = lastpos;
P_CheckSector(sector, true); P_CheckSector(sector, true);
} }
P_SetTarget(&tmthing, ptmthing); tm = ptm;
break; break;
} }
case sector_floorpic: case sector_floorpic:
@ -2127,7 +2127,7 @@ static int ffloor_set(lua_State *L)
case ffloor_topheight: { // topheight case ffloor_topheight: { // topheight
boolean flag; boolean flag;
fixed_t lastpos = *ffloor->topheight; fixed_t lastpos = *ffloor->topheight;
mobj_t *ptmthing = tmthing; tm_t ptm = tm;
sector_t *sector = &sectors[ffloor->secnum]; sector_t *sector = &sectors[ffloor->secnum];
sector->ceilingheight = luaL_checkfixed(L, 3); sector->ceilingheight = luaL_checkfixed(L, 3);
flag = P_CheckSector(sector, true); flag = P_CheckSector(sector, true);
@ -2136,7 +2136,7 @@ static int ffloor_set(lua_State *L)
*ffloor->topheight = lastpos; *ffloor->topheight = lastpos;
P_CheckSector(sector, true); P_CheckSector(sector, true);
} }
P_SetTarget(&tmthing, ptmthing); tm = ptm;
break; break;
} }
case ffloor_toppic: case ffloor_toppic:
@ -2148,7 +2148,7 @@ static int ffloor_set(lua_State *L)
case ffloor_bottomheight: { // bottomheight case ffloor_bottomheight: { // bottomheight
boolean flag; boolean flag;
fixed_t lastpos = *ffloor->bottomheight; fixed_t lastpos = *ffloor->bottomheight;
mobj_t *ptmthing = tmthing; tm_t ptm = tm;
sector_t *sector = &sectors[ffloor->secnum]; sector_t *sector = &sectors[ffloor->secnum];
sector->floorheight = luaL_checkfixed(L, 3); sector->floorheight = luaL_checkfixed(L, 3);
flag = P_CheckSector(sector, true); flag = P_CheckSector(sector, true);
@ -2157,7 +2157,7 @@ static int ffloor_set(lua_State *L)
*ffloor->bottomheight = lastpos; *ffloor->bottomheight = lastpos;
P_CheckSector(sector, true); P_CheckSector(sector, true);
} }
P_SetTarget(&tmthing, ptmthing); tm = ptm;
break; break;
} }
case ffloor_bottompic: case ffloor_bottompic:

View file

@ -515,14 +515,14 @@ static int mobj_set(lua_State *L)
case mobj_z: case mobj_z:
{ {
// z doesn't cross sector bounds so it's okay. // z doesn't cross sector bounds so it's okay.
mobj_t *ptmthing = tmthing; tm_t ptm = tm;
mo->z = luaL_checkfixed(L, 3); mo->z = luaL_checkfixed(L, 3);
P_CheckPosition(mo, mo->x, mo->y); P_CheckPosition(mo, mo->x, mo->y);
mo->floorz = tmfloorz; mo->floorz = tm.floorz;
mo->ceilingz = tmceilingz; mo->ceilingz = tm.ceilingz;
mo->floorrover = tmfloorrover; mo->floorrover = tm.floorrover;
mo->ceilingrover = tmceilingrover; mo->ceilingrover = tm.ceilingrover;
P_SetTarget(&tmthing, ptmthing); tm = ptm;
break; break;
} }
case mobj_snext: case mobj_snext:
@ -583,30 +583,30 @@ static int mobj_set(lua_State *L)
return NOSET; return NOSET;
case mobj_radius: case mobj_radius:
{ {
mobj_t *ptmthing = tmthing; tm_t ptm = tm;
mo->radius = luaL_checkfixed(L, 3); mo->radius = luaL_checkfixed(L, 3);
if (mo->radius < 0) if (mo->radius < 0)
mo->radius = 0; mo->radius = 0;
P_CheckPosition(mo, mo->x, mo->y); P_CheckPosition(mo, mo->x, mo->y);
mo->floorz = tmfloorz; mo->floorz = tm.floorz;
mo->ceilingz = tmceilingz; mo->ceilingz = tm.ceilingz;
mo->floorrover = tmfloorrover; mo->floorrover = tm.floorrover;
mo->ceilingrover = tmceilingrover; mo->ceilingrover = tm.ceilingrover;
P_SetTarget(&tmthing, ptmthing); tm = ptm;
break; break;
} }
case mobj_height: case mobj_height:
{ {
mobj_t *ptmthing = tmthing; tm_t ptm = tm;
mo->height = luaL_checkfixed(L, 3); mo->height = luaL_checkfixed(L, 3);
if (mo->height < 0) if (mo->height < 0)
mo->height = 0; mo->height = 0;
P_CheckPosition(mo, mo->x, mo->y); P_CheckPosition(mo, mo->x, mo->y);
mo->floorz = tmfloorz; mo->floorz = tm.floorz;
mo->ceilingz = tmceilingz; mo->ceilingz = tm.ceilingz;
mo->floorrover = tmfloorrover; mo->floorrover = tm.floorrover;
mo->ceilingrover = tmceilingrover; mo->ceilingrover = tm.ceilingrover;
P_SetTarget(&tmthing, ptmthing); tm = ptm;
break; break;
} }
case mobj_momx: case mobj_momx:

View file

@ -543,10 +543,10 @@ boolean P_Move(mobj_t *actor, fixed_t speed)
if (!P_TryMove(actor, tryx, tryy, false)) if (!P_TryMove(actor, tryx, tryy, false))
{ {
if (actor->flags & MF_FLOAT && floatok) if (actor->flags & MF_FLOAT && tm.floatok)
{ {
// must adjust height // must adjust height
if (actor->z < tmfloorz) if (actor->z < tm.floorz)
actor->z += FixedMul(FLOATSPEED, actor->scale); actor->z += FixedMul(FLOATSPEED, actor->scale);
else else
actor->z -= FixedMul(FLOATSPEED, actor->scale); actor->z -= FixedMul(FLOATSPEED, actor->scale);
@ -10421,13 +10421,13 @@ void A_FlickyCenter(mobj_t *actor)
{ {
actor->extravalue2 = 1; actor->extravalue2 = 1;
P_SetOrigin(actor, actor->target->x, actor->target->y, actor->target->z); P_SetOrigin(actor, actor->target->x, actor->target->y, actor->target->z);
tmthing = NULL; P_SetTarget(&tm.thing, NULL);
} }
else if(actor->extravalue2) else if(actor->extravalue2)
{ {
actor->extravalue2 = 0; actor->extravalue2 = 0;
P_SetOrigin(actor, originx, originy, originz); P_SetOrigin(actor, originx, originy, originz);
tmthing = NULL; P_SetTarget(&tm.thing, NULL);
} }
} }
} }

View file

@ -381,25 +381,46 @@ void P_InternalFlickyHop(mobj_t *actor, fixed_t momz, fixed_t momh, angle_t angl
// P_MAP // P_MAP
// //
// If "floatok" true, move would be ok typedef struct tm_s
// if within "tmfloorz - tmceilingz". {
extern boolean floatok; mobj_t *thing;
extern fixed_t tmfloorz; fixed_t x, y;
extern fixed_t tmceilingz; fixed_t bbox[4];
extern ffloor_t *tmfloorrover, *tmceilingrover; INT32 flags;
extern mobj_t *tmfloorthing, *tmhitthing, *tmthing;
precipmobj_t *precipthing;
fixed_t precipbbox[4];
// If "floatok" true, move would be ok
// if within "tm.floorz - tm.ceilingz".
boolean floatok;
fixed_t floorz, ceilingz;
fixed_t dropoffz, drpoffceilz; // drop-off floor/ceiling heights
mobj_t *floorthing; // the thing corresponding to tm.floorz or NULL if tm.floorz is from a sector
mobj_t *hitthing; // the solid thing you bumped into (for collisions)
ffloor_t *floorrover, *ceilingrover;
pslope_t *floorslope, *ceilingslope;
INT32 floorpic, ceilingpic;
fixed_t floorstep, ceilingstep;
// keep track of the line that lowers the ceiling,
// so missiles don't explode against sky hack walls
line_t *ceilingline;
// set by PIT_CheckLine() for any line that stopped the PIT_CheckLine()
// that is, for any line which is 'solid'
line_t *blockingline;
} tm_t;
extern tm_t tm;
extern camera_t *mapcampointer; extern camera_t *mapcampointer;
extern fixed_t tmx;
extern fixed_t tmy;
extern pslope_t *tmfloorslope, *tmceilingslope;
extern INT32 tmfloorpic, tmceilingpic;
/* cphipps 2004/08/30 */ /* cphipps 2004/08/30 */
extern void P_MapStart(void); extern void P_MapStart(void);
extern void P_MapEnd(void); extern void P_MapEnd(void);
extern line_t *ceilingline;
extern line_t *blockingline;
extern msecnode_t *sector_list; extern msecnode_t *sector_list;
extern mprecipsecnode_t *precipsector_list; extern mprecipsecnode_t *precipsector_list;

File diff suppressed because it is too large Load diff

View file

@ -379,8 +379,8 @@ void P_CameraLineOpening(line_t *linedef)
} }
else else
{ {
frontfloor = P_CameraGetFloorZ (mapcampointer, front, tmx, tmy, linedef); frontfloor = P_CameraGetFloorZ (mapcampointer, front, tm.x, tm.y, linedef);
frontceiling = P_CameraGetCeilingZ(mapcampointer, front, tmx, tmy, linedef); frontceiling = P_CameraGetCeilingZ(mapcampointer, front, tm.x, tm.y, linedef);
} }
if (back->camsec >= 0) if (back->camsec >= 0)
@ -397,8 +397,8 @@ void P_CameraLineOpening(line_t *linedef)
} }
else else
{ {
backfloor = P_CameraGetFloorZ(mapcampointer, back, tmx, tmy, linedef); backfloor = P_CameraGetFloorZ(mapcampointer, back, tm.x, tm.y, linedef);
backceiling = P_CameraGetCeilingZ(mapcampointer, back, tmx, tmy, linedef); backceiling = P_CameraGetCeilingZ(mapcampointer, back, tm.x, tm.y, linedef);
} }
{ {
@ -440,8 +440,8 @@ void P_CameraLineOpening(line_t *linedef)
if (!(rover->fofflags & FOF_BLOCKOTHERS) || !(rover->fofflags & FOF_RENDERALL) || !(rover->fofflags & FOF_EXISTS) || (rover->master->frontsector->flags & MSF_NOCLIPCAMERA)) if (!(rover->fofflags & FOF_BLOCKOTHERS) || !(rover->fofflags & FOF_RENDERALL) || !(rover->fofflags & FOF_EXISTS) || (rover->master->frontsector->flags & MSF_NOCLIPCAMERA))
continue; continue;
topheight = P_CameraGetFOFTopZ(mapcampointer, front, rover, tmx, tmy, linedef); topheight = P_CameraGetFOFTopZ(mapcampointer, front, rover, tm.x, tm.y, linedef);
bottomheight = P_CameraGetFOFBottomZ(mapcampointer, front, rover, tmx, tmy, linedef); bottomheight = P_CameraGetFOFBottomZ(mapcampointer, front, rover, tm.x, tm.y, linedef);
delta1 = abs(mapcampointer->z - (bottomheight + ((topheight - bottomheight)/2))); delta1 = abs(mapcampointer->z - (bottomheight + ((topheight - bottomheight)/2)));
delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2))); delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2)));
@ -464,8 +464,8 @@ void P_CameraLineOpening(line_t *linedef)
if (!(rover->fofflags & FOF_BLOCKOTHERS) || !(rover->fofflags & FOF_RENDERALL) || !(rover->fofflags & FOF_EXISTS) || (rover->master->frontsector->flags & MSF_NOCLIPCAMERA)) if (!(rover->fofflags & FOF_BLOCKOTHERS) || !(rover->fofflags & FOF_RENDERALL) || !(rover->fofflags & FOF_EXISTS) || (rover->master->frontsector->flags & MSF_NOCLIPCAMERA))
continue; continue;
topheight = P_CameraGetFOFTopZ(mapcampointer, back, rover, tmx, tmy, linedef); topheight = P_CameraGetFOFTopZ(mapcampointer, back, rover, tm.x, tm.y, linedef);
bottomheight = P_CameraGetFOFBottomZ(mapcampointer, back, rover, tmx, tmy, linedef); bottomheight = P_CameraGetFOFBottomZ(mapcampointer, back, rover, tm.x, tm.y, linedef);
delta1 = abs(mapcampointer->z - (bottomheight + ((topheight - bottomheight)/2))); delta1 = abs(mapcampointer->z - (bottomheight + ((topheight - bottomheight)/2)));
delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2))); delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2)));
@ -614,7 +614,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
return; return;
} }
P_ClosestPointOnLine(tmx, tmy, linedef, &cross); P_ClosestPointOnLine(tm.x, tm.y, linedef, &cross);
// Treat polyobjects kind of like 3D Floors // Treat polyobjects kind of like 3D Floors
if (linedef->polyobj && (linedef->polyobj->flags & POF_TESTHEIGHT)) if (linedef->polyobj && (linedef->polyobj->flags & POF_TESTHEIGHT))
@ -656,8 +656,8 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
fixed_t height[2]; fixed_t height[2];
const sector_t * sector[2] = { front, back }; const sector_t * sector[2] = { front, back };
height[FRONT] = P_GetCeilingZ(mobj, front, tmx, tmy, linedef); height[FRONT] = P_GetCeilingZ(mobj, front, tm.x, tm.y, linedef);
height[BACK] = P_GetCeilingZ(mobj, back, tmx, tmy, linedef); height[BACK] = P_GetCeilingZ(mobj, back, tm.x, tm.y, linedef);
hi = ( height[0] < height[1] ); hi = ( height[0] < height[1] );
lo = ! hi; lo = ! hi;
@ -676,8 +676,8 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
openceilingdrop = ( topedge[hi] - topedge[lo] ); openceilingdrop = ( topedge[hi] - topedge[lo] );
} }
height[FRONT] = P_GetFloorZ(mobj, front, tmx, tmy, linedef); height[FRONT] = P_GetFloorZ(mobj, front, tm.x, tm.y, linedef);
height[BACK] = P_GetFloorZ(mobj, back, tmx, tmy, linedef); height[BACK] = P_GetFloorZ(mobj, back, tm.x, tm.y, linedef);
hi = ( height[0] < height[1] ); hi = ( height[0] < height[1] );
lo = ! hi; lo = ! hi;
@ -818,8 +818,8 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|| (rover->fofflags & FOF_BLOCKOTHERS && !mobj->player))) || (rover->fofflags & FOF_BLOCKOTHERS && !mobj->player)))
continue; continue;
topheight = P_GetFOFTopZ(mobj, front, rover, tmx, tmy, linedef); topheight = P_GetFOFTopZ(mobj, front, rover, tm.x, tm.y, linedef);
bottomheight = P_GetFOFBottomZ(mobj, front, rover, tmx, tmy, linedef); bottomheight = P_GetFOFBottomZ(mobj, front, rover, tm.x, tm.y, linedef);
delta1 = abs(mobj->z - (bottomheight + ((topheight - bottomheight)/2))); delta1 = abs(mobj->z - (bottomheight + ((topheight - bottomheight)/2)));
delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2))); delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2)));
@ -862,8 +862,8 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|| (rover->fofflags & FOF_BLOCKOTHERS && !mobj->player))) || (rover->fofflags & FOF_BLOCKOTHERS && !mobj->player)))
continue; continue;
topheight = P_GetFOFTopZ(mobj, back, rover, tmx, tmy, linedef); topheight = P_GetFOFTopZ(mobj, back, rover, tm.x, tm.y, linedef);
bottomheight = P_GetFOFBottomZ(mobj, back, rover, tmx, tmy, linedef); bottomheight = P_GetFOFBottomZ(mobj, back, rover, tm.x, tm.y, linedef);
delta1 = abs(mobj->z - (bottomheight + ((topheight - bottomheight)/2))); delta1 = abs(mobj->z - (bottomheight + ((topheight - bottomheight)/2)));
delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2))); delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2)));
@ -1596,16 +1596,16 @@ boolean P_RadiusLinesCheck(fixed_t radius, fixed_t x, fixed_t y,
INT32 xl, xh, yl, yh; INT32 xl, xh, yl, yh;
INT32 bx, by; INT32 bx, by;
tmbbox[BOXTOP] = y + radius; tm.bbox[BOXTOP] = y + radius;
tmbbox[BOXBOTTOM] = y - radius; tm.bbox[BOXBOTTOM] = y - radius;
tmbbox[BOXRIGHT] = x + radius; tm.bbox[BOXRIGHT] = x + radius;
tmbbox[BOXLEFT] = x - radius; tm.bbox[BOXLEFT] = x - radius;
// check lines // check lines
xl = (unsigned)(tmbbox[BOXLEFT] - bmaporgx)>>MAPBLOCKSHIFT; xl = (unsigned)(tm.bbox[BOXLEFT] - bmaporgx)>>MAPBLOCKSHIFT;
xh = (unsigned)(tmbbox[BOXRIGHT] - bmaporgx)>>MAPBLOCKSHIFT; xh = (unsigned)(tm.bbox[BOXRIGHT] - bmaporgx)>>MAPBLOCKSHIFT;
yl = (unsigned)(tmbbox[BOXBOTTOM] - bmaporgy)>>MAPBLOCKSHIFT; yl = (unsigned)(tm.bbox[BOXBOTTOM] - bmaporgy)>>MAPBLOCKSHIFT;
yh = (unsigned)(tmbbox[BOXTOP] - bmaporgy)>>MAPBLOCKSHIFT; yh = (unsigned)(tm.bbox[BOXTOP] - bmaporgy)>>MAPBLOCKSHIFT;
for (bx = xl; bx <= xh; bx++) for (bx = xl; bx <= xh; bx++)
for (by = yl; by <= yh; by++) for (by = yl; by <= yh; by++)

View file

@ -85,8 +85,6 @@ boolean P_BlockThingsIterator(INT32 x, INT32 y, BlockItReturn_t(*func)(mobj_t *)
extern divline_t trace; extern divline_t trace;
extern fixed_t tmbbox[4]; // p_map.c
// call your user function for each line of the blockmap in the // call your user function for each line of the blockmap in the
// bbox defined by the radius // bbox defined by the radius
//boolean P_RadiusLinesCheck(fixed_t radius, fixed_t x, fixed_t y, //boolean P_RadiusLinesCheck(fixed_t radius, fixed_t x, fixed_t y,

View file

@ -1491,12 +1491,12 @@ bustupdone:
// //
static boolean P_CheckSkyHit(mobj_t *mo) static boolean P_CheckSkyHit(mobj_t *mo)
{ {
if (ceilingline && ceilingline->backsector if (tm.ceilingline && tm.ceilingline->backsector
&& ceilingline->backsector->ceilingpic == skyflatnum && tm.ceilingline->backsector->ceilingpic == skyflatnum
&& ceilingline->frontsector && tm.ceilingline->frontsector
&& ceilingline->frontsector->ceilingpic == skyflatnum && tm.ceilingline->frontsector->ceilingpic == skyflatnum
&& (mo->z >= ceilingline->frontsector->ceilingheight && (mo->z >= tm.ceilingline->frontsector->ceilingheight
|| mo->z >= ceilingline->backsector->ceilingheight)) || mo->z >= tm.ceilingline->backsector->ceilingheight))
return true; return true;
return false; return false;
} }
@ -1601,7 +1601,7 @@ void P_XYMovement(mobj_t *mo)
// blocked move // blocked move
moved = false; moved = false;
if (LUA_HookMobjMoveBlocked(mo, tmhitthing, blockingline)) if (LUA_HookMobjMoveBlocked(mo, tm.hitthing, tm.blockingline))
{ {
if (P_MobjWasRemoved(mo)) if (P_MobjWasRemoved(mo))
return; return;
@ -1626,7 +1626,7 @@ void P_XYMovement(mobj_t *mo)
// draw damage on wall // draw damage on wall
//SPLAT TEST ---------------------------------------------------------- //SPLAT TEST ----------------------------------------------------------
#ifdef WALLSPLATS #ifdef WALLSPLATS
if (blockingline && mo->type != MT_REDRING && mo->type != MT_FIREBALL if (tm.blockingline && mo->type != MT_REDRING && mo->type != MT_FIREBALL
&& !(mo->flags2 & (MF2_AUTOMATIC|MF2_RAILRING|MF2_BOUNCERING|MF2_EXPLOSION|MF2_SCATTER))) && !(mo->flags2 & (MF2_AUTOMATIC|MF2_RAILRING|MF2_BOUNCERING|MF2_EXPLOSION|MF2_SCATTER)))
// set by last P_TryMove() that failed // set by last P_TryMove() that failed
{ {
@ -1634,13 +1634,13 @@ void P_XYMovement(mobj_t *mo)
divline_t misl; divline_t misl;
fixed_t frac; fixed_t frac;
P_MakeDivline(blockingline, &divl); P_MakeDivline(tm.blockingline, &divl);
misl.x = mo->x; misl.x = mo->x;
misl.y = mo->y; misl.y = mo->y;
misl.dx = mo->momx; misl.dx = mo->momx;
misl.dy = mo->momy; misl.dy = mo->momy;
frac = P_InterceptVector(&divl, &misl); frac = P_InterceptVector(&divl, &misl);
R_AddWallSplat(blockingline, P_PointOnLineSide(mo->x,mo->y,blockingline), R_AddWallSplat(tm.blockingline, P_PointOnLineSide(mo->x,mo->y,tm.blockingline),
"A_DMG3", mo->z, frac, SPLATDRAWMODE_SHADE); "A_DMG3", mo->z, frac, SPLATDRAWMODE_SHADE);
} }
#endif #endif
@ -2371,11 +2371,11 @@ boolean P_ZMovement(mobj_t *mo)
if (P_MobjWasRemoved(mo)) // mobjs can be removed by P_CheckPosition -- Monster Iestyn 31/07/21 if (P_MobjWasRemoved(mo)) // mobjs can be removed by P_CheckPosition -- Monster Iestyn 31/07/21
return false; return false;
K_UpdateMobjTerrain(mo, ((mo->eflags & MFE_VERTICALFLIP) ? tmceilingpic : tmfloorpic)); K_UpdateMobjTerrain(mo, ((mo->eflags & MFE_VERTICALFLIP) ? tm.ceilingpic : tm.floorpic));
if (((mo->eflags & MFE_VERTICALFLIP) ? tmceilingslope : tmfloorslope) && (mo->type != MT_STEAM)) if (((mo->eflags & MFE_VERTICALFLIP) ? tm.ceilingslope : tm.floorslope) && (mo->type != MT_STEAM))
{ {
mo->standingslope = (mo->eflags & MFE_VERTICALFLIP) ? tmceilingslope : tmfloorslope; mo->standingslope = (mo->eflags & MFE_VERTICALFLIP) ? tm.ceilingslope : tm.floorslope;
P_SetPitchRollFromSlope(mo, mo->standingslope); P_SetPitchRollFromSlope(mo, mo->standingslope);
P_ReverseQuantizeMomentumToSlope(&mom, mo->standingslope); P_ReverseQuantizeMomentumToSlope(&mom, mo->standingslope);
} }
@ -2591,11 +2591,11 @@ boolean P_ZMovement(mobj_t *mo)
} }
} }
else else
mom.z = (tmfloorthing ? tmfloorthing->momz : 0); mom.z = (tm.floorthing ? tm.floorthing->momz : 0);
} }
else if (tmfloorthing) else if (tm.floorthing)
mom.z = tmfloorthing->momz; mom.z = tm.floorthing->momz;
if (mo->standingslope) { // MT_STEAM will never have a standingslope, see above. if (mo->standingslope) { // MT_STEAM will never have a standingslope, see above.
P_QuantizeMomentumToSlope(&mom, mo->standingslope); P_QuantizeMomentumToSlope(&mom, mo->standingslope);
@ -2834,7 +2834,7 @@ void P_PlayerZMovement(mobj_t *mo)
mo->z = mo->floorz; mo->z = mo->floorz;
} }
K_UpdateMobjTerrain(mo, (mo->eflags & MFE_VERTICALFLIP ? tmceilingpic : tmfloorpic)); K_UpdateMobjTerrain(mo, (mo->eflags & MFE_VERTICALFLIP ? tm.ceilingpic : tm.floorpic));
// Get up if you fell. // Get up if you fell.
if (mo->player->panim == PA_HURT && mo->player->spinouttimer == 0 && mo->player->tumbleBounces == 0) if (mo->player->panim == PA_HURT && mo->player->spinouttimer == 0 && mo->player->tumbleBounces == 0)
@ -2842,10 +2842,10 @@ void P_PlayerZMovement(mobj_t *mo)
P_SetPlayerMobjState(mo, S_KART_STILL); P_SetPlayerMobjState(mo, S_KART_STILL);
} }
if (!mo->standingslope && (mo->eflags & MFE_VERTICALFLIP ? tmceilingslope : tmfloorslope)) if (!mo->standingslope && (mo->eflags & MFE_VERTICALFLIP ? tm.ceilingslope : tm.floorslope))
{ {
// Handle landing on slope during Z movement // Handle landing on slope during Z movement
P_HandleSlopeLanding(mo, (mo->eflags & MFE_VERTICALFLIP ? tmceilingslope : tmfloorslope)); P_HandleSlopeLanding(mo, (mo->eflags & MFE_VERTICALFLIP ? tm.ceilingslope : tm.floorslope));
} }
if (P_MobjFlip(mo) * mo->momz < 0) // falling if (P_MobjFlip(mo) * mo->momz < 0) // falling
@ -2860,12 +2860,12 @@ void P_PlayerZMovement(mobj_t *mo)
if (clipmomz) if (clipmomz)
{ {
mo->momz = (tmfloorthing ? tmfloorthing->momz : 0); mo->momz = (tm.floorthing ? tm.floorthing->momz : 0);
} }
} }
else if (tmfloorthing) else if (tm.floorthing)
{ {
mo->momz = tmfloorthing->momz; mo->momz = tm.floorthing->momz;
} }
} }
else else
@ -3083,9 +3083,9 @@ boolean P_SceneryZMovement(mobj_t *mo)
{ {
mo->eflags |= MFE_JUSTHITFLOOR; // Spin Attack mo->eflags |= MFE_JUSTHITFLOOR; // Spin Attack
if (tmfloorthing) if (tm.floorthing)
mo->momz = tmfloorthing->momz; mo->momz = tm.floorthing->momz;
else if (!tmfloorthing) else if (!tm.floorthing)
mo->momz = 0; mo->momz = 0;
} }
} }
@ -3801,8 +3801,8 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
} }
thiscam->subsector = R_PointInSubsector(thiscam->x, thiscam->y); thiscam->subsector = R_PointInSubsector(thiscam->x, thiscam->y);
thiscam->floorz = tmfloorz; thiscam->floorz = tm.floorz;
thiscam->ceilingz = tmceilingz; thiscam->ceilingz = tm.ceilingz;
if (thiscam->momz || player->mo->pmomz) if (thiscam->momz || player->mo->pmomz)
{ {
@ -3960,8 +3960,8 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
mobj->z += mobj->momz; mobj->z += mobj->momz;
P_SetThingPosition(mobj); P_SetThingPosition(mobj);
P_CheckPosition(mobj, mobj->x, mobj->y); P_CheckPosition(mobj, mobj->x, mobj->y);
mobj->floorz = tmfloorz; mobj->floorz = tm.floorz;
mobj->ceilingz = tmceilingz; mobj->ceilingz = tm.ceilingz;
goto animonly; goto animonly;
} }
@ -9451,7 +9451,7 @@ void P_MobjThinker(mobj_t *mobj)
mobj->eflags &= ~(MFE_PUSHED|MFE_SPRUNG|MFE_JUSTBOUNCEDWALL|MFE_DAMAGEHITLAG|MFE_SLOPELAUNCHED); mobj->eflags &= ~(MFE_PUSHED|MFE_SPRUNG|MFE_JUSTBOUNCEDWALL|MFE_DAMAGEHITLAG|MFE_SLOPELAUNCHED);
tmfloorthing = tmhitthing = NULL; tm.floorthing = tm.hitthing = NULL;
// Sector flag MSF_TRIGGERLINE_MOBJ allows ANY mobj to trigger a linedef exec // Sector flag MSF_TRIGGERLINE_MOBJ allows ANY mobj to trigger a linedef exec
P_CheckMobjTrigger(mobj, false); P_CheckMobjTrigger(mobj, false);
@ -9809,10 +9809,10 @@ void P_SceneryThinker(mobj_t *mobj)
P_CheckPosition(mobj, mobj->x, mobj->y); // Need this to pick up objects! P_CheckPosition(mobj, mobj->x, mobj->y); // Need this to pick up objects!
if (P_MobjWasRemoved(mobj)) if (P_MobjWasRemoved(mobj))
return; return;
mobj->floorz = tmfloorz; mobj->floorz = tm.floorz;
mobj->ceilingz = tmceilingz; mobj->ceilingz = tm.ceilingz;
mobj->floorrover = tmfloorrover; mobj->floorrover = tm.floorrover;
mobj->ceilingrover = tmceilingrover; mobj->ceilingrover = tm.ceilingrover;
} }
else else
{ {

View file

@ -762,7 +762,7 @@ static void Polyobj_removeFromBlockmap(polyobj_t *po)
// Movement functions // Movement functions
// A version of Lee's routine from p_maputl.c that accepts an mobj pointer // A version of Lee's routine from p_maputl.c that accepts an mobj pointer
// argument instead of using tmthing. Returns true if the line isn't contacted // argument instead of using tm.thing. Returns true if the line isn't contacted
// and false otherwise. // and false otherwise.
static inline boolean Polyobj_untouched(line_t *ld, mobj_t *mo) static inline boolean Polyobj_untouched(line_t *ld, mobj_t *mo)
{ {
@ -806,10 +806,10 @@ static void Polyobj_pushThing(polyobj_t *po, line_t *line, mobj_t *mo)
if (po->damage && (mo->flags & MF_SHOOTABLE)) if (po->damage && (mo->flags & MF_SHOOTABLE))
{ {
P_CheckPosition(mo, mo->x + momx, mo->y + momy); P_CheckPosition(mo, mo->x + momx, mo->y + momy);
mo->floorz = tmfloorz; mo->floorz = tm.floorz;
mo->ceilingz = tmceilingz; mo->ceilingz = tm.ceilingz;
mo->floorrover = tmfloorrover; mo->floorrover = tm.floorrover;
mo->ceilingrover = tmceilingrover; mo->ceilingrover = tm.ceilingrover;
} }
} }

View file

@ -7465,7 +7465,7 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
P_ResetTubeWaypoints(); P_ResetTubeWaypoints();
P_MapStart(); // tmthing can be used starting from this point P_MapStart(); // tm.thing can be used starting from this point
// init anything that P_SpawnSlopes/P_LoadThings needs to know // init anything that P_SpawnSlopes/P_LoadThings needs to know
P_InitSpecials(); P_InitSpecials();
@ -7570,7 +7570,7 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
P_RunCachedActions(); P_RunCachedActions();
P_MapEnd(); // tmthing is no longer needed from this point onwards P_MapEnd(); // tm.thing is no longer needed from this point onwards
// Took me 3 hours to figure out why my progression kept on getting overwritten with the titlemap... // Took me 3 hours to figure out why my progression kept on getting overwritten with the titlemap...
if (!titlemapinaction) if (!titlemapinaction)
@ -7629,9 +7629,9 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
G_CopyTiccmd(&players[i].cmd, &netcmds[buf][i], 1); G_CopyTiccmd(&players[i].cmd, &netcmds[buf][i], 1);
} }
P_PreTicker(2); P_PreTicker(2);
P_MapStart(); // just in case MapLoad modifies tmthing P_MapStart(); // just in case MapLoad modifies tm.thing
LUA_HookInt(gamemap, HOOK(MapLoad)); LUA_HookInt(gamemap, HOOK(MapLoad));
P_MapEnd(); // just in case MapLoad modifies tmthing P_MapEnd(); // just in case MapLoad modifies tm.thing
} }
K_TimerReset(); K_TimerReset();

View file

@ -749,10 +749,10 @@ static boolean P_CrossBotTraversalSubsector(size_t num, register traceblocking_t
} }
// set openrange, opentop, openbottom // set openrange, opentop, openbottom
tmx = tb->compareThing->x; tm.x = tb->compareThing->x;
tmy = tb->compareThing->y; tm.y = tb->compareThing->y;
P_LineOpening(line, tb->compareThing); P_LineOpening(line, tb->compareThing);
maxstep = P_GetThingStepUp(tb->compareThing, tmx, tmy); maxstep = P_GetThingStepUp(tb->compareThing, tm.x, tm.y);
if ((openrange < tb->compareThing->height) // doesn't fit if ((openrange < tb->compareThing->height) // doesn't fit
|| (opentop - tb->compareThing->z < tb->compareThing->height) // mobj is too high || (opentop - tb->compareThing->z < tb->compareThing->height) // mobj is too high