Duke3D/Engine: Player cannot jump when standing on a sprite platform close to the ceiling of the lower TROR layer
Taken from here:
- https://forums.duke4.net/topic/775-eduke32-20-and-polymer/page__view__findpost__p__319968
- https://forums.duke4.net/topic/10788-incorrect-getzrange-calculation-while-standing-on-sprite-bridges-in-tror-areas/
Illustration: https://media.discordapp.net/attachments/309183622143803392/568383929783156746/unknown.png
To reproduce: https://forums.duke4.net/index.php?app=core&module=attach§ion=attach&attach_id=14341
Description:
The problem here is a bug in the getzrange()
function causing the condition if (klabs(floorZ2-ceilZ2) > (48<<8))
to be false in player.cpp
, see below:
// jumping
if (!TEST_SYNC_KEY(playerBits, SK_JUMP) && pPlayer->jumping_toggle)
pPlayer->jumping_toggle--;
else if (TEST_SYNC_KEY(playerBits, SK_JUMP) && pPlayer->jumping_toggle == 0)
{
int32_t floorZ2, ceilZ2;
getzrange(&pPlayer->pos, pPlayer->cursectnum, &ceilZ2, &dummy, &floorZ2, &dummy, pPlayer->clipdist - GETZRANGECLIPDISTOFFSET, CLIPMASK0);
if (klabs(floorZ2-ceilZ2) > (48<<8))
{
.......
}
}
In a TROR area as in the example map, getzrange(...)
returns the wrong value for ceilZ
if the player is standing on a spritefloor. It returns the ceiling height of the lower TROR layer, rather than the height of the actual physical ceiling in the upper layer. The problem does not occur when one is standing on a sector floor.
(The statement made in the thread about the height of the floor grate is wrong, but I cannot edit the post anymore)
Edit: I completely forgot to mention that this started with commit d060ca95, in which the aforementioned getzrange()
call was added.