summaryrefslogtreecommitdiff
path: root/src/hexen/h2_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/hexen/h2_main.c')
-rw-r--r--src/hexen/h2_main.c69
1 files changed, 65 insertions, 4 deletions
diff --git a/src/hexen/h2_main.c b/src/hexen/h2_main.c
index 9d92a65b..b98621b2 100644
--- a/src/hexen/h2_main.c
+++ b/src/hexen/h2_main.c
@@ -93,6 +93,7 @@ extern boolean askforquit;
// PUBLIC DATA DEFINITIONS -------------------------------------------------
GameMode_t gamemode;
+char *gamedescription;
char *iwadfile;
static char demolumpname[9]; // Demo lump to start playing.
boolean nomonsters; // checkparm of -nomonsters
@@ -112,6 +113,7 @@ boolean autostart;
boolean advancedemo;
FILE *debugfile;
int UpdateState;
+int maxplayers = MAXPLAYERS;
// PRIVATE DATA DEFINITIONS ------------------------------------------------
@@ -253,6 +255,57 @@ static void D_AddFile(char *filename)
W_AddFile(filename);
}
+// Find out what version of Hexen is playing.
+
+void D_IdentifyVersion(void)
+{
+ // The Hexen Shareware, ne 4 Level Demo Version, is missing the SKY1 lump
+ // and uses the SKY2 lump instead. Let's use this fact and the missing
+ // levels from MAP05 onward to identify it and set gamemode accordingly.
+
+ if (W_CheckNumForName("SKY1") == -1 &&
+ W_CheckNumForName("MAP05") == -1 )
+ {
+ gamemode = shareware;
+ maxplayers = 4;
+ }
+
+ // The v1.0 IWAD file is missing a bunch of lumps.
+ if (gamemode != shareware && W_CheckNumForName("CLUS1MSG") == -1)
+ {
+ printf(
+ "** WARNING: You are playing with the Hexen v1.0 IWAD. This\n"
+ "** isn't supported by " PACKAGE_NAME ", and you may find that\n"
+ "** the game will crash. Please upgrade to the v1.1 IWAD file.\n"
+ "** See here for more information:\n"
+ "** http://www.doomworld.com/classicdoom/info/patches.php\n");
+ }
+}
+
+// Set the gamedescription string.
+
+void D_SetGameDescription(void)
+{
+/*
+ NB: The 4 Level Demo Version actually prints a four-lined banner
+ (and indeed waits for a keypress):
+
+ Hexen: Beyond Heretic
+
+ 4 Level Demo Version
+ Press any key to continue.
+*/
+
+ if (gamemode == shareware)
+ {
+ gamedescription = "Hexen: 4 Level Demo Version";
+ }
+ else
+ {
+ gamedescription = "Hexen";
+ }
+}
+
//==========================================================================
//
// H2_Main
@@ -332,11 +385,13 @@ void D_DoomMain(void)
D_AddFile(iwadfile);
W_CheckCorrectIWAD(hexen);
+ D_IdentifyVersion();
+ D_SetGameDescription();
AdjustForMacIWAD();
HandleArgs();
- I_PrintStartupBanner("Hexen");
+ I_PrintStartupBanner(gamedescription);
ST_Message("MN_Init: Init menu system.\n");
MN_Init();
@@ -579,17 +634,23 @@ static void HandleArgs(void)
if (p)
{
+ char *uc_filename;
char file[256];
M_StringCopy(file, myargv[p+1], sizeof(file));
// With Vanilla Hexen you have to specify the file without
// extension, but make that optional.
- if (!M_StringEndsWith(myargv[p+1], ".lmp"))
+ uc_filename = strdup(myargv[p + 1]);
+ M_ForceUppercase(uc_filename);
+
+ if (!M_StringEndsWith(uc_filename, ".LMP"))
{
M_StringConcat(file, ".lmp", sizeof(file));
}
+ free(uc_filename);
+
if (W_AddFile(file) != NULL)
{
M_StringCopy(demolumpname, lumpinfo[numlumps - 1].name,
@@ -664,7 +725,7 @@ void H2_GameLoop(void)
M_snprintf(filename, sizeof(filename), "debug%i.txt", consoleplayer);
debugfile = fopen(filename, "w");
}
- I_SetWindowTitle("Hexen");
+ I_SetWindowTitle(gamedescription);
I_GraphicsCheckCommandLine();
I_SetGrabMouseCallback(D_GrabMouseCallback);
I_InitGraphics();
@@ -805,7 +866,7 @@ static void DrawMessage(void)
player_t *player;
player = &players[consoleplayer];
- if (player->messageTics <= 0 || !player->message)
+ if (player->messageTics <= 0)
{ // No message
return;
}