mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
Check for a valid return value from BuildBullet() in FuncTrap() before trying to use it. Will need to check all instances of BuildBullet() return value uses as original game doesn't seem to check if they're valid before using them to index arrays.
This commit is contained in:
parent
ff3dec2f08
commit
3977c3e3bd
1 changed files with 24 additions and 20 deletions
|
@ -1230,9 +1230,9 @@ int BuildTrap(int nSprite, int edx, int ebx, int ecx)
|
|||
}
|
||||
}
|
||||
|
||||
void FuncTrap(int a, int b, int c)
|
||||
void FuncTrap(int a, int b, int nRun)
|
||||
{
|
||||
short nTrap = RunData[c].nVal;
|
||||
short nTrap = RunData[nRun].nVal;
|
||||
short nSprite = sTrap[nTrap].nSprite;
|
||||
|
||||
int nMessage = a & 0x7F0000;
|
||||
|
@ -1293,30 +1293,34 @@ void FuncTrap(int a, int b, int c)
|
|||
}
|
||||
|
||||
int nBullet = BuildBullet(nSprite, nType, 0, 0, 0, sprite[nSprite].ang, 0, 1);
|
||||
short nBulletSprite = nBullet & 0xFFFF; // isolate the sprite index (disregard top 16 bits)
|
||||
|
||||
if (nType == 15)
|
||||
if (nBullet > -1)
|
||||
{
|
||||
sprite[nBulletSprite].ang = (sprite[nBulletSprite].ang - 512) & kAngleMask;
|
||||
D3PlayFX(StaticSound[kSound32], nSprite);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprite[nBulletSprite].clipdist = 50;
|
||||
short nBulletSprite = nBullet & 0xFFFF; // isolate the sprite index (disregard top 16 bits)
|
||||
assert(nBulletSprite >= 0);
|
||||
|
||||
short nWall = sTrap[nTrap].field_6;
|
||||
if (nWall > -1)
|
||||
if (nType == 15)
|
||||
{
|
||||
wall[nWall].picnum = sTrap[nTrap].field_A + 1;
|
||||
sprite[nBulletSprite].ang = (sprite[nBulletSprite].ang - 512) & kAngleMask;
|
||||
D3PlayFX(StaticSound[kSound32], nSprite);
|
||||
}
|
||||
|
||||
nWall = sTrap[nTrap].field_8;
|
||||
if (nWall > -1)
|
||||
else
|
||||
{
|
||||
wall[nWall].picnum = sTrap[nTrap].field_C + 1;
|
||||
}
|
||||
sprite[nBulletSprite].clipdist = 50;
|
||||
|
||||
D3PlayFX(StaticSound[kSound36], nSprite);
|
||||
short nWall = sTrap[nTrap].field_6;
|
||||
if (nWall > -1)
|
||||
{
|
||||
wall[nWall].picnum = sTrap[nTrap].field_A + 1;
|
||||
}
|
||||
|
||||
nWall = sTrap[nTrap].field_8;
|
||||
if (nWall > -1)
|
||||
{
|
||||
wall[nWall].picnum = sTrap[nTrap].field_C + 1;
|
||||
}
|
||||
|
||||
D3PlayFX(StaticSound[kSound36], nSprite);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue