mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
- complete cleanup of sub_2A620, now renamed to actRadiusDamage.
This commit is contained in:
parent
6110ec5cfd
commit
23df336ebe
4 changed files with 114 additions and 108 deletions
|
@ -2615,6 +2615,12 @@ int actWallBounceVector(int *x, int *y, int nWall, int a4)
|
|||
return mulscale16r(t, 0x10000-a4);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int actFloorBounceVector(int *x, int *y, int *z, int nSector, int a5)
|
||||
{
|
||||
int t = 0x10000-a5;
|
||||
|
@ -2641,78 +2647,73 @@ int actFloorBounceVector(int *x, int *y, int *z, int nSector, int a5)
|
|||
return mulscale16r(t8, t);
|
||||
}
|
||||
|
||||
void sub_2A620(int nSprite, int x, int y, int z, int nSector, int nDist, int a7, int a8, DAMAGE_TYPE a9, int a10, int a11, int , int )
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void actRadiusDamage(DBloodActor* source, int x, int y, int z, int nSector, int nDist, int baseDmg, int distDmg, DAMAGE_TYPE dmgType, int flags, int burn)
|
||||
{
|
||||
uint8_t va0[(kMaxSectors+7)>>3];
|
||||
int nOwner = sprite[nSprite].owner;
|
||||
GetClosestSpriteSectors(nSector, x, y, nDist, va0);
|
||||
uint8_t sectmap[(kMaxSectors + 7) >> 3];
|
||||
auto pOwner = source->GetOwner();
|
||||
GetClosestSpriteSectors(nSector, x, y, nDist, sectmap);
|
||||
nDist <<= 4;
|
||||
if (a10 & 2)
|
||||
if (flags & 2)
|
||||
{
|
||||
int i;
|
||||
StatIterator it(kStatDude);
|
||||
while ((i = it.NextIndex()) >= 0)
|
||||
BloodStatIterator it(kStatDude);
|
||||
while (auto act2 = it.Next())
|
||||
{
|
||||
if (i != nSprite || (a10 & 1))
|
||||
if (act2 != source || (flags & 1))
|
||||
{
|
||||
spritetype *pSprite2 = &sprite[i];
|
||||
if (pSprite2->extra > 0 && pSprite2->extra < kMaxXSprites)
|
||||
auto pSprite2 = &act2->s();
|
||||
if (act2->hasX())
|
||||
{
|
||||
if (pSprite2->flags & 0x20) continue;
|
||||
if (!TestBitString(sectmap, pSprite2->sectnum)) continue;
|
||||
if (!CheckProximity(pSprite2, x, y, z, nSector, nDist)) continue;
|
||||
|
||||
if (pSprite2->flags & 0x20)
|
||||
continue;
|
||||
if (!TestBitString(va0, pSprite2->sectnum))
|
||||
continue;
|
||||
if (!CheckProximity(pSprite2, x, y, z, nSector, nDist))
|
||||
continue;
|
||||
int dx = abs(x-pSprite2->x);
|
||||
int dy = abs(y-pSprite2->y);
|
||||
int dz = abs(z-pSprite2->z)>>4;
|
||||
int dist = ksqrt(dx*dx+dy*dy+dz*dz);
|
||||
if (dist > nDist)
|
||||
continue;
|
||||
int vcx;
|
||||
if (dist != 0)
|
||||
vcx = a7+((nDist-dist)*a8)/nDist;
|
||||
else
|
||||
vcx = a7+a8;
|
||||
actDamageSprite(nSprite, pSprite2, a9, vcx<<4);
|
||||
if (a11)
|
||||
actBurnSprite(nOwner, &xsprite[pSprite2->extra], a11);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (a10 & 4)
|
||||
{
|
||||
int i;
|
||||
StatIterator it(kStatThing);
|
||||
while ((i = it.NextIndex()) >= 0)
|
||||
{
|
||||
spritetype *pSprite2 = &sprite[i];
|
||||
int dx = abs(x - pSprite2->x);
|
||||
int dy = abs(y - pSprite2->y);
|
||||
int dz = abs(z - pSprite2->z) >> 4;
|
||||
int dist = ksqrt(dx * dx + dy * dy + dz * dz);
|
||||
if (dist > nDist) continue;
|
||||
|
||||
if (pSprite2->flags&0x20)
|
||||
continue;
|
||||
if (!TestBitString(va0, pSprite2->sectnum))
|
||||
continue;
|
||||
if (!CheckProximity(pSprite2, x, y, z, nSector, nDist))
|
||||
continue;
|
||||
XSPRITE *pXSprite2 = &xsprite[pSprite2->extra];
|
||||
if (pXSprite2->locked)
|
||||
continue;
|
||||
int dx = abs(x-pSprite2->x);
|
||||
int dy = abs(y-pSprite2->y);
|
||||
int dist = ksqrt(dx*dx+dy*dy);
|
||||
if (dist > nDist)
|
||||
continue;
|
||||
int vcx;
|
||||
if (dist != 0)
|
||||
vcx = a7+((nDist-dist)*a8)/nDist;
|
||||
else
|
||||
vcx = a7+a8;
|
||||
actDamageSprite(nSprite, pSprite2, a9, vcx<<4);
|
||||
if (a11)
|
||||
actBurnSprite(nOwner, pXSprite2, a11);
|
||||
int totaldmg;
|
||||
if (dist != 0) totaldmg = baseDmg + ((nDist - dist) * distDmg) / nDist;
|
||||
else totaldmg = baseDmg + distDmg;
|
||||
|
||||
actDamageSprite(source, act2, dmgType, totaldmg << 4);
|
||||
if (burn) actBurnSprite(pOwner, act2, burn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (flags & 4)
|
||||
{
|
||||
BloodStatIterator it(kStatDude);
|
||||
while (auto act2 = it.Next())
|
||||
{
|
||||
auto pSprite2 = &act2->s();
|
||||
|
||||
if (pSprite2->flags & 0x20) continue;
|
||||
if (!TestBitString(sectmap, pSprite2->sectnum)) continue;
|
||||
if (!CheckProximity(pSprite2, x, y, z, nSector, nDist)) continue;
|
||||
|
||||
XSPRITE* pXSprite2 = &act2->x();
|
||||
if (pXSprite2->locked) continue;
|
||||
|
||||
int dx = abs(x - pSprite2->x);
|
||||
int dy = abs(y - pSprite2->y);
|
||||
int dist = ksqrt(dx * dx + dy * dy);
|
||||
if (dist > nDist) continue;
|
||||
|
||||
int totaldmg;
|
||||
if (dist != 0) totaldmg = baseDmg + ((nDist - dist) * distDmg) / nDist;
|
||||
else totaldmg = baseDmg + distDmg;
|
||||
|
||||
actDamageSprite(source, act2, dmgType, totaldmg << 4);
|
||||
if (burn) actBurnSprite(pOwner, act2, burn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2728,7 +2729,7 @@ void sub_2AA94(DBloodActor* actor)
|
|||
pSprite->cstat |= 4;
|
||||
|
||||
sfxPlay3DSound(pSprite, 303, 24+(pSprite->flags&3), 1);
|
||||
sub_2A620(nOwner, pSprite->x, pSprite->y, pSprite->z, pSprite->sectnum, 128, 0, 60, DAMAGE_TYPE_3, 15, 120, 0, 0);
|
||||
actRadiusDamage(actor->GetOwner(), pSprite->x, pSprite->y, pSprite->z, pSprite->sectnum, 128, 0, 60, DAMAGE_TYPE_3, 15, 120);
|
||||
if (pXSprite->data4 > 1)
|
||||
{
|
||||
GibSprite(pSprite, GIBTYPE_5, NULL, NULL);
|
||||
|
@ -3599,7 +3600,7 @@ int actDamageSprite(int nSource, spritetype *pSprite, DAMAGE_TYPE damageType, in
|
|||
|
||||
int actDamageSprite(DBloodActor* pSource, DBloodActor* pTarget, DAMAGE_TYPE damageType, int damage)
|
||||
{
|
||||
return actDamageSprite(pSource->s().index, &pTarget->s(), damageType, damage);
|
||||
return actDamageSprite(pSource? pSource->s().index : -1, &pTarget->s(), damageType, damage);
|
||||
}
|
||||
|
||||
void actHitcodeToData(int a1, HITINFO *pHitInfo, int *a3, spritetype **a4, XSPRITE **a5, int *a6, walltype **a7, XWALL **a8, int *a9, sectortype **a10, XSECTOR **a11)
|
||||
|
@ -3790,7 +3791,7 @@ void actImpactMissile(spritetype *pMissile, int hitCode)
|
|||
evPost(nSpriteHit, 3, 0, kCallbackFXFlameLick);
|
||||
|
||||
actBurnSprite(pMissile->owner, pXSpriteHit, 480);
|
||||
sub_2A620(nOwner, pMissile->x, pMissile->y, pMissile->z, pMissile->sectnum, 16, 20, 10, DAMAGE_TYPE_2, 6, 480, 0, 0);
|
||||
actRadiusDamage(&bloodActors[nOwner], pMissile->x, pMissile->y, pMissile->z, pMissile->sectnum, 16, 20, 10, DAMAGE_TYPE_2, 6, 480);
|
||||
|
||||
// by NoOne: allow additional bullet damage for Flare Gun
|
||||
if (gGameOptions.weaponsV10x && !VanillaMode() && !DemoRecordStatus()) {
|
||||
|
@ -5605,7 +5606,7 @@ void actProcessSprites(void)
|
|||
case kThingPodGreenBall:
|
||||
if ((hit&0xc000) == 0x4000)
|
||||
{
|
||||
sub_2A620(pSprite->owner, pSprite->x, pSprite->y, pSprite->z, pSprite->sectnum, 200, 1, 20, DAMAGE_TYPE_3, 6, 0, 0, 0);
|
||||
actRadiusDamage(&bloodActors[pSprite->owner], pSprite->x, pSprite->y, pSprite->z, pSprite->sectnum, 200, 1, 20, DAMAGE_TYPE_3, 6, 0);
|
||||
evPost(pSprite->index, 3, 0, kCallbackFXPodBloodSplat);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -213,7 +213,7 @@ bool IsUnderwaterSector(int nSector);
|
|||
void actInit(bool bSaveLoad);
|
||||
int actWallBounceVector(int *x, int *y, int nWall, int a4);
|
||||
int actFloorBounceVector(int *x, int *y, int *z, int nSector, int a5);
|
||||
void sub_2A620(int nSprite, int x, int y, int z, int nSector, int nDist, int a7, int a8, DAMAGE_TYPE a9, int a10, int a11, int a12, int a13);
|
||||
void actRadiusDamage(DBloodActor* source, int x, int y, int z, int nSector, int nDist, int a7, int a8, DAMAGE_TYPE a9, int a10, int a11);
|
||||
void sub_2AA94(DBloodActor *actor);
|
||||
spritetype *actSpawnFloor(spritetype *pSprite);
|
||||
spritetype *actDropAmmo(spritetype *pSprite, int nType);
|
||||
|
|
|
@ -119,8 +119,7 @@ void podAttack(int, DBloodActor* actor)
|
|||
|
||||
void sub_70284(int, DBloodActor* actor)
|
||||
{
|
||||
XSPRITE* pXSprite = &actor->x();
|
||||
spritetype* pSprite = &actor->s();
|
||||
auto pSprite = &actor->s();
|
||||
sfxPlay3DSound(pSprite, 2502, -1, 0);
|
||||
int nDist, nBurn;
|
||||
DAMAGE_TYPE dmgType;
|
||||
|
@ -137,7 +136,7 @@ void sub_70284(int, DBloodActor* actor)
|
|||
nDist = 75;
|
||||
break;
|
||||
}
|
||||
sub_2A620(pSprite->index, pSprite->x, pSprite->y, pSprite->z, pSprite->sectnum, nDist, 1, 5*(1+gGameOptions.nDifficulty), dmgType, 2, nBurn, 0, 0);
|
||||
actRadiusDamage(actor, pSprite->x, pSprite->y, pSprite->z, pSprite->sectnum, nDist, 1, 5*(1+gGameOptions.nDifficulty), dmgType, 2, nBurn);
|
||||
}
|
||||
|
||||
static void aiPodSearch(DBloodActor* actor)
|
||||
|
|
|
@ -124,5 +124,11 @@ inline int DeleteSprite(DBloodActor* nSprite)
|
|||
return 0;
|
||||
}
|
||||
|
||||
inline void actBurnSprite(DBloodActor* pSource, DBloodActor* pTarget, int nTime)
|
||||
{
|
||||
auto pXSprite = &pTarget->x();
|
||||
pXSprite->burnTime = ClipHigh(pXSprite->burnTime + nTime, sprite[pXSprite->reference].statnum == kStatDude ? 2400 : 1200);
|
||||
pXSprite->burnSource = pSource->s().index;
|
||||
}
|
||||
|
||||
END_BLD_NS
|
||||
|
|
Loading…
Reference in a new issue