- several uses of tu and bu - almost all very minor stuff.

This commit is contained in:
Christoph Oelckers 2021-12-25 19:38:41 +01:00
parent 1ec6743f20
commit b49e3201ae
8 changed files with 33 additions and 62 deletions

View file

@ -808,8 +808,6 @@ bool HitBreakWall(WALLp wp, int hit_x, int hit_y, int hit_z, int ang, int type)
int KillBreakSprite(DSWActor* breakActor)
{
USERp bu = breakActor->u();
// Does not actually kill the sprite so it will be valid for the rest
// of the loop traversal.
@ -818,7 +816,7 @@ int KillBreakSprite(DSWActor* breakActor)
SpriteQueueDelete(breakActor);
if (bu)
if (breakActor->hasU())
{
if (breakActor->spr.statnum == STAT_DEFAULT)
// special case allow kill of sprites on STAT_DEFAULT list
@ -993,8 +991,6 @@ bool NullActor(DSWActor* actor)
int HitBreakSprite(DSWActor* breakActor, int type)
{
USERp bu = breakActor->u();
if (TEST_BOOL1(breakActor))
{
if (TEST_BOOL2(breakActor))
@ -1003,7 +999,7 @@ int HitBreakSprite(DSWActor* breakActor, int type)
return UserBreakSprite(breakActor);
}
if (bu && !NullActor(breakActor))
if (breakActor->hasU() && !NullActor(breakActor))
{
// programmed animating type - without BOOL1 set
if (breakActor->spr.lotag)

View file

@ -543,7 +543,6 @@ int DoCheckSwarm(DSWActor* actor)
{
USER* u = actor->u();
SPRITEp tsp;
USERp tu;
int dist, pdist, a,b,c;
PLAYERp pp;
@ -566,15 +565,13 @@ int DoCheckSwarm(DSWActor* actor)
SWStatIterator it(STAT_ENEMY);
while (auto itActor = it.Next())
{
tu = itActor->u();
if (!tu) continue;
if (!itActor->hasU()) continue;
if (itActor->spr.hitag != TAG_SWARMSPOT || itActor->spr.lotag != 2) continue;
DISTANCE(actor->spr.pos.X, actor->spr.pos.Y, itActor->spr.pos.X, itActor->spr.pos.Y, dist, a, b, c);
if (dist < pdist && u->ID == tu->ID) // Only flock to your own kind
if (dist < pdist && u->ID == itActor->user.ID) // Only flock to your own kind
{
u->targetActor = itActor; // Set target to swarm center
}

View file

@ -796,8 +796,6 @@ int PachinkoCheckWin(DSWActor* actor)
if (RandomRange(1000) > 900 || Pachinko_Win_Cheat)
{
int i;
SPRITEp tsp;
USERp tu;
// Do a possible combo switch
if (ComboSwitchTest(TAG_COMBO_SWITCH_EVERYTHING, actor->spr.hitag))
@ -815,14 +813,12 @@ int PachinkoCheckWin(DSWActor* actor)
SWStatIterator it(STAT_ENEMY);
while (auto itActor = it.Next())
{
tu = itActor->u();
if (itActor->spr.lotag == TAG_PACHINKOLIGHT)
{
if (itActor->spr.hitag == SP_TAG5(actor))
{
itActor->spr.shade = -90; // Full brightness
tu->WaitTics = SEC(3); // Flash
itActor->user.WaitTics = SEC(3); // Flash
ChangeState(itActor,s_PachinkoLightOperate);
}
}

View file

@ -509,15 +509,12 @@ int DoSlidor(DSWActor* actor)
// if heading for the OFF (original) position and should NOT CRUSH
if (TEST_BOOL3(actor) && r->tgt == 0)
{
USERp bu;
bool found = false;
SWSectIterator it(actor->spr.sector());
while (auto itActor = it.Next())
{
bu = itActor->u();
if (bu && TEST(itActor->spr.cstat, CSTAT_SPRITE_BLOCK) && TEST(itActor->spr.extra, SPRX_PLAYER_OR_ENEMY))
if (itActor->hasU() && TEST(itActor->spr.cstat, CSTAT_SPRITE_BLOCK) && TEST(itActor->spr.extra, SPRX_PLAYER_OR_ENEMY))
{
// found something blocking so reverse to ON position
ReverseSlidor(actor);

View file

@ -349,15 +349,12 @@ int DoSpike(DSWActor* actor)
// if heading for the OFF (original) position and should NOT CRUSH
if (TEST_BOOL3(actor) && u->z_tgt == u->oz)
{
USERp bu;
bool found = false;
SWSectIterator it(actor->spr.sector());
while (auto itActor = it.Next())
{
bu = actor->u();
if (bu && TEST(actor->spr.cstat, CSTAT_SPRITE_BLOCK) && TEST(actor->spr.extra, SPRX_PLAYER_OR_ENEMY))
if (actor->hasU() && TEST(actor->spr.cstat, CSTAT_SPRITE_BLOCK) && TEST(actor->spr.extra, SPRX_PLAYER_OR_ENEMY))
{
ReverseSpike(actor);
found = true;

View file

@ -458,14 +458,11 @@ int DoVator(DSWActor* actor)
if (TEST_BOOL3(actor) && u->z_tgt == u->oz)
{
int i;
USERp bu;
bool found = false;
SWSectIterator it(actor->spr.sector());
while (auto itActor = it.Next())
{
bu = itActor->u();
if (itActor->spr.statnum == STAT_ENEMY)
{
if (labs(sectp->ceilingz - sectp->floorz) < ActorSizeZ(itActor))
@ -477,7 +474,7 @@ int DoVator(DSWActor* actor)
}
}
if (bu && TEST(itActor->spr.cstat, CSTAT_SPRITE_BLOCK) && TEST(itActor->spr.extra, SPRX_PLAYER_OR_ENEMY))
if (itActor->hasU() && TEST(itActor->spr.cstat, CSTAT_SPRITE_BLOCK) && TEST(itActor->spr.extra, SPRX_PLAYER_OR_ENEMY))
{
// found something blocking so reverse to ON position
ReverseVator(actor);

View file

@ -11197,9 +11197,6 @@ int DoBloodWorm(DSWActor* actor)
// stay alive for 10 seconds
if (++u->Counter3 > 3)
{
USERp tu;
int i;
InitBloodSpray(actor, false, 1);
InitBloodSpray(actor, false, 1);
InitBloodSpray(actor, false, 1);
@ -11209,9 +11206,8 @@ int DoBloodWorm(DSWActor* actor)
while (auto itActor = it.Next())
{
if (!itActor->hasU()) continue;
tu = itActor->u();
if (tu->ID == ZOMBIE_RUN_R0 && GetOwner(itActor) == GetOwner(actor))
if (itActor->user.ID == ZOMBIE_RUN_R0 && GetOwner(itActor) == GetOwner(actor))
{
InitBloodSpray(itActor, true, 105);
InitBloodSpray(itActor, true, 105);
@ -11704,10 +11700,10 @@ int DoSerpRing(DSWActor* actor)
if (u->Counter2 > 0)
{
auto tu = ou->targetActor->u();
if (!ou->targetActor->hasU() ||
!tu->PlayerP ||
!TEST(tu->PlayerP->Flags, PF_DEAD))
DSWActor* tActor = ou->targetActor;
if (!tActor->hasU() ||
!tActor->user.PlayerP ||
!TEST(tActor->user.PlayerP->Flags, PF_DEAD))
{
u->targetActor = ou->targetActor;
DISTANCE(actor->spr.pos.X, actor->spr.pos.Y, u->targetActor->spr.pos.X, u->targetActor->spr.pos.Y, dist, a,b,c);
@ -12202,7 +12198,7 @@ int InitEnemyMirv(DSWActor* actor)
int InitSwordAttack(PLAYERp pp)
{
DSWActor* plActor = pp->actor;
USERp u = plActor->u(), tu;
USERp u = plActor->u();
unsigned stat;
int dist;
short reach, face;
@ -12297,17 +12293,16 @@ int InitSwordAttack(PLAYERp pp)
if (hitActor->hasU()) // JBF: added null check
{
tu = hitActor->u();
switch (tu->ID)
switch (hitActor->user.ID)
{
case ZILLA_RUN_R0:
SpawnSwordSparks(pp, hit.hitSector, nullptr, hit.hitpos.X, hit.hitpos.Y, hit.hitpos.Z, daang);
PlaySound(DIGI_SWORDCLANK, &hit.hitpos, v3df_none);
break;
case TRASHCAN:
if (tu->WaitTics <= 0)
if (hitActor->user.WaitTics <= 0)
{
tu->WaitTics = SEC(2);
hitActor->user.WaitTics = SEC(2);
ChangeState(hitActor, s_TrashCanPain);
}
SpawnSwordSparks(pp, hit.hitSector, nullptr, hit.hitpos.X, hit.hitpos.Y, hit.hitpos.Z, daang);
@ -12376,7 +12371,7 @@ int InitSwordAttack(PLAYERp pp)
int InitFistAttack(PLAYERp pp)
{
DSWActor* plActor = pp->actor;
USERp u = plActor->u(),tu;
USERp u = plActor->u();
unsigned stat;
int dist;
short reach,face;
@ -12480,17 +12475,16 @@ int InitFistAttack(PLAYERp pp)
if (hitActor->hasU()) // JBF: added null check
{
tu = hitActor->u();
switch (tu->ID)
switch (hitActor->user.ID)
{
case ZILLA_RUN_R0:
SpawnSwordSparks(pp, hit.hitSector, nullptr, hit.hitpos.X, hit.hitpos.Y, hit.hitpos.Z, daang);
PlaySound(DIGI_ARMORHIT, &hit.hitpos, v3df_none);
break;
case TRASHCAN:
if (tu->WaitTics <= 0)
if (hitActor->user.WaitTics <= 0)
{
tu->WaitTics = SEC(2);
hitActor->user.WaitTics = SEC(2);
ChangeState(hitActor, s_TrashCanPain);
}
SpawnSwordSparks(pp, hit.hitSector, nullptr, hit.hitpos.X, hit.hitpos.Y, hit.hitpos.Z, daang);
@ -17802,26 +17796,23 @@ bool MissileHitDiveArea(DSWActor* actor)
DSWActor* SpawnBubble(DSWActor* actor)
{
USERp bu;
if (Prediction)
return nullptr;
auto actorNew = SpawnActor(STAT_MISSILE, BUBBLE, s_Bubble, actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, actor->spr.ang, 0);
bu = actorNew->u();
actorNew->spr.xrepeat = 8 + (RANDOM_P2(8 << 8) >> 8);
actorNew->spr.yrepeat = actorNew->spr.xrepeat;
bu->sx = actorNew->spr.xrepeat;
bu->sy = actorNew->spr.yrepeat;
bu->ceiling_dist = Z(1);
bu->floor_dist = Z(1);
actorNew->user.sx = actorNew->spr.xrepeat;
actorNew->user.sy = actorNew->spr.yrepeat;
actorNew->user.ceiling_dist = Z(1);
actorNew->user.floor_dist = Z(1);
actorNew->spr.shade = actor->spr.sector()->floorshade - 10;
bu->WaitTics = 120 * 120;
actorNew->user.WaitTics = 120 * 120;
actorNew->spr.zvel = 512;
actorNew->spr.clipdist = 12 >> 2;
SET(actorNew->spr.cstat, CSTAT_SPRITE_YCENTER);
SET(bu->Flags, SPR_UNDERWATER);
SET(actorNew->user.Flags, SPR_UNDERWATER);
actorNew->spr.shade = -60; // Make em brighter
return actorNew;

View file

@ -866,10 +866,10 @@ int DoZombieMove(DSWActor* actor)
return 0;
}
if (u->targetActor && u->targetActor->hasU())
DSWActor* tActor = u->targetActor;
if (tActor && tActor->hasU())
{
auto tu = u->targetActor->u();
if (TEST(tu->Flags, PF_DEAD))
if (TEST(tActor->user.Flags, PF_DEAD))
DoActorPickClosePlayer(actor);
}
@ -919,10 +919,10 @@ int NullZombie(DSWActor* actor)
return 0;
}
if (u->targetActor && u->targetActor->hasU())
DSWActor* tActor = u->targetActor;
if (tActor && tActor->hasU())
{
auto tu = u->targetActor->u();
if (TEST(tu->Flags, PF_DEAD))
if (TEST(tActor->user.Flags, PF_DEAD))
DoActorPickClosePlayer(actor);
}