summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Howard2008-09-23 23:12:03 +0000
committerSimon Howard2008-09-23 23:12:03 +0000
commitfb176d6121a9313cd98cd015045d239ddfef3994 (patch)
treeca696ac4195e62bc46ba88c8500fd16eb87e1594 /src
parent350fe185784d6d0350ed8b675630440ff425a6ca (diff)
parent5bab2a788da04bd8aaa65891cb3fc7240d56a9b7 (diff)
downloadchocolate-doom-fb176d6121a9313cd98cd015045d239ddfef3994.tar.gz
chocolate-doom-fb176d6121a9313cd98cd015045d239ddfef3994.tar.bz2
chocolate-doom-fb176d6121a9313cd98cd015045d239ddfef3994.zip
Merge updates from trunk.
Subversion-branch: /branches/raven-branch Subversion-revision: 1266
Diffstat (limited to 'src')
-rw-r--r--src/doom/d_main.c2
-rw-r--r--src/doom/deh_cheat.c10
-rw-r--r--src/doom/deh_io.c13
-rw-r--r--src/doom/deh_main.c15
-rw-r--r--src/doom/deh_main.h1
-rw-r--r--src/i_main.c18
6 files changed, 47 insertions, 12 deletions
diff --git a/src/doom/d_main.c b/src/doom/d_main.c
index 67a22a50..3188ece3 100644
--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -510,7 +510,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;
diff --git a/src/doom/deh_cheat.c b/src/doom/deh_cheat.c
index d4ea9113..b953c8a8 100644
--- a/src/doom/deh_cheat.c
+++ b/src/doom/deh_cheat.c
@@ -121,7 +121,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
@@ -133,7 +136,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/doom/deh_io.c b/src/doom/deh_io.c
index 77cc40a1..3386a6fa 100644
--- a/src/doom/deh_io.c
+++ b/src/doom/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;
}
}
diff --git a/src/doom/deh_main.c b/src/doom/deh_main.c
index 9d528b0a..59e63ea3 100644
--- a/src/doom/deh_main.c
+++ b/src/doom/deh_main.c
@@ -69,6 +69,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:
//
@@ -384,6 +388,17 @@ void DEH_Init(void)
InitialiseSections();
//!
+ // @category mod
+ //
+ // Ignore cheats in dehacked files.
+ //
+
+ if (M_CheckParm("-nocheats") > 0)
+ {
+ deh_apply_cheats = false;
+ }
+
+ //!
// @arg <files>
// @category mod
//
diff --git a/src/doom/deh_main.h b/src/doom/deh_main.h
index 8a0587ff..f9cb44ca 100644
--- a/src/doom/deh_main.h
+++ b/src/doom/deh_main.h
@@ -48,6 +48,7 @@ void DEH_Checksum(md5_digest_t digest);
extern boolean deh_allow_long_strings;
extern boolean deh_allow_long_cheats;
+extern boolean deh_apply_cheats;
#endif /* #ifndef DEH_MAIN_H */
diff --git a/src/i_main.c b/src/i_main.c
index ac4a68e3..4efd2cd9 100644
--- a/src/i_main.c
+++ b/src/i_main.c
@@ -32,6 +32,9 @@
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
+#else
+#include <unistd.h>
+#include <sched.h>
#endif
#include "doomtype.h"
@@ -53,16 +56,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