From 3265b52c174bb9a5f694fcb2d436f7956657b6aa Mon Sep 17 00:00:00 2001 From: sirlemonhead Date: Sat, 14 Dec 2019 00:33:26 +0000 Subject: [PATCH] Add support for Powerslave demo version # Conflicts: # source/exhumed/src/exhumed.cpp # source/exhumed/src/grpscan.cpp # source/exhumed/src/grpscan.h # source/exhumed/src/sound.cpp --- source/exhumed/src/exhumed.cpp | 84 +++++++++++++++++++++++----------- source/exhumed/src/exhumed.h | 6 ++- source/exhumed/src/menu.cpp | 11 +++++ source/exhumed/src/sound.cpp | 3 +- 4 files changed, 75 insertions(+), 29 deletions(-) diff --git a/source/exhumed/src/exhumed.cpp b/source/exhumed/src/exhumed.cpp index 61267f078..c462006b9 100644 --- a/source/exhumed/src/exhumed.cpp +++ b/source/exhumed/src/exhumed.cpp @@ -1701,6 +1701,61 @@ static int32_t check_filename_casing(void) int32_t r_maxfpsoffset = 0; +void PatchDemoStrings() +{ + if (!ISDEMOVER) + return; + + if (EXHUMED) { + gString[60] = "PICK UP A COPY OF EXHUMED"; + } + else { + gString[60] = "PICK UP A COPY OF POWERSLAVE"; + } + + gString[61] = "TODAY TO CONTINUE THE ADVENTURE!"; + gString[62] = "MORE LEVELS, NASTIER CREATURES"; + gString[63] = "AND THE EVIL DOINGS OF THE"; + gString[64] = "KILMAAT AWAIT YOU IN THE FULL"; + gString[65] = "VERSION OF THE GAME."; + gString[66] = "TWENTY LEVELS, PLUS 12 NETWORK"; + gString[67] = "PLAY LEVELS CAN BE YOURS!"; + gString[68] = "END"; +} + +void ExitGame() +{ + if (bRecord) { + fclose(vcrfp); + } + + FadeSong(); + if (CDplaying()) { + fadecdaudio(); + } + + StopAllSounds(); + StopLocalSound(); + mysaveconfig(); + + if (bSerialPlay) + { + if (nNetPlayerCount != 0) { + bSendBye = kTrue; + UpdateSerialInputs(); + } + } + else + { + if (nNetPlayerCount != 0) { + SendGoodbye(); + } + } + + ShutDown(); + exit(0); +} + static int32_t nonsharedtimer; void CheckCommandLine(int argc, char const* const* argv, int &doTitle) @@ -1905,6 +1960,7 @@ int GameInterface::app_main() + PatchDemoStrings(); // loc_115F5: nItemTextIndex = FindGString("ITEMS"); nFirstPassword = FindGString("PASSWORDS"); @@ -2508,34 +2564,8 @@ LOOP3: fps++; } EXITGAME: - if (bRecord) { - fclose(vcrfp); - } - FadeSong(); - if (CDplaying()) { - fadecdaudio(); - } - - StopAllSounds(); - StopLocalSound(); - mysaveconfig(); - - if (bSerialPlay) - { - if (nNetPlayerCount != 0) { - bSendBye = kTrue; - UpdateSerialInputs(); - } - } - else - { - if (nNetPlayerCount != 0) { - SendGoodbye(); - } - } - - ShutDown(); + ExitGame(); return 0; } diff --git a/source/exhumed/src/exhumed.h b/source/exhumed/src/exhumed.h index 66713abd6..55b877164 100644 --- a/source/exhumed/src/exhumed.h +++ b/source/exhumed/src/exhumed.h @@ -95,6 +95,7 @@ struct demo_input }; #pragma pack(pop) +void ExitGame(); void ShutDown(void); void DebugOut(const char *fmt, ...); int ExhumedMain(int argc, char *argv[]); @@ -234,12 +235,15 @@ extern int lCountDown; extern short bSlipMode; extern short nItemTextIndex; -extern const char *gString[]; +extern const char* gString[]; +extern const char* gPSDemoString[]; +extern const char* gEXDemoString[]; extern int bVanilla; #define POWERSLAVE (g_gameType & GAMEFLAG_POWERSLAVE) #define EXHUMED (g_gameType & GAMEFLAG_EXHUMED) +#define ISDEMOVER (g_gameType & GAMEFLAG_DEMO) extern double g_frameDelay; diff --git a/source/exhumed/src/menu.cpp b/source/exhumed/src/menu.cpp index c5442bacd..f6f66b3a9 100644 --- a/source/exhumed/src/menu.cpp +++ b/source/exhumed/src/menu.cpp @@ -2016,6 +2016,12 @@ void GoToTheCinema(int nVal) } } + if (ISDEMOVER) { + if (!waloff[cinematile]) { + tileCreate(cinematile, 320, 200); + } + } + FadeOut(kFalse); StopAllSounds(); NoClip(); @@ -2095,6 +2101,11 @@ void GoToTheCinema(int nVal) GrabPalette(); Clip(); + + // quit the game if we've finished level 4 and displayed the advert text + if (ISDEMOVER && nVal == 3) { + ExitGame(); + } } diff --git a/source/exhumed/src/sound.cpp b/source/exhumed/src/sound.cpp index a344454c1..559188856 100644 --- a/source/exhumed/src/sound.cpp +++ b/source/exhumed/src/sound.cpp @@ -460,7 +460,8 @@ int LoadSound(const char *sound) } else { - Printf("Unable to open sound '%s'!\n", buffer); + if (!ISDEMOVER) // demo tries to load sound files it doesn't have + Printf("Unable to open sound '%s'!\n", buffer); SoundBuf[i] = NULL; SoundLen[i] = 0; //return hVoc;