- handle all hu = itActor.u();

This commit is contained in:
Christoph Oelckers 2021-12-25 20:26:31 +01:00
parent 86704b264e
commit 91a355a82e
3 changed files with 16 additions and 35 deletions

View file

@ -589,10 +589,8 @@ int DoPhosphorus(DSWActor* actor)
case kHitSprite:
{
short wall_ang;
USERp hu;
auto hitActor = u->coll.actor();
hu = hitActor->u();
if (TEST(hitActor->spr.cstat, CSTAT_SPRITE_ALIGNMENT_WALL))
{
@ -604,10 +602,10 @@ int DoPhosphorus(DSWActor* actor)
{
if (TEST(hitActor->spr.extra, SPRX_BURNABLE))
{
if (!hu)
hu = SpawnUser(hitActor, hitActor->spr.picnum, nullptr);
if (!hitActor->hasU())
SpawnUser(hitActor, hitActor->spr.picnum, nullptr);
SpawnFireballExp(actor);
if (hu)
if (hitActor->hasU())
SpawnFireballFlames(actor, hitActor);
DoFlamesDamageTest(actor);
}
@ -1455,7 +1453,6 @@ int PlayerInitFlashBomb(PLAYERp pp)
int dist, tx, ty, tmin;
short damage;
DSWActor* actor = pp->actor;
USERp hu;
PlaySound(DIGI_GASPOP, pp, v3df_dontpan | v3df_doppler);
@ -1467,8 +1464,6 @@ int PlayerInitFlashBomb(PLAYERp pp)
SWStatIterator it(StatDamageList[stat]);
while (auto itActor = it.Next())
{
hu = itActor->u();
if (itActor == pp->Actor())
break;
@ -1484,16 +1479,16 @@ int PlayerInitFlashBomb(PLAYERp pp)
damage = GetDamage(itActor, pp->Actor(), DMG_FLASHBOMB);
if (hu->sop_parent)
if (itActor->user.sop_parent)
{
break;
}
else if (hu->PlayerP)
else if (itActor->user.PlayerP)
{
// if(hu->PlayerP->NightVision)
// if(itActor->user.PlayerP->NightVision)
// {
// SetFadeAmt(hu->PlayerP, -200, 1); // Got him with night vision on!
// PlayerUpdateHealth(hu->PlayerP, -15); // Hurt eyes
// SetFadeAmt(itActor->user.PlayerP, -200, 1); // Got him with night vision on!
// PlayerUpdateHealth(itActor->user.PlayerP, -15); // Hurt eyes
// }else
if (damage < -70)
{
@ -1503,7 +1498,7 @@ int PlayerInitFlashBomb(PLAYERp pp)
PlayerSound(PlayerLowHealthPainVocs[choosesnd],v3df_dontpan|v3df_doppler|v3df_follow,pp);
}
SetFadeAmt(hu->PlayerP, damage, 1); // White flash
SetFadeAmt(itActor->user.PlayerP, damage, 1); // White flash
}
else
{
@ -1522,7 +1517,6 @@ int InitFlashBomb(DSWActor* actor)
unsigned int stat;
int dist, tx, ty, tmin;
short damage;
USERp hu;
PLAYERp pp = Player + screenpeek;
PlaySound(DIGI_GASPOP, actor, v3df_dontpan | v3df_doppler);
@ -1532,8 +1526,6 @@ int InitFlashBomb(DSWActor* actor)
SWStatIterator it(StatDamageList[stat]);
while (auto itActor = it.Next())
{
hu = itActor->u();
DISTANCE(itActor->spr.pos.X, itActor->spr.pos.Y, actor->spr.pos.X, actor->spr.pos.Y, dist, tx, ty, tmin);
if (dist > 16384) // Flash radius
continue;
@ -1546,11 +1538,11 @@ int InitFlashBomb(DSWActor* actor)
damage = GetDamage(itActor, actor, DMG_FLASHBOMB);
if (hu->sop_parent)
if (itActor->user.sop_parent)
{
break;
}
else if (hu->PlayerP)
else if (itActor->user.PlayerP)
{
if (damage < -70)
{
@ -1560,7 +1552,7 @@ int InitFlashBomb(DSWActor* actor)
PlayerSound(PlayerLowHealthPainVocs[choosesnd],v3df_dontpan|v3df_doppler|v3df_follow,pp);
}
SetFadeAmt(hu->PlayerP, damage, 1); // White flash
SetFadeAmt(itActor->user.PlayerP, damage, 1); // White flash
}
else
{

View file

@ -5861,8 +5861,6 @@ void DoPlayerDeathCheckKick(PLAYERp pp)
SWStatIterator it(StatDamageList[stat]);
while (auto itActor = it.Next())
{
auto hu = itActor->u();
if (itActor == pp->Actor())
break;
@ -5872,7 +5870,7 @@ void DoPlayerDeathCheckKick(PLAYERp pp)
DISTANCE(itActor->spr.pos.X, itActor->spr.pos.Y, actor->spr.pos.X, actor->spr.pos.Y, dist, a, b, c);
if (unsigned(dist) < hu->Radius + 100)
if (unsigned(dist) < itActor->user.Radius + 100)
{
pp->KillerActor = itActor;

View file

@ -10899,15 +10899,12 @@ int DoFireball(DSWActor* actor)
{
case kHitSprite:
{
USERp hu;
auto hitActor = u->coll.actor();
hu = hitActor->u();
if (TEST(hitActor->spr.extra, SPRX_BURNABLE))
{
if (!hitActor->hasU())
hu = SpawnUser(hitActor, hitActor->spr.picnum, nullptr);
SpawnUser(hitActor, hitActor->spr.picnum, nullptr);
SpawnFireballFlames(actor, hitActor);
hit_burn = true;
}
@ -14203,7 +14200,6 @@ int InitMicro(PLAYERp pp)
int InitRipperSlash(DSWActor* actor)
{
USER* u = actor->u();
USERp hu;
int i;
unsigned stat;
int dist, a, b, c;
@ -14215,12 +14211,10 @@ int InitRipperSlash(DSWActor* actor)
SWStatIterator it(StatDamageList[stat]);
while (auto itActor = it.Next())
{
hu = itActor->u();
if (itActor == actor)
break;
if ((unsigned)FindDistance3D(actor->spr.pos.X - itActor->spr.pos.X, actor->spr.pos.Y - itActor->spr.pos.Y, actor->spr.pos.Z - itActor->spr.pos.Z) > hu->Radius + u->Radius)
if ((unsigned)FindDistance3D(actor->spr.pos.X - itActor->spr.pos.X, actor->spr.pos.Y - itActor->spr.pos.Y, actor->spr.pos.Z - itActor->spr.pos.Z) > itActor->user.Radius + u->Radius)
continue;
DISTANCE(itActor->spr.pos.X, itActor->spr.pos.Y, actor->spr.pos.X, actor->spr.pos.Y, dist, a, b, c);
@ -15219,7 +15213,6 @@ int GenerateDrips(DSWActor* actor)
int InitEelFire(DSWActor* actor)
{
USER* u = actor->u();
USERp hu;
unsigned stat;
int dist, a, b, c;
@ -15228,15 +15221,13 @@ int InitEelFire(DSWActor* actor)
SWStatIterator it(StatDamageList[stat]);
while (auto itActor = it.Next())
{
hu = itActor->u();
if (itActor == actor)
continue;
if (itActor != u->targetActor)
continue;
if ((unsigned)FindDistance3D(actor->spr.pos.X - itActor->spr.pos.X, actor->spr.pos.Y - itActor->spr.pos.Y, actor->spr.pos.Z - itActor->spr.pos.Z) > hu->Radius + u->Radius)
if ((unsigned)FindDistance3D(actor->spr.pos.X - itActor->spr.pos.X, actor->spr.pos.Y - itActor->spr.pos.Y, actor->spr.pos.Z - itActor->spr.pos.Z) > itActor->user.Radius + u->Radius)
continue;
DISTANCE(itActor->spr.pos.X, itActor->spr.pos.Y, actor->spr.pos.X, actor->spr.pos.Y, dist, a, b, c);