From 651bf324e39d6365855e0ad79817547fc8999cc4 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 31 Aug 2022 23:10:50 +0200 Subject: [PATCH] - int_Actor* cleanup. --- source/games/sw/src/game.h | 29 ++++------------------------- source/games/sw/src/skull.cpp | 4 ++-- 2 files changed, 6 insertions(+), 27 deletions(-) diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index 5035c6695..5ece2a916 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -2162,14 +2162,9 @@ inline double ActorZOfBottom(DSWActor* actor) return GetSpriteZOfBottom(&actor->spr) * zinttoworld; } -inline int int_ActorZOfMiddle(DSWActor* actor) -{ - return (int_ActorZOfTop(actor) + int_ActorZOfBottom(actor)) >> 1; -} - inline double ActorZOfMiddle(DSWActor* actor) { - return (int_ActorZOfTop(actor) + int_ActorZOfBottom(actor)) * zinttoworld * 0.5; + return (ActorZOfTop(actor) + ActorZOfBottom(actor)) * 0.5; } inline DVector3 ActorVectOfMiddle(DSWActor* actor) @@ -2187,11 +2182,6 @@ inline double ActorSizeZ(DSWActor* actor) return (tileHeight(actor->spr.picnum) * actor->spr.yrepeat) / 64.; } -inline int int_ActorUpperZ(DSWActor* actor) -{ - return (int_ActorZOfTop(actor) + (int_ActorSizeZ(actor) >> 2)); -} - inline double ActorUpperZ(DSWActor* actor) { return (ActorZOfTop(actor) + (ActorSizeZ(actor) * 0.25)); @@ -2202,14 +2192,9 @@ inline DVector3 ActorUpperVect(DSWActor* actor) return DVector3(actor->spr.pos.XY(), ActorUpperZ(actor)); } -inline int int_ActorLowerZ(DSWActor* actor) -{ - return (int_ActorZOfBottom(actor) - (int_ActorSizeZ(actor) >> 2)); -} - inline double ActorLowerZ(DSWActor* actor) { - return (int_ActorZOfBottom(actor) - (int_ActorSizeZ(actor) * 0.25)) * zinttoworld; + return (ActorZOfBottom(actor) - (ActorSizeZ(actor) * 0.25)); } inline DVector3 ActorLowerVect(DSWActor* actor) @@ -2217,16 +2202,10 @@ inline DVector3 ActorLowerVect(DSWActor* actor) return DVector3(actor->spr.pos.XY(), ActorLowerZ(actor)); } - // Z size of top (TOS) and bottom (BOS) part of sprite -inline int ActorSizeToTop(DSWActor* a) +inline double ActorSizeToTop(DSWActor* a) { - return ((int_ActorSizeZ(a)) + (tileTopOffset(a->spr.picnum) << 8)) >> 1; -} - -inline int ActorSizeToBottom(DSWActor* a) -{ - return ((int_ActorSizeZ(a)) - (tileTopOffset(a->spr.picnum) << 8)) >> 1; + return (ActorSizeZ(a) + tileTopOffset(a->spr.picnum)) * 0.5; } inline int ActorSizeX(DSWActor* sp) diff --git a/source/games/sw/src/skull.cpp b/source/games/sw/src/skull.cpp index 36e91920d..6d211190f 100644 --- a/source/games/sw/src/skull.cpp +++ b/source/games/sw/src/skull.cpp @@ -238,7 +238,7 @@ int SetupSkull(DSWActor* actor) actor->user.loz = actor->spr.pos.Z; // leave 8 pixels above the ground - actor->add_int_z(ActorSizeToTop(actor) - Z(3)); + actor->spr.pos.Z += ActorSizeToTop(actor) - 3; } else { @@ -619,7 +619,7 @@ int SetupBetty(DSWActor* actor) actor->user.loz = actor->spr.pos.Z; // leave 8 pixels above the ground - actor->add_int_z(ActorSizeToTop(actor) - Z(3)); + actor->spr.pos.Z += ActorSizeToTop(actor) - 3; } else {