From 92798b5a0706f7fb1e528f6e5ef6cc64af1241ba Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Wed, 28 Sep 2022 13:33:54 +1000 Subject: [PATCH] - Remove most `buildhoriz()` calls. --- source/core/g_mapinfo.cpp | 2 +- source/core/mapinfo.h | 3 ++- source/games/blood/src/view.cpp | 2 +- source/games/duke/src/actors_d.cpp | 2 +- source/games/duke/src/actors_r.cpp | 2 +- source/games/duke/src/gameexec.cpp | 4 ++-- source/games/duke/src/player.cpp | 6 +++--- source/games/duke/src/player_r.cpp | 6 +++--- source/games/duke/src/render.cpp | 6 +++--- source/games/exhumed/src/player.cpp | 10 +++++----- 10 files changed, 22 insertions(+), 21 deletions(-) diff --git a/source/core/g_mapinfo.cpp b/source/core/g_mapinfo.cpp index 3dc2744a0..ee2dfa230 100644 --- a/source/core/g_mapinfo.cpp +++ b/source/core/g_mapinfo.cpp @@ -572,7 +572,7 @@ DEFINE_MAP_OPTION(ex_ramses_horiz, false) { parse.ParseAssign(); parse.sc.MustGetNumber(); - info->ex_ramses_horiz = parse.sc.Number; + info->ex_ramses_horiz = maphoriz(parse.sc.Number); } DEFINE_MAP_OPTION(ex_ramses_cdtrack, false) diff --git a/source/core/mapinfo.h b/source/core/mapinfo.h index 8ec6fc4e2..7fa5bedb5 100644 --- a/source/core/mapinfo.h +++ b/source/core/mapinfo.h @@ -6,6 +6,7 @@ #include "palentry.h" #include "vectors.h" #include "screenjob.h" +#include "maptypes.h" #ifdef GetMessage #undef GetMessage // Windows strikes... @@ -148,7 +149,7 @@ struct MapRecord // game specific stuff int rr_startsound = 0; int rr_mamaspawn = 15; - int ex_ramses_horiz = 11; + fixedhoriz ex_ramses_horiz = pitchhoriz(4.912); int ex_ramses_cdtrack = -1; // this is not music, it is the actual dialogue! FString ex_ramses_pup; FString ex_ramses_text; diff --git a/source/games/blood/src/view.cpp b/source/games/blood/src/view.cpp index 4101539a9..94a5d538d 100644 --- a/source/games/blood/src/view.cpp +++ b/source/games/blood/src/view.cpp @@ -513,7 +513,7 @@ static void SetupView(PLAYER* pPlayer, DVector3& cPos, DAngle& cA, fixedhoriz& c } viewUpdateShake(pPlayer, cPos, cA, cH, shakeX, shakeY); - cH += buildhoriz(MulScale(0x40000000 - Cos(pPlayer->tiltEffect << 2), 30, 30)); + cH += pitchhoriz((1 - BobVal((pPlayer->tiltEffect << 2) + 512)) * 13.2); if (gViewPos == 0) { if (cl_viewhbob) diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 04a8d4ebf..a8424f972 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -1382,7 +1382,7 @@ static bool weaponhitsprite(DDukeActor* proj, DDukeActor *targ, bool fireball) if (proj->spr.picnum == SPIT) { - ps[p].horizon.addadjustment(buildhoriz(32)); + ps[p].horizon.addadjustment(pitchhoriz(14.04)); ps[p].sync.actions |= SB_CENTERVIEW; if (ps[p].loogcnt == 0) diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index b8944eeb2..5e51be1ab 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -1006,7 +1006,7 @@ static bool weaponhitsprite(DDukeActor *proj, DDukeActor *targ, const DVector3 & guts_r(proj, RABBITJIBC, 2, myconnectindex); } - ps[p].horizon.addadjustment(buildhoriz(32)); + ps[p].horizon.addadjustment(pitchhoriz(14.04)); ps[p].sync.actions |= SB_CENTERVIEW; if (ps[p].loogcnt == 0) diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index 0b2003ceb..4cb5c5852 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -344,7 +344,7 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, { ps[iPlayer].sync.actions &= ~SB_CENTERVIEW; } - ps[iPlayer].horizon.settarget(buildhoriz(lValue)); + ps[iPlayer].horizon.settarget(maphoriz(lValue)); } else SetGameVarID(lVar2, ps[iPlayer].horizon.horiz.asbuild(), sActor, sPlayer); break; @@ -354,7 +354,7 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, break; case PLAYER_HORIZOFF: - if (bSet) ps[iPlayer].horizon.horizoff = buildhoriz(lValue); + if (bSet) ps[iPlayer].horizon.horizoff = maphoriz(lValue); else SetGameVarID(lVar2, ps[iPlayer].horizon.horizoff.asbuild(), sActor, sPlayer); break; diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index 79d22eab0..92edf861c 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -117,7 +117,7 @@ void forceplayerangle(int snum) { player_struct* p = &ps[snum]; - p->horizon.addadjustment(buildhoriz(64)); + p->horizon.addadjustment(pitchhoriz(26.566)); p->sync.actions |= SB_CENTERVIEW; p->angle.rotscrnang = p->angle.look_ang = (DAngle22_5 - randomAngle(45)) / 2.; } @@ -374,7 +374,7 @@ void dokneeattack(int snum, const std::initializer_list & respawnlist) { p->oknee_incs = p->knee_incs; p->knee_incs++; - p->horizon.addadjustment(buildhoriz(-48)); + p->horizon.addadjustment(pitchhoriz(-20.556)); p->sync.actions |= SB_CENTERVIEW; if (p->knee_incs > 15) { @@ -806,7 +806,7 @@ void player_struct::checkhardlanding() { if (hard_landing > 0) { - horizon.addadjustment(buildhoriz(-(hard_landing << 4))); + horizon.addadjustment(maphoriz(-(hard_landing << 4))); hard_landing--; } } diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 01f15734b..f4bac9d26 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -2962,7 +2962,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp) case RIFLEGUN_WEAPON: p->kickback_pic++; - p->horizon.addadjustment(buildhoriz(1)); + p->horizon.addadjustment(pitchhoriz(0.4476)); p->recoil++; if (p->kickback_pic <= 12) @@ -3134,7 +3134,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp) else if (p->kickback_pic == 12) { p->vel.XY() -= p->angle.ang.ToVector(); - p->horizon.addadjustment(buildhoriz(20)); + p->horizon.addadjustment(pitchhoriz(8.88)); p->recoil += 20; } if (p->kickback_pic > 20) @@ -3975,7 +3975,7 @@ HORIZONLY: if (!d) d = 1; p->recoil -= d; - p->horizon.addadjustment(buildhoriz(-d)); + p->horizon.addadjustment(maphoriz(-d)); } if (SyncInput()) diff --git a/source/games/duke/src/render.cpp b/source/games/duke/src/render.cpp index 393c427ac..2c2542e77 100644 --- a/source/games/duke/src/render.cpp +++ b/source/games/duke/src/render.cpp @@ -89,7 +89,7 @@ void GameInterface::UpdateCameras(double smoothratio) display_mirror = 1; // should really be 'display external view'. auto cstat = camera->spr.cstat; camera->spr.cstat = CSTAT_SPRITE_INVISIBLE; - render_camtex(camera, camera->spr.pos, camera->sector(), camera->interpolatedangle(smoothratio), buildhoriz(camera->spr.shade), nullAngle, tex, rect, smoothratio); + render_camtex(camera, camera->spr.pos, camera->sector(), camera->interpolatedangle(smoothratio), maphoriz(camera->spr.shade), nullAngle, tex, rect, smoothratio); camera->spr.cstat = cstat; display_mirror = 0; }); @@ -255,7 +255,7 @@ void displayrooms(int snum, double interpfrac, bool sceneonly) cpos = viewer->spr.pos.plusZ(-4); cang = viewer->interpolatedangle(interpfrac); - choriz = buildhoriz(viewer->spr.yint); + choriz = maphoriz(viewer->spr.yint); rotscrnang = nullAngle; sect = viewer->sector(); } @@ -311,7 +311,7 @@ void displayrooms(int snum, double interpfrac, bool sceneonly) { viewer = p->newOwner; cang = viewer->interpolatedangle(interpfrac); - choriz = buildhoriz(viewer->spr.shade); + choriz = maphoriz(viewer->spr.shade); cpos = viewer->spr.pos; sect = viewer->sector(); rotscrnang = nullAngle; diff --git a/source/games/exhumed/src/player.cpp b/source/games/exhumed/src/player.cpp index 0bc34b697..e43009eac 100644 --- a/source/games/exhumed/src/player.cpp +++ b/source/games/exhumed/src/player.cpp @@ -1079,7 +1079,7 @@ void AIPlayer::Tick(RunListEvent* ev) PlayerList[nPlayer].angle.settarget(ang, true); pPlayerActor->spr.angle = ang; - PlayerList[nPlayer].horizon.settarget(buildhoriz(0), true); + PlayerList[nPlayer].horizon.settarget(pitchhoriz(nullAngle.Degrees()), true); sPlayerInput[nPlayer].vel.Zero(); pPlayerActor->vel.Zero(); @@ -1092,7 +1092,7 @@ void AIPlayer::Tick(RunListEvent* ev) InitSpiritHead(); PlayerList[nPlayer].nDestVertPan = pitchhoriz(nullAngle.Degrees()); - PlayerList[nPlayer].horizon.settarget(buildhoriz(currentLevel->ex_ramses_horiz)); + PlayerList[nPlayer].horizon.settarget(currentLevel->ex_ramses_horiz); } } else @@ -2623,16 +2623,16 @@ sectdone: { if (PlayerList[nPlayer].horizon.horiz.Sgn() < 0) { - PlayerList[nPlayer].horizon.settarget(buildhoriz(0)); + PlayerList[nPlayer].horizon.settarget(pitchhoriz(nullAngle.Degrees())); PlayerList[nPlayer].eyelevel -= dVertPan[nPlayer]; } else { - PlayerList[nPlayer].horizon.addadjustment(buildhoriz(dVertPan[nPlayer])); + PlayerList[nPlayer].horizon.addadjustment(maphoriz(dVertPan[nPlayer])); if (PlayerList[nPlayer].horizon.horiz.Degrees() >= 38) { - PlayerList[nPlayer].horizon.settarget(buildhoriz(99)); + PlayerList[nPlayer].horizon.settarget(pitchhoriz(37.72)); } else if (PlayerList[nPlayer].horizon.horiz.Sgn() <= 0) {