rename tm to g_tm to fix C conflict

This commit is contained in:
NepDisk 2025-02-22 01:24:29 -05:00
parent 464f9464e9
commit 51154e346c
14 changed files with 763 additions and 739 deletions

View file

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

View file

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

View file

@ -7589,7 +7589,7 @@ boolean K_SafeRespawnPosition(mobj_t * mo)
po->validcount = validcount;
if (!P_BBoxInsidePolyobj(po, tm.bbox)
if (!P_BBoxInsidePolyobj(po, g_tm.bbox)
|| !(po->flags & POF_SOLID))
{
plink = (polymaplink_t *)(plink->link.next);

View file

@ -1041,7 +1041,8 @@ static int lib_pRemoveFloorSpriteSlope(lua_State *L)
static int lib_pRailThinker(lua_State *L)
{
mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
tm_t ptm = tm;
tm_t ptm = g_tm;
NOHUD
INLEVEL
if (!mobj)
@ -1054,7 +1055,8 @@ static int lib_pRailThinker(lua_State *L)
static int lib_pXYMovement(lua_State *L)
{
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
tm_t ptm = tm;
tm_t ptm = g_tm;
NOHUD
INLEVEL
if (!actor)
@ -1067,7 +1069,8 @@ static int lib_pXYMovement(lua_State *L)
static int lib_pRingXYMovement(lua_State *L)
{
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
tm_t ptm = tm;
tm_t ptm = g_tm;
NOHUD
INLEVEL
if (!actor)
@ -1080,7 +1083,8 @@ static int lib_pRingXYMovement(lua_State *L)
static int lib_pSceneryXYMovement(lua_State *L)
{
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
tm_t ptm = tm;
tm_t ptm = g_tm;
NOHUD
INLEVEL
if (!actor)
@ -1093,7 +1097,8 @@ static int lib_pSceneryXYMovement(lua_State *L)
static int lib_pZMovement(lua_State *L)
{
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
tm_t ptm = tm;
tm_t ptm = g_tm;
NOHUD
INLEVEL
if (!actor)
@ -1107,7 +1112,8 @@ static int lib_pZMovement(lua_State *L)
static int lib_pRingZMovement(lua_State *L)
{
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
tm_t ptm = tm;
tm_t ptm = g_tm;
NOHUD
INLEVEL
if (!actor)
@ -1121,7 +1127,8 @@ static int lib_pRingZMovement(lua_State *L)
static int lib_pSceneryZMovement(lua_State *L)
{
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
tm_t ptm = tm;
tm_t ptm = g_tm;
NOHUD
INLEVEL
if (!actor)
@ -1135,7 +1142,8 @@ static int lib_pSceneryZMovement(lua_State *L)
static int lib_pPlayerZMovement(lua_State *L)
{
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
tm_t ptm = tm;
tm_t ptm = g_tm;
NOHUD
INLEVEL
if (!actor)
@ -1354,7 +1362,8 @@ static int lib_pGivePlayerLives(lua_State *L)
static int lib_pMovePlayer(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
tm_t ptm = tm;
tm_t ptm = g_tm;
NOHUD
INLEVEL
if (!player)
@ -1432,7 +1441,8 @@ static int lib_pNukeEnemies(lua_State *L)
static int lib_pCheckPosition(lua_State *L)
{
tm_t ptm = tm;
tm_t ptm = g_tm;
mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
fixed_t x = luaL_checkfixed(L, 2);
fixed_t y = luaL_checkfixed(L, 3);
@ -1441,14 +1451,15 @@ static int lib_pCheckPosition(lua_State *L)
if (!thing)
return LUA_ErrInvalid(L, "mobj_t");
lua_pushboolean(L, P_CheckPosition(thing, x, y, NULL));
LUA_PushUserdata(L, tm.thing, META_MOBJ);
LUA_PushUserdata(L, g_tm.thing, META_MOBJ);
P_RestoreTMStruct(ptm);
return 2;
}
static int lib_pTryMove(lua_State *L)
{
tm_t ptm = tm;
tm_t ptm = g_tm;
mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
fixed_t x = luaL_checkfixed(L, 2);
fixed_t y = luaL_checkfixed(L, 3);
@ -1458,14 +1469,15 @@ static int lib_pTryMove(lua_State *L)
if (!thing)
return LUA_ErrInvalid(L, "mobj_t");
lua_pushboolean(L, P_TryMove(thing, x, y, allowdropoff, NULL));
LUA_PushUserdata(L, tm.thing, META_MOBJ);
LUA_PushUserdata(L, g_tm.thing, META_MOBJ);
P_RestoreTMStruct(ptm);
return 2;
}
static int lib_pMove(lua_State *L)
{
tm_t ptm = tm;
tm_t ptm = g_tm;
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
fixed_t speed = luaL_checkfixed(L, 2);
NOHUD
@ -1473,14 +1485,15 @@ static int lib_pMove(lua_State *L)
if (!actor)
return LUA_ErrInvalid(L, "mobj_t");
lua_pushboolean(L, P_Move(actor, speed));
LUA_PushUserdata(L, tm.thing, META_MOBJ);
LUA_PushUserdata(L, g_tm.thing, META_MOBJ);
P_RestoreTMStruct(ptm);
return 2;
}
static int lib_pTeleportMove(lua_State *L)
{
tm_t ptm = tm;
tm_t ptm = g_tm;
mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
fixed_t x = luaL_checkfixed(L, 2);
fixed_t y = luaL_checkfixed(L, 3);
@ -1491,14 +1504,15 @@ static int lib_pTeleportMove(lua_State *L)
return LUA_ErrInvalid(L, "mobj_t");
LUA_Deprecated(L, "P_TeleportMove", "P_SetOrigin\" or \"P_MoveOrigin");
lua_pushboolean(L, P_MoveOrigin(thing, x, y, z));
LUA_PushUserdata(L, tm.thing, META_MOBJ);
LUA_PushUserdata(L, g_tm.thing, META_MOBJ);
P_RestoreTMStruct(ptm);
return 2;
}
static int lib_pSetOrigin(lua_State *L)
{
tm_t ptm = tm;
tm_t ptm = g_tm;
mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
fixed_t x = luaL_checkfixed(L, 2);
fixed_t y = luaL_checkfixed(L, 3);
@ -1508,14 +1522,15 @@ static int lib_pSetOrigin(lua_State *L)
if (!thing)
return LUA_ErrInvalid(L, "mobj_t");
lua_pushboolean(L, P_SetOrigin(thing, x, y, z));
LUA_PushUserdata(L, tm.thing, META_MOBJ);
LUA_PushUserdata(L, g_tm.thing, META_MOBJ);
P_RestoreTMStruct(ptm);
return 2;
}
static int lib_pMoveOrigin(lua_State *L)
{
tm_t ptm = tm;
tm_t ptm = g_tm;
mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
fixed_t x = luaL_checkfixed(L, 2);
fixed_t y = luaL_checkfixed(L, 3);
@ -1525,7 +1540,7 @@ static int lib_pMoveOrigin(lua_State *L)
if (!thing)
return LUA_ErrInvalid(L, "mobj_t");
lua_pushboolean(L, P_MoveOrigin(thing, x, y, z));
LUA_PushUserdata(L, tm.thing, META_MOBJ);
LUA_PushUserdata(L, g_tm.thing, META_MOBJ);
P_RestoreTMStruct(ptm);
return 2;
}

View file

@ -812,7 +812,8 @@ static int sector_set(lua_State *L)
return luaL_error(L, "sector_t has no field named " LUA_QS ".", lua_tostring(L, 2));
case sector_floorheight: { // floorheight
boolean flag;
tm_t ptm = tm;
tm_t ptm = g_tm;
fixed_t lastpos = sector->floorheight;
sector->floorheight = luaL_checkfixed(L, 3);
flag = P_CheckSector(sector, true);
@ -826,7 +827,8 @@ static int sector_set(lua_State *L)
}
case sector_ceilingheight: { // ceilingheight
boolean flag;
tm_t ptm = tm;
tm_t ptm = g_tm;
fixed_t lastpos = sector->ceilingheight;
sector->ceilingheight = luaL_checkfixed(L, 3);
flag = P_CheckSector(sector, true);
@ -2264,7 +2266,8 @@ static int ffloor_set(lua_State *L)
case ffloor_topheight: { // topheight
boolean flag;
fixed_t lastpos = *ffloor->topheight;
tm_t ptm = tm;
tm_t ptm = g_tm;
sector_t *sector = &sectors[ffloor->secnum];
sector->ceilingheight = luaL_checkfixed(L, 3);
flag = P_CheckSector(sector, true);
@ -2285,7 +2288,8 @@ static int ffloor_set(lua_State *L)
case ffloor_bottomheight: { // bottomheight
boolean flag;
fixed_t lastpos = *ffloor->bottomheight;
tm_t ptm = tm;
tm_t ptm = g_tm;
sector_t *sector = &sectors[ffloor->secnum];
sector->floorheight = luaL_checkfixed(L, 3);
flag = P_CheckSector(sector, true);

View file

@ -648,13 +648,14 @@ static int mobj_set(lua_State *L)
case mobj_z:
{
// z doesn't cross sector bounds so it's okay.
tm_t ptm = tm;
tm_t ptm = g_tm;
mo->z = luaL_checkfixed(L, 3);
P_CheckPosition(mo, mo->x, mo->y, NULL);
mo->floorz = tm.floorz;
mo->ceilingz = tm.ceilingz;
mo->floorrover = tm.floorrover;
mo->ceilingrover = tm.ceilingrover;
mo->floorz = g_tm.floorz;
mo->ceilingz = g_tm.ceilingz;
mo->floorrover = g_tm.floorrover;
mo->ceilingrover = g_tm.ceilingrover;
P_RestoreTMStruct(ptm);
break;
}
@ -726,29 +727,31 @@ static int mobj_set(lua_State *L)
return NOSET;
case mobj_radius:
{
tm_t ptm = tm;
tm_t ptm = g_tm;
mo->radius = luaL_checkfixed(L, 3);
if (mo->radius < 0)
mo->radius = 0;
P_CheckPosition(mo, mo->x, mo->y, NULL);
mo->floorz = tm.floorz;
mo->ceilingz = tm.ceilingz;
mo->floorrover = tm.floorrover;
mo->ceilingrover = tm.ceilingrover;
mo->floorz = g_tm.floorz;
mo->ceilingz = g_tm.ceilingz;
mo->floorrover = g_tm.floorrover;
mo->ceilingrover = g_tm.ceilingrover;
P_RestoreTMStruct(ptm);
break;
}
case mobj_height:
{
tm_t ptm = tm;
tm_t ptm = g_tm;
mo->height = luaL_checkfixed(L, 3);
if (mo->height < 0)
mo->height = 0;
P_CheckPosition(mo, mo->x, mo->y, NULL);
mo->floorz = tm.floorz;
mo->ceilingz = tm.ceilingz;
mo->floorrover = tm.floorrover;
mo->ceilingrover = tm.ceilingrover;
mo->floorz = g_tm.floorz;
mo->ceilingz = g_tm.ceilingz;
mo->floorrover = g_tm.floorrover;
mo->ceilingrover = g_tm.ceilingrover;
P_RestoreTMStruct(ptm);
break;
}

View file

@ -269,10 +269,10 @@ boolean P_Move(mobj_t *actor, fixed_t speed)
if (!P_TryMove(actor, tryx, tryy, false, NULL))
{
if (actor->flags & MF_FLOAT && tm.floatok)
if (actor->flags & MF_FLOAT && g_tm.floatok)
{
// must adjust height
if (actor->z < tm.floorz)
if (actor->z < g_tm.floorz)
actor->z += FixedMul(FLOATSPEED, actor->scale);
else
actor->z -= FixedMul(FLOATSPEED, actor->scale);
@ -10312,13 +10312,13 @@ void A_FlickyCenter(mobj_t *actor)
{
actor->extravalue2 = 1;
P_SetOrigin(actor, actor->target->x, actor->target->y, actor->target->z);
P_SetTarget(&tm.thing, NULL);
P_SetTarget(&g_tm.thing, NULL);
}
else if(actor->extravalue2)
{
actor->extravalue2 = 0;
P_SetOrigin(actor, originx, originy, originz);
P_SetTarget(&tm.thing, NULL);
P_SetTarget(&g_tm.thing, NULL);
}
}
}
@ -12997,7 +12997,7 @@ void A_ItemPop(mobj_t *actor)
remains->skin = NULL;
remains->spawnpoint = actor->spawnpoint;
P_SetTarget(&tm.thing, remains);
P_SetTarget(&g_tm.thing, remains);
//if (actor->info->deathsound)
//S_StartSound(remains, actor->info->deathsound);

View file

@ -405,12 +405,12 @@ struct tm_t
fixed_t precipbbox[4];
// If "floatok" true, move would be ok
// if within "tm.floorz - tm.ceilingz".
// if within "g_tm.floorz - g_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 *floorthing; // the thing corresponding to g_tm.floorz or NULL if g_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;
@ -429,11 +429,11 @@ struct tm_t
// lines
boolean sweep;
// sweep: max step up at tm.x, tm.y
// sweep: max step up at g_tm.x, g_tm.y
fixed_t maxstep;
};
extern tm_t tm;
extern tm_t g_tm;
void P_RestoreTMStruct(tm_t tmrestore);

File diff suppressed because it is too large Load diff

View file

@ -315,8 +315,8 @@ void P_CameraLineOpening(line_t *linedef, opening_t *open)
}
else
{
frontfloor = P_CameraGetFloorZ (mapcampointer, front, tm.x, tm.y, linedef);
frontceiling = P_CameraGetCeilingZ(mapcampointer, front, tm.x, tm.y, linedef);
frontfloor = P_CameraGetFloorZ (mapcampointer, front, g_tm.x, g_tm.y, linedef);
frontceiling = P_CameraGetCeilingZ(mapcampointer, front, g_tm.x, g_tm.y, linedef);
}
if (back->camsec >= 0)
@ -333,8 +333,8 @@ void P_CameraLineOpening(line_t *linedef, opening_t *open)
}
else
{
backfloor = P_CameraGetFloorZ(mapcampointer, back, tm.x, tm.y, linedef);
backceiling = P_CameraGetCeilingZ(mapcampointer, back, tm.x, tm.y, linedef);
backfloor = P_CameraGetFloorZ(mapcampointer, back, g_tm.x, g_tm.y, linedef);
backceiling = P_CameraGetCeilingZ(mapcampointer, back, g_tm.x, g_tm.y, linedef);
}
thingtop = mapcampointer->z + mapcampointer->height;
@ -375,8 +375,8 @@ void P_CameraLineOpening(line_t *linedef, opening_t *open)
if (!(rover->fofflags & FOF_BLOCKOTHERS) || !(rover->fofflags & FOF_RENDERALL) || !(rover->fofflags & FOF_EXISTS) )
continue;
topheight = P_CameraGetFOFTopZ(mapcampointer, front, rover, tm.x, tm.y, linedef);
bottomheight = P_CameraGetFOFBottomZ(mapcampointer, front, rover, tm.x, tm.y, linedef);
topheight = P_CameraGetFOFTopZ(mapcampointer, front, rover, g_tm.x, g_tm.y, linedef);
bottomheight = P_CameraGetFOFBottomZ(mapcampointer, front, rover, g_tm.x, g_tm.y, linedef);
delta1 = abs(mapcampointer->z - (bottomheight + ((topheight - bottomheight)/2)));
delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2)));
@ -399,8 +399,8 @@ void P_CameraLineOpening(line_t *linedef, opening_t *open)
if (!(rover->fofflags & FOF_BLOCKOTHERS) || !(rover->fofflags & FOF_RENDERALL) || !(rover->fofflags & FOF_EXISTS) )
continue;
topheight = P_CameraGetFOFTopZ(mapcampointer, back, rover, tm.x, tm.y, linedef);
bottomheight = P_CameraGetFOFBottomZ(mapcampointer, back, rover, tm.x, tm.y, linedef);
topheight = P_CameraGetFOFTopZ(mapcampointer, back, rover, g_tm.x, g_tm.y, linedef);
bottomheight = P_CameraGetFOFBottomZ(mapcampointer, back, rover, g_tm.x, g_tm.y, linedef);
delta1 = abs(mapcampointer->z - (bottomheight + ((topheight - bottomheight)/2)));
delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2)));
@ -539,7 +539,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj, opening_t *open)
return;
}
P_ClosestPointOnLine(tm.x, tm.y, linedef, &cross);
P_ClosestPointOnLine(g_tm.x, g_tm.y, linedef, &cross);
// Treat polyobjects kind of like 3D Floors
if (linedef->polyobj && (linedef->polyobj->flags & POF_TESTHEIGHT))
@ -567,8 +567,8 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj, opening_t *open)
fixed_t height[2];
const sector_t * sector[2] = { front, back };
height[FRONT] = P_GetCeilingZ(mobj, front, tm.x, tm.y, linedef);
height[BACK] = P_GetCeilingZ(mobj, back, tm.x, tm.y, linedef);
height[FRONT] = P_GetCeilingZ(mobj, front, g_tm.x, g_tm.y, linedef);
height[BACK] = P_GetCeilingZ(mobj, back, g_tm.x, g_tm.y, linedef);
hi = ( height[0] < height[1] );
lo = ! hi;
@ -587,8 +587,8 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj, opening_t *open)
open->ceilingdrop = ( topedge[hi] - topedge[lo] );
}
height[FRONT] = P_GetFloorZ(mobj, front, tm.x, tm.y, linedef);
height[BACK] = P_GetFloorZ(mobj, back, tm.x, tm.y, linedef);
height[FRONT] = P_GetFloorZ(mobj, front, g_tm.x, g_tm.y, linedef);
height[BACK] = P_GetFloorZ(mobj, back, g_tm.x, g_tm.y, linedef);
hi = ( height[0] < height[1] );
lo = ! hi;
@ -777,8 +777,8 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj, opening_t *open)
}
else
{
topheight = P_GetFOFTopZ(mobj, front, rover, tm.x, tm.y, linedef);
bottomheight = P_GetFOFBottomZ(mobj, front, rover, tm.x, tm.y, linedef);
topheight = P_GetFOFTopZ(mobj, front, rover, g_tm.x, g_tm.y, linedef);
bottomheight = P_GetFOFBottomZ(mobj, front, rover, g_tm.x, g_tm.y, linedef);
}
switch (open->fofType)
@ -869,8 +869,8 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj, opening_t *open)
}
else
{
topheight = P_GetFOFTopZ(mobj, back, rover, tm.x, tm.y, linedef);
bottomheight = P_GetFOFBottomZ(mobj, back, rover, tm.x, tm.y, linedef);
topheight = P_GetFOFTopZ(mobj, back, rover, g_tm.x, g_tm.y, linedef);
bottomheight = P_GetFOFBottomZ(mobj, back, rover, g_tm.x, g_tm.y, linedef);
}
switch (open->fofType)
@ -1834,16 +1834,16 @@ boolean P_RadiusLinesCheck(fixed_t radius, fixed_t x, fixed_t y,
INT32 xl, xh, yl, yh;
INT32 bx, by;
tm.bbox[BOXTOP] = y + radius;
tm.bbox[BOXBOTTOM] = y - radius;
tm.bbox[BOXRIGHT] = x + radius;
tm.bbox[BOXLEFT] = x - radius;
g_tm.bbox[BOXTOP] = y + radius;
g_tm.bbox[BOXBOTTOM] = y - radius;
g_tm.bbox[BOXRIGHT] = x + radius;
g_tm.bbox[BOXLEFT] = x - radius;
// check lines
xl = (unsigned)(tm.bbox[BOXLEFT] - bmaporgx)>>MAPBLOCKSHIFT;
xh = (unsigned)(tm.bbox[BOXRIGHT] - bmaporgx)>>MAPBLOCKSHIFT;
yl = (unsigned)(tm.bbox[BOXBOTTOM] - bmaporgy)>>MAPBLOCKSHIFT;
yh = (unsigned)(tm.bbox[BOXTOP] - bmaporgy)>>MAPBLOCKSHIFT;
xl = (unsigned)(g_tm.bbox[BOXLEFT] - bmaporgx)>>MAPBLOCKSHIFT;
xh = (unsigned)(g_tm.bbox[BOXRIGHT] - bmaporgx)>>MAPBLOCKSHIFT;
yl = (unsigned)(g_tm.bbox[BOXBOTTOM] - bmaporgy)>>MAPBLOCKSHIFT;
yh = (unsigned)(g_tm.bbox[BOXTOP] - bmaporgy)>>MAPBLOCKSHIFT;
for (bx = xl; bx <= xh; bx++)
for (by = yl; by <= yh; by++)

View file

@ -1508,12 +1508,12 @@ bustupdone:
//
static boolean P_CheckSkyHit(mobj_t *mo)
{
if (tm.ceilingline && tm.ceilingline->backsector
&& tm.ceilingline->backsector->ceilingpic == skyflatnum
&& tm.ceilingline->frontsector
&& tm.ceilingline->frontsector->ceilingpic == skyflatnum
&& (mo->z >= tm.ceilingline->frontsector->ceilingheight
|| mo->z >= tm.ceilingline->backsector->ceilingheight))
if (g_tm.ceilingline && g_tm.ceilingline->backsector
&& g_tm.ceilingline->backsector->ceilingpic == skyflatnum
&& g_tm.ceilingline->frontsector
&& g_tm.ceilingline->frontsector->ceilingpic == skyflatnum
&& (mo->z >= g_tm.ceilingline->frontsector->ceilingheight
|| mo->z >= g_tm.ceilingline->backsector->ceilingheight))
return true;
return false;
}
@ -1610,7 +1610,7 @@ void P_XYMovement(mobj_t *mo)
// blocked move
moved = false;
if (LUA_HookMobjMoveBlocked(mo, tm.hitthing, result.line))
if (LUA_HookMobjMoveBlocked(mo, g_tm.hitthing, result.line))
{
if (P_MobjWasRemoved(mo))
return;
@ -1651,7 +1651,7 @@ void P_XYMovement(mobj_t *mo)
// draw damage on wall
//SPLAT TEST ----------------------------------------------------------
#ifdef WALLSPLATS
if (tm.blockingline && mo->type != MT_REDRING && mo->type != MT_FIREBALL
if (g_tm.blockingline && mo->type != MT_REDRING && mo->type != MT_FIREBALL
&& !(mo->flags2 & (MF2_AUTOMATIC|MF2_RAILRING|MF2_BOUNCERING|MF2_EXPLOSION|MF2_SCATTER)))
// set by last P_TryMove() that failed
{
@ -1659,13 +1659,13 @@ void P_XYMovement(mobj_t *mo)
divline_t misl;
fixed_t frac;
P_MakeDivline(tm.blockingline, &divl);
P_MakeDivline(g_tm.blockingline, &divl);
misl.x = mo->x;
misl.y = mo->y;
misl.dx = mo->momx;
misl.dy = mo->momy;
frac = P_InterceptVector(&divl, &misl);
R_AddWallSplat(tm.blockingline, P_PointOnLineSide(mo->x,mo->y,tm.blockingline),
R_AddWallSplat(g_tm.blockingline, P_PointOnLineSide(mo->x,mo->y,g_tm.blockingline),
"A_DMG3", mo->z, frac, SPLATDRAWMODE_SHADE);
}
#endif
@ -2388,11 +2388,11 @@ boolean P_ZMovement(mobj_t *mo)
if (P_MobjWasRemoved(mo)) // mobjs can be removed by P_CheckPosition -- Monster Iestyn 31/07/21
return false;
K_UpdateMobjTerrain(mo, ((mo->eflags & MFE_VERTICALFLIP) ? tm.ceilingpic : tm.floorpic));
K_UpdateMobjTerrain(mo, ((mo->eflags & MFE_VERTICALFLIP) ? g_tm.ceilingpic : g_tm.floorpic));
if (((mo->eflags & MFE_VERTICALFLIP) ? tm.ceilingslope : tm.floorslope) && (mo->type != MT_STEAM))
if (((mo->eflags & MFE_VERTICALFLIP) ? g_tm.ceilingslope : g_tm.floorslope) && (mo->type != MT_STEAM))
{
mo->standingslope = (mo->eflags & MFE_VERTICALFLIP) ? tm.ceilingslope : tm.floorslope;
mo->standingslope = (mo->eflags & MFE_VERTICALFLIP) ? g_tm.ceilingslope : g_tm.floorslope;
P_SetPitchRollFromSlope(mo, mo->standingslope);
P_ReverseQuantizeMomentumToSlope(&mom, mo->standingslope);
}
@ -2525,11 +2525,11 @@ boolean P_ZMovement(mobj_t *mo)
}
}
else
mom.z = (tm.floorthing ? tm.floorthing->momz : 0);
mom.z = (g_tm.floorthing ? g_tm.floorthing->momz : 0);
}
else if (tm.floorthing)
mom.z = tm.floorthing->momz;
else if (g_tm.floorthing)
mom.z = g_tm.floorthing->momz;
if (mo->standingslope) { // MT_STEAM will never have a standingslope, see above.
P_QuantizeMomentumToSlope(&mom, mo->standingslope);
@ -2763,7 +2763,7 @@ void P_PlayerZMovement(mobj_t *mo)
mo->z = mo->floorz;
}
K_UpdateMobjTerrain(mo, (mo->eflags & MFE_VERTICALFLIP ? tm.ceilingpic : tm.floorpic));
K_UpdateMobjTerrain(mo, (mo->eflags & MFE_VERTICALFLIP ? g_tm.ceilingpic : g_tm.floorpic));
// Get up if you fell.
if (mo->player->panim == PA_HURT && mo->player->spinouttimer == 0 && mo->player->squishedtimer == 0)
@ -2771,10 +2771,10 @@ void P_PlayerZMovement(mobj_t *mo)
P_SetPlayerMobjState(mo, S_KART_STILL);
}
if (!mo->standingslope && (mo->eflags & MFE_VERTICALFLIP ? tm.ceilingslope : tm.floorslope))
if (!mo->standingslope && (mo->eflags & MFE_VERTICALFLIP ? g_tm.ceilingslope : g_tm.floorslope))
{
// Handle landing on slope during Z movement
P_HandleSlopeLanding(mo, (mo->eflags & MFE_VERTICALFLIP ? tm.ceilingslope : tm.floorslope));
P_HandleSlopeLanding(mo, (mo->eflags & MFE_VERTICALFLIP ? g_tm.ceilingslope : g_tm.floorslope));
}
if (P_MobjFlip(mo) * mo->momz < 0) // falling
@ -2789,12 +2789,12 @@ void P_PlayerZMovement(mobj_t *mo)
if (clipmomz)
{
mo->momz = (tm.floorthing ? tm.floorthing->momz : 0);
mo->momz = (g_tm.floorthing ? g_tm.floorthing->momz : 0);
}
}
else if (tm.floorthing)
else if (g_tm.floorthing)
{
mo->momz = tm.floorthing->momz;
mo->momz = g_tm.floorthing->momz;
}
}
else
@ -2963,9 +2963,9 @@ boolean P_SceneryZMovement(mobj_t *mo)
{
mo->eflags |= MFE_JUSTHITFLOOR; // Spin Attack
if (tm.floorthing)
mo->momz = tm.floorthing->momz;
else if (!tm.floorthing)
if (g_tm.floorthing)
mo->momz = g_tm.floorthing->momz;
else if (!g_tm.floorthing)
mo->momz = 0;
}
}
@ -3633,8 +3633,8 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
}
thiscam->subsector = R_PointInSubsectorFast(thiscam->x, thiscam->y);
thiscam->floorz = tm.floorz;
thiscam->ceilingz = tm.ceilingz;
thiscam->floorz = g_tm.floorz;
thiscam->ceilingz = g_tm.ceilingz;
if (thiscam->momz || player->mo->pmomz)
{
@ -3781,8 +3781,8 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
mobj->z += mobj->momz;
P_SetThingPosition(mobj);
P_CheckPosition(mobj, mobj->x, mobj->y, NULL);
mobj->floorz = tm.floorz;
mobj->ceilingz = tm.ceilingz;
mobj->floorz = g_tm.floorz;
mobj->ceilingz = g_tm.ceilingz;
mobj->terrain = NULL;
goto animonly;
}
@ -8662,8 +8662,8 @@ void P_MobjThinker(mobj_t *mobj)
mobj->eflags &= ~(MFE_PUSHED|MFE_SPRUNG|MFE_JUSTBOUNCEDWALL|MFE_SLOPELAUNCHED);
// sal: what the hell? is there any reason this isn't done, like, literally ANYWHERE else?
P_SetTarget(&tm.floorthing, NULL);
P_SetTarget(&tm.hitthing, NULL);
P_SetTarget(&g_tm.floorthing, NULL);
P_SetTarget(&g_tm.hitthing, NULL);
if (udmf)
{
@ -9047,10 +9047,10 @@ void P_SceneryThinker(mobj_t *mobj)
P_CheckPosition(mobj, mobj->x, mobj->y, NULL); // Need this to pick up objects!
if (P_MobjWasRemoved(mobj))
return;
mobj->floorz = tm.floorz;
mobj->ceilingz = tm.ceilingz;
mobj->floorrover = tm.floorrover;
mobj->ceilingrover = tm.ceilingrover;
mobj->floorz = g_tm.floorz;
mobj->ceilingz = g_tm.ceilingz;
mobj->floorrover = g_tm.floorrover;
mobj->ceilingrover = g_tm.ceilingrover;
}
else
{

View file

@ -200,7 +200,7 @@ boolean P_BBoxInsidePolyobj(polyobj_t *po, fixed_t *bbox)
{
if (P_BoxOnLineSide(bbox, po->lines[i]) == 0)
return false;
if (tm.sweep)
if (g_tm.sweep)
{
P_TestLine(po->lines[i]);
}
@ -801,7 +801,7 @@ static void Polyobj_removeFromBlockmap(polyobj_t *po)
// Movement functions
// A version of Lee's routine from p_maputl.c that accepts an mobj pointer
// argument instead of using tm.thing. Returns true if the line isn't contacted
// argument instead of using g_tm.thing. Returns true if the line isn't contacted
// and false otherwise.
static inline boolean Polyobj_untouched(line_t *ld, mobj_t *mo)
{
@ -845,10 +845,10 @@ static void Polyobj_pushThing(polyobj_t *po, line_t *line, mobj_t *mo)
if (po->damage && (mo->flags & MF_SHOOTABLE))
{
P_CheckPosition(mo, mo->x + momx, mo->y + momy, NULL);
mo->floorz = tm.floorz;
mo->ceilingz = tm.ceilingz;
mo->floorrover = tm.floorrover;
mo->ceilingrover = tm.ceilingrover;
mo->floorz = g_tm.floorz;
mo->ceilingz = g_tm.ceilingz;
mo->floorrover = g_tm.floorrover;
mo->ceilingrover = g_tm.ceilingrover;
}
}

View file

@ -8625,7 +8625,7 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
P_ResetTubeWaypoints();
P_MapStart(); // tm.thing can be used starting from this point
P_MapStart(); // g_tm.thing can be used starting from this point
// init anything that P_SpawnSlopes/P_LoadThings needs to know
P_InitSpecials();
@ -8740,7 +8740,7 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
G_AddMapToBuffer(gamemap-1);
P_MapEnd(); // tm.thing is no longer needed from this point onwards
P_MapEnd(); // g_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...
if (!titlemapinaction)
@ -8825,7 +8825,7 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
void P_PostLoadLevel(void)
{
TracyCZone(__zone, true);
P_MapStart(); // tm.thing can be used starting from this point
P_MapStart(); // g_tm.thing can be used starting from this point
if (G_GametypeHasSpectators())
{

View file

@ -335,13 +335,13 @@ static boolean P_CanBotTraverse(seg_t *seg, divline_t *divl, register los_t *los
frac = P_InterceptVector(&los->strace, divl);
// calculate position at intercept
tm.x = los->strace.x + FixedMul(los->strace.dx, frac);
tm.y = los->strace.y + FixedMul(los->strace.dy, frac);
g_tm.x = los->strace.x + FixedMul(los->strace.dx, frac);
g_tm.y = los->strace.y + FixedMul(los->strace.dy, frac);
// set openrange, opentop, openbottom
open.fofType = (flip ? LO_FOF_CEILINGS : LO_FOF_FLOORS);
P_LineOpening(line, los->t1, &open);
maxstep = P_GetThingStepUp(los->t1, tm.x, tm.y);
maxstep = P_GetThingStepUp(los->t1, g_tm.x, g_tm.y);
if (open.range < los->t1->height)
{
@ -363,7 +363,7 @@ static boolean P_CanBotTraverse(seg_t *seg, divline_t *divl, register los_t *los
UINT8 side = P_DivlineSide(los->t2x, los->t2y, divl) & 1;
sector_t *sector = (side == 1) ? seg->backsector : seg->frontsector;
if (K_BotHatesThisSector(los->t1->player, sector, tm.x, tm.y))
if (K_BotHatesThisSector(los->t1->player, sector, g_tm.x, g_tm.y))
{
// This line does not block us, but we don't want to cross it regardless.
return false;
@ -403,13 +403,13 @@ static boolean P_CanWaypointTraverse(seg_t *seg, divline_t *divl, register los_t
frac = P_InterceptVector(&los->strace, divl);
// calculate position at intercept
tm.x = los->strace.x + FixedMul(los->strace.dx, frac);
tm.y = los->strace.y + FixedMul(los->strace.dy, frac);
g_tm.x = los->strace.x + FixedMul(los->strace.dx, frac);
g_tm.y = los->strace.y + FixedMul(los->strace.dy, frac);
// set openrange, opentop, openbottom
open.fofType = (flip ? LO_FOF_CEILINGS : LO_FOF_FLOORS);
P_LineOpening(line, los->t1, &open);
maxstep = P_GetThingStepUp(los->t1, tm.x, tm.y);
maxstep = P_GetThingStepUp(los->t1, g_tm.x, g_tm.y);
#if 0
if (los->t2->type == MT_WAYPOINT)