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
1 changed files with 16 additions and 7 deletions

View File

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