ref: c39b37221169c959dc5746c9d009f8574ff7731e
parent: 3579a07a56d6bdd2150e6d3a07817b60b53cea20
author: Simon Howard <[email protected]>
date: Fri Oct 27 20:23:11 EDT 2006
Display a warning when setting dehacked fields that would overflow buffers in Vanilla dehacked. This should help pick up bugs like the one in Batman Doom. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 742
--- a/src/deh_frame.c
+++ b/src/deh_frame.c
@@ -62,6 +62,12 @@
return NULL;
}
+ if (frame_number >= DEH_VANILLA_NUMSTATES)
+ {
+ DEH_Warning(context, "Attempt to modify frame %i: this will cause "
+ "problems in Vanilla dehacked.", frame_number);
+ }
+
state = &states[frame_number];
return state;
--- a/src/deh_main.h
+++ b/src/deh_main.h
@@ -31,6 +31,13 @@
#include "doomfeatures.h"
#include "md5.h"
+// These are the limits that dehacked uses (from dheinit.h in the dehacked
+// source). If these limits are exceeded, it does not generate an error, but
+// a warning is displayed.
+
+#define DEH_VANILLA_NUMSTATES 966
+#define DEH_VANILLA_NUMSFX 107
+
void DEH_Init(void);
boolean DEH_ParseAssignment(char *line, char **variable_name, char **value);
--- a/src/deh_sound.c
+++ b/src/deh_sound.c
@@ -61,6 +61,12 @@
DEH_Warning(context, "Invalid sound number: %i", sound_number);
return NULL;
}
+
+ if (sound_number >= DEH_VANILLA_NUMSFX)
+ {
+ DEH_Warning(context, "Attempt to modify SFX %i. This will problems "
+ "in Vanilla dehacked.", sound_number);
+ }
sfx = &S_sfx[sound_number];