mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-02-10 23:40:35 +00:00
PCExhumed: Avoid some original memory read bugs and correct some bullet code branching.
This commit is contained in:
parent
02d4712e57
commit
73a56f76af
3 changed files with 72 additions and 69 deletions
|
@ -280,15 +280,18 @@ void FuncAnubis(int a, int nDamage, int nRun)
|
||||||
{
|
{
|
||||||
AnubisList[nAnubis].g = 60;
|
AnubisList[nAnubis].g = 60;
|
||||||
|
|
||||||
if (cansee(sprite[nSprite].x, sprite[nSprite].y, sprite[nSprite].z - GetSpriteHeight(nSprite), sprite[nSprite].sectnum,
|
if (nTarget > -1) // NOTE: nTarget can be -1. this check wasn't in original code. TODO: demo compatiblity?
|
||||||
sprite[nTarget].x, sprite[nTarget].y, sprite[nTarget].z - GetSpriteHeight(nTarget), sprite[nTarget].sectnum))
|
{
|
||||||
{
|
if (cansee(sprite[nSprite].x, sprite[nSprite].y, sprite[nSprite].z - GetSpriteHeight(nSprite), sprite[nSprite].sectnum,
|
||||||
sprite[nSprite].xvel = 0;
|
sprite[nTarget].x, sprite[nTarget].y, sprite[nTarget].z - GetSpriteHeight(nTarget), sprite[nTarget].sectnum))
|
||||||
sprite[nSprite].yvel = 0;
|
{
|
||||||
sprite[nSprite].ang = GetMyAngle(sprite[nTarget].x - sprite[nSprite].x, sprite[nTarget].y - sprite[nSprite].y);
|
sprite[nSprite].xvel = 0;
|
||||||
|
sprite[nSprite].yvel = 0;
|
||||||
|
sprite[nSprite].ang = GetMyAngle(sprite[nTarget].x - sprite[nSprite].x, sprite[nTarget].y - sprite[nSprite].y);
|
||||||
|
|
||||||
AnubisList[nAnubis].nAction = 3;
|
AnubisList[nAnubis].nAction = 3;
|
||||||
AnubisList[nAnubis].nFrame = 0;
|
AnubisList[nAnubis].nFrame = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -92,23 +92,23 @@ static SavegameHelper sgh("bullet",
|
||||||
|
|
||||||
|
|
||||||
bulletInfo BulletInfo[] = {
|
bulletInfo BulletInfo[] = {
|
||||||
{ 25, 1, 20, -1, -1, 13, 0, 0, -1, 0 },
|
{ 25, 1, 20, -1, -1, 13, 0, 0, -1 },
|
||||||
{ 25, -1, 65000, -1, 31, 73, 0, 0, -1, 0 },
|
{ 25, -1, 65000, -1, 31, 73, 0, 0, -1 },
|
||||||
{ 15, -1, 60000, -1, 31, 73, 0, 0, -1, 0 },
|
{ 15, -1, 60000, -1, 31, 73, 0, 0, -1 },
|
||||||
{ 5, 15, 2000, -1, 14, 38, 4, 5, 3, 0 },
|
{ 5, 15, 2000, -1, 14, 38, 4, 5, 3 },
|
||||||
{ 250, 100, 2000, -1, 33, 34, 4, 20, -1, 0 },
|
{ 250, 100, 2000, -1, 33, 34, 4, 20, -1 },
|
||||||
{ 200, -1, 2000, -1, 20, 23, 4, 10, -1, 0 },
|
{ 200, -1, 2000, -1, 20, 23, 4, 10, -1 },
|
||||||
{ 200, -1, 60000, 68, 68, -1, -1, 0, -1, 0 },
|
{ 200, -1, 60000, 68, 68, -1, -1, 0, -1 },
|
||||||
{ 300, 1, 0, -1, -1, -1, 0, 50, -1, 0 },
|
{ 300, 1, 0, -1, -1, -1, 0, 50, -1 },
|
||||||
{ 18, -1, 2000, -1, 18, 29, 4, 0, -1, 0 },
|
{ 18, -1, 2000, -1, 18, 29, 4, 0, -1 },
|
||||||
{ 20, -1, 2000, 37, 11, 30, 4, 0, -1, 0 },
|
{ 20, -1, 2000, 37, 11, 30, 4, 0, -1 },
|
||||||
{ 25, -1, 3000, -1, 44, 36, 4, 15, 90, 0 },
|
{ 25, -1, 3000, -1, 44, 36, 4, 15, 90 },
|
||||||
{ 30, -1, 1000, -1, 52, 53, 4, 20, 48, 0 },
|
{ 30, -1, 1000, -1, 52, 53, 4, 20, 48 },
|
||||||
{ 20, -1, 3500, -1, 54, 55, 4, 30, -1, 0 },
|
{ 20, -1, 3500, -1, 54, 55, 4, 30, -1 },
|
||||||
{ 10, -1, 5000, -1, 57, 76, 4, 0, -1, 0 },
|
{ 10, -1, 5000, -1, 57, 76, 4, 0, -1 },
|
||||||
{ 40, -1, 1500, -1, 63, 38, 4, 10, 40, 0 },
|
{ 40, -1, 1500, -1, 63, 38, 4, 10, 40 },
|
||||||
{ 20, -1, 2000, -1, 60, 12, 0, 0, -1, 0 },
|
{ 20, -1, 2000, -1, 60, 12, 0, 0, -1 },
|
||||||
{ 5, -1, 60000, -1, 31, 76, 0, 0, -1, 0 }
|
{ 5, -1, 60000, -1, 31, 76, 0, 0, -1 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -354,7 +354,6 @@ int MoveBullet(short nBullet)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// loc_2A1DD
|
|
||||||
nVal = movesprite(nSprite, pBullet->x, pBullet->y, pBullet->z, pSprite->clipdist >> 1, pSprite->clipdist >> 1, CLIPMASK1);
|
nVal = movesprite(nSprite, pBullet->x, pBullet->y, pBullet->z, pSprite->clipdist >> 1, pSprite->clipdist >> 1, CLIPMASK1);
|
||||||
|
|
||||||
MOVEEND:
|
MOVEEND:
|
||||||
|
@ -452,8 +451,6 @@ HITSPRITE:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// assert(hitsect <= kMaxSectors);
|
|
||||||
|
|
||||||
BulletHitsSprite(pBullet, pSprite->owner, hitsprite, x2, y2, z2, hitsect);
|
BulletHitsSprite(pBullet, pSprite->owner, hitsprite, x2, y2, z2, hitsect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -477,57 +474,61 @@ HITWALL:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// loc_2A4F5:?
|
if (hitsect > -1) // NOTE: hitsect can be -1. this check wasn't in original code. TODO: demo compatiblity?
|
||||||
if (hitsprite < 0 && hitwall < 0)
|
|
||||||
{
|
{
|
||||||
if ((SectBelow[hitsect] >= 0 && (SectFlag[SectBelow[hitsect]] & kSectUnderwater)) || SectDepth[hitsect])
|
if (hitsprite < 0 && hitwall < 0)
|
||||||
{
|
{
|
||||||
pSprite->x = x2;
|
if ((SectBelow[hitsect] >= 0 && (SectFlag[SectBelow[hitsect]] & kSectUnderwater)) || SectDepth[hitsect])
|
||||||
pSprite->y = y2;
|
{
|
||||||
pSprite->z = z2;
|
pSprite->x = x2;
|
||||||
BuildSplash(nSprite, hitsect);
|
pSprite->y = y2;
|
||||||
|
pSprite->z = z2;
|
||||||
|
BuildSplash(nSprite, hitsect);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BuildAnim(-1, pBulletInfo->field_C, 0, x2, y2, z2, hitsect, 40, pBulletInfo->nFlags);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BuildAnim(-1, pBulletInfo->field_C, 0, x2, y2, z2, hitsect, 40, pBulletInfo->nFlags);
|
if (hitwall >= 0)
|
||||||
}
|
{
|
||||||
}
|
BackUpBullet(&x2, &y2, pSprite->ang);
|
||||||
else if (hitwall >= 0)
|
|
||||||
{
|
|
||||||
BackUpBullet(&x2, &y2, pSprite->ang);
|
|
||||||
|
|
||||||
if (nType != 3 || RandomSize(2) == 0)
|
if (nType != 3 || RandomSize(2) == 0)
|
||||||
{
|
{
|
||||||
int zOffset = RandomSize(8) << 3;
|
int zOffset = RandomSize(8) << 3;
|
||||||
|
|
||||||
if (!RandomBit()) {
|
if (!RandomBit()) {
|
||||||
zOffset = -zOffset;
|
zOffset = -zOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
// draws bullet puff on walls when they're shot
|
||||||
|
BuildAnim(-1, pBulletInfo->field_C, 0, x2, y2, z2 + zOffset, hitsect, 40, pBulletInfo->nFlags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pSprite->x = x2;
|
||||||
|
pSprite->y = y2;
|
||||||
|
pSprite->z = z2;
|
||||||
|
|
||||||
|
mychangespritesect(nSprite, hitsect);
|
||||||
}
|
}
|
||||||
|
|
||||||
// draws bullet puff on walls when they're shot
|
if (BulletInfo[nType].nRadius)
|
||||||
BuildAnim(-1, pBulletInfo->field_C, 0, x2, y2, z2 + zOffset, hitsect, 40, pBulletInfo->nFlags);
|
{
|
||||||
|
nRadialBullet = nType;
|
||||||
|
|
||||||
|
runlist_RadialDamageEnemy(nSprite, pBulletInfo->nDamage, pBulletInfo->nRadius);
|
||||||
|
|
||||||
|
nRadialBullet = -1;
|
||||||
|
|
||||||
|
AddFlash(pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 128);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
pSprite->x = x2;
|
|
||||||
pSprite->y = y2;
|
|
||||||
pSprite->z = z2;
|
|
||||||
|
|
||||||
mychangespritesect(nSprite, hitsect);
|
|
||||||
}
|
|
||||||
|
|
||||||
// loc_2A639:
|
|
||||||
if (BulletInfo[nType].nRadius)
|
|
||||||
{
|
|
||||||
nRadialBullet = nType;
|
|
||||||
|
|
||||||
runlist_RadialDamageEnemy(nSprite, pBulletInfo->nDamage, pBulletInfo->nRadius);
|
|
||||||
|
|
||||||
nRadialBullet = -1;
|
|
||||||
|
|
||||||
AddFlash(pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 128);
|
|
||||||
}
|
|
||||||
|
|
||||||
DestroyBullet(nBullet);
|
DestroyBullet(nBullet);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,6 @@ struct bulletInfo
|
||||||
short nFlags;
|
short nFlags;
|
||||||
short nRadius; // damage radius
|
short nRadius; // damage radius
|
||||||
short xyRepeat;
|
short xyRepeat;
|
||||||
char pad[12];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern bulletInfo BulletInfo[];
|
extern bulletInfo BulletInfo[];
|
||||||
|
|
Loading…
Reference in a new issue