shithub: choc

Download patch

ref: 77a480fcbf908bd39192b64af00487b6831a2d7b
parent: 4987a479c986206dc2ea0e5e141e89c67a2c963a
parent: cae001b84b567aa349c05d4bb7d241d8de6426e6
author: Simon Howard <fraggle@soulsphere.org>
date: Sat Feb 27 20:43:56 EST 2016

Merge remote-tracking branch 'origin/master' into sdl2-branch

diff: cannot open b/.github//null: file does not exist: 'b/.github//null'
--- /dev/null
+++ b/.github/CONTRIBUTING.md
@@ -1,0 +1,88 @@
+Thanks for contributing to Chocolate Doom! Whatever your contribution,
+whether it's code or just a bug report, it's greatly appreciated.
+
+### Reporting bugs
+
+Before reporting a bug, it's worth checking if this really is a bug.
+Chocolate Doom's mission is to reproduce the Vanilla (DOS) versions of
+the Doom engine games, bugs and all. Check out the
+[NOT-BUGS](../NOT-BUGS) file for a list of common issues which aren't
+really bugs at all. You might also try searching [the GitHub issues
+list](https://github.com/chocolate-doom/chocolate-doom/issues) to see
+if your bug has already been reported.
+
+If you're confident that you've found a real bug (or even if you're
+not sure!) please go ahead and [file an issue on
+GitHub](https://github.com/chocolate-doom/chocolate-doom/issues/new).
+You'll need a GitHub account, but it's pretty easy to sign up.
+
+Please try to give as much information as possible:
+
+* What version of Chocolate Doom are you using? Check the title bar of
+  the window for the version number.
+
+* Chocolate Doom runs on many different operating systems (not just
+  Windows!). Please say which operating system and what version of it
+  you're using.
+
+* Please say which game you're playing (Doom 1, Doom 2, Heretic,
+  Hexen, Strife, etc.) and list any add-on WADs you're using. Please
+  mention if you have any special configuration you think may be
+  relevant, too.
+
+### Feature requests
+
+Chocolate Doom is always open to new feature requests; however, please
+be aware that the project is designed around a deliberately limited
+[philosophy](../PHILOSOPHY), and many features common in other source
+ports will not be accepted. Here are a few common requests which are
+often rejected:
+
+* "High resolution" rendering (greater than 320x200 display).
+
+* An option to disable Vanilla limits, such as the visplane rendering
+  limit.
+
+* Ability to play "No Rest For The Living", the expansion pack which
+  comes with the XBLA / BFG Edition of Doom.
+
+If you're not sure whether your feature is in line with the project
+philosophy, don't worry - just ask anyway!
+To make a feature request, [file an issue on
+GitHub](https://github.com/chocolate-doom/chocolate-doom/issues/new).
+
+### Bug fixes / code submission
+
+Thank you for contributing code to Chocolate Doom! Please check the
+following guidelines before opening a pull request:
+
+* All code must be licensed under [the GNU General Public License,
+  version 2](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html).
+  Please don't reuse code that isn't GPL, or that is GPLv3 licensed.
+  Be aware that by submitting your code to the project, you're agreeing
+  to license it under the GPL.
+
+* Please follow the coding style guidelines described in the
+  [HACKING](../HACKING) file.
+
+* The guidelines given above in the "feature requests" section also
+  apply here. New features which aren't in line with the project
+  philosophy are likely to be rejected. If you're not sure, open a
+  feature request first and ask before you start implementing your
+  feature.
+
+* Follow the guidelines for [how to write a Git commit
+  message](http://chris.beams.io/posts/git-commit/). In short: the
+  first line should be a short summary; keep to an 80 column limit;
+  use the imperative mood ("fix bug X", rather than "fixed bug X" or
+  "fixing bug X"). If your change fixes a particular subsystem,
+  prefix the summary with that subsystem: eg. "doom: Fix bug X" or
+  "textscreen: Change size of X".
+
+* If you're making a change related to a bug, reference the GitHub
+  issue number in the commit message, eg. "This is a partial fix
+  for #646". This will link your commit into the issue comments. If
+  your change is a fix for the bug, put the word "fixes" before the
+  issue number to automatically close the issue once your change
+  is merged.
+
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -279,7 +279,8 @@
 midiread : midifile.c
 	$(CC) -DTEST $(CFLAGS) @LDFLAGS@ midifile.c -o $@
 
-MUS2MID_SOURCES = mus2mid.c memio.c z_native.c i_system.c m_argv.c m_misc.c
-mus2mid : $(MUS2MID_SOURCES)
-	$(CC) -DSTANDALONE -I$(top_builddir) $(CFLAGS) @LDFLAGS@ $(MUS2MID_SOURCES) -o $@
+MUS2MID_SRC_FILES = mus2mid.c memio.c z_native.c i_system.c m_argv.c m_misc.c
+mus2mid : $(MUS2MID_SRC_FILES)
+	$(CC) -DSTANDALONE -I$(top_builddir) $(CFLAGS) @LDFLAGS@ \
+              $(MUS2MID_SRC_FILES) -o $@
 
--- a/src/doom/g_game.c
+++ b/src/doom/g_game.c
@@ -1612,59 +1612,78 @@
 { 
     char *savegame_file;
     char *temp_savegame_file;
+    char *recovery_savegame_file;
 
+    recovery_savegame_file = NULL;
     temp_savegame_file = P_TempSaveGameFile();
     savegame_file = P_SaveGameFile(savegameslot);
 
     // Open the savegame file for writing.  We write to a temporary file
     // and then rename it at the end if it was successfully written.
-    // This prevents an existing savegame from being overwritten by 
+    // This prevents an existing savegame from being overwritten by
     // a corrupted one, or if a savegame buffer overrun occurs.
-
     save_stream = fopen(temp_savegame_file, "wb");
 
     if (save_stream == NULL)
     {
-        return;
+        // Failed to save the game, so we're going to have to abort. But
+        // to be nice, save to somewhere else before we call I_Error().
+        recovery_savegame_file = M_TempFile("recovery.dsg");
+        save_stream = fopen(recovery_savegame_file, "wb");
+        if (save_stream == NULL)
+        {
+            I_Error("Failed to open either '%s' or '%s' to write savegame.",
+                    temp_savegame_file, recovery_savegame_file);
+        }
     }
 
     savegame_error = false;
 
     P_WriteSaveGameHeader(savedescription);
- 
-    P_ArchivePlayers (); 
-    P_ArchiveWorld (); 
-    P_ArchiveThinkers (); 
-    P_ArchiveSpecials (); 
-	 
+
+    P_ArchivePlayers ();
+    P_ArchiveWorld ();
+    P_ArchiveThinkers ();
+    P_ArchiveSpecials ();
+
     P_WriteSaveGameEOF();
-	 
-    // Enforce the same savegame size limit as in Vanilla Doom, 
+
+    // Enforce the same savegame size limit as in Vanilla Doom,
     // except if the vanilla_savegame_limit setting is turned off.
 
     if (vanilla_savegame_limit && ftell(save_stream) > SAVEGAMESIZE)
     {
-        I_Error ("Savegame buffer overrun");
+        I_Error("Savegame buffer overrun");
     }
-    
+
     // Finish up, close the savegame file.
 
     fclose(save_stream);
 
+    if (recovery_savegame_file != NULL)
+    {
+        // We failed to save to the normal location, but we wrote a
+        // recovery file to the temp directory. Now we can bomb out
+        // with an error.
+        I_Error("Failed to open savegame file '%s' for writing.\n"
+                "But your game has been saved to '%s' for recovery.",
+                temp_savegame_file, recovery_savegame_file);
+    }
+
     // Now rename the temporary savegame file to the actual savegame
     // file, overwriting the old savegame if there was one there.
 
     remove(savegame_file);
     rename(temp_savegame_file, savegame_file);
-    
-    gameaction = ga_nothing; 
+
+    gameaction = ga_nothing;
     M_StringCopy(savedescription, "", sizeof(savedescription));
 
     players[consoleplayer].message = DEH_String(GGSAVED);
 
     // draw the pattern into the back screen
-    R_FillBackScreen ();	
-} 
+    R_FillBackScreen ();
+}
  
 
 //
--- a/src/i_joystick.c
+++ b/src/i_joystick.c
@@ -107,7 +107,7 @@
 
 void I_InitJoystick(void)
 {
-    if (!usejoystick)
+    if (!usejoystick || joystick_index < 0)
     {
         return;
     }
@@ -117,7 +117,7 @@
         return;
     }
 
-    if (joystick_index < 0 || joystick_index >= SDL_NumJoysticks())
+    if (joystick_index >= SDL_NumJoysticks())
     {
         printf("I_InitJoystick: Invalid joystick ID: %i\n", joystick_index);
         SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
--- a/src/i_swap.h
+++ b/src/i_swap.h
@@ -35,9 +35,7 @@
 
 // Defines for checking the endianness of the system.
 
-#if SDL_BYTEORDER == SYS_LIL_ENDIAN
-#define SYS_LITTLE_ENDIAN
-#elif SDL_BYTEORDER == SYS_BIG_ENDIAN
+#if SDL_BYTEORDER == SDL_BIG_ENDIAN
 #define SYS_BIG_ENDIAN
 #endif
 
--- a/src/strife/p_inter.c
+++ b/src/strife/p_inter.c
@@ -874,7 +874,8 @@
             P_SetMobjState(target, S_DISR_00);  // 373
         else
         {
-            if(target->health < -target->info->spawnhealth 
+            // haleyjd [STRIFE] 20160111: Rogue changed check from < to <=
+            if(target->health <= -target->info->spawnhealth 
                 && target->info->xdeathstate)
                 P_SetMobjState(target, target->info->xdeathstate);
             else