shithub: choc

Download patch

ref: fb176d6121a9313cd98cd015045d239ddfef3994
parent: 350fe185784d6d0350ed8b675630440ff425a6ca
parent: 5bab2a788da04bd8aaa65891cb3fc7240d56a9b7
author: Simon Howard <[email protected]>
date: Tue Sep 23 19:12:03 EDT 2008

Merge updates from trunk.

Subversion-branch: /branches/raven-branch
Subversion-revision: 1266

--- a/codeblocks/game.cbp
+++ b/codeblocks/game.cbp
@@ -13,10 +13,14 @@
 				<Option type="0" />
 				<Option compiler="gcc" />
 				<Option parameters="-iwad d:\russell\games\doom2\iwad\doom2.wad" />
+				<Option projectLinkerOptionsRelation="2" />
 				<Compiler>
 					<Add option="-W" />
-					<Add option="-g" />
+					<Add option="-gdwarf-2" />
 				</Compiler>
+				<Linker>
+					<Add option="-lpcsound-dbg -ltextscreen-dbg" />
+				</Linker>
 			</Target>
 			<Target title="Release">
 				<Option output="..\bin\$(PROJECT_NAME).exe" prefix_auto="0" extension_auto="0" />
@@ -24,11 +28,13 @@
 				<Option object_output="..\obj\rel" />
 				<Option type="0" />
 				<Option compiler="gcc" />
+				<Option projectLinkerOptionsRelation="2" />
 				<Compiler>
 					<Add option="-O2" />
 				</Compiler>
 				<Linker>
 					<Add option="-s" />
+					<Add option="-lpcsound -ltextscreen" />
 				</Linker>
 			</Target>
 		</Build>
@@ -42,7 +48,7 @@
 			<Add directory="..\pcsound" />
 		</Compiler>
 		<Linker>
-			<Add option="-lpcsound -ltextscreen -lmingw32 -lSDLmain -lSDL -lSDL_mixer -lSDL_net -mwindows" />
+			<Add option="-lmingw32 -lSDLmain -lSDL -lSDL_mixer -lSDL_net -mwindows" />
 			<Add directory="..\lib" />
 		</Linker>
 		<Unit filename="config.h" />
--- a/codeblocks/libpcsound.cbp
+++ b/codeblocks/libpcsound.cbp
@@ -13,7 +13,7 @@
 				<Option type="2" />
 				<Option compiler="gcc" />
 				<Compiler>
-					<Add option="-g" />
+					<Add option="-gdwarf-2" />
 				</Compiler>
 			</Target>
 			<Target title="Release">
--- a/codeblocks/server.cbp
+++ b/codeblocks/server.cbp
@@ -14,7 +14,7 @@
 				<Option compiler="gcc" />
 				<Compiler>
 					<Add option="-W" />
-					<Add option="-g" />
+					<Add option="-gdwarf-2" />
 				</Compiler>
 			</Target>
 			<Target title="Release">
--- a/codeblocks/setup.cbp
+++ b/codeblocks/setup.cbp
@@ -12,10 +12,15 @@
 				<Option object_output="..\obj\dbg\" />
 				<Option type="0" />
 				<Option compiler="gcc" />
+				<Option projectLinkerOptionsRelation="2" />
 				<Compiler>
 					<Add option="-W" />
 					<Add option="-g" />
+					<Add option="-gdwarf-2" />
 				</Compiler>
+				<Linker>
+					<Add option="-ltextscreen-dbg" />
+				</Linker>
 			</Target>
 			<Target title="Release">
 				<Option output="..\bin\$(PROJECT_NAME).exe" prefix_auto="0" extension_auto="0" />
@@ -23,11 +28,13 @@
 				<Option object_output="..\obj\rel\" />
 				<Option type="0" />
 				<Option compiler="gcc" />
+				<Option projectLinkerOptionsRelation="2" />
 				<Compiler>
 					<Add option="-O2" />
 				</Compiler>
 				<Linker>
 					<Add option="-s" />
+					<Add option="-ltextscreen" />
 				</Linker>
 			</Target>
 		</Build>
@@ -45,7 +52,7 @@
 			<Add directory="..\setup" />
 		</ResourceCompiler>
 		<Linker>
-			<Add option="-ltextscreen -lmingw32 -lSDLmain -lSDL -mwindows" />
+			<Add option="-lmingw32 -lSDLmain -lSDL -mwindows" />
 			<Add directory="..\lib" />
 		</Linker>
 		<Unit filename="setup-res.rc">
--- a/codeblocks/textscreen.cbp
+++ b/codeblocks/textscreen.cbp
@@ -15,7 +15,7 @@
 				<Option createDefFile="1" />
 				<Compiler>
 					<Add option="-W" />
-					<Add option="-g" />
+					<Add option="-gdwarf-2" />
 				</Compiler>
 			</Target>
 			<Target title="Release">
@@ -116,6 +116,7 @@
 		<Extensions>
 			<code_completion />
 			<envvars />
+			<debugger />
 		</Extensions>
 	</Project>
 </CodeBlocks_project_file>
--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -510,7 +510,7 @@
     paused = false;
     gameaction = ga_nothing;
 
-    if ( gamemode == retail )
+    if (gamemode == retail && gameversion != exe_chex)
       demosequence = (demosequence+1)%7;
     else
       demosequence = (demosequence+1)%6;
--- a/src/doom/deh_cheat.c
+++ b/src/doom/deh_cheat.c
@@ -121,7 +121,10 @@
             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 @@
         }
     }
 
-    cheat->seq->sequence[i] = '\0';
+    if (deh_apply_cheats)
+    {
+        cheat->seq->sequence[i] = '\0';
+    }
 }
 
 deh_section_t deh_section_cheat =
--- a/src/doom/deh_io.c
+++ b/src/doom/deh_io.c
@@ -142,7 +142,7 @@
     int c;
     int pos;
 
-    for (pos=0; ; ++pos)
+    for (pos = 0;;)
     {
         c = DEH_GetChar(context);
 
@@ -153,11 +153,6 @@
             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 @@
             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;
         }
     }
     
--- a/src/doom/deh_main.c
+++ b/src/doom/deh_main.c
@@ -69,6 +69,10 @@
 
 boolean deh_allow_long_cheats = false;
 
+// If false, dehacked cheat replacements are ignored.
+
+boolean deh_apply_cheats = true;
+
 //
 // List of section types:
 //
@@ -382,6 +386,17 @@
     int p;
 
     InitialiseSections();
+
+    //!
+    // @category mod
+    //
+    // Ignore cheats in dehacked files.
+    //
+
+    if (M_CheckParm("-nocheats") > 0) 
+    {
+	deh_apply_cheats = false;
+    }
 
     //!
     // @arg <files>
--- a/src/doom/deh_main.h
+++ b/src/doom/deh_main.h
@@ -48,6 +48,7 @@
 
 extern boolean deh_allow_long_strings;
 extern boolean deh_allow_long_cheats;
+extern boolean deh_apply_cheats;
 
 #endif /* #ifndef DEH_MAIN_H */
 
--- 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,15 +56,26 @@
     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