summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Howard2008-07-31 20:06:42 +0000
committerSimon Howard2008-07-31 20:06:42 +0000
commit8c7078eca9a086f50002d5b84a0b8e80a9d36070 (patch)
tree087f804b937bd00409c01d45d352dc0ecd5c6f4e /src
parentec5ca368b7dfa19a485f75a60cc6b0377882562d (diff)
downloadchocolate-doom-8c7078eca9a086f50002d5b84a0b8e80a9d36070.tar.gz
chocolate-doom-8c7078eca9a086f50002d5b84a0b8e80a9d36070.tar.bz2
chocolate-doom-8c7078eca9a086f50002d5b84a0b8e80a9d36070.zip
Automatically load chex.deh on startup if playing in chex mode.
Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1165
Diffstat (limited to 'src')
-rw-r--r--src/d_main.c17
-rw-r--r--src/deh_main.c13
-rw-r--r--src/deh_main.h1
-rw-r--r--src/i_system.c2
4 files changed, 27 insertions, 6 deletions
diff --git a/src/d_main.c b/src/d_main.c
index 6b90d57e..9aa85f9c 100644
--- a/src/d_main.c
+++ b/src/d_main.c
@@ -770,6 +770,22 @@ void PrintGameVersion(void)
}
}
+// 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 @@ void D_DoomMain (void)
D_IdentifyVersion();
InitGameVersion();
+ LoadChexDeh();
D_SetGameDescription();
D_SetSaveGameDir();
diff --git a/src/deh_main.c b/src/deh_main.c
index 3ace70e5..b70a3384 100644
--- a/src/deh_main.c
+++ b/src/deh_main.c
@@ -351,21 +351,25 @@ static void DEH_ParseContext(deh_context_t *context)
// 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 @@ void DEH_Init(void)
while (p < myargc && myargv[p][0] != '-')
{
filename = D_TryFindWADByName(myargv[p]);
- printf(" loading %s\n", filename);
- DEH_ParseFile(filename);
+ DEH_LoadFile(filename);
++p;
}
}
diff --git a/src/deh_main.h b/src/deh_main.h
index 01f82b83..388c56de 100644
--- 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);
diff --git a/src/i_system.c b/src/i_system.c
index 09e211fd..fe596a60 100644
--- a/src/i_system.c
+++ b/src/i_system.c
@@ -225,7 +225,7 @@ void I_Error (char *error, ...)
// Message first.
va_start(argptr, error);
- fprintf(stderr, "Error: ");
+ fprintf(stderr, "\nError: ");
vfprintf(stderr, error, argptr);
fprintf(stderr, "\n");
va_end(argptr);