- HitBreakSprite

This commit is contained in:
Christoph Oelckers 2021-10-31 18:54:02 +01:00
parent aa13619087
commit a69a45523f
3 changed files with 18 additions and 25 deletions

View file

@ -1015,17 +1015,11 @@ bool NullActor(DSWActor* actor)
return false;
}
int HitBreakSprite(short BreakSprite, short type)
int HitBreakSprite(DSWActor* breakActor, short type)
{
auto breakActor = &swActors[BreakSprite];
SPRITEp bp = &breakActor->s();
USERp bu = breakActor->u();
//SPRITEp sp;
// ignore as a breakable if true
//if (sp->lotag == TAG_SPRITE_HIT_MATCH)
// return(false);
if (TEST_BOOL1(bp))
{
if (TEST_BOOL2(bp))

View file

@ -2591,7 +2591,7 @@ void DriveCrush(PLAYERp pp, int *x, int *y)
if (testpointinquad(sp->x, sp->y, x, y))
{
if (TEST(sp->extra, SPRX_BREAKABLE) && HitBreakSprite(actor->GetSpriteIndex(),0))
if (TEST(sp->extra, SPRX_BREAKABLE) && HitBreakSprite(actor, 0))
continue;
if (sp->statnum == STAT_MISSILE)

View file

@ -4360,7 +4360,7 @@ VehicleMoveHit(short SpriteNum)
if (TEST(hsp->extra, SPRX_BREAKABLE))
{
HitBreakSprite(hit_sprite, u->ID);
HitBreakSprite(&swActors[hit_sprite], u->ID);
return true;
}
@ -4531,7 +4531,7 @@ WeaponMoveHit(short SpriteNum)
if (TEST(hsp->extra, SPRX_BREAKABLE))
{
HitBreakSprite(hit_sprite, u->ID);
HitBreakSprite(&swActors[hit_sprite], u->ID);
return true;
}
@ -7794,11 +7794,11 @@ int DoExpDamageTest(DSWActor* actor)
// Breakable stuff
for (stat = 0; stat < max_stat; stat++)
{
StatIterator it(StatBreakList[stat]);
while ((i = it.NextIndex()) >= 0)
SWStatIterator it(StatBreakList[stat]);
while (auto itActor = it.Next())
{
sp = &sprite[i];
u = User[i].Data();
sp = &itActor->s();
u = itActor->u();
DISTANCE(sp->x, sp->y, wp->x, wp->y, dist, tx, ty, tmin);
if ((unsigned)dist > wu->Radius)
@ -7813,7 +7813,7 @@ int DoExpDamageTest(DSWActor* actor)
if (TEST(sp->extra, SPRX_BREAKABLE))
{
HitBreakSprite(i, wu->ID);
HitBreakSprite(itActor, wu->ID);
break_count++;
if (break_count > 6)
break;
@ -10814,8 +10814,7 @@ void SpawnFireballFlames(int16_t SpriteNum, int16_t enemy)
}
int
SpawnBreakFlames(DSWActor* actor)
int SpawnBreakFlames(DSWActor* actor)
{
SPRITEp sp = &actor->s();
USERp u = actor->u();
@ -13438,7 +13437,7 @@ InitSwordAttack(PLAYERp pp)
if (TEST(hsp->extra, SPRX_BREAKABLE))
{
HitBreakSprite(hitinfo.sprite,0);
HitBreakSprite(&swActors[hitinfo.sprite],0);
}
// hit a switch?
@ -13629,7 +13628,7 @@ InitFistAttack(PLAYERp pp)
if (TEST(hsp->extra, SPRX_BREAKABLE))
{
HitBreakSprite(hitinfo.sprite,0);
HitBreakSprite(&swActors[hitinfo.sprite],0);
}
// hit a switch?
@ -14523,7 +14522,7 @@ int ContinueHitscan(PLAYERp pp, short sectnum, int x, int y, int z, short ang, i
if (TEST(hsp->extra, SPRX_BREAKABLE))
{
HitBreakSprite(hitinfo.sprite,0);
HitBreakSprite(&swActors[hitinfo.sprite],0);
return 0;
}
@ -14697,7 +14696,7 @@ InitShotgun(PLAYERp pp)
if (TEST(hsp->extra, SPRX_BREAKABLE))
{
HitBreakSprite(hitinfo.sprite,0);
HitBreakSprite(&swActors[hitinfo.sprite],0);
continue;
}
@ -17549,7 +17548,7 @@ InitUzi(PLAYERp pp)
return 0;
}
if (TEST(hsp->extra, SPRX_BREAKABLE) && HitBreakSprite(hitinfo.sprite,0))
if (TEST(hsp->extra, SPRX_BREAKABLE) && HitBreakSprite(&swActors[hitinfo.sprite],0))
{
return 0;
}
@ -17728,7 +17727,7 @@ InitEMP(PLAYERp pp)
if (TEST(hsp->extra, SPRX_BREAKABLE))
{
HitBreakSprite(hitinfo.sprite,0);
HitBreakSprite(&swActors[hitinfo.sprite],0);
//return(0);
}
@ -18239,7 +18238,7 @@ InitSobjMachineGun(short SpriteNum, PLAYERp pp)
if (TEST(hsp->extra, SPRX_BREAKABLE))
{
HitBreakSprite(hitinfo.sprite,0);
HitBreakSprite(&swActors[hitinfo.sprite],0);
return 0;
}
@ -18674,7 +18673,7 @@ InitTurretMgun(SECTOR_OBJECTp sop)
if (TEST(hsp->extra, SPRX_BREAKABLE))
{
HitBreakSprite(hitinfo.sprite,0);
HitBreakSprite(&swActors[hitinfo.sprite],0);
continue;
}