From 9dfa153e7497403d874e980868b7aa6d15595286 Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 1 Feb 2022 03:40:26 -0800 Subject: [PATCH] Use P_CheckMove --- src/p_enemy.c | 15 +++++---------- src/p_user.c | 15 ++++----------- 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 9c226481e..94c030d0f 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3333,10 +3333,8 @@ void A_SkullAttack(mobj_t *actor) UINT32 oldflags = mobjinfo[MT_NULL].flags; fixed_t oldradius = mobjinfo[MT_NULL].radius; fixed_t oldheight = mobjinfo[MT_NULL].height; - mobj_t *check; INT32 i, j; static INT32 k;/* static for (at least) GCC 9.1 weirdness */ - boolean allow; angle_t testang = 0; mobjinfo[MT_NULL].spawnstate = S_INVISIBLE; @@ -3355,15 +3353,12 @@ void A_SkullAttack(mobj_t *actor) j = 9; } -#define dostuff(q) check = P_SpawnMobjFromMobj(actor, 0, 0, 0, MT_NULL);\ +#define dostuff(q) \ testang = actor->angle + ((i+(q))*ANG10);\ - allow = (P_TryMove(check,\ - P_ReturnThrustX(check, testang, dist + 2*actor->radius),\ - P_ReturnThrustY(check, testang, dist + 2*actor->radius),\ - true));\ - P_RemoveMobj(check);\ - if (allow)\ - break; + if (P_CheckMove(actor,\ + P_ReturnThrustX(actor, testang, dist + 2*actor->radius),\ + P_ReturnThrustY(actor, testang, dist + 2*actor->radius),\ + true)) break; if (P_RandomChance(FRACUNIT/2)) // port priority 2? { diff --git a/src/p_user.c b/src/p_user.c index 83eb4ea02..e1998cdff 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6281,18 +6281,11 @@ static void P_NightsTransferPoints(player_t *player, fixed_t xspeed, fixed_t rad if (player->exiting) return; + if (!P_CheckMove(player->mo, + player->mo->x + player->mo->momx, + player->mo->y + player->mo->momy, true)) { - boolean notallowed; - mobj_t *hack = P_SpawnMobjFromMobj(player->mo, 0, 0, 0, MT_NULL); - hack->flags = MF_NOGRAVITY; - hack->radius = player->mo->radius; - hack->height = player->mo->height; - hack->z = player->mo->z; - P_SetThingPosition(hack); - notallowed = (!(P_TryMove(hack, player->mo->x+player->mo->momx, player->mo->y+player->mo->momy, true))); - P_RemoveMobj(hack); - if (notallowed) - return; + return; } {