diff options
author | Simon Howard | 2006-10-28 00:23:11 +0000 |
---|---|---|
committer | Simon Howard | 2006-10-28 00:23:11 +0000 |
commit | c39b37221169c959dc5746c9d009f8574ff7731e (patch) | |
tree | fd0b1192f903bad2241256f9ba722672a86aab5e | |
parent | 3579a07a56d6bdd2150e6d3a07817b60b53cea20 (diff) | |
download | chocolate-doom-c39b37221169c959dc5746c9d009f8574ff7731e.tar.gz chocolate-doom-c39b37221169c959dc5746c9d009f8574ff7731e.tar.bz2 chocolate-doom-c39b37221169c959dc5746c9d009f8574ff7731e.zip |
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
-rw-r--r-- | src/deh_frame.c | 6 | ||||
-rw-r--r-- | src/deh_main.h | 7 | ||||
-rw-r--r-- | src/deh_sound.c | 6 |
3 files changed, 19 insertions, 0 deletions
diff --git a/src/deh_frame.c b/src/deh_frame.c index a2e4dc47..2204579b 100644 --- a/src/deh_frame.c +++ b/src/deh_frame.c @@ -62,6 +62,12 @@ static void *DEH_FrameStart(deh_context_t *context, char *line) 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; diff --git a/src/deh_main.h b/src/deh_main.h index 416564d8..b1460a07 100644 --- 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); diff --git a/src/deh_sound.c b/src/deh_sound.c index 180108c0..9f99384b 100644 --- a/src/deh_sound.c +++ b/src/deh_sound.c @@ -61,6 +61,12 @@ static void *DEH_SoundStart(deh_context_t *context, char *line) 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]; |