mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-12 11:10:39 +00:00
- iterators in teslaHit.
This commit is contained in:
parent
ea7ff0b5eb
commit
741d24b9df
1 changed files with 20 additions and 20 deletions
|
@ -2644,13 +2644,14 @@ void WeaponProcess(PLAYER *pPlayer) {
|
||||||
|
|
||||||
void teslaHit(spritetype *pMissile, int a2)
|
void teslaHit(spritetype *pMissile, int a2)
|
||||||
{
|
{
|
||||||
|
auto missileactor = &bloodActors[pMissile->index];
|
||||||
uint8_t sectmap[(kMaxSectors+7)>>3];
|
uint8_t sectmap[(kMaxSectors+7)>>3];
|
||||||
int x = pMissile->x;
|
int x = pMissile->x;
|
||||||
int y = pMissile->y;
|
int y = pMissile->y;
|
||||||
int z = pMissile->z;
|
int z = pMissile->z;
|
||||||
int nDist = 300;
|
int nDist = 300;
|
||||||
int nSector = pMissile->sectnum;
|
int nSector = pMissile->sectnum;
|
||||||
int nOwner = pMissile->owner;
|
auto owner = missileactor->GetOwner();
|
||||||
const bool newSectCheckMethod = !cl_bloodvanillaexplosions && !VanillaMode(); // use new sector checking logic
|
const bool newSectCheckMethod = !cl_bloodvanillaexplosions && !VanillaMode(); // use new sector checking logic
|
||||||
GetClosestSpriteSectors(nSector, x, y, nDist, sectmap, nullptr, newSectCheckMethod);
|
GetClosestSpriteSectors(nSector, x, y, nDist, sectmap, nullptr, newSectCheckMethod);
|
||||||
bool v4 = true;
|
bool v4 = true;
|
||||||
|
@ -2658,41 +2659,40 @@ void teslaHit(spritetype *pMissile, int a2)
|
||||||
actHitcodeToData(a2, &gHitInfo, &actor);
|
actHitcodeToData(a2, &gHitInfo, &actor);
|
||||||
if (a2 == 3 && actor && actor->s().statnum == kStatDude)
|
if (a2 == 3 && actor && actor->s().statnum == kStatDude)
|
||||||
v4 = false;
|
v4 = false;
|
||||||
int nSprite;
|
BloodStatIterator it(kStatDude);
|
||||||
StatIterator it(kStatDude);
|
while (auto hitactor = it.Next())
|
||||||
while ((nSprite = it.NextIndex()) >= 0)
|
|
||||||
{
|
{
|
||||||
if (nSprite != nOwner || v4)
|
if (hitactor != owner || v4)
|
||||||
{
|
{
|
||||||
spritetype *pSprite = &sprite[nSprite];
|
spritetype *pHitSprite = &hitactor->s();
|
||||||
if (pSprite->flags&32)
|
if (pHitSprite->flags&32)
|
||||||
continue;
|
continue;
|
||||||
if (TestBitString(sectmap, pSprite->sectnum) && CheckProximity(pSprite, x, y, z, nSector, nDist))
|
if (TestBitString(sectmap, pHitSprite->sectnum) && CheckProximity(pHitSprite, x, y, z, nSector, nDist))
|
||||||
{
|
{
|
||||||
int dx = pMissile->x-pSprite->x;
|
int dx = pMissile->x-pHitSprite->x;
|
||||||
int dy = pMissile->y-pSprite->y;
|
int dy = pMissile->y-pHitSprite->y;
|
||||||
int nDamage = ClipLow((nDist-(ksqrt(dx*dx+dy*dy)>>4)+20)>>1, 10);
|
int nDamage = ClipLow((nDist-(ksqrt(dx*dx+dy*dy)>>4)+20)>>1, 10);
|
||||||
if (nSprite == nOwner)
|
if (hitactor == owner)
|
||||||
nDamage /= 2;
|
nDamage /= 2;
|
||||||
actDamageSprite_(nOwner, pSprite, kDamageTesla, nDamage<<4);
|
actDamageSprite(owner, hitactor, kDamageTesla, nDamage<<4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
it.Reset(kStatThing);
|
it.Reset(kStatThing);
|
||||||
while ((nSprite = it.NextIndex()) >= 0)
|
while (auto hitactor = it.Next())
|
||||||
{
|
{
|
||||||
spritetype *pSprite = &sprite[nSprite];
|
spritetype *pHitSprite = &hitactor->s();
|
||||||
if (pSprite->flags&32)
|
if (pHitSprite->flags&32)
|
||||||
continue;
|
continue;
|
||||||
if (TestBitString(sectmap, pSprite->sectnum) && CheckProximity(pSprite, x, y, z, nSector, nDist))
|
if (TestBitString(sectmap, pHitSprite->sectnum) && CheckProximity(pHitSprite, x, y, z, nSector, nDist))
|
||||||
{
|
{
|
||||||
XSPRITE *pXSprite = &xsprite[pSprite->extra];
|
XSPRITE *pXSprite = &hitactor->x();
|
||||||
if (!pXSprite->locked)
|
if (!pXSprite->locked)
|
||||||
{
|
{
|
||||||
int dx = pMissile->x-pSprite->x;
|
int dx = pMissile->x-pHitSprite->x;
|
||||||
int dy = pMissile->y-pSprite->y;
|
int dy = pMissile->y-pHitSprite->y;
|
||||||
int nDamage = ClipLow(nDist-(ksqrt(dx*dx+dy*dy)>>4)+20, 20);
|
int nDamage = ClipLow(nDist-(ksqrt(dx*dx+dy*dy)>>4)+20, 20);
|
||||||
actDamageSprite_(nOwner, pSprite, kDamageTesla, nDamage<<4);
|
actDamageSprite(owner, hitactor, kDamageTesla, nDamage << 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue