mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-29 18:30:37 +00:00
- delete the old one.
This commit is contained in:
parent
b29351f3bc
commit
68de42075e
1 changed files with 3 additions and 190 deletions
|
@ -58,198 +58,11 @@ static FORCE_INLINE int32_t G_WallSpriteDist(uwalltype const * const wal, usprit
|
|||
return klabs(wal->x - spr->x) + klabs(wal->y - spr->y);
|
||||
}
|
||||
|
||||
void hitradius(short i, int r, int hp1, int hp2, int hp3, int hp4);
|
||||
|
||||
void A_RadiusDamage(int spriteNum, int blastRadius, int dmg1, int dmg2, int dmg3, int dmg4)
|
||||
{
|
||||
uspritetype const *const pSprite = (uspritetype *)&sprite[spriteNum];
|
||||
|
||||
int32_t sectorCount = 0;
|
||||
int32_t numSectors = 1;
|
||||
int16_t sectorList[64] = { pSprite->sectnum };
|
||||
|
||||
if ((pSprite->picnum == TILE_RPG && pSprite->xrepeat < 11)
|
||||
|| (RRRA && pSprite->picnum == TILE_RPG2 && pSprite->xrepeat < 11)
|
||||
|| (!RR && pSprite->picnum == TILE_SHRINKSPARK))
|
||||
goto SKIPWALLCHECK;
|
||||
|
||||
do
|
||||
{
|
||||
int const sectorNum = sectorList[sectorCount++];
|
||||
int const startWall = sector[sectorNum].wallptr;
|
||||
int const endWall = startWall + sector[sectorNum].wallnum;
|
||||
int const w2 = wall[startWall].point2;
|
||||
|
||||
// Check if "hit" 1st or 3rd wall-point. This mainly makes sense
|
||||
// for rectangular "ceiling light"-style sectors.
|
||||
if (G_WallSpriteDist((uwalltype *)&wall[startWall], pSprite) < blastRadius ||
|
||||
G_WallSpriteDist((uwalltype *)&wall[wall[w2].point2], pSprite) < blastRadius)
|
||||
{
|
||||
if (((sector[sectorNum].ceilingz-pSprite->z)>>8) < blastRadius)
|
||||
Sect_DamageCeiling(sectorNum);
|
||||
}
|
||||
|
||||
native_t w = startWall;
|
||||
|
||||
for (uwalltype const *pWall = (uwalltype *)&wall[startWall]; w < endWall; w++, pWall++)
|
||||
{
|
||||
if (G_WallSpriteDist(pWall, pSprite) >= blastRadius)
|
||||
continue;
|
||||
|
||||
int const nextSector = pWall->nextsector;
|
||||
|
||||
if (nextSector >= 0)
|
||||
{
|
||||
native_t otherSector = 0;
|
||||
|
||||
for (; otherSector < numSectors; ++otherSector)
|
||||
if (sectorList[otherSector] == nextSector)
|
||||
break;
|
||||
|
||||
if (otherSector == numSectors)
|
||||
{
|
||||
if (numSectors == ARRAY_SIZE(sectorList))
|
||||
goto SKIPWALLCHECK; // prevent oob access of 'sectorlist'
|
||||
|
||||
sectorList[numSectors++] = nextSector;
|
||||
}
|
||||
}
|
||||
|
||||
int16_t damageSector = (nextSector >= 0) ? wall[wall[w].nextwall].nextsector : sectorofwall(w);
|
||||
vec3_t const vect = { (((pWall->x + wall[pWall->point2].x) >> 1) + pSprite->x) >> 1,
|
||||
(((pWall->y + wall[pWall->point2].y) >> 1) + pSprite->y) >> 1, pSprite->z };
|
||||
|
||||
updatesector(vect.x, vect.y, &damageSector);
|
||||
|
||||
if (damageSector >= 0 && cansee(vect.x, vect.y, pSprite->z, damageSector, pSprite->x, pSprite->y, pSprite->z, pSprite->sectnum))
|
||||
A_DamageWall(spriteNum, w, &vect, pSprite->picnum);
|
||||
}
|
||||
}
|
||||
while (sectorCount < numSectors);
|
||||
|
||||
SKIPWALLCHECK:
|
||||
|
||||
// this is really weird
|
||||
int32_t const zRand = (RR ? -(24<<8) : -ZOFFSET2) + (krand2()&(ZOFFSET5-1));
|
||||
|
||||
static const uint8_t statnumList [] ={
|
||||
STAT_DEFAULT, STAT_ACTOR, STAT_STANDABLE,
|
||||
STAT_PLAYER, STAT_FALLER, STAT_ZOMBIEACTOR, STAT_MISC
|
||||
};
|
||||
|
||||
for (unsigned char stati : statnumList)
|
||||
{
|
||||
int32_t otherSprite = headspritestat[stati];
|
||||
|
||||
while (otherSprite >= 0)
|
||||
{
|
||||
int const nextOther = nextspritestat[otherSprite];
|
||||
spritetype *const pOther = &sprite[otherSprite];
|
||||
|
||||
// DEFAULT, ZOMBIEACTOR, MISC
|
||||
if (stati == STAT_DEFAULT || stati == STAT_ZOMBIEACTOR || stati == STAT_MISC || AFLAMABLE(pOther->picnum))
|
||||
{
|
||||
if ((!RR && pSprite->picnum != TILE_SHRINKSPARK) || (pOther->cstat&257))
|
||||
{
|
||||
if (dist(pSprite, pOther) < blastRadius)
|
||||
{
|
||||
if (A_CheckEnemySprite(pOther) && !cansee(pOther->x, pOther->y, pOther->z+zRand, pOther->sectnum, pSprite->x, pSprite->y, pSprite->z+zRand, pSprite->sectnum))
|
||||
goto next_sprite;
|
||||
A_DamageObject(otherSprite, spriteNum);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (pOther->extra >= 0 && (uspritetype *)pOther != pSprite && ((pOther->cstat & 257) ||
|
||||
(!RR && pOther->picnum == TILE_TRIPBOMB) || pOther->picnum == TILE_QUEBALL || (RR && pOther->picnum == TILE_RRTILE3440) || pOther->picnum == TILE_STRIPEBALL || pOther->picnum == TILE_DUKELYINGDEAD ||
|
||||
A_CheckEnemySprite(pOther)))
|
||||
{
|
||||
if ((!RR && pSprite->picnum == TILE_SHRINKSPARK && pOther->picnum != TILE_SHARK && (otherSprite == pSprite->owner || pOther->xrepeat < 24))
|
||||
|| (pSprite->picnum == TILE_MORTER && otherSprite == pSprite->owner)
|
||||
|| (RRRA && ((pSprite->picnum == TILE_CHEERBOMB && otherSprite == pSprite->owner) || (pOther->picnum == TILE_MINION && pOther->pal == 19))))
|
||||
goto next_sprite;
|
||||
int32_t const spriteDist = pOther->picnum == TILE_APLAYER
|
||||
? FindDistance3D(pSprite->x - pOther->x, pSprite->y - pOther->y, pSprite->z - (pOther->z - PHEIGHT))
|
||||
: dist(pSprite, pOther);
|
||||
|
||||
if (spriteDist >= blastRadius || !cansee(pOther->x, pOther->y, pOther->z - ZOFFSET3, pOther->sectnum, pSprite->x,
|
||||
pSprite->y, pSprite->z - ZOFFSET4, pSprite->sectnum))
|
||||
goto next_sprite;
|
||||
|
||||
actor_t & dmgActor = actor[otherSprite];
|
||||
|
||||
dmgActor.ang = getangle(pOther->x - pSprite->x, pOther->y - pSprite->y);
|
||||
|
||||
if (RRRA && pOther->extra > 0 && pSprite->picnum == TILE_RPG2)
|
||||
dmgActor.picnum = TILE_RPG;
|
||||
else if ((pOther->extra > 0 && pSprite->picnum == TILE_RPG)
|
||||
|| (!RR && pSprite->picnum == TILE_SHRINKSPARK))
|
||||
dmgActor.picnum = pSprite->picnum;
|
||||
else dmgActor.picnum = TILE_RADIUSEXPLOSION;
|
||||
|
||||
if (RR || pSprite->picnum != TILE_SHRINKSPARK)
|
||||
{
|
||||
if (spriteDist < blastRadius/3)
|
||||
{
|
||||
if (dmg4 == dmg3) dmg4++;
|
||||
dmgActor.extra = dmg3 + (krand2()%(dmg4-dmg3));
|
||||
}
|
||||
else if (spriteDist < (2*blastRadius)/3)
|
||||
{
|
||||
if (dmg3 == dmg2) dmg3++;
|
||||
dmgActor.extra = dmg2 + (krand2()%(dmg3-dmg2));
|
||||
}
|
||||
else if (spriteDist < blastRadius)
|
||||
{
|
||||
if (dmg2 == dmg1) dmg2++;
|
||||
dmgActor.extra = dmg1 + (krand2()%(dmg2-dmg1));
|
||||
}
|
||||
|
||||
if (!A_CheckSpriteFlags(otherSprite, SFLAG_NODAMAGEPUSH))
|
||||
{
|
||||
if (pOther->xvel < 0) pOther->xvel = 0;
|
||||
pOther->xvel += ((RR ? pOther->extra : pSprite->extra)<<2);
|
||||
}
|
||||
|
||||
switch (DYNAMICTILEMAP(pOther->picnum))
|
||||
{
|
||||
case PODFEM1__STATIC:
|
||||
case FEM1__STATIC:
|
||||
case FEM2__STATIC:
|
||||
case FEM3__STATIC:
|
||||
case FEM4__STATIC:
|
||||
case FEM5__STATIC:
|
||||
case FEM6__STATIC:
|
||||
case FEM7__STATIC:
|
||||
case FEM8__STATIC:
|
||||
case FEM9__STATIC:
|
||||
case FEM10__STATIC:
|
||||
case SPACEMARINE__STATIC: if (RR) break; fallthrough__;
|
||||
case STATUE__STATIC:
|
||||
case STATUEFLASH__STATIC:
|
||||
case QUEBALL__STATIC:
|
||||
case RRTILE3440__STATICRR:
|
||||
case STRIPEBALL__STATIC: A_DamageObject(otherSprite, spriteNum);
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
else if (pSprite->extra == 0) dmgActor.extra = 0;
|
||||
|
||||
if (pOther->picnum != TILE_RADIUSEXPLOSION &&
|
||||
pSprite->owner >= 0 && sprite[pSprite->owner].statnum < MAXSTATUS)
|
||||
{
|
||||
if (pOther->picnum == TILE_APLAYER)
|
||||
{
|
||||
DukePlayer_t *pPlayer = g_player[P_GetP((uspritetype *)pOther)].ps;
|
||||
|
||||
if (pPlayer->newowner >= 0)
|
||||
G_ClearCameraView(pPlayer);
|
||||
}
|
||||
|
||||
dmgActor.owner = pSprite->owner;
|
||||
}
|
||||
}
|
||||
next_sprite:
|
||||
otherSprite = nextOther;
|
||||
}
|
||||
}
|
||||
hitradius(spriteNum, blastRadius, dmg1, dmg2, dmg3, dmg4);
|
||||
}
|
||||
|
||||
// Check whether sprite <s> is on/in a non-SE7 water sector.
|
||||
|
|
Loading…
Reference in a new issue