Fix longstanding player hitscan and decal z coordinate offset bug

This one traces back to the original DOS code.

git-svn-id: https://svn.eduke32.com/eduke32@7614 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2019-04-19 22:31:43 +00:00 committed by Christoph Oelckers
parent 9534bb1578
commit aa4cfed3f1

View file

@ -527,7 +527,8 @@ notarget:
Proj_MaybeAddSpread(doSpread, zvel, shootAng, zRange, angRange); Proj_MaybeAddSpread(doSpread, zvel, shootAng, zRange, angRange);
} }
srcVect->z -= (2<<8); // ZOFFSET6 is added to this position at the same time as the player's pyoff in A_ShootWithZvel()
srcVect->z -= ZOFFSET6;
} }
// Hitscan weapon fired from actor (sprite s); // Hitscan weapon fired from actor (sprite s);
@ -719,19 +720,24 @@ static int P_PostFireHitscan(int playerNum, int const spriteNum, hitdata_t *cons
{ {
decalSprite = A_Spawn(spriteNum, decalTile); decalSprite = A_Spawn(spriteNum, decalTile);
auto const decal = &sprite[decalSprite];
A_SetHitData(decalSprite, hitData); A_SetHitData(decalSprite, hitData);
if (!A_CheckSpriteFlags(decalSprite, SFLAG_DECAL)) if (!A_CheckSpriteFlags(decalSprite, SFLAG_DECAL))
actor[decalSprite].flags |= SFLAG_DECAL; actor[decalSprite].flags |= SFLAG_DECAL;
sprite[decalSprite].ang int32_t diffZ;
= (getangle(hitWall->x - wall[hitWall->point2].x, hitWall->y - wall[hitWall->point2].y) + 1536) & 2047; spriteheightofs(decalSprite, &diffZ, 0);
decal->z += diffZ >> 1;
decal->ang = (getangle(hitWall->x - wall[hitWall->point2].x, hitWall->y - wall[hitWall->point2].y) + 1536) & 2047;
if (decalFlags & 1) if (decalFlags & 1)
Proj_DoRandDecalSize(decalSprite, projecTile); Proj_DoRandDecalSize(decalSprite, projecTile);
if (decalFlags & 2) if (decalFlags & 2)
sprite[decalSprite].cstat = 16 + (krand() & (8 + 4)); decal->cstat = 16 + (krand() & (8 + 4));
A_SetSprite(decalSprite, CLIPMASK0); A_SetSprite(decalSprite, CLIPMASK0);