- Blood: ported BloodGDX's fix for the double shotgun graphics glitch.

Fixes #114
This commit is contained in:
Christoph Oelckers 2020-11-22 20:09:09 +01:00
parent 2db60ae847
commit 182b8023ca
2 changed files with 21 additions and 1 deletions

View file

@ -875,7 +875,7 @@ int GetClosestSpriteSectors(int nSector, int x, int y, int nDist, uint8_t *pSect
} }
i++; i++;
} }
walls[m] = -1; if (walls) walls[m] = -1;
return n; return n;
} }

View file

@ -261,6 +261,15 @@ void WeaponPrecache(HitList &hits)
} }
} }
bool isOriginalQAV()
{
static int cached = -1;
if (cached != -1) return cached;
int lump = fileSystem.FindResource(60, "QAV");
cached = lump >= 0 && fileSystem.GetFileContainer(lump) < fileSystem.GetMaxIwadNum();
return cached;
}
void WeaponDraw(PLAYER *pPlayer, int shade, double xpos, double ypos, int palnum, int smoothratio) void WeaponDraw(PLAYER *pPlayer, int shade, double xpos, double ypos, int palnum, int smoothratio)
{ {
assert(pPlayer != NULL); assert(pPlayer != NULL);
@ -268,6 +277,17 @@ void WeaponDraw(PLAYER *pPlayer, int shade, double xpos, double ypos, int palnum
return; return;
QAV * pQAV = weaponQAV[pPlayer->weaponQav]; QAV * pQAV = weaponQAV[pPlayer->weaponQav];
int duration; int duration;
if (pPlayer->weaponTimer == 0) // playing idle QAV?
{
// Double shotgun fix from BloodGDX.
if (/*!IsOriginalDemo() &&*/ (pPlayer->weaponState == -1 || (pPlayer->curWeapon == 3 && pPlayer->weaponState == 7)) && isOriginalQAV())
duration = pQAV->duration - 1;
else duration = (gFrameClock + mulscale16(4, smoothratio)) % pQAV->duration;
}
else duration = pQAV->duration - pPlayer->weaponTimer;
if (pPlayer->weaponTimer == 0) if (pPlayer->weaponTimer == 0)
duration = (gFrameClock + mulscale16(4, smoothratio)) % pQAV->duration; duration = (gFrameClock + mulscale16(4, smoothratio)) % pQAV->duration;
else else