diff --git a/source/duke3d/src/actors.cpp b/source/duke3d/src/actors.cpp index 12512a5d0..74244bfd6 100644 --- a/source/duke3d/src/actors.cpp +++ b/source/duke3d/src/actors.cpp @@ -389,7 +389,10 @@ static int32_t A_CheckNeedZUpdate(int32_t spriteNum, int32_t zChange, int32_t *p *pZcoord = newZ; - A_GetZLimits(spriteNum); + int32_t ceilhit, florhit; + int const clipDist = A_GetClipdist(spriteNum, -1); + + VM_GetZRange(spriteNum, &ceilhit, &florhit, pSprite->statnum == STAT_PROJECTILE ? clipDist << 3 : clipDist); if (newZ > actor[spriteNum].ceilingz && newZ <= actor[spriteNum].floorz) return 1; @@ -2857,6 +2860,8 @@ ACTOR_STATIC void Proj_MoveCustom(int const spriteNum) if (pProj->workslike & PROJECTILE_SPIT && pSprite->zvel < 6144) pSprite->zvel += g_spriteGravity - 112; + A_GetZLimits(spriteNum); + if (pProj->trail >= 0) { for (bssize_t cnt = 0; cnt <= pProj->tnum; cnt++) @@ -3131,6 +3136,8 @@ ACTOR_STATIC void G_MoveWeapons(void) vec3_t davect = *(vec3_t *) pSprite; + A_GetZLimits(spriteNum); + if (pSprite->picnum == RPG && actor[spriteNum].picnum != BOSS2 && pSprite->xrepeat >= 10 && sector[pSprite->sectnum].lotag != ST_2_UNDERWATER && g_scriptVersion >= 13) diff --git a/source/duke3d/src/gameexec.cpp b/source/duke3d/src/gameexec.cpp index 996e50af5..e9a060a42 100644 --- a/source/duke3d/src/gameexec.cpp +++ b/source/duke3d/src/gameexec.cpp @@ -380,7 +380,7 @@ int A_FurthestVisiblePoint(int const spriteNum, uspriteptr_t const ts, vec2_t * return -1; } -static void VM_GetZRange(int const spriteNum, int32_t * const ceilhit, int32_t * const florhit, int const wallDist) +void VM_GetZRange(int const spriteNum, int32_t * const ceilhit, int32_t * const florhit, int const wallDist) { auto const pSprite = &sprite[spriteNum]; int const ocstat = pSprite->cstat; @@ -415,7 +415,7 @@ void A_GetZLimits(int const spriteNum) { actor[spriteNum].flags |= SFLAG_NOFLOORSHADOW; // No shadows on actors pSprite->xvel = -256; // SLIDE_ABOVE_ENEMY - A_SetSpriteNoZ(spriteNum, CLIPMASK0); + A_SetSprite(spriteNum, CLIPMASK0); } else if (pSprite->statnum == STAT_PROJECTILE && hitspr->picnum == APLAYER && pSprite->owner==florhit) { diff --git a/source/duke3d/src/gameexec.h b/source/duke3d/src/gameexec.h index c5f69f1f8..0a564cdce 100644 --- a/source/duke3d/src/gameexec.h +++ b/source/duke3d/src/gameexec.h @@ -137,6 +137,7 @@ int32_t VM_CheckSquished2(int32_t i, int32_t snum); #endif void VM_UpdateAnim(int const spriteNum, int32_t * const pData); +void VM_GetZRange(int const spriteNum, int32_t * const ceilhit, int32_t * const florhit, int const wallDist); #ifdef __cplusplus }