From f3f6bad1f8aa8615307ec8fbdf42243d43ab981c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 11 Oct 2020 13:21:54 +0200 Subject: [PATCH] - Exhumed: Wrapped the logo retrieval code into getter functions and removed the game type macros. --- source/exhumed/src/2d.cpp | 6 +++--- source/exhumed/src/d_menu.cpp | 2 +- source/exhumed/src/exhumed.h | 13 ++++++++++--- source/exhumed/src/gameloop.cpp | 2 +- source/exhumed/src/player.h | 2 +- source/exhumed/src/sound.cpp | 2 +- 6 files changed, 17 insertions(+), 10 deletions(-) diff --git a/source/exhumed/src/2d.cpp b/source/exhumed/src/2d.cpp index c44baf47a..b69d0eeb7 100644 --- a/source/exhumed/src/2d.cpp +++ b/source/exhumed/src/2d.cpp @@ -168,7 +168,7 @@ void menu_DoPlasma() nextPlasmaTic = pclock + 4; if (!nLogoTile) - nLogoTile = EXHUMED ? kExhumedLogo : kPowerslaveLogo; + nLogoTile = GameLogo(); if (!PlasmaBuffer) { @@ -505,7 +505,7 @@ void DoTitle(CompletionFunc completion) JobDesc jobs[5]; int job = 0; - jobs[job++] = { Create(tileGetTexture(EXHUMED ? kTileBMGLogo : kTilePIELogo), DScreenJob::fadein | DScreenJob::fadeout) }; + jobs[job++] = { Create(tileGetTexture(PublisherLogo()), DScreenJob::fadein | DScreenJob::fadeout) }; jobs[job++] = { Create(tileGetTexture(seq_GetSeqPicnum(kSeqScreens, 0, 0)), DScreenJob::fadein | DScreenJob::fadeout) }; jobs[job++] = { PlayMovie("book.mov") }; jobs[job++] = { Create() }; @@ -1003,7 +1003,7 @@ public: int ret = skiprequest ? -1 : cont ? 1 : 0; // quit the game if we've finished level 4 and displayed the advert text - if (ISDEMOVER && currentCinemaPalette == 3 && ret != 1) + if (isShareware() && currentCinemaPalette == 3 && ret != 1) { ExitGame(); } diff --git a/source/exhumed/src/d_menu.cpp b/source/exhumed/src/d_menu.cpp index 2174911c6..17fd07e4c 100644 --- a/source/exhumed/src/d_menu.cpp +++ b/source/exhumed/src/d_menu.cpp @@ -99,7 +99,7 @@ DEFINE_ACTION_FUNCTION(_ListMenuItemExhumedPlasma, Draw) DEFINE_ACTION_FUNCTION(_ListMenuItemExhumedLogo, Draw) { - auto nLogoTile = EXHUMED ? kExhumedLogo : kPowerslaveLogo; + auto nLogoTile = GameLogo(); DrawRel(nLogoTile, 160, 40); return 0; } diff --git a/source/exhumed/src/exhumed.h b/source/exhumed/src/exhumed.h index e5f8fbc33..70bdcb025 100644 --- a/source/exhumed/src/exhumed.h +++ b/source/exhumed/src/exhumed.h @@ -31,6 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "filesystem.h" #include "screenjob.h" #include "gamestruct.h" +#include "names.h" BEGIN_PS_NS @@ -157,9 +158,15 @@ extern short bDoFlashes; extern int bVanilla; -#define POWERSLAVE (g_gameType & GAMEFLAG_POWERSLAVE) -#define EXHUMED (g_gameType & GAMEFLAG_EXHUMED) -#define ISDEMOVER (g_gameType & GAMEFLAG_SHAREWARE) +inline int PublisherLogo() +{ + return (g_gameType & GAMEFLAG_EXHUMED) ? kTileBMGLogo : kTilePIELogo; +} + +inline int GameLogo() +{ + return (g_gameType & GAMEFLAG_EXHUMED) ? kExhumedLogo : kPowerslaveLogo; +} extern double g_frameDelay; diff --git a/source/exhumed/src/gameloop.cpp b/source/exhumed/src/gameloop.cpp index ed7b58f4e..41212bb16 100644 --- a/source/exhumed/src/gameloop.cpp +++ b/source/exhumed/src/gameloop.cpp @@ -114,7 +114,7 @@ void GameInterface::Render() void GameInterface::DrawBackground() { - auto nLogoTile = EXHUMED ? kExhumedLogo : kPowerslaveLogo; + auto nLogoTile = GameLogo(); int dword_9AB5F = (I_GetBuildTime() / 16) & 3; twod->ClearScreen(); diff --git a/source/exhumed/src/player.h b/source/exhumed/src/player.h index 6855ff67e..6f8ce7a49 100644 --- a/source/exhumed/src/player.h +++ b/source/exhumed/src/player.h @@ -39,7 +39,7 @@ enum kDefaultLives = 3, kMaxPlayerLives = 5, kMaxHealth = 800 -} +}; extern int nLocalPlayer; diff --git a/source/exhumed/src/sound.cpp b/source/exhumed/src/sound.cpp index be7ac5b63..5990a9e3f 100644 --- a/source/exhumed/src/sound.cpp +++ b/source/exhumed/src/sound.cpp @@ -203,7 +203,7 @@ int LoadSound(const char* name) looped[retval-1] = loops; return retval - 1; } - else if (!ISDEMOVER) // demo tries to load sound files it doesn't have + else if (!isShareware()) // demo tries to load sound files it doesn't have { Printf("Unable to open sound '%s'!\n", filename.GetChars()); }