From 56604e5e2509567961dd0a157be485e6b24d9737 Mon Sep 17 00:00:00 2001 From: terminx Date: Wed, 24 Jul 2019 18:06:06 +0000 Subject: [PATCH] Make it easier to jump into vents git-svn-id: https://svn.eduke32.com/eduke32@7841 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/duke3d/src/player.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/source/duke3d/src/player.cpp b/source/duke3d/src/player.cpp index 80c8a26f5..638cd819c 100644 --- a/source/duke3d/src/player.cpp +++ b/source/duke3d/src/player.cpp @@ -4662,6 +4662,7 @@ static void P_ClampZ(DukePlayer_t* const pPlayer, int const sectorLotag, int32_t pPlayer->pos.z = floorZ - PMINHEIGHT; } +#define GETZRANGECLIPDISTOFFSET 8 void P_ProcessInput(int playerNum) { @@ -4702,15 +4703,17 @@ void P_ProcessInput(int playerNum) if (pPlayer->pos.z + stepHeight > actor[pPlayer->i].floorz - PMINHEIGHT) stepHeight -= (pPlayer->pos.z + stepHeight) - (actor[pPlayer->i].floorz - PMINHEIGHT); else - stepHeight -= (pPlayer->jumping_counter << 1); + stepHeight -= (pPlayer->jumping_counter << 1) + (pPlayer->jumping_counter >> 1); + + stepHeight = max(stepHeight, 0); } pPlayer->pos.z += stepHeight; - getzrange(&pPlayer->pos, pPlayer->cursectnum, &ceilZ, &highZhit, &floorZ, &lowZhit, pPlayer->clipdist - 16, CLIPMASK0); + getzrange(&pPlayer->pos, pPlayer->cursectnum, &ceilZ, &highZhit, &floorZ, &lowZhit, pPlayer->clipdist - GETZRANGECLIPDISTOFFSET, CLIPMASK0); pPlayer->pos.z -= stepHeight; int32_t ceilZ2 = ceilZ; - getzrange(&pPlayer->pos, pPlayer->cursectnum, &ceilZ, &highZhit, &dummy, &dummy, pPlayer->clipdist - 16, CSTAT_SPRITE_ALIGNMENT_FLOOR << 16); + getzrange(&pPlayer->pos, pPlayer->cursectnum, &ceilZ, &highZhit, &dummy, &dummy, pPlayer->clipdist - GETZRANGECLIPDISTOFFSET, CSTAT_SPRITE_ALIGNMENT_FLOOR << 16); if ((highZhit & 49152) == 49152 && (sprite[highZhit & (MAXSPRITES - 1)].cstat & CSTAT_SPRITE_BLOCK) != CSTAT_SPRITE_BLOCK) ceilZ = ceilZ2; @@ -5148,7 +5151,7 @@ void P_ProcessInput(int playerNum) 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 - 16, CLIPMASK0); + getzrange(&pPlayer->pos, pPlayer->cursectnum, &ceilZ2, &dummy, &floorZ2, &dummy, pPlayer->clipdist - GETZRANGECLIPDISTOFFSET, CLIPMASK0); if ((floorZ2-ceilZ2) > (48<<8)) {