ref: 8c7078eca9a086f50002d5b84a0b8e80a9d36070
parent: ec5ca368b7dfa19a485f75a60cc6b0377882562d
author: Simon Howard <[email protected]>
date: Thu Jul 31 16:06:42 EDT 2008
Automatically load chex.deh on startup if playing in chex mode. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1165
--- a/src/d_main.c
+++ b/src/d_main.c
@@ -770,6 +770,22 @@
}
}
+// Load the Chex Quest dehacked file, if we are in Chex mode.
+
+static void LoadChexDeh(void)
+{
+ if (gameversion == exe_chex)
+ {
+ if (!DEH_LoadFile("chex.deh"))
+ {
+ I_Error("Unable to find Chex Quest dehacked file (chex.deh).\n"
+ "The dehacked file is required in order to emulate\n"
+ "chex.exe correctly. Please download it from the\n"
+ "/idgames repository.");
+ }
+ }
+}
+
//
// D_DoomMain
//
@@ -1200,6 +1216,7 @@
D_IdentifyVersion();
InitGameVersion();
+ LoadChexDeh();
D_SetGameDescription();
D_SetSaveGameDir();
--- a/src/deh_main.c
+++ b/src/deh_main.c
@@ -351,21 +351,25 @@
// Parses a dehacked file
-static void DEH_ParseFile(char *filename)
+int DEH_LoadFile(char *filename)
{
deh_context_t *context;
+ printf(" loading %s\n", filename);
+
context = DEH_OpenFile(filename);
if (context == NULL)
{
- fprintf(stderr, "DEH_ParseFile: Unable to open %s\n", filename);
- return;
+ fprintf(stderr, "DEH_LoadFile: Unable to open %s\n", filename);
+ return 0;
}
DEH_ParseContext(context);
DEH_CloseFile(context);
+
+ return 1;
}
// Checks the command line for -deh argument
@@ -393,8 +397,7 @@
while (p < myargc && myargv[p][0] != '-')
{
filename = D_TryFindWADByName(myargv[p]);
- printf(" loading %s\n", filename);
- DEH_ParseFile(filename);
+ DEH_LoadFile(filename);
++p;
}
}
--- a/src/deh_main.h
+++ b/src/deh_main.h
@@ -39,6 +39,7 @@
#define DEH_VANILLA_NUMSFX 107
void DEH_Init(void);
+int DEH_LoadFile(char *filename);
boolean DEH_ParseAssignment(char *line, char **variable_name, char **value);
--- a/src/i_system.c
+++ b/src/i_system.c
@@ -225,7 +225,7 @@
// Message first.
va_start(argptr, error);
- fprintf(stderr, "Error: ");
+ fprintf(stderr, "\nError: ");
vfprintf(stderr, error, argptr);
fprintf(stderr, "\n");
va_end(argptr);