From 93bbda69b51835fd9177deca0c706001ccb0a2a8 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sun, 7 Sep 2008 17:47:08 +0000 Subject: Strip out NUL characters from dehacked files; this makes the dehacked patch with portal.wad load properly. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1208 --- src/deh_io.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/deh_io.c b/src/deh_io.c index 77cc40a1..3386a6fa 100644 --- a/src/deh_io.c +++ b/src/deh_io.c @@ -142,7 +142,7 @@ char *DEH_ReadLine(deh_context_t *context) int c; int pos; - for (pos=0; ; ++pos) + for (pos = 0;;) { c = DEH_GetChar(context); @@ -153,11 +153,6 @@ char *DEH_ReadLine(deh_context_t *context) return NULL; } - if (c == '\0') - { - return NULL; - } - // cope with lines of any length: increase the buffer size if (pos >= context->readbuffer_size) @@ -172,9 +167,13 @@ char *DEH_ReadLine(deh_context_t *context) context->readbuffer[pos] = '\0'; break; } - else + else if (c != '\0') { + // normal character; don't allow NUL characters to be + // added. + context->readbuffer[pos] = (char) c; + ++pos; } } -- cgit v1.2.3 From 8980e849e5b03ae4dd6c264c6c152bc461daa9ef Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sun, 14 Sep 2008 18:14:46 +0000 Subject: Add -nocheat command line parameter to disable applying cheats from dehacked files. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1227 --- src/deh_cheat.c | 10 ++++++++-- src/deh_main.c | 15 +++++++++++++++ src/deh_main.h | 1 + 3 files changed, 24 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/deh_cheat.c b/src/deh_cheat.c index f501adbf..89e5d219 100644 --- a/src/deh_cheat.c +++ b/src/deh_cheat.c @@ -120,7 +120,10 @@ static void DEH_CheatParseLine(deh_context_t *context, char *line, void *tag) break; } - cheat->seq->sequence[i] = unsvalue[i]; + if (deh_apply_cheats) + { + cheat->seq->sequence[i] = unsvalue[i]; + } ++i; // Absolute limit - don't exceed @@ -132,7 +135,10 @@ static void DEH_CheatParseLine(deh_context_t *context, char *line, void *tag) } } - cheat->seq->sequence[i] = '\0'; + if (deh_apply_cheats) + { + cheat->seq->sequence[i] = '\0'; + } } deh_section_t deh_section_cheat = diff --git a/src/deh_main.c b/src/deh_main.c index b70a3384..616b30e0 100644 --- a/src/deh_main.c +++ b/src/deh_main.c @@ -67,6 +67,10 @@ boolean deh_allow_long_strings = false; boolean deh_allow_long_cheats = false; +// If false, dehacked cheat replacements are ignored. + +boolean deh_apply_cheats = true; + // // List of section types: // @@ -381,6 +385,17 @@ void DEH_Init(void) InitialiseSections(); + //! + // @category mod + // + // Ignore cheats in dehacked files. + // + + if (M_CheckParm("-nocheats") > 0) + { + deh_apply_cheats = false; + } + //! // @arg // @category mod diff --git a/src/deh_main.h b/src/deh_main.h index 388c56de..6afe07f3 100644 --- a/src/deh_main.h +++ b/src/deh_main.h @@ -61,6 +61,7 @@ char *DEH_String(char *s); extern boolean deh_allow_long_strings; extern boolean deh_allow_long_cheats; +extern boolean deh_apply_cheats; #endif /* #ifndef DEH_MAIN_H */ -- cgit v1.2.3 From 0d4e0453946cbdde4995b108c2cc0b8431be2168 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 20 Sep 2008 18:18:06 +0000 Subject: Set processor affinity under non-Windows platforms using the POSIX API. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1243 --- src/i_main.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/i_main.c b/src/i_main.c index 748a72be..74b164b1 100644 --- a/src/i_main.c +++ b/src/i_main.c @@ -32,6 +32,9 @@ #ifdef _WIN32 #define WIN32_LEAN_AND_MEAN #include +#else +#include +#include #endif #include "doomdef.h" @@ -46,16 +49,27 @@ int main(int argc, char **argv) myargc = argc; myargv = argv; -#ifdef _WIN32 - // Set the process affinity mask to 1 on Windows, so that all threads + // Set the process affinity mask so that all threads // run on the same processor. This is a workaround for a bug in // SDL_mixer that causes occasional crashes. +#ifdef _WIN32 if (!SetProcessAffinityMask(GetCurrentProcess(), 1)) { fprintf(stderr, "Failed to set process affinity mask (%d)\n", (int) GetLastError()); } +#else + // POSIX version: + + { + cpu_set_t set; + + CPU_ZERO(&set); + CPU_SET(0, &set); + + sched_setaffinity(getpid(), sizeof(set), &set); + } #endif // start doom -- cgit v1.2.3 From 5bab2a788da04bd8aaa65891cb3fc7240d56a9b7 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sun, 21 Sep 2008 18:20:32 +0000 Subject: Don't play DEMO4 if gameversion is emulating chex.exe - it only plays demos 1-3. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1264 --- src/d_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/d_main.c b/src/d_main.c index 2ab329bf..849897fe 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -504,7 +504,7 @@ void D_DoAdvanceDemo (void) paused = false; gameaction = ga_nothing; - if ( gamemode == retail ) + if (gamemode == retail && gameversion != exe_chex) demosequence = (demosequence+1)%7; else demosequence = (demosequence+1)%6; -- cgit v1.2.3