This theoretically helps with cases in which the player is squished by geometry

git-svn-id: https://svn.eduke32.com/eduke32@8100 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2019-09-17 03:20:04 +00:00 committed by Christoph Oelckers
parent 35274783a9
commit 0cba9d2036

View file

@ -4933,6 +4933,7 @@ void P_ProcessInput(int playerNum)
const uint8_t *const weaponFrame = &pPlayer->kickback_pic; const uint8_t *const weaponFrame = &pPlayer->kickback_pic;
int floorZOffset = 40; int floorZOffset = 40;
int const playerShrunk = (pSprite->yrepeat < 32); int const playerShrunk = (pSprite->yrepeat < 32);
vec3_t const backupPos = pPlayer->opos;
if (pPlayer->on_crane >= 0) if (pPlayer->on_crane >= 0)
goto HORIZONLY; goto HORIZONLY;
@ -5471,12 +5472,13 @@ HORIZONLY:;
pPlayer->on_warping_sector = 0; pPlayer->on_warping_sector = 0;
bool mashedPotato = 0;
if (pPlayer->cursectnum >= 0 && ud.noclip == 0) if (pPlayer->cursectnum >= 0 && ud.noclip == 0)
{ {
int const pushResult = pushmove(&pPlayer->pos, &pPlayer->cursectnum, pPlayer->clipdist - 1, (4L << 8), (4L << 8), CLIPMASK0); RECHECK:
int const furthestAngle = A_GetFurthestAngle(pPlayer->i, 32); int const pushResult = pushmove(&pPlayer->pos, &pPlayer->cursectnum, pPlayer->clipdist - 1, (4L<<8), (4L<<8), CLIPMASK0, !mashedPotato);
int const angleDelta = G_GetAngleDelta(fix16_to_int(pPlayer->q16ang), furthestAngle); bool const squishPlayer = pushResult < 0;
bool const squishPlayer = pushResult < 0 && !angleDelta;
if (squishPlayer || klabs(actor[pPlayer->i].floorz-actor[pPlayer->i].ceilingz) < (48<<8)) if (squishPlayer || klabs(actor[pPlayer->i].floorz-actor[pPlayer->i].ceilingz) < (48<<8))
{ {
@ -5485,11 +5487,18 @@ HORIZONLY:;
G_ActivateBySector(pSprite->sectnum, pPlayer->i); G_ActivateBySector(pSprite->sectnum, pPlayer->i);
if (squishPlayer) if (squishPlayer)
{
if (mashedPotato)
{ {
OSD_Printf(OSD_ERROR "%s: player killed by pushmove()!\n", EDUKE32_FUNCTION); OSD_Printf(OSD_ERROR "%s: player killed by pushmove()!\n", EDUKE32_FUNCTION);
P_QuickKill(pPlayer); P_QuickKill(pPlayer);
return; return;
} }
mashedPotato = true;
pPlayer->pos = pPlayer->opos = backupPos;
goto RECHECK;
}
} }
else if (klabs(floorZ - ceilZ) < ZOFFSET5 && isanunderoperator(sector[pPlayer->cursectnum].lotag)) else if (klabs(floorZ - ceilZ) < ZOFFSET5 && isanunderoperator(sector[pPlayer->cursectnum].lotag))
G_ActivateBySector(pPlayer->cursectnum, pPlayer->i); G_ActivateBySector(pPlayer->cursectnum, pPlayer->i);