mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-31 04:20:42 +00:00
- several uses of tu and bu - almost all very minor stuff.
This commit is contained in:
parent
1ec6743f20
commit
b49e3201ae
8 changed files with 33 additions and 62 deletions
|
@ -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)
|
int KillBreakSprite(DSWActor* breakActor)
|
||||||
{
|
{
|
||||||
USERp bu = breakActor->u();
|
|
||||||
|
|
||||||
// Does not actually kill the sprite so it will be valid for the rest
|
// Does not actually kill the sprite so it will be valid for the rest
|
||||||
// of the loop traversal.
|
// of the loop traversal.
|
||||||
|
|
||||||
|
@ -818,7 +816,7 @@ int KillBreakSprite(DSWActor* breakActor)
|
||||||
|
|
||||||
SpriteQueueDelete(breakActor);
|
SpriteQueueDelete(breakActor);
|
||||||
|
|
||||||
if (bu)
|
if (breakActor->hasU())
|
||||||
{
|
{
|
||||||
if (breakActor->spr.statnum == STAT_DEFAULT)
|
if (breakActor->spr.statnum == STAT_DEFAULT)
|
||||||
// special case allow kill of sprites on STAT_DEFAULT list
|
// special case allow kill of sprites on STAT_DEFAULT list
|
||||||
|
@ -993,8 +991,6 @@ bool NullActor(DSWActor* actor)
|
||||||
|
|
||||||
int HitBreakSprite(DSWActor* breakActor, int type)
|
int HitBreakSprite(DSWActor* breakActor, int type)
|
||||||
{
|
{
|
||||||
USERp bu = breakActor->u();
|
|
||||||
|
|
||||||
if (TEST_BOOL1(breakActor))
|
if (TEST_BOOL1(breakActor))
|
||||||
{
|
{
|
||||||
if (TEST_BOOL2(breakActor))
|
if (TEST_BOOL2(breakActor))
|
||||||
|
@ -1003,7 +999,7 @@ int HitBreakSprite(DSWActor* breakActor, int type)
|
||||||
return UserBreakSprite(breakActor);
|
return UserBreakSprite(breakActor);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bu && !NullActor(breakActor))
|
if (breakActor->hasU() && !NullActor(breakActor))
|
||||||
{
|
{
|
||||||
// programmed animating type - without BOOL1 set
|
// programmed animating type - without BOOL1 set
|
||||||
if (breakActor->spr.lotag)
|
if (breakActor->spr.lotag)
|
||||||
|
|
|
@ -543,7 +543,6 @@ int DoCheckSwarm(DSWActor* actor)
|
||||||
{
|
{
|
||||||
USER* u = actor->u();
|
USER* u = actor->u();
|
||||||
SPRITEp tsp;
|
SPRITEp tsp;
|
||||||
USERp tu;
|
|
||||||
int dist, pdist, a,b,c;
|
int dist, pdist, a,b,c;
|
||||||
PLAYERp pp;
|
PLAYERp pp;
|
||||||
|
|
||||||
|
@ -566,15 +565,13 @@ int DoCheckSwarm(DSWActor* actor)
|
||||||
SWStatIterator it(STAT_ENEMY);
|
SWStatIterator it(STAT_ENEMY);
|
||||||
while (auto itActor = it.Next())
|
while (auto itActor = it.Next())
|
||||||
{
|
{
|
||||||
tu = itActor->u();
|
if (!itActor->hasU()) continue;
|
||||||
|
|
||||||
if (!tu) continue;
|
|
||||||
|
|
||||||
if (itActor->spr.hitag != TAG_SWARMSPOT || itActor->spr.lotag != 2) 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);
|
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
|
u->targetActor = itActor; // Set target to swarm center
|
||||||
}
|
}
|
||||||
|
|
|
@ -796,8 +796,6 @@ int PachinkoCheckWin(DSWActor* actor)
|
||||||
if (RandomRange(1000) > 900 || Pachinko_Win_Cheat)
|
if (RandomRange(1000) > 900 || Pachinko_Win_Cheat)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
SPRITEp tsp;
|
|
||||||
USERp tu;
|
|
||||||
|
|
||||||
// Do a possible combo switch
|
// Do a possible combo switch
|
||||||
if (ComboSwitchTest(TAG_COMBO_SWITCH_EVERYTHING, actor->spr.hitag))
|
if (ComboSwitchTest(TAG_COMBO_SWITCH_EVERYTHING, actor->spr.hitag))
|
||||||
|
@ -815,14 +813,12 @@ int PachinkoCheckWin(DSWActor* actor)
|
||||||
SWStatIterator it(STAT_ENEMY);
|
SWStatIterator it(STAT_ENEMY);
|
||||||
while (auto itActor = it.Next())
|
while (auto itActor = it.Next())
|
||||||
{
|
{
|
||||||
tu = itActor->u();
|
|
||||||
|
|
||||||
if (itActor->spr.lotag == TAG_PACHINKOLIGHT)
|
if (itActor->spr.lotag == TAG_PACHINKOLIGHT)
|
||||||
{
|
{
|
||||||
if (itActor->spr.hitag == SP_TAG5(actor))
|
if (itActor->spr.hitag == SP_TAG5(actor))
|
||||||
{
|
{
|
||||||
itActor->spr.shade = -90; // Full brightness
|
itActor->spr.shade = -90; // Full brightness
|
||||||
tu->WaitTics = SEC(3); // Flash
|
itActor->user.WaitTics = SEC(3); // Flash
|
||||||
ChangeState(itActor,s_PachinkoLightOperate);
|
ChangeState(itActor,s_PachinkoLightOperate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -509,15 +509,12 @@ int DoSlidor(DSWActor* actor)
|
||||||
// if heading for the OFF (original) position and should NOT CRUSH
|
// if heading for the OFF (original) position and should NOT CRUSH
|
||||||
if (TEST_BOOL3(actor) && r->tgt == 0)
|
if (TEST_BOOL3(actor) && r->tgt == 0)
|
||||||
{
|
{
|
||||||
USERp bu;
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
SWSectIterator it(actor->spr.sector());
|
SWSectIterator it(actor->spr.sector());
|
||||||
while (auto itActor = it.Next())
|
while (auto itActor = it.Next())
|
||||||
{
|
{
|
||||||
bu = itActor->u();
|
if (itActor->hasU() && TEST(itActor->spr.cstat, CSTAT_SPRITE_BLOCK) && TEST(itActor->spr.extra, SPRX_PLAYER_OR_ENEMY))
|
||||||
|
|
||||||
if (bu && TEST(itActor->spr.cstat, CSTAT_SPRITE_BLOCK) && TEST(itActor->spr.extra, SPRX_PLAYER_OR_ENEMY))
|
|
||||||
{
|
{
|
||||||
// found something blocking so reverse to ON position
|
// found something blocking so reverse to ON position
|
||||||
ReverseSlidor(actor);
|
ReverseSlidor(actor);
|
||||||
|
|
|
@ -349,15 +349,12 @@ int DoSpike(DSWActor* actor)
|
||||||
// if heading for the OFF (original) position and should NOT CRUSH
|
// if heading for the OFF (original) position and should NOT CRUSH
|
||||||
if (TEST_BOOL3(actor) && u->z_tgt == u->oz)
|
if (TEST_BOOL3(actor) && u->z_tgt == u->oz)
|
||||||
{
|
{
|
||||||
USERp bu;
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
SWSectIterator it(actor->spr.sector());
|
SWSectIterator it(actor->spr.sector());
|
||||||
while (auto itActor = it.Next())
|
while (auto itActor = it.Next())
|
||||||
{
|
{
|
||||||
bu = actor->u();
|
if (actor->hasU() && TEST(actor->spr.cstat, CSTAT_SPRITE_BLOCK) && TEST(actor->spr.extra, SPRX_PLAYER_OR_ENEMY))
|
||||||
|
|
||||||
if (bu && TEST(actor->spr.cstat, CSTAT_SPRITE_BLOCK) && TEST(actor->spr.extra, SPRX_PLAYER_OR_ENEMY))
|
|
||||||
{
|
{
|
||||||
ReverseSpike(actor);
|
ReverseSpike(actor);
|
||||||
found = true;
|
found = true;
|
||||||
|
|
|
@ -458,14 +458,11 @@ int DoVator(DSWActor* actor)
|
||||||
if (TEST_BOOL3(actor) && u->z_tgt == u->oz)
|
if (TEST_BOOL3(actor) && u->z_tgt == u->oz)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
USERp bu;
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
SWSectIterator it(actor->spr.sector());
|
SWSectIterator it(actor->spr.sector());
|
||||||
while (auto itActor = it.Next())
|
while (auto itActor = it.Next())
|
||||||
{
|
{
|
||||||
bu = itActor->u();
|
|
||||||
|
|
||||||
if (itActor->spr.statnum == STAT_ENEMY)
|
if (itActor->spr.statnum == STAT_ENEMY)
|
||||||
{
|
{
|
||||||
if (labs(sectp->ceilingz - sectp->floorz) < ActorSizeZ(itActor))
|
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
|
// found something blocking so reverse to ON position
|
||||||
ReverseVator(actor);
|
ReverseVator(actor);
|
||||||
|
|
|
@ -11197,9 +11197,6 @@ int DoBloodWorm(DSWActor* actor)
|
||||||
// stay alive for 10 seconds
|
// stay alive for 10 seconds
|
||||||
if (++u->Counter3 > 3)
|
if (++u->Counter3 > 3)
|
||||||
{
|
{
|
||||||
USERp tu;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
InitBloodSpray(actor, false, 1);
|
InitBloodSpray(actor, false, 1);
|
||||||
InitBloodSpray(actor, false, 1);
|
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())
|
while (auto itActor = it.Next())
|
||||||
{
|
{
|
||||||
if (!itActor->hasU()) continue;
|
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);
|
||||||
InitBloodSpray(itActor, true, 105);
|
InitBloodSpray(itActor, true, 105);
|
||||||
|
@ -11704,10 +11700,10 @@ int DoSerpRing(DSWActor* actor)
|
||||||
|
|
||||||
if (u->Counter2 > 0)
|
if (u->Counter2 > 0)
|
||||||
{
|
{
|
||||||
auto tu = ou->targetActor->u();
|
DSWActor* tActor = ou->targetActor;
|
||||||
if (!ou->targetActor->hasU() ||
|
if (!tActor->hasU() ||
|
||||||
!tu->PlayerP ||
|
!tActor->user.PlayerP ||
|
||||||
!TEST(tu->PlayerP->Flags, PF_DEAD))
|
!TEST(tActor->user.PlayerP->Flags, PF_DEAD))
|
||||||
{
|
{
|
||||||
u->targetActor = ou->targetActor;
|
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);
|
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)
|
int InitSwordAttack(PLAYERp pp)
|
||||||
{
|
{
|
||||||
DSWActor* plActor = pp->actor;
|
DSWActor* plActor = pp->actor;
|
||||||
USERp u = plActor->u(), tu;
|
USERp u = plActor->u();
|
||||||
unsigned stat;
|
unsigned stat;
|
||||||
int dist;
|
int dist;
|
||||||
short reach, face;
|
short reach, face;
|
||||||
|
@ -12297,17 +12293,16 @@ int InitSwordAttack(PLAYERp pp)
|
||||||
|
|
||||||
if (hitActor->hasU()) // JBF: added null check
|
if (hitActor->hasU()) // JBF: added null check
|
||||||
{
|
{
|
||||||
tu = hitActor->u();
|
switch (hitActor->user.ID)
|
||||||
switch (tu->ID)
|
|
||||||
{
|
{
|
||||||
case ZILLA_RUN_R0:
|
case ZILLA_RUN_R0:
|
||||||
SpawnSwordSparks(pp, hit.hitSector, nullptr, hit.hitpos.X, hit.hitpos.Y, hit.hitpos.Z, daang);
|
SpawnSwordSparks(pp, hit.hitSector, nullptr, hit.hitpos.X, hit.hitpos.Y, hit.hitpos.Z, daang);
|
||||||
PlaySound(DIGI_SWORDCLANK, &hit.hitpos, v3df_none);
|
PlaySound(DIGI_SWORDCLANK, &hit.hitpos, v3df_none);
|
||||||
break;
|
break;
|
||||||
case TRASHCAN:
|
case TRASHCAN:
|
||||||
if (tu->WaitTics <= 0)
|
if (hitActor->user.WaitTics <= 0)
|
||||||
{
|
{
|
||||||
tu->WaitTics = SEC(2);
|
hitActor->user.WaitTics = SEC(2);
|
||||||
ChangeState(hitActor, s_TrashCanPain);
|
ChangeState(hitActor, s_TrashCanPain);
|
||||||
}
|
}
|
||||||
SpawnSwordSparks(pp, hit.hitSector, nullptr, hit.hitpos.X, hit.hitpos.Y, hit.hitpos.Z, daang);
|
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)
|
int InitFistAttack(PLAYERp pp)
|
||||||
{
|
{
|
||||||
DSWActor* plActor = pp->actor;
|
DSWActor* plActor = pp->actor;
|
||||||
USERp u = plActor->u(),tu;
|
USERp u = plActor->u();
|
||||||
unsigned stat;
|
unsigned stat;
|
||||||
int dist;
|
int dist;
|
||||||
short reach,face;
|
short reach,face;
|
||||||
|
@ -12480,17 +12475,16 @@ int InitFistAttack(PLAYERp pp)
|
||||||
|
|
||||||
if (hitActor->hasU()) // JBF: added null check
|
if (hitActor->hasU()) // JBF: added null check
|
||||||
{
|
{
|
||||||
tu = hitActor->u();
|
switch (hitActor->user.ID)
|
||||||
switch (tu->ID)
|
|
||||||
{
|
{
|
||||||
case ZILLA_RUN_R0:
|
case ZILLA_RUN_R0:
|
||||||
SpawnSwordSparks(pp, hit.hitSector, nullptr, hit.hitpos.X, hit.hitpos.Y, hit.hitpos.Z, daang);
|
SpawnSwordSparks(pp, hit.hitSector, nullptr, hit.hitpos.X, hit.hitpos.Y, hit.hitpos.Z, daang);
|
||||||
PlaySound(DIGI_ARMORHIT, &hit.hitpos, v3df_none);
|
PlaySound(DIGI_ARMORHIT, &hit.hitpos, v3df_none);
|
||||||
break;
|
break;
|
||||||
case TRASHCAN:
|
case TRASHCAN:
|
||||||
if (tu->WaitTics <= 0)
|
if (hitActor->user.WaitTics <= 0)
|
||||||
{
|
{
|
||||||
tu->WaitTics = SEC(2);
|
hitActor->user.WaitTics = SEC(2);
|
||||||
ChangeState(hitActor, s_TrashCanPain);
|
ChangeState(hitActor, s_TrashCanPain);
|
||||||
}
|
}
|
||||||
SpawnSwordSparks(pp, hit.hitSector, nullptr, hit.hitpos.X, hit.hitpos.Y, hit.hitpos.Z, daang);
|
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)
|
DSWActor* SpawnBubble(DSWActor* actor)
|
||||||
{
|
{
|
||||||
USERp bu;
|
|
||||||
|
|
||||||
if (Prediction)
|
if (Prediction)
|
||||||
return nullptr;
|
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);
|
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.xrepeat = 8 + (RANDOM_P2(8 << 8) >> 8);
|
||||||
actorNew->spr.yrepeat = actorNew->spr.xrepeat;
|
actorNew->spr.yrepeat = actorNew->spr.xrepeat;
|
||||||
bu->sx = actorNew->spr.xrepeat;
|
actorNew->user.sx = actorNew->spr.xrepeat;
|
||||||
bu->sy = actorNew->spr.yrepeat;
|
actorNew->user.sy = actorNew->spr.yrepeat;
|
||||||
bu->ceiling_dist = Z(1);
|
actorNew->user.ceiling_dist = Z(1);
|
||||||
bu->floor_dist = Z(1);
|
actorNew->user.floor_dist = Z(1);
|
||||||
actorNew->spr.shade = actor->spr.sector()->floorshade - 10;
|
actorNew->spr.shade = actor->spr.sector()->floorshade - 10;
|
||||||
bu->WaitTics = 120 * 120;
|
actorNew->user.WaitTics = 120 * 120;
|
||||||
actorNew->spr.zvel = 512;
|
actorNew->spr.zvel = 512;
|
||||||
actorNew->spr.clipdist = 12 >> 2;
|
actorNew->spr.clipdist = 12 >> 2;
|
||||||
SET(actorNew->spr.cstat, CSTAT_SPRITE_YCENTER);
|
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
|
actorNew->spr.shade = -60; // Make em brighter
|
||||||
|
|
||||||
return actorNew;
|
return actorNew;
|
||||||
|
|
|
@ -866,10 +866,10 @@ int DoZombieMove(DSWActor* actor)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (u->targetActor && u->targetActor->hasU())
|
DSWActor* tActor = u->targetActor;
|
||||||
|
if (tActor && tActor->hasU())
|
||||||
{
|
{
|
||||||
auto tu = u->targetActor->u();
|
if (TEST(tActor->user.Flags, PF_DEAD))
|
||||||
if (TEST(tu->Flags, PF_DEAD))
|
|
||||||
DoActorPickClosePlayer(actor);
|
DoActorPickClosePlayer(actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -919,10 +919,10 @@ int NullZombie(DSWActor* actor)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (u->targetActor && u->targetActor->hasU())
|
DSWActor* tActor = u->targetActor;
|
||||||
|
if (tActor && tActor->hasU())
|
||||||
{
|
{
|
||||||
auto tu = u->targetActor->u();
|
if (TEST(tActor->user.Flags, PF_DEAD))
|
||||||
if (TEST(tu->Flags, PF_DEAD))
|
|
||||||
DoActorPickClosePlayer(actor);
|
DoActorPickClosePlayer(actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue