mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 20:20:40 +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);
|
return mulscale16r(t, 0x10000-a4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
int actFloorBounceVector(int *x, int *y, int *z, int nSector, int a5)
|
int actFloorBounceVector(int *x, int *y, int *z, int nSector, int a5)
|
||||||
{
|
{
|
||||||
int t = 0x10000-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);
|
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 )
|
//---------------------------------------------------------------------------
|
||||||
{
|
//
|
||||||
uint8_t va0[(kMaxSectors+7)>>3];
|
//
|
||||||
int nOwner = sprite[nSprite].owner;
|
//
|
||||||
GetClosestSpriteSectors(nSector, x, y, nDist, va0);
|
//---------------------------------------------------------------------------
|
||||||
nDist <<= 4;
|
|
||||||
if (a10 & 2)
|
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)
|
||||||
{
|
{
|
||||||
int i;
|
uint8_t sectmap[(kMaxSectors + 7) >> 3];
|
||||||
StatIterator it(kStatDude);
|
auto pOwner = source->GetOwner();
|
||||||
while ((i = it.NextIndex()) >= 0)
|
GetClosestSpriteSectors(nSector, x, y, nDist, sectmap);
|
||||||
{
|
nDist <<= 4;
|
||||||
if (i != nSprite || (a10 & 1))
|
if (flags & 2)
|
||||||
{
|
{
|
||||||
spritetype *pSprite2 = &sprite[i];
|
BloodStatIterator it(kStatDude);
|
||||||
if (pSprite2->extra > 0 && pSprite2->extra < kMaxXSprites)
|
while (auto act2 = it.Next())
|
||||||
{
|
{
|
||||||
|
if (act2 != source || (flags & 1))
|
||||||
|
{
|
||||||
|
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 dx = abs(x - pSprite2->x);
|
||||||
int dy = abs(y - pSprite2->y);
|
int dy = abs(y - pSprite2->y);
|
||||||
int dz = abs(z - pSprite2->z) >> 4;
|
int dz = abs(z - pSprite2->z) >> 4;
|
||||||
int dist = ksqrt(dx * dx + dy * dy + dz * dz);
|
int dist = ksqrt(dx * dx + dy * dy + dz * dz);
|
||||||
if (dist > nDist)
|
if (dist > nDist) continue;
|
||||||
continue;
|
|
||||||
int vcx;
|
int totaldmg;
|
||||||
if (dist != 0)
|
if (dist != 0) totaldmg = baseDmg + ((nDist - dist) * distDmg) / nDist;
|
||||||
vcx = a7+((nDist-dist)*a8)/nDist;
|
else totaldmg = baseDmg + distDmg;
|
||||||
else
|
|
||||||
vcx = a7+a8;
|
actDamageSprite(source, act2, dmgType, totaldmg << 4);
|
||||||
actDamageSprite(nSprite, pSprite2, a9, vcx<<4);
|
if (burn) actBurnSprite(pOwner, act2, burn);
|
||||||
if (a11)
|
}
|
||||||
actBurnSprite(nOwner, &xsprite[pSprite2->extra], a11);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if (flags & 4)
|
||||||
}
|
{
|
||||||
if (a10 & 4)
|
BloodStatIterator it(kStatDude);
|
||||||
{
|
while (auto act2 = it.Next())
|
||||||
int i;
|
{
|
||||||
StatIterator it(kStatThing);
|
auto pSprite2 = &act2->s();
|
||||||
while ((i = it.NextIndex()) >= 0)
|
|
||||||
{
|
if (pSprite2->flags & 0x20) continue;
|
||||||
spritetype *pSprite2 = &sprite[i];
|
if (!TestBitString(sectmap, pSprite2->sectnum)) continue;
|
||||||
|
if (!CheckProximity(pSprite2, x, y, z, nSector, nDist)) continue;
|
||||||
|
|
||||||
|
XSPRITE* pXSprite2 = &act2->x();
|
||||||
|
if (pXSprite2->locked) 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 dx = abs(x - pSprite2->x);
|
||||||
int dy = abs(y - pSprite2->y);
|
int dy = abs(y - pSprite2->y);
|
||||||
int dist = ksqrt(dx * dx + dy * dy);
|
int dist = ksqrt(dx * dx + dy * dy);
|
||||||
if (dist > nDist)
|
if (dist > nDist) continue;
|
||||||
continue;
|
|
||||||
int vcx;
|
int totaldmg;
|
||||||
if (dist != 0)
|
if (dist != 0) totaldmg = baseDmg + ((nDist - dist) * distDmg) / nDist;
|
||||||
vcx = a7+((nDist-dist)*a8)/nDist;
|
else totaldmg = baseDmg + distDmg;
|
||||||
else
|
|
||||||
vcx = a7+a8;
|
actDamageSprite(source, act2, dmgType, totaldmg << 4);
|
||||||
actDamageSprite(nSprite, pSprite2, a9, vcx<<4);
|
if (burn) actBurnSprite(pOwner, act2, burn);
|
||||||
if (a11)
|
|
||||||
actBurnSprite(nOwner, pXSprite2, a11);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2728,7 +2729,7 @@ void sub_2AA94(DBloodActor* actor)
|
||||||
pSprite->cstat |= 4;
|
pSprite->cstat |= 4;
|
||||||
|
|
||||||
sfxPlay3DSound(pSprite, 303, 24+(pSprite->flags&3), 1);
|
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)
|
if (pXSprite->data4 > 1)
|
||||||
{
|
{
|
||||||
GibSprite(pSprite, GIBTYPE_5, NULL, NULL);
|
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)
|
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)
|
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);
|
evPost(nSpriteHit, 3, 0, kCallbackFXFlameLick);
|
||||||
|
|
||||||
actBurnSprite(pMissile->owner, pXSpriteHit, 480);
|
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
|
// by NoOne: allow additional bullet damage for Flare Gun
|
||||||
if (gGameOptions.weaponsV10x && !VanillaMode() && !DemoRecordStatus()) {
|
if (gGameOptions.weaponsV10x && !VanillaMode() && !DemoRecordStatus()) {
|
||||||
|
@ -5605,7 +5606,7 @@ void actProcessSprites(void)
|
||||||
case kThingPodGreenBall:
|
case kThingPodGreenBall:
|
||||||
if ((hit&0xc000) == 0x4000)
|
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);
|
evPost(pSprite->index, 3, 0, kCallbackFXPodBloodSplat);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -213,7 +213,7 @@ bool IsUnderwaterSector(int nSector);
|
||||||
void actInit(bool bSaveLoad);
|
void actInit(bool bSaveLoad);
|
||||||
int actWallBounceVector(int *x, int *y, int nWall, int a4);
|
int actWallBounceVector(int *x, int *y, int nWall, int a4);
|
||||||
int actFloorBounceVector(int *x, int *y, int *z, int nSector, int a5);
|
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);
|
void sub_2AA94(DBloodActor *actor);
|
||||||
spritetype *actSpawnFloor(spritetype *pSprite);
|
spritetype *actSpawnFloor(spritetype *pSprite);
|
||||||
spritetype *actDropAmmo(spritetype *pSprite, int nType);
|
spritetype *actDropAmmo(spritetype *pSprite, int nType);
|
||||||
|
|
|
@ -119,8 +119,7 @@ void podAttack(int, DBloodActor* actor)
|
||||||
|
|
||||||
void sub_70284(int, DBloodActor* actor)
|
void sub_70284(int, DBloodActor* actor)
|
||||||
{
|
{
|
||||||
XSPRITE* pXSprite = &actor->x();
|
auto pSprite = &actor->s();
|
||||||
spritetype* pSprite = &actor->s();
|
|
||||||
sfxPlay3DSound(pSprite, 2502, -1, 0);
|
sfxPlay3DSound(pSprite, 2502, -1, 0);
|
||||||
int nDist, nBurn;
|
int nDist, nBurn;
|
||||||
DAMAGE_TYPE dmgType;
|
DAMAGE_TYPE dmgType;
|
||||||
|
@ -137,7 +136,7 @@ void sub_70284(int, DBloodActor* actor)
|
||||||
nDist = 75;
|
nDist = 75;
|
||||||
break;
|
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)
|
static void aiPodSearch(DBloodActor* actor)
|
||||||
|
|
|
@ -124,5 +124,11 @@ inline int DeleteSprite(DBloodActor* nSprite)
|
||||||
return 0;
|
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
|
END_BLD_NS
|
||||||
|
|
Loading…
Reference in a new issue