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
This commit is contained in:
sirlemonhead 2019-12-14 00:33:26 +00:00 committed by Christoph Oelckers
parent ff91493e39
commit 3265b52c17
4 changed files with 75 additions and 29 deletions

View file

@ -1701,6 +1701,61 @@ static int32_t check_filename_casing(void)
int32_t r_maxfpsoffset = 0; 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; static int32_t nonsharedtimer;
void CheckCommandLine(int argc, char const* const* argv, int &doTitle) void CheckCommandLine(int argc, char const* const* argv, int &doTitle)
@ -1905,6 +1960,7 @@ int GameInterface::app_main()
PatchDemoStrings();
// loc_115F5: // loc_115F5:
nItemTextIndex = FindGString("ITEMS"); nItemTextIndex = FindGString("ITEMS");
nFirstPassword = FindGString("PASSWORDS"); nFirstPassword = FindGString("PASSWORDS");
@ -2508,34 +2564,8 @@ LOOP3:
fps++; fps++;
} }
EXITGAME: EXITGAME:
if (bRecord) {
fclose(vcrfp);
}
FadeSong(); ExitGame();
if (CDplaying()) {
fadecdaudio();
}
StopAllSounds();
StopLocalSound();
mysaveconfig();
if (bSerialPlay)
{
if (nNetPlayerCount != 0) {
bSendBye = kTrue;
UpdateSerialInputs();
}
}
else
{
if (nNetPlayerCount != 0) {
SendGoodbye();
}
}
ShutDown();
return 0; return 0;
} }

View file

@ -95,6 +95,7 @@ struct demo_input
}; };
#pragma pack(pop) #pragma pack(pop)
void ExitGame();
void ShutDown(void); void ShutDown(void);
void DebugOut(const char *fmt, ...); void DebugOut(const char *fmt, ...);
int ExhumedMain(int argc, char *argv[]); int ExhumedMain(int argc, char *argv[]);
@ -234,12 +235,15 @@ extern int lCountDown;
extern short bSlipMode; extern short bSlipMode;
extern short nItemTextIndex; extern short nItemTextIndex;
extern const char *gString[]; extern const char* gString[];
extern const char* gPSDemoString[];
extern const char* gEXDemoString[];
extern int bVanilla; extern int bVanilla;
#define POWERSLAVE (g_gameType & GAMEFLAG_POWERSLAVE) #define POWERSLAVE (g_gameType & GAMEFLAG_POWERSLAVE)
#define EXHUMED (g_gameType & GAMEFLAG_EXHUMED) #define EXHUMED (g_gameType & GAMEFLAG_EXHUMED)
#define ISDEMOVER (g_gameType & GAMEFLAG_DEMO)
extern double g_frameDelay; extern double g_frameDelay;

View file

@ -2016,6 +2016,12 @@ void GoToTheCinema(int nVal)
} }
} }
if (ISDEMOVER) {
if (!waloff[cinematile]) {
tileCreate(cinematile, 320, 200);
}
}
FadeOut(kFalse); FadeOut(kFalse);
StopAllSounds(); StopAllSounds();
NoClip(); NoClip();
@ -2095,6 +2101,11 @@ void GoToTheCinema(int nVal)
GrabPalette(); GrabPalette();
Clip(); Clip();
// quit the game if we've finished level 4 and displayed the advert text
if (ISDEMOVER && nVal == 3) {
ExitGame();
}
} }

View file

@ -460,7 +460,8 @@ int LoadSound(const char *sound)
} }
else 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; SoundBuf[i] = NULL;
SoundLen[i] = 0; SoundLen[i] = 0;
//return hVoc; //return hVoc;