From 212f07f7ffa05acb06fbce3148e5a79100993d4e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 24 Dec 2021 17:01:31 +0100 Subject: [PATCH] - sp cleanup in skull.cpp, sumo.cpp, zilla.cpp, zombie.cpp --- source/games/sw/src/skull.cpp | 20 ++++---------------- source/games/sw/src/sumo.cpp | 26 +++----------------------- source/games/sw/src/zilla.cpp | 4 ---- source/games/sw/src/zombie.cpp | 2 -- 4 files changed, 7 insertions(+), 45 deletions(-) diff --git a/source/games/sw/src/skull.cpp b/source/games/sw/src/skull.cpp index 8e4c44b7c..5f923ff02 100644 --- a/source/games/sw/src/skull.cpp +++ b/source/games/sw/src/skull.cpp @@ -209,7 +209,6 @@ STATEp sg_SkullExplode[] = int SetupSkull(DSWActor* actor) { - SPRITEp sp = &actor->s(); USERp u; ANIMATOR DoActorDecide; @@ -239,13 +238,13 @@ int SetupSkull(DSWActor* actor) u->Radius = 400; - if (GetSpriteZOfBottom(sp) > u->loz - Z(16)) + if (ActorZOfBottom(actor) > u->loz - Z(16)) { actor->spr.pos.Z = u->loz + Z(tileTopOffset(actor->spr.picnum)); u->loz = actor->spr.pos.Z; // leave 8 pixels above the ground - actor->spr.pos.Z += GetSpriteSizeToTop(sp) - Z(3);; + actor->spr.pos.Z += ActorSizeToTop(actor) - Z(3);; } else { @@ -260,7 +259,6 @@ int SetupSkull(DSWActor* actor) int DoSkullMove(DSWActor* actor) { USER* u = actor->u(); - SPRITEp sp = &actor->s(); int32_t dax, day, daz; dax = MOVEx(actor->spr.xvel, actor->spr.ang); @@ -276,7 +274,6 @@ int DoSkullMove(DSWActor* actor) int DoSkullBeginDeath(DSWActor* actor) { USER* u = actor->u(); - SPRITEp sp = &actor->s(); int16_t i,num_ord=0; // Decrease for Serp God @@ -356,7 +353,6 @@ int DoSkullBeginDeath(DSWActor* actor) int DoSkullJump(DSWActor* actor) { USER* u = actor->u(); - SPRITEp sp = &actor->s(); if (actor->spr.xvel) DoSkullMove(actor); @@ -418,7 +414,6 @@ int DoSkullJump(DSWActor* actor) int DoSkullBob(DSWActor* actor) { USER* u = actor->u(); - SPRITEp sp = &actor->s(); // actor does a sine wave about u->sz - this is the z mid point const int SKULL_BOB_AMT = (Z(16)); @@ -441,7 +436,6 @@ int DoSkullSpawnShrap(DSWActor* actor) int DoSkullWait(DSWActor* actor) { USER* u = actor->u(); - SPRITEp sp = &actor->s(); int a,b,c,dist; DISTANCE(actor->spr.pos.X, actor->spr.pos.Y, u->targetActor->spr.pos.X, u->targetActor->spr.pos.Y, dist, a, b, c); @@ -613,7 +607,6 @@ STATEp sg_BettyExplode[] = int SetupBetty(DSWActor* actor) { - SPRITEp sp = &actor->s(); USERp u; ANIMATOR DoActorDecide; @@ -643,13 +636,13 @@ int SetupBetty(DSWActor* actor) u->Radius = 400; - if (GetSpriteZOfBottom(sp) > u->loz - Z(16)) + if (ActorZOfBottom(actor) > u->loz - Z(16)) { actor->spr.pos.Z = u->loz + Z(tileTopOffset(actor->spr.picnum)); u->loz = actor->spr.pos.Z; // leave 8 pixels above the ground - actor->spr.pos.Z += GetSpriteSizeToTop(sp) - Z(3);; + actor->spr.pos.Z += ActorSizeToTop(actor) - Z(3);; } else { @@ -664,7 +657,6 @@ int SetupBetty(DSWActor* actor) int DoBettyMove(DSWActor* actor) { USER* u = actor->u(); - SPRITEp sp = &actor->s(); int32_t dax, day, daz; dax = MOVEx(actor->spr.xvel, actor->spr.ang); @@ -680,7 +672,6 @@ int DoBettyMove(DSWActor* actor) int DoBettyBeginDeath(DSWActor* actor) { USER* u = actor->u(); - SPRITEp sp = &actor->s(); int16_t i,num_ord=0; // starts the explosion that does the actual damage @@ -754,7 +745,6 @@ int DoBettyBeginDeath(DSWActor* actor) int DoBettyJump(DSWActor* actor) { USER* u = actor->u(); - SPRITEp sp = &actor->s(); if (actor->spr.xvel) DoBettyMove(actor); @@ -814,7 +804,6 @@ int DoBettyJump(DSWActor* actor) int DoBettyBob(DSWActor* actor) { USER* u = actor->u(); - SPRITEp sp = &actor->s(); // actor does a sine wave about u->sz - this is the z mid point const int BETTY_BOB_AMT = (Z(16)); @@ -836,7 +825,6 @@ int DoBettySpawnShrap(DSWActor* actor) int DoBettyWait(DSWActor* actor) { USER* u = actor->u(); - SPRITEp sp = &actor->s(); int a,b,c,dist; DISTANCE(actor->spr.pos.X, actor->spr.pos.Y, u->targetActor->spr.pos.X, u->targetActor->spr.pos.Y, dist, a, b, c); diff --git a/source/games/sw/src/sumo.cpp b/source/games/sw/src/sumo.cpp index b8735cc3f..cb5299051 100644 --- a/source/games/sw/src/sumo.cpp +++ b/source/games/sw/src/sumo.cpp @@ -634,7 +634,6 @@ ACTOR_ACTION_SET MiniSumoActionSet = int SetupSumo(DSWActor* actor) { - SPRITEp sp = &actor->s(); USERp u; ANIMATOR DoActorDecide; @@ -714,46 +713,29 @@ int DoSumoMove(DSWActor* actor) int DoSumoRumble(DSWActor* actor) { - USER* u = actor->u(); - SPRITEp sp = &actor->s(); - SetSumoQuake(actor); - return 0; } int InitSumoFart(DSWActor* actor) { - USER* u = actor->u(); - SPRITEp sp = &actor->s(); - PlaySound(DIGI_SUMOFART, actor, v3df_follow); - InitChemBomb(actor); - SetSumoFartQuake(actor); InitSumoNapalm(actor); - return 0; } int InitSumoStomp(DSWActor* actor) { - USER* u = actor->u(); - SPRITEp sp = &actor->s(); - PlaySound(DIGI_SUMOSTOMP, actor, v3df_none); SetSumoQuake(actor); InitSumoStompAttack(actor); - return 0; } int InitSumoClap(DSWActor* actor) { - USER* u = actor->u(); - SPRITEp sp = &actor->s(); - if (actor->spr.pal == 16 && RandomRange(1000) <= 800) InitMiniSumoClap(actor); else @@ -764,7 +746,6 @@ int InitSumoClap(DSWActor* actor) int DoSumoDeathMelt(DSWActor* actor) { USER* u = actor->u(); - SPRITEp sp = &actor->s(); PlaySound(DIGI_SUMOFART, actor, v3df_follow); @@ -832,13 +813,12 @@ void BossHealthMeter(void) // Only show the meter when you can see the boss for (int i=0; i<3; i++) { - auto actor = BossSpriteNum[i]; + DSWActor* actor = BossSpriteNum[i]; if (actor != nullptr && !bosswasseen[i]) { - sp = &actor->s(); u = actor->u(); - if (cansee(actor->spr.pos.X, actor->spr.pos.Y, GetSpriteZOfTop(sp), actor->spr.sector(), pp->pos.X, pp->pos.Y, pp->pos.Z - Z(40), pp->cursector)) + if (cansee(actor->spr.pos.X, actor->spr.pos.Y, ActorZOfTop(actor), actor->spr.sector(), pp->pos.X, pp->pos.Y, pp->pos.Z - Z(40), pp->cursector)) { if (i == 0 && !bosswasseen[0]) { @@ -871,7 +851,7 @@ void BossHealthMeter(void) for (int i=0; i<3; i++) { - auto actor = BossSpriteNum[i]; + DSWActor* actor = BossSpriteNum[i]; if ((!bosswasseen[i] || actor == nullptr)) continue; diff --git a/source/games/sw/src/zilla.cpp b/source/games/sw/src/zilla.cpp index c0157155f..133ae8e5b 100644 --- a/source/games/sw/src/zilla.cpp +++ b/source/games/sw/src/zilla.cpp @@ -640,7 +640,6 @@ ACTOR_ACTION_SET ZillaActionSet = int SetupZilla(DSWActor* actor) { - SPRITEp sp = &actor->s(); USERp u; ANIMATOR DoActorDecide; @@ -676,7 +675,6 @@ int SetupZilla(DSWActor* actor) int NullZilla(DSWActor* actor) { USER* u = actor->u(); - SPRITEp sp = &actor->s(); #if 0 if (u->State == s_ZillaDie) @@ -703,7 +701,6 @@ int NullZilla(DSWActor* actor) int DoZillaMove(DSWActor* actor) { USER* u = actor->u(); - SPRITEp sp = &actor->s(); short choose; // Random Zilla taunts @@ -746,7 +743,6 @@ int DoZillaStomp(DSWActor* actor) int DoZillaDeathMelt(DSWActor* actor) { USER* u = actor->u(); - SPRITEp sp = &actor->s(); if (RandomRange(1000) > 800) SpawnGrenadeExp(actor); diff --git a/source/games/sw/src/zombie.cpp b/source/games/sw/src/zombie.cpp index 09f235676..bfd5af34b 100644 --- a/source/games/sw/src/zombie.cpp +++ b/source/games/sw/src/zombie.cpp @@ -749,7 +749,6 @@ ACTOR_ACTION_SET ZombieActionSet = int SetupZombie(DSWActor* actor) { - SPRITEp sp = &actor->s(); USERp u = actor->u(); ANIMATOR DoActorDecide; @@ -807,7 +806,6 @@ void SpawnZombie(PLAYERp pp, DSWActor* weaponActor) void SpawnZombie2(DSWActor* actor) { - SPRITEp sp = &actor->s(); SPRITEp np; USERp nu; auto sectu = actor->spr.sector();