From df609ccfbc486a65d75728668680ebf82519cadb Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Tue, 16 Jul 2019 07:00:24 +0000 Subject: [PATCH] Fix an OG Duke bug where projectiles would bounce off the tops of sprites instead of registering a hit git-svn-id: https://svn.eduke32.com/eduke32@7794 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/duke3d/src/actors.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/source/duke3d/src/actors.cpp b/source/duke3d/src/actors.cpp index 1bc0ce278..9c89f2c34 100644 --- a/source/duke3d/src/actors.cpp +++ b/source/duke3d/src/actors.cpp @@ -379,7 +379,8 @@ int A_CheckNoSE7Water(uspriteptr_t const pSprite, int sectNum, int sectLotag, in // 1 if yes, but stayed inside [actor[].ceilingz+1, actor[].floorz]. // <0 if yes, but passed a TROR no-SE7 water boundary. -returnvalue-1 is the // other-side sector number. -static int32_t A_CheckNeedZUpdate(int32_t spriteNum, int32_t zChange, int32_t *pZcoord) +static int32_t A_CheckNeedZUpdate(int32_t spriteNum, int32_t zChange, int32_t *pZcoord, + int32_t *ceilhit, int32_t *florhit) { if (zChange == 0) return 0; @@ -389,10 +390,9 @@ static int32_t A_CheckNeedZUpdate(int32_t spriteNum, int32_t zChange, int32_t *p *pZcoord = newZ; - int32_t ceilhit, florhit; int const clipDist = A_GetClipdist(spriteNum, -1); - VM_GetZRange(spriteNum, &ceilhit, &florhit, pSprite->statnum == STAT_PROJECTILE ? clipDist << 3 : clipDist); + VM_GetZRange(spriteNum, ceilhit, florhit, pSprite->statnum == STAT_PROJECTILE ? clipDist << 3 : clipDist); if (newZ > actor[spriteNum].ceilingz && newZ <= actor[spriteNum].floorz) return 1; @@ -419,7 +419,7 @@ static int32_t A_CheckNeedZUpdate(int32_t spriteNum, int32_t zChange, int32_t *p } #endif - return 0; + return 2; } int A_GetClipdist(int spriteNum, int clipDist) @@ -558,10 +558,13 @@ int32_t A_MoveSpriteClipdist(int32_t spriteNum, vec3_t const * const change, uin Bassert(newSectnum == pSprite->sectnum); - int const doZUpdate = change->z ? A_CheckNeedZUpdate(spriteNum, change->z, &newZ) : 0; + int32_t ceilhit, florhit; + int const doZUpdate = change->z ? A_CheckNeedZUpdate(spriteNum, change->z, &newZ, &ceilhit, &florhit) : 0; // Update sprite's z positions and (for TROR) maybe the sector number. - if (doZUpdate) + if (doZUpdate == 2) + returnValue = change->z < 0 ? ceilhit : florhit; + else if (doZUpdate) { pSprite->z = newZ; #ifdef YAX_ENABLE