- u() in lava.cpp, light.cpp and predict.cpp

This commit is contained in:
Christoph Oelckers 2021-12-25 22:13:03 +01:00
parent 78fa76678d
commit a1c5c06e27
3 changed files with 19 additions and 34 deletions

View file

@ -453,41 +453,33 @@ ACTOR_ACTION_SET LavaActionSet =
int SetupLava(DSWActor* actor)
{
USERp u;
ANIMATOR DoActorDecide;
if (TEST(actor->spr.cstat, CSTAT_SPRITE_RESTORE))
if (!TEST(actor->spr.cstat, CSTAT_SPRITE_RESTORE))
{
u = actor->u();
ASSERT(u);
}
else
{
u = SpawnUser(actor, LAVA_RUN_R0, s_LavaRun[0]);
u->Health = 100;
SpawnUser(actor, LAVA_RUN_R0, s_LavaRun[0]);
actor->user.Health = 100;
}
ChangeState(actor, s_LavaRun[0]);
u->Attrib = &LavaAttrib;
actor->user.Attrib = &LavaAttrib;
DoActorSetSpeed(actor, NORM_SPEED);
u->StateEnd = s_LavaDie;
u->Rot = sg_LavaRun;
actor->user.StateEnd = s_LavaDie;
actor->user.Rot = sg_LavaRun;
EnemyDefaults(actor, &LavaActionSet, &LavaPersonality);
actor->spr.xrepeat = actor->spr.yrepeat = 110;
actor->spr.clipdist = (512) >> 2;
SET(u->Flags, SPR_XFLIP_TOGGLE|SPR_ELECTRO_TOLERANT);
SET(actor->user.Flags, SPR_XFLIP_TOGGLE|SPR_ELECTRO_TOLERANT);
u->loz = actor->spr.pos.Z;
actor->user.loz = actor->spr.pos.Z;
return 0;
}
int NullLava(DSWActor* actor)
{
USER* u = actor->u();
if (TEST(u->Flags,SPR_SLIDING))
if (TEST(actor->user.Flags,SPR_SLIDING))
DoActorSlide(actor);
KeepActorOnFloor(actor);
@ -498,15 +490,13 @@ int NullLava(DSWActor* actor)
int DoLavaMove(DSWActor* actor)
{
USER* u = actor->u();
if (TEST(u->Flags,SPR_SLIDING))
if (TEST(actor->user.Flags,SPR_SLIDING))
DoActorSlide(actor);
if (u->track >= 0)
if (actor->user.track >= 0)
ActorFollowTrack(actor, ACTORMOVETICS);
else
(*u->ActorActionFunc)(actor);
(*actor->user.ActorActionFunc)(actor);
KeepActorOnFloor(actor);

View file

@ -36,7 +36,6 @@ BEGIN_SW_NS
void SectorLightShade(DSWActor* actor, short intensity)
{
auto u = actor->hasU()? actor->u() : nullptr;
int8_t* wall_shade;
short base_shade;
@ -60,8 +59,8 @@ void SectorLightShade(DSWActor* actor, short intensity)
// change wall
if (!TEST_BOOL4(actor))
{
ASSERT(u && u->WallShade.Data());
wall_shade = u->WallShade.Data();
ASSERT(actor->hasU() && actor->user.WallShade.Data());
wall_shade = actor->user.WallShade.Data();
int wallcount = 0;
for(auto &wal : wallsofsector(actor->spr.sector()))
@ -124,8 +123,6 @@ void DoLightingMatch(short match, short state)
SWStatIterator it(STAT_LIGHTING);
while (auto itActor = it.Next())
{
auto u = itActor->u();
if (LIGHT_Match(itActor) != match)
continue;
@ -144,7 +141,7 @@ void DoLightingMatch(short match, short state)
{
SET_BOOL1(itActor);
itActor->spr.shade = -LIGHT_MaxBright(itActor);
itActor->spr.pal = u->spal; // on
itActor->spr.pal = itActor->user.spal; // on
SectorLightShade(itActor, itActor->spr.shade);
DiffuseLighting(itActor);
}
@ -258,8 +255,6 @@ void DoLighting(void)
SWStatIterator it(STAT_LIGHTING);
while (auto itActor = it.Next())
{
auto u = itActor->u();
// on/off test
if (TEST_BOOL1(itActor) == OFF)
continue;
@ -345,7 +340,7 @@ void DoLighting(void)
else
{
itActor->spr.shade -= LIGHT_ShadeInc(itActor);
itActor->spr.pal = u->spal; // on
itActor->spr.pal = itActor->user.spal; // on
if (itActor->spr.shade <= -LIGHT_MaxBright(itActor))
{
LIGHT_DirChange(itActor);

View file

@ -39,7 +39,7 @@ BEGIN_SW_NS
bool PredictionOn = true;
bool Prediction = false;
PLAYER PredictPlayer;
USER PredictUser;
//USER PredictUser;
PLAYERp ppp = &PredictPlayer;
typedef struct
@ -63,8 +63,8 @@ void InitPrediction(PLAYERp pp)
return;
// make a copy of player struct and sprite
*ppp = *pp;
PredictUser = *pp->Actor()->u();
//*ppp = *pp;
//PredictUser = *pp->Actor()->user;
}
void DoPrediction(PLAYERp ppp)