Merge branch 'gremlin-fix' into 'master'

Evict the wall gremlin

Closes #326

See merge request KartKrew/Kart!777
This commit is contained in:
Sal 2022-11-25 22:39:17 +00:00
commit df68b87e93
10 changed files with 222 additions and 411 deletions

View file

@ -2549,7 +2549,7 @@ static boolean G_CheckSpot(INT32 playernum, mapthing_t *mthing)
if (!K_CheckPlayersRespawnColliding(playernum, x, y))
return false;
if (!P_CheckPosition(players[playernum].mo, x, y))
if (!P_CheckPosition(players[playernum].mo, x, y, NULL))
return false;
return true;

View file

@ -1057,7 +1057,7 @@ static int lib_pZMovement(lua_State *L)
if (!actor)
return LUA_ErrInvalid(L, "mobj_t");
lua_pushboolean(L, P_ZMovement(actor));
P_CheckPosition(actor, actor->x, actor->y);
P_CheckPosition(actor, actor->x, actor->y, NULL);
P_RestoreTMStruct(ptm);
return 1;
}
@ -1071,7 +1071,7 @@ static int lib_pRingZMovement(lua_State *L)
if (!actor)
return LUA_ErrInvalid(L, "mobj_t");
P_RingZMovement(actor);
P_CheckPosition(actor, actor->x, actor->y);
P_CheckPosition(actor, actor->x, actor->y, NULL);
P_RestoreTMStruct(ptm);
return 0;
}
@ -1085,7 +1085,7 @@ static int lib_pSceneryZMovement(lua_State *L)
if (!actor)
return LUA_ErrInvalid(L, "mobj_t");
lua_pushboolean(L, P_SceneryZMovement(actor));
P_CheckPosition(actor, actor->x, actor->y);
P_CheckPosition(actor, actor->x, actor->y, NULL);
P_RestoreTMStruct(ptm);
return 1;
}
@ -1099,7 +1099,7 @@ static int lib_pPlayerZMovement(lua_State *L)
if (!actor)
return LUA_ErrInvalid(L, "mobj_t");
P_PlayerZMovement(actor);
P_CheckPosition(actor, actor->x, actor->y);
P_CheckPosition(actor, actor->x, actor->y, NULL);
P_RestoreTMStruct(ptm);
return 0;
}
@ -1388,7 +1388,7 @@ static int lib_pCheckPosition(lua_State *L)
INLEVEL
if (!thing)
return LUA_ErrInvalid(L, "mobj_t");
lua_pushboolean(L, P_CheckPosition(thing, x, y));
lua_pushboolean(L, P_CheckPosition(thing, x, y, NULL));
LUA_PushUserdata(L, tm.thing, META_MOBJ);
P_RestoreTMStruct(ptm);
return 2;
@ -1405,7 +1405,7 @@ static int lib_pTryMove(lua_State *L)
INLEVEL
if (!thing)
return LUA_ErrInvalid(L, "mobj_t");
lua_pushboolean(L, P_TryMove(thing, x, y, allowdropoff));
lua_pushboolean(L, P_TryMove(thing, x, y, allowdropoff, NULL));
LUA_PushUserdata(L, tm.thing, META_MOBJ);
P_RestoreTMStruct(ptm);
return 2;
@ -1520,23 +1520,31 @@ static int lib_pSetRoll(lua_State *L)
static int lib_pSlideMove(lua_State *L)
{
/*
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
NOHUD
INLEVEL
if (!mo)
return LUA_ErrInvalid(L, "mobj_t");
P_SlideMove(mo);
*/
LUA_UsageWarning(L, "FIXME: P_SlideMove needs updated to use result from P_TryMove");
(void)L;
return 0;
}
static int lib_pBounceMove(lua_State *L)
{
/*
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
NOHUD
INLEVEL
if (!mo)
return LUA_ErrInvalid(L, "mobj_t");
P_BounceMove(mo);
*/
LUA_UsageWarning(L, "FIXME: P_BounceMove needs updated to use result from P_TryMove");
(void)L;
return 0;
}

View file

@ -517,7 +517,7 @@ static int mobj_set(lua_State *L)
// z doesn't cross sector bounds so it's okay.
tm_t ptm = tm;
mo->z = luaL_checkfixed(L, 3);
P_CheckPosition(mo, mo->x, mo->y);
P_CheckPosition(mo, mo->x, mo->y, NULL);
mo->floorz = tm.floorz;
mo->ceilingz = tm.ceilingz;
mo->floorrover = tm.floorrover;
@ -587,7 +587,7 @@ static int mobj_set(lua_State *L)
mo->radius = luaL_checkfixed(L, 3);
if (mo->radius < 0)
mo->radius = 0;
P_CheckPosition(mo, mo->x, mo->y);
P_CheckPosition(mo, mo->x, mo->y, NULL);
mo->floorz = tm.floorz;
mo->ceilingz = tm.ceilingz;
mo->floorrover = tm.floorrover;
@ -601,7 +601,7 @@ static int mobj_set(lua_State *L)
mo->height = luaL_checkfixed(L, 3);
if (mo->height < 0)
mo->height = 0;
P_CheckPosition(mo, mo->x, mo->y);
P_CheckPosition(mo, mo->x, mo->y, NULL);
mo->floorz = tm.floorz;
mo->ceilingz = tm.ceilingz;
mo->floorrover = tm.floorrover;

View file

@ -358,9 +358,9 @@ void Obj_OrbinautJawzMoveHeld(player_t *player)
cur->momy = FixedMul(FINESINE(cur->angle >> ANGLETOFINESHIFT), orbinaut_shield_dist(cur));
cur->flags &= ~MF_NOCLIPTHING;
if (!P_TryMove(cur, player->mo->x + cur->momx, player->mo->y + cur->momy, true))
if (!P_TryMove(cur, player->mo->x + cur->momx, player->mo->y + cur->momy, true, NULL))
{
P_SlideMove(cur);
P_SlideMove(cur, NULL);
}
if (P_IsObjectOnGround(player->mo))

View file

@ -541,7 +541,7 @@ boolean P_Move(mobj_t *actor, fixed_t speed)
if (actor->type == MT_SKIM && !P_WaterInSector(actor, tryx, tryy)) // bail out if sector lacks water
return false;
if (!P_TryMove(actor, tryx, tryy, false))
if (!P_TryMove(actor, tryx, tryy, false, NULL))
{
if (actor->flags & MF_FLOAT && tm.floatok)
{
@ -1074,7 +1074,7 @@ void A_FaceStabRev(mobj_t *actor)
}
else
{
P_TryMove(actor, actor->x - P_ReturnThrustX(actor, actor->angle, 2<<FRACBITS), actor->y - P_ReturnThrustY(actor, actor->angle, 2<<FRACBITS), false);
P_TryMove(actor, actor->x - P_ReturnThrustX(actor, actor->angle, 2<<FRACBITS), actor->y - P_ReturnThrustY(actor, actor->angle, 2<<FRACBITS), false, NULL);
P_FaceStabFlume(actor);
}
}
@ -1126,7 +1126,7 @@ void A_FaceStabHurl(mobj_t *actor)
if (P_TryMove(actor,
actor->x + P_ReturnThrustX(actor, dirang, actor->extravalue2<<FRACBITS),
actor->y + P_ReturnThrustY(actor, dirang, actor->extravalue2<<FRACBITS),
false))
false, NULL))
{
// Do the spear damage.
#define NUMSTEPS 3
@ -1196,7 +1196,7 @@ void A_FaceStabMiss(mobj_t *actor)
if (actor->extravalue2 <= 0 || !P_TryMove(actor,
actor->x + P_ReturnThrustX(actor, actor->angle, actor->extravalue2<<FRACBITS),
actor->y + P_ReturnThrustY(actor, actor->angle, actor->extravalue2<<FRACBITS),
false))
false, NULL))
{
actor->extravalue2 = 0;
P_SetMobjState(actor, locvar2);
@ -1821,7 +1821,7 @@ void A_CrushstaceanWalk(mobj_t *actor)
if (!P_TryMove(actor,
actor->x + P_ReturnThrustX(actor, ang, locvar1*actor->scale),
actor->y + P_ReturnThrustY(actor, ang, locvar1*actor->scale),
false)
false, NULL)
|| (actor->reactiontime-- <= 0))
{
actor->flags2 ^= MF2_AMBUSH;
@ -2000,7 +2000,7 @@ void A_CrushclawLaunch(mobj_t *actor)
if (!P_TryMove(actor,
actor->target->x + P_ReturnThrustX(actor, actor->target->angle, actor->extravalue2*actor->scale),
actor->target->y + P_ReturnThrustY(actor, actor->target->angle, actor->extravalue2*actor->scale),
true)
true, NULL)
&& !locvar1)
{
actor->extravalue1 = 0;
@ -2946,9 +2946,9 @@ void A_Boss1Laser(mobj_t *actor)
{
fixed_t distx = P_ReturnThrustX(point, point->angle, point->radius);
fixed_t disty = P_ReturnThrustY(point, point->angle, point->radius);
if (P_TryMove(point, point->x + distx, point->y + disty, false) // prevents the sprite from clipping into the wall or dangling off ledges
&& P_TryMove(point, point->x - 2*distx, point->y - 2*disty, false)
&& P_TryMove(point, point->x + distx, point->y + disty, false))
if (P_TryMove(point, point->x + distx, point->y + disty, false, NULL) // prevents the sprite from clipping into the wall or dangling off ledges
&& P_TryMove(point, point->x - 2*distx, point->y - 2*disty, false, NULL)
&& P_TryMove(point, point->x + distx, point->y + disty, false, NULL))
{
if (point->info->seesound)
S_StartSound(point, point->info->seesound);
@ -3012,7 +3012,7 @@ void A_FocusTarget(mobj_t *actor)
{
actor->momx = 0, actor->momy = 0, actor->momz = 0;
actor->z = actor->target->z + (actor->target->height>>1);
P_TryMove(actor, actor->target->x, actor->target->y, true);
P_TryMove(actor, actor->target->x, actor->target->y, true, NULL);
}
break;
default:
@ -3168,7 +3168,7 @@ void A_SkullAttack(mobj_t *actor)
if (P_CheckMove(actor,\
P_ReturnThrustX(actor, testang, dist + 2*actor->radius),\
P_ReturnThrustY(actor, testang, dist + 2*actor->radius),\
true)) break;
true, NULL)) break;
if (P_RandomChance(PR_UNDEFINED, FRACUNIT/2)) // port priority 2?
{
@ -4483,13 +4483,13 @@ void A_MinusDigging(mobj_t *actor)
par = P_SpawnMobj(actor->x, actor->y, mz, MT_MINUSDIRT);
if (actor->eflags & MFE_VERTICALFLIP)
par->eflags |= MFE_VERTICALFLIP;
P_TryMove(par, x, y, false);
P_TryMove(par, x, y, false, NULL);
// If close enough, prepare to attack
if (P_AproxDistance(actor->x - actor->target->x, actor->y - actor->target->y) < actor->radius*2)
{
P_SetMobjState(actor, actor->info->meleestate);
P_TryMove(actor, actor->target->x, actor->target->y, false);
P_TryMove(actor, actor->target->x, actor->target->y, false, NULL);
S_StartSound(actor, actor->info->attacksound);
// Spawn growing dirt pile.
@ -4532,7 +4532,7 @@ void A_MinusDigging(mobj_t *actor)
}
else
{
if (P_TryMove(actor->tracer, actor->x, actor->y, false))
if (P_TryMove(actor->tracer, actor->x, actor->y, false, NULL))
actor->tracer->z = mz;
else
P_SetTarget(&actor->tracer, NULL);
@ -5702,7 +5702,7 @@ void A_MixUp(mobj_t *actor)
players[i].mo->floorz = P_GetFloorZ(players[i].mo, players[i].mo->subsector->sector, players[i].mo->x, players[i].mo->y, NULL);
players[i].mo->ceilingz = P_GetCeilingZ(players[i].mo, players[i].mo->subsector->sector, players[i].mo->x, players[i].mo->y, NULL);
P_CheckPosition(players[i].mo, players[i].mo->x, players[i].mo->y);
P_CheckPosition(players[i].mo, players[i].mo->x, players[i].mo->y, NULL);
}
}
}
@ -6470,7 +6470,7 @@ void A_GuardChase(mobj_t *actor)
&& !P_TryMove(actor,
actor->x + P_ReturnThrustX(actor, actor->angle, speed),
actor->y + P_ReturnThrustY(actor, actor->angle, speed),
false)
false, NULL)
&& speed > 0) // can't be the same check as previous so that P_TryMove gets to happen.
{
INT32 direction = actor->spawnpoint ? actor->spawnpoint->args[0] : TMGD_BACK;
@ -9273,7 +9273,7 @@ void A_SpikeRetract(mobj_t *actor)
actor->flags &= ~MF_NOCLIPTHING;
}
if (actor->flags & MF_SOLID)
P_CheckPosition(actor, actor->x, actor->y);
P_CheckPosition(actor, actor->x, actor->y, NULL);
}
// Function: A_InfoState
@ -11511,7 +11511,7 @@ void A_DoNPCSkid(mobj_t *actor)
locvar2 = FRACUNIT/2;
if ((FixedHypot(actor->momx, actor->momy) < locvar2)
|| !P_TryMove(actor, actor->x + actor->momx, actor->y + actor->momy, false))
|| !P_TryMove(actor, actor->x + actor->momx, actor->y + actor->momy, false, NULL))
{
actor->momx = actor->momy = 0;
P_SetMobjState(actor, locvar1);
@ -12286,7 +12286,7 @@ static void P_SnapperLegPlace(mobj_t *mo)
INT32 necklen = (32*(mo->info->reactiontime - mo->reactiontime))/mo->info->reactiontime; // Not in FU
seg->z = mo->z + ((mo->eflags & MFE_VERTICALFLIP) ? (((mo->height<<1)/3) - seg->height) : mo->height/3);
P_TryMove(seg, mo->x + FixedMul(c, rad) + necklen*c, mo->y + FixedMul(s, rad) + necklen*s, true);
P_TryMove(seg, mo->x + FixedMul(c, rad) + necklen*c, mo->y + FixedMul(s, rad) + necklen*s, true, NULL);
seg->angle = a;
// Move as many legs as available.
@ -12307,7 +12307,7 @@ static void P_SnapperLegPlace(mobj_t *mo)
x = c*o2 + s*o1;
y = s*o2 - c*o1;
seg->z = mo->z + (((mo->eflags & MFE_VERTICALFLIP) ? (mo->height - seg->height) : 0));
P_TryMove(seg, mo->x + x, mo->y + y, true);
P_TryMove(seg, mo->x + x, mo->y + y, true, NULL);
P_SetMobjState(seg, seg->info->raisestate);
}
else
@ -12442,7 +12442,7 @@ void A_SnapperThinker(mobj_t *actor)
c = FINECOSINE(fa);
s = FINESINE(fa);
P_TryMove(actor, actor->x + c*speed, actor->y + s*speed, false);
P_TryMove(actor, actor->x + c*speed, actor->y + s*speed, false, NULL);
// The snapper spawns dust if going fast!
if (actor->reactiontime < 4)

View file

@ -431,20 +431,28 @@ void P_UnsetThingPosition(mobj_t *thing);
void P_SetThingPosition(mobj_t *thing);
void P_SetUnderlayPosition(mobj_t *thing);
typedef struct TryMoveResult_s
{
boolean success;
line_t *line;
mobj_t *mo;
} TryMoveResult_t;
boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y, TryMoveResult_t *result);
boolean P_CheckMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff, TryMoveResult_t *result);
boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff, TryMoveResult_t *result);
boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y, TryMoveResult_t *result);
boolean P_IsLineBlocking(const line_t *ld, const mobj_t *thing);
boolean P_IsLineTripWire(const line_t *ld);
boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y);
boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam);
boolean P_CheckMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff);
fixed_t P_BaseStepUp(void);
fixed_t P_GetThingStepUp(mobj_t *thing, fixed_t destX, fixed_t destY);
boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff);
boolean P_Move(mobj_t *actor, fixed_t speed);
boolean P_SetOrigin(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z);
boolean P_MoveOrigin(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z);
void P_SlideMove(mobj_t *mo);
void P_BouncePlayerMove(mobj_t *mo);
void P_BounceMove(mobj_t *mo);
void P_SlideMove(mobj_t *mo, TryMoveResult_t *result);
void P_BounceMove(mobj_t *mo, TryMoveResult_t *result);
boolean P_CheckSight(mobj_t *t1, mobj_t *t2);
boolean P_TraceBlockingLines(mobj_t *t1, mobj_t *t2);
boolean P_TraceBotTraversal(mobj_t *t1, mobj_t *t2);

View file

@ -131,7 +131,7 @@ static boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z)
P_SetThingPosition(thing);
P_CheckPosition(thing, thing->x, thing->y);
P_CheckPosition(thing, thing->x, thing->y, NULL);
if (P_MobjWasRemoved(thing))
return true;
@ -302,7 +302,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
if (horizspeed && vertispeed) // Mimic SA
{
object->momx = object->momy = 0;
P_TryMove(object, spring->x, spring->y, true);
P_TryMove(object, spring->x, spring->y, true, NULL);
}
#endif
@ -352,7 +352,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
else if (offx < -(spring->radius + object->radius + 1))
offx = -(spring->radius + object->radius + 1);
P_TryMove(object, spring->x + offx, spring->y + offy, true);
P_TryMove(object, spring->x + offx, spring->y + offy, true, NULL);
}
if (vertispeed)
@ -1838,7 +1838,7 @@ static BlockItReturn_t PIT_CheckLine(line_t *ld)
// tm.ceilingz
// the nearest ceiling or thing's bottom over tm.thing
//
boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y, TryMoveResult_t *result)
{
INT32 thingtop = thing->z + thing->height;
INT32 xl, xh, yl, yh, bx, by;
@ -2108,6 +2108,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
if (!(thing->flags & MF_NOCLIPTHING))
{
for (bx = xl; bx <= xh; bx++)
{
for (by = yl; by <= yh; by++)
{
if (!P_BlockThingsIterator(bx, by, PIT_CheckThing))
@ -2120,8 +2121,11 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
}
if (P_MobjWasRemoved(tm.thing))
{
return false;
}
}
}
}
validcount++;
@ -2138,6 +2142,12 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
}
}
if (result != NULL)
{
result->line = tm.blockingline;
result->mo = tm.hitthing;
}
return blockval;
}
@ -2499,7 +2509,7 @@ BlockItReturn_t PIT_PushableMoved(mobj_t *thing)
tm_t oldtm = tm;
// Move the player
P_TryMove(thing, thing->x + stand->momx, thing->y + stand->momy, true);
P_TryMove(thing, thing->x + stand->momx, thing->y + stand->momy, true, NULL);
// Now restore EVERYTHING so the gargoyle doesn't keep the player's tmstuff and break
P_RestoreTMStruct(oldtm);
@ -2565,7 +2575,8 @@ increment_move
fixed_t x,
fixed_t y,
boolean allowdropoff,
fixed_t * return_stairjank)
fixed_t * return_stairjank,
TryMoveResult_t * result)
{
fixed_t tryx = thing->x;
fixed_t tryy = thing->y;
@ -2607,15 +2618,17 @@ increment_move
tryy = y;
}
if (!P_CheckPosition(thing, tryx, tryy))
if (!P_CheckPosition(thing, tryx, tryy, result))
{
return false; // solid wall or thing
}
// copy into the spechitint buffer from spechit
spechitint_copyinto();
if (!(thing->flags & MF_NOCLIP))
{
//All things are affected by their scale.
// All things are affected by their scale.
fixed_t maxstep = P_GetThingStepUp(thing, tryx, tryy);
if (tm.ceilingz - tm.floorz < thing->height)
@ -2714,7 +2727,9 @@ increment_move
} while (tryx != x || tryy != y);
if (return_stairjank)
{
*return_stairjank = stairjank;
}
return true;
}
@ -2723,7 +2738,7 @@ increment_move
// P_CheckMove
// Check if a P_TryMove would be successful.
//
boolean P_CheckMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
boolean P_CheckMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff, TryMoveResult_t *result)
{
boolean moveok = false;
mobj_t *hack = P_SpawnMobjFromMobj(thing, 0, 0, 0, MT_RAY);
@ -2731,7 +2746,7 @@ boolean P_CheckMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
hack->radius = thing->radius;
hack->height = thing->height;
moveok = increment_move(hack, x, y, allowdropoff, NULL);
moveok = increment_move(hack, x, y, allowdropoff, NULL, result);
P_RemoveMobj(hack);
return moveok;
@ -2741,7 +2756,7 @@ boolean P_CheckMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
// P_TryMove
// Attempt to move to a new position.
//
boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff, TryMoveResult_t *result)
{
fixed_t oldx = thing->x;
fixed_t oldy = thing->y;
@ -2750,8 +2765,12 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
pslope_t *oldslope = thing->standingslope;
// Is the move OK?
if (increment_move(thing, x, y, allowdropoff, &stairjank) == false)
if (increment_move(thing, x, y, allowdropoff, &stairjank, result) == false)
{
if (result != NULL)
{
result->success = false;
}
return false;
}
@ -2899,10 +2918,15 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
}
}
if (result != NULL)
{
result->success = true;
}
return true;
}
boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y)
boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y, TryMoveResult_t *result)
{
fixed_t tryx, tryy;
@ -2922,7 +2946,7 @@ boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y)
else
tryy = y;
if (!P_CheckPosition(thing, tryx, tryy))
if (!P_CheckPosition(thing, tryx, tryy, result))
return false; // solid wall or thing
if (!(thing->flags & MF_NOCLIP))
@ -3074,7 +3098,7 @@ static boolean P_ThingHeightClip(mobj_t *thing)
if (thing->flags & MF_NOCLIPHEIGHT)
return true;
P_CheckPosition(thing, thing->x, thing->y);
P_CheckPosition(thing, thing->x, thing->y, NULL);
if (P_MobjWasRemoved(thing))
return true;
@ -3202,42 +3226,25 @@ static void P_HitCameraSlideLine(line_t *ld, camera_t *thiscam)
static void P_HitSlideLine(line_t *ld)
{
INT32 side;
angle_t lineangle, moveangle, deltaangle;
fixed_t movelen, newlen;
if (ld->slopetype == ST_HORIZONTAL)
{
tmymove = 0;
return;
}
if (ld->slopetype == ST_VERTICAL)
{
tmxmove = 0;
return;
}
angle_t lineangle;
fixed_t nx, ny;
fixed_t d;
side = P_PointOnLineSide(slidemo->x, slidemo->y, ld);
lineangle = ld->angle;
lineangle = ld->angle - ANGLE_90;
if (side == 1)
lineangle += ANGLE_180;
moveangle = R_PointToAngle2(0, 0, tmxmove, tmymove);
deltaangle = moveangle-lineangle;
if (deltaangle > ANGLE_180)
deltaangle += ANGLE_180;
lineangle >>= ANGLETOFINESHIFT;
deltaangle >>= ANGLETOFINESHIFT;
movelen = R_PointToDist2(0, 0, tmxmove, tmymove);
newlen = FixedMul(movelen, FINECOSINE(deltaangle));
nx = FINECOSINE(lineangle);
ny = FINESINE(lineangle);
tmxmove = FixedMul(newlen, FINECOSINE(lineangle));
tmymove = FixedMul(newlen, FINESINE(lineangle));
d = FixedMul(tmxmove, nx) + FixedMul(tmymove, ny);
tmxmove -= FixedMul(nx, d);
tmymove -= FixedMul(ny, d);
}
//
@ -3371,6 +3378,7 @@ isblocking:
return false; // stop
}
/*
static boolean PTR_LineIsBlocking(line_t *li)
{
// one-sided linedefs are always solid to sliding movement.
@ -3394,7 +3402,9 @@ static boolean PTR_LineIsBlocking(line_t *li)
return false;
}
*/
/*
static boolean PTR_SlideTraverse(intercept_t *in)
{
line_t *li;
@ -3424,6 +3434,7 @@ static boolean PTR_SlideTraverse(intercept_t *in)
return false; // stop
}
*/
//
// P_SlideCameraMove
@ -3580,186 +3591,85 @@ static void P_CheckLavaWall(mobj_t *mo, sector_t *sec)
//
// This is a kludgy mess.
//
void P_SlideMove(mobj_t *mo)
void P_SlideMove(mobj_t *mo, TryMoveResult_t *result)
{
fixed_t leadx, leady, trailx, traily, newx, newy;
INT16 hitcount = 0;
fixed_t newx, newy;
boolean success = false;
boolean papercol = false;
vertex_t v1, v2; // fake vertexes
line_t junk; // fake linedef
if (P_MobjWasRemoved(mo))
return;
if (tm.hitthing && mo->z + mo->height > tm.hitthing->z && mo->z < tm.hitthing->z + tm.hitthing->height)
if (result == NULL)
return;
if (result->mo && mo->z + mo->height > result->mo->z && mo->z < result->mo->z + result->mo->height)
{
// Don't mess with your momentum if it's a pushable object. Pushables do their own crazy things already.
if (tm.hitthing->flags & MF_PUSHABLE)
if (result->mo->flags & MF_PUSHABLE)
return;
if (tm.hitthing->flags & MF_PAPERCOLLISION)
if (result->mo->flags & MF_PAPERCOLLISION)
{
fixed_t cosradius, sinradius, num, den;
fixed_t cosradius, sinradius;
// trace along the three leading corners
if (mo->momx > 0)
{
leadx = mo->x + mo->radius;
trailx = mo->x - mo->radius;
}
else
{
leadx = mo->x - mo->radius;
trailx = mo->x + mo->radius;
}
if (mo->momy > 0)
{
leady = mo->y + mo->radius;
traily = mo->y - mo->radius;
}
else
{
leady = mo->y - mo->radius;
traily = mo->y + mo->radius;
}
papercol = true;
slidemo = mo;
bestslideline = &junk;
cosradius = FixedMul(tm.hitthing->radius, FINECOSINE(tm.hitthing->angle>>ANGLETOFINESHIFT));
sinradius = FixedMul(tm.hitthing->radius, FINESINE(tm.hitthing->angle>>ANGLETOFINESHIFT));
cosradius = FixedMul(result->mo->radius, FINECOSINE(result->mo->angle>>ANGLETOFINESHIFT));
sinradius = FixedMul(result->mo->radius, FINESINE(result->mo->angle>>ANGLETOFINESHIFT));
v1.x = tm.hitthing->x - cosradius;
v1.y = tm.hitthing->y - sinradius;
v2.x = tm.hitthing->x + cosradius;
v2.y = tm.hitthing->y + sinradius;
v1.x = result->mo->x - cosradius;
v1.y = result->mo->y - sinradius;
v2.x = result->mo->x + cosradius;
v2.y = result->mo->y + sinradius;
// Can we box collision our way into smooth movement..?
if (sinradius && mo->y + mo->radius <= min(v1.y, v2.y))
{
mo->momy = 0;
P_TryMove(mo, mo->x + mo->momx, min(v1.y, v2.y) - mo->radius, true);
return;
}
else if (sinradius && mo->y - mo->radius >= max(v1.y, v2.y))
{
mo->momy = 0;
P_TryMove(mo, mo->x + mo->momx, max(v1.y, v2.y) + mo->radius, true);
return;
}
else if (cosradius && mo->x + mo->radius <= min(v1.x, v2.x))
{
mo->momx = 0;
P_TryMove(mo, min(v1.x, v2.x) - mo->radius, mo->y + mo->momy, true);
return;
}
else if (cosradius && mo->x - mo->radius >= max(v1.x, v2.x))
{
mo->momx = 0;
P_TryMove(mo, max(v1.x, v2.x) + mo->radius, mo->y + mo->momy, true);
return;
}
// nope, gotta fuck around with a fake linedef!
// gotta fuck around with a fake linedef!
junk.v1 = &v1;
junk.v2 = &v2;
junk.dx = 2*cosradius; // v2.x - v1.x;
junk.dy = 2*sinradius; // v2.y - v1.y;
junk.slopetype = !cosradius ? ST_VERTICAL : !sinradius ? ST_HORIZONTAL :
((sinradius > 0) == (cosradius > 0)) ? ST_POSITIVE : ST_NEGATIVE;
bestslidefrac = FRACUNIT+1;
den = FixedMul(junk.dy>>8, mo->momx) - FixedMul(junk.dx>>8, mo->momy);
if (!den)
bestslidefrac = 0;
else
{
fixed_t frac;
#define P_PaperTraverse(startx, starty) \
num = FixedMul((v1.x - leadx)>>8, junk.dy) + FixedMul((leady - v1.y)>>8, junk.dx); \
frac = FixedDiv(num, den); \
if (frac < bestslidefrac) \
bestslidefrac = frac
P_PaperTraverse(leadx, leady);
P_PaperTraverse(trailx, leady);
P_PaperTraverse(leadx, traily);
#undef dowork
}
((sinradius > 0) == (cosradius > 0)) ? ST_POSITIVE : ST_NEGATIVE;
goto papercollision;
}
// Thankfully box collisions are a lot simpler than arbitrary lines. There's only four possible cases.
if (mo->y + mo->radius <= tm.hitthing->y - tm.hitthing->radius)
if (mo->y + mo->radius <= result->mo->y - result->mo->radius)
{
mo->momy = 0;
P_TryMove(mo, mo->x + mo->momx, tm.hitthing->y - tm.hitthing->radius - mo->radius, true);
P_TryMove(mo, mo->x + mo->momx, result->mo->y - result->mo->radius - mo->radius, true, NULL);
}
else if (mo->y - mo->radius >= tm.hitthing->y + tm.hitthing->radius)
else if (mo->y - mo->radius >= result->mo->y + result->mo->radius)
{
mo->momy = 0;
P_TryMove(mo, mo->x + mo->momx, tm.hitthing->y + tm.hitthing->radius + mo->radius, true);
P_TryMove(mo, mo->x + mo->momx, result->mo->y + result->mo->radius + mo->radius, true, NULL);
}
else if (mo->x + mo->radius <= tm.hitthing->x - tm.hitthing->radius)
else if (mo->x + mo->radius <= result->mo->x - result->mo->radius)
{
mo->momx = 0;
P_TryMove(mo, tm.hitthing->x - tm.hitthing->radius - mo->radius, mo->y + mo->momy, true);
P_TryMove(mo, result->mo->x - result->mo->radius - mo->radius, mo->y + mo->momy, true, NULL);
}
else if (mo->x - mo->radius >= tm.hitthing->x + tm.hitthing->radius)
else if (mo->x - mo->radius >= result->mo->x + result->mo->radius)
{
mo->momx = 0;
P_TryMove(mo, tm.hitthing->x + tm.hitthing->radius + mo->radius, mo->y + mo->momy, true);
P_TryMove(mo, result->mo->x + result->mo->radius + mo->radius, mo->y + mo->momy, true, NULL);
}
else
mo->momx = mo->momy = 0;
return;
}
slidemo = mo;
bestslideline = NULL;
bestslideline = result->line;
retry:
if ((++hitcount == 3) || papercol)
goto stairstep; // don't loop forever
// trace along the three leading corners
if (mo->momx > 0)
{
leadx = mo->x + mo->radius;
trailx = mo->x - mo->radius;
}
else
{
leadx = mo->x - mo->radius;
trailx = mo->x + mo->radius;
}
if (mo->momy > 0)
{
leady = mo->y + mo->radius;
traily = mo->y - mo->radius;
}
else
{
leady = mo->y - mo->radius;
traily = mo->y + mo->radius;
}
bestslidefrac = FRACUNIT+1;
P_PathTraverse(leadx, leady, leadx + mo->momx, leady + mo->momy,
PT_ADDLINES, PTR_SlideTraverse);
P_PathTraverse(trailx, leady, trailx + mo->momx, leady + mo->momy,
PT_ADDLINES, PTR_SlideTraverse);
P_PathTraverse(leadx, traily, leadx + mo->momx, traily + mo->momy,
PT_ADDLINES, PTR_SlideTraverse);
if (bestslideline == NULL)
return;
if (bestslideline && mo->player && bestslideline->sidenum[1] != 0xffff)
{
@ -3768,39 +3678,8 @@ retry:
}
papercollision:
// move up to the wall
if (bestslidefrac == FRACUNIT+1)
{
// the move must have hit the middle, so stairstep
stairstep:
if (!P_TryMove(mo, mo->x, mo->y + mo->momy, true)) //Allow things to drop off.
P_TryMove(mo, mo->x + mo->momx, mo->y, true);
return;
}
// fudge a bit to make sure it doesn't hit
bestslidefrac -= 0x800;
if (bestslidefrac > 0)
{
newx = FixedMul(mo->momx, bestslidefrac);
newy = FixedMul(mo->momy, bestslidefrac);
if (!P_TryMove(mo, mo->x + newx, mo->y + newy, true))
goto stairstep;
}
// Now continue along the wall.
// First calculate remainder.
bestslidefrac = FRACUNIT - (bestslidefrac+0x800);
if (bestslidefrac > FRACUNIT)
bestslidefrac = FRACUNIT;
if (bestslidefrac <= 0)
return;
tmxmove = FixedMul(mo->momx, bestslidefrac);
tmymove = FixedMul(mo->momy, bestslidefrac);
tmxmove = mo->momx;
tmymove = mo->momy;
P_HitSlideLine(bestslideline); // clip the moves
@ -3808,31 +3687,47 @@ stairstep:
mo->momy = tmymove;
do {
if (tmxmove > mo->radius) {
if (tmxmove > mo->radius)
{
newx = mo->x + mo->radius;
tmxmove -= mo->radius;
} else if (tmxmove < -mo->radius) {
}
else if (tmxmove < -mo->radius)
{
newx = mo->x - mo->radius;
tmxmove += mo->radius;
} else {
}
else
{
newx = mo->x + tmxmove;
tmxmove = 0;
}
if (tmymove > mo->radius) {
if (tmymove > mo->radius)
{
newy = mo->y + mo->radius;
tmymove -= mo->radius;
} else if (tmymove < -mo->radius) {
}
else if (tmymove < -mo->radius)
{
newy = mo->y - mo->radius;
tmymove += mo->radius;
} else {
}
else
{
newy = mo->y + tmymove;
tmymove = 0;
}
if (!P_TryMove(mo, newx, newy, true)) {
if (success || P_MobjWasRemoved(mo))
if (!P_TryMove(mo, newx, newy, true, NULL))
{
if (success || P_MobjWasRemoved(mo))
return; // Good enough!!
else
goto retry;
// the move must have hit the middle, so stairstep
if (!P_TryMove(mo, mo->x, mo->y + mo->momy, true, NULL)) // Allow things to drop off.
P_TryMove(mo, mo->x + mo->momx, mo->y, true, NULL);
return;
}
success = true;
} while(tmxmove || tmymove);
@ -3844,64 +3739,33 @@ stairstep:
// Bounce move, for players.
//
void P_BouncePlayerMove(mobj_t *mo)
static void P_BouncePlayerMove(mobj_t *mo, TryMoveResult_t *result)
{
fixed_t leadx, leady;
fixed_t trailx, traily;
fixed_t mmomx = 0, mmomy = 0;
fixed_t oldmomx = mo->momx, oldmomy = mo->momy;
if (!mo->player)
if (P_MobjWasRemoved(mo) == true)
return;
if (mo->player == NULL)
return;
if (result == NULL)
return;
if (mo->player->spectator)
{
P_SlideMove(mo);
P_SlideMove(mo, result);
return;
}
slidemo = mo;
mmomx = mo->player->rmomx;
mmomy = mo->player->rmomy;
// trace along the three leading corners
if (mo->momx > 0)
{
leadx = mo->x + mo->radius;
trailx = mo->x - mo->radius;
}
else
{
leadx = mo->x - mo->radius;
trailx = mo->x + mo->radius;
}
slidemo = mo;
bestslideline = result->line;
if (mo->momy > 0)
{
leady = mo->y + mo->radius;
traily = mo->y - mo->radius;
}
else
{
leady = mo->y - mo->radius;
traily = mo->y + mo->radius;
}
bestslidefrac = FRACUNIT + 1;
P_PathTraverse(leadx, leady, leadx + mmomx, leady + mmomy, PT_ADDLINES, PTR_SlideTraverse);
P_PathTraverse(trailx, leady, trailx + mmomx, leady + mmomy, PT_ADDLINES, PTR_SlideTraverse);
P_PathTraverse(leadx, traily, leadx + mmomx, traily + mmomy, PT_ADDLINES, PTR_SlideTraverse);
// Now continue along the wall.
// First calculate remainder.
bestslidefrac = FRACUNIT - bestslidefrac;
if (bestslidefrac > FRACUNIT)
bestslidefrac = FRACUNIT;
if (bestslidefrac <= 0)
if (bestslideline == NULL)
return;
if (mo->eflags & MFE_JUSTBOUNCEDWALL) // Stronger push-out
@ -3926,7 +3790,7 @@ void P_BouncePlayerMove(mobj_t *mo)
if (bestslideline && (bestslideline->flags & ML_NOTBOUNCY))
{
// SRB2Kart: Non-bouncy line!
P_SlideMove(mo);
P_SlideMove(mo, result);
return;
}
@ -3943,8 +3807,9 @@ void P_BouncePlayerMove(mobj_t *mo)
if (!P_IsLineTripWire(bestslideline))
{
if (!P_TryMove(mo, mo->x + tmxmove, mo->y + tmymove, true)) {
P_TryMove(mo, mo->x - oldmomx, mo->y - oldmomy, true);
if (!P_TryMove(mo, mo->x + tmxmove, mo->y + tmymove, true, NULL))
{
P_TryMove(mo, mo->x - oldmomx, mo->y - oldmomy, true, NULL);
}
}
}
@ -3954,12 +3819,8 @@ void P_BouncePlayerMove(mobj_t *mo)
//
// The momx / momy move is bad, so try to bounce off a wall.
//
void P_BounceMove(mobj_t *mo)
void P_BounceMove(mobj_t *mo, TryMoveResult_t *result)
{
fixed_t leadx, leady;
fixed_t trailx, traily;
fixed_t newx, newy;
INT32 hitcount;
fixed_t mmomx = 0, mmomy = 0;
if (P_MobjWasRemoved(mo))
@ -3967,89 +3828,23 @@ void P_BounceMove(mobj_t *mo)
if (mo->player)
{
P_BouncePlayerMove(mo);
P_BouncePlayerMove(mo, result);
return;
}
if (mo->eflags & MFE_JUSTBOUNCEDWALL)
{
P_SlideMove(mo);
P_SlideMove(mo, result);
return;
}
slidemo = mo;
hitcount = 0;
retry:
if (++hitcount == 3)
goto bounceback; // don't loop forever
mmomx = mo->momx;
mmomy = mo->momy;
// trace along the three leading corners
if (mo->momx > 0)
{
leadx = mo->x + mo->radius;
trailx = mo->x - mo->radius;
}
else
{
leadx = mo->x - mo->radius;
trailx = mo->x + mo->radius;
}
slidemo = mo;
bestslideline = result->line;
if (mo->momy > 0)
{
leady = mo->y + mo->radius;
traily = mo->y - mo->radius;
}
else
{
leady = mo->y - mo->radius;
traily = mo->y + mo->radius;
}
bestslidefrac = FRACUNIT + 1;
P_PathTraverse(leadx, leady, leadx + mmomx, leady + mmomy, PT_ADDLINES, PTR_SlideTraverse);
P_PathTraverse(trailx, leady, trailx + mmomx, leady + mmomy, PT_ADDLINES, PTR_SlideTraverse);
P_PathTraverse(leadx, traily, leadx + mmomx, traily + mmomy, PT_ADDLINES, PTR_SlideTraverse);
// move up to the wall
if (bestslidefrac == FRACUNIT + 1)
{
// the move must have hit the middle, so bounce straight back
bounceback:
if (P_TryMove(mo, mo->x - mmomx, mo->y - mmomy, true))
{
mo->momx *= -1;
mo->momy *= -1;
mo->momx = FixedMul(mo->momx, (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3)));
mo->momy = FixedMul(mo->momy, (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3)));
}
return;
}
// fudge a bit to make sure it doesn't hit
bestslidefrac -= 0x800;
if (bestslidefrac > 0)
{
newx = FixedMul(mmomx, bestslidefrac);
newy = FixedMul(mmomy, bestslidefrac);
if (!P_TryMove(mo, mo->x + newx, mo->y + newy, true))
goto bounceback;
}
// Now continue along the wall.
// First calculate remainder.
bestslidefrac = FRACUNIT - bestslidefrac;
if (bestslidefrac > FRACUNIT)
bestslidefrac = FRACUNIT;
if (bestslidefrac <= 0)
if (bestslideline == NULL)
return;
if (mo->type == MT_SHELL)
@ -4074,24 +3869,21 @@ bounceback:
tmymove = FixedMul(mmomy, (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3)));
}
// Some walls aren't bouncy even if you are
if (bestslideline && (bestslideline->flags & ML_NOTBOUNCY))
{
// SRB2Kart: Non-bouncy line!
P_SlideMove(mo);
return;
}
P_HitBounceLine(bestslideline); // clip the moves
mo->momx = tmxmove;
mo->momy = tmymove;
if (!P_TryMove(mo, mo->x + tmxmove, mo->y + tmymove, true))
if (!P_TryMove(mo, mo->x + tmxmove, mo->y + tmymove, true, NULL))
{
if (P_MobjWasRemoved(mo))
return;
goto retry;
// the move must have hit the middle, so bounce straight back
mo->momx *= -1;
mo->momy *= -1;
mo->momx = FixedMul(mo->momx, (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3)));
mo->momy = FixedMul(mo->momy, (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3)));
}
}

View file

@ -53,7 +53,6 @@ line_t * P_FindNearestLine(const fixed_t x, const fixed_t y, const sector_t *, c
void P_UnsetPrecipThingPosition(precipmobj_t *thing);
void P_SetPrecipitationThingPosition(precipmobj_t *thing);
void P_CreatePrecipSecNodeList(precipmobj_t *thing, fixed_t x,fixed_t y);
boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y);
void P_HitSpecialLines(mobj_t *thing, fixed_t x, fixed_t y, fixed_t momx, fixed_t momy);
boolean P_GetMidtextureTopBottom(line_t *linedef, fixed_t x, fixed_t y, fixed_t *return_top, fixed_t *return_bottom);

View file

@ -1513,6 +1513,7 @@ void P_XYMovement(mobj_t *mo)
pslope_t *oldslope = NULL;
vector3_t slopemom = {0,0,0};
fixed_t predictedz = 0;
TryMoveResult_t result = {0};
I_Assert(mo != NULL);
I_Assert(!P_MobjWasRemoved(mo));
@ -1595,7 +1596,7 @@ void P_XYMovement(mobj_t *mo)
}
//}
if (!P_TryMove(mo, mo->x + xmove, mo->y + ymove, true)
if (!P_TryMove(mo, mo->x + xmove, mo->y + ymove, true, &result)
&& !(P_MobjWasRemoved(mo) || mo->eflags & MFE_SPRUNG))
{
// blocked move
@ -1691,7 +1692,7 @@ void P_XYMovement(mobj_t *mo)
walltransferred = true;
P_SlideMove(mo);
P_SlideMove(mo, &result);
xmove = ymove = 0;
@ -1726,14 +1727,14 @@ void P_XYMovement(mobj_t *mo)
}
else if (mo->flags & MF_SLIDEME)
{
P_SlideMove(mo);
P_SlideMove(mo, &result);
if (P_MobjWasRemoved(mo))
return;
xmove = ymove = 0;
}
else
{
P_BounceMove(mo);
P_BounceMove(mo, &result);
if (P_MobjWasRemoved(mo))
return;
xmove = ymove = 0;
@ -1895,16 +1896,19 @@ void P_XYMovement(mobj_t *mo)
void P_RingXYMovement(mobj_t *mo)
{
TryMoveResult_t result = {0};
I_Assert(mo != NULL);
I_Assert(!P_MobjWasRemoved(mo));
if (!P_SceneryTryMove(mo, mo->x + mo->momx, mo->y + mo->momy))
P_BounceMove(mo);
if (!P_SceneryTryMove(mo, mo->x + mo->momx, mo->y + mo->momy, &result))
P_BounceMove(mo, &result);
}
void P_SceneryXYMovement(mobj_t *mo)
{
fixed_t oldx, oldy; // reducing bobbing/momentum on ice when up against walls
TryMoveResult_t result = {0};
I_Assert(mo != NULL);
I_Assert(!P_MobjWasRemoved(mo));
@ -1912,8 +1916,8 @@ void P_SceneryXYMovement(mobj_t *mo)
oldx = mo->x;
oldy = mo->y;
if (!P_SceneryTryMove(mo, mo->x + mo->momx, mo->y + mo->momy))
P_BounceMove(mo);
if (!P_SceneryTryMove(mo, mo->x + mo->momx, mo->y + mo->momy, &result))
P_BounceMove(mo, &result);
if (P_MobjWasRemoved(mo))
return;
@ -2367,7 +2371,7 @@ boolean P_ZMovement(mobj_t *mo)
return true;
}
P_CheckPosition(mo, mo->x, mo->y); // Sets mo->standingslope correctly
P_CheckPosition(mo, mo->x, mo->y, NULL); // Sets mo->standingslope correctly
if (P_MobjWasRemoved(mo)) // mobjs can be removed by P_CheckPosition -- Monster Iestyn 31/07/21
return false;
@ -2985,7 +2989,7 @@ boolean P_SceneryZMovement(mobj_t *mo)
if (!(mo->flags & MF_SLIDEME) && (mo->z <= mo->floorz || mo->z+mo->height >= mo->ceilingz))
{
// set standingslope
P_TryMove(mo, mo->x, mo->y, true);
P_TryMove(mo, mo->x, mo->y, true, NULL);
mo->momz = -mo->momz;
if (mo->standingslope)
{
@ -3959,7 +3963,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
mobj->y += mobj->momy;
mobj->z += mobj->momz;
P_SetThingPosition(mobj);
P_CheckPosition(mobj, mobj->x, mobj->y);
P_CheckPosition(mobj, mobj->x, mobj->y, NULL);
mobj->floorz = tm.floorz;
mobj->ceilingz = tm.ceilingz;
goto animonly;
@ -3976,7 +3980,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
return;
}
else
P_TryMove(mobj, mobj->x, mobj->y, true);
P_TryMove(mobj, mobj->x, mobj->y, true, NULL);
P_CheckCrumblingPlatforms(mobj);
@ -3991,7 +3995,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
|| P_IsObjectInGoop(mobj))
{
P_PlayerZMovement(mobj);
P_CheckPosition(mobj, mobj->x, mobj->y); // Need this to pick up objects!
P_CheckPosition(mobj, mobj->x, mobj->y, NULL); // Need this to pick up objects!
if (P_MobjWasRemoved(mobj))
return;
@ -4181,7 +4185,7 @@ static void P_RingThinker(mobj_t *mobj)
if (mobj->momz)
{
P_RingZMovement(mobj);
P_CheckPosition(mobj, mobj->x, mobj->y); // Need this to pick up objects!
P_CheckPosition(mobj, mobj->x, mobj->y, NULL); // Need this to pick up objects!
if (P_MobjWasRemoved(mobj))
return;
@ -5330,7 +5334,7 @@ void P_RunOverlays(void)
P_SetUnderlayPosition(mo);
else
P_SetThingPosition(mo);
P_CheckPosition(mo, mo->x, mo->y);
P_CheckPosition(mo, mo->x, mo->y, NULL);
}
P_SetTarget(&overlaycap, NULL);
}
@ -8408,7 +8412,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
mobj->movecount += mobj->lastlook;
if (!(P_TryMove(mobj->tracer, mobj->x + ((mobj->extravalue1<<FRACBITS) * mobj->movecount), mobj->y + ((mobj->extravalue2<<FRACBITS) * mobj->movecount), true))
if (!(P_TryMove(mobj->tracer, mobj->x + ((mobj->extravalue1<<FRACBITS) * mobj->movecount), mobj->y + ((mobj->extravalue2<<FRACBITS) * mobj->movecount), true, NULL))
|| (mobj->movecount >= 16) // maximum travel time
|| (mobj->tracer->z <= mobj->tracer->floorz) // Through the floor
|| ((mobj->tracer->z + mobj->tracer->height) >= mobj->tracer->ceilingz)) // Through the ceiling
@ -9609,7 +9613,7 @@ void P_MobjThinker(mobj_t *mobj)
{
if (!P_ZMovement(mobj))
return; // mobj was removed
P_CheckPosition(mobj, mobj->x, mobj->y); // Need this to pick up objects!
P_CheckPosition(mobj, mobj->x, mobj->y, NULL); // Need this to pick up objects!
if (P_MobjWasRemoved(mobj))
return;
}
@ -9633,7 +9637,7 @@ void P_MobjThinker(mobj_t *mobj)
|| mobj->type == MT_JAWZ
|| (mobj->type == MT_DROPTARGET && mobj->reactiontime))
{
P_TryMove(mobj, mobj->x, mobj->y, true); // Sets mo->standingslope correctly
P_TryMove(mobj, mobj->x, mobj->y, true, NULL); // Sets mo->standingslope correctly
if (P_MobjWasRemoved(mobj)) // anything that calls checkposition can be lethal
return;
@ -9731,7 +9735,7 @@ boolean P_RailThinker(mobj_t *mobj)
{
if (!P_ZMovement(mobj))
return true; // mobj was removed
//P_CheckPosition(mobj, mobj->x, mobj->y);
//P_CheckPosition(mobj, mobj->x, mobj->y, NULL);
}
return P_MobjWasRemoved(mobj) || (x == mobj->x && y == mobj->y && z == mobj->z);
@ -9747,7 +9751,7 @@ void P_PushableThinker(mobj_t *mobj)
// it has to be pushable RIGHT NOW for this part to happen
if (mobj->flags & MF_PUSHABLE && !(mobj->momx || mobj->momy))
P_TryMove(mobj, mobj->x, mobj->y, true);
P_TryMove(mobj, mobj->x, mobj->y, true, NULL);
if (mobj->fuse == 1) // it would explode in the MobjThinker code
{
@ -9808,7 +9812,7 @@ void P_SceneryThinker(mobj_t *mobj)
{
if (!P_SceneryZMovement(mobj))
return; // mobj was removed
P_CheckPosition(mobj, mobj->x, mobj->y); // Need this to pick up objects!
P_CheckPosition(mobj, mobj->x, mobj->y, NULL); // Need this to pick up objects!
if (P_MobjWasRemoved(mobj))
return;
mobj->floorz = tm.floorz;
@ -13350,7 +13354,7 @@ boolean P_CheckMissileSpawn(mobj_t *th)
th->z += th->momz>>1;
}
if (!P_TryMove(th, th->x, th->y, true))
if (!P_TryMove(th, th->x, th->y, true, NULL))
{
P_ExplodeMissile(th);
return false;

View file

@ -805,7 +805,7 @@ static void Polyobj_pushThing(polyobj_t *po, line_t *line, mobj_t *mo)
// if object doesn't fit at desired location, possibly hurt it
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, NULL);
mo->floorz = tm.floorz;
mo->ceilingz = tm.ceilingz;
mo->floorrover = tm.floorrover;
@ -851,7 +851,7 @@ static void Polyobj_slideThing(mobj_t *mo, fixed_t dx, fixed_t dy)
mo->player->onconveyor = 1;
} else
P_TryMove(mo, mo->x+dx, mo->y+dy, true);
P_TryMove(mo, mo->x+dx, mo->y+dy, true, NULL);
}
// Causes objects resting on top of the polyobject to 'ride' with its movement.