Fix actor z position update bug

git-svn-id: https://svn.eduke32.com/eduke32@7667 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2019-05-19 03:55:40 +00:00 committed by Christoph Oelckers
parent 549ef41eb7
commit 509febe25a
3 changed files with 11 additions and 3 deletions

View file

@ -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)

View file

@ -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)
{

View file

@ -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
}