shithub: choc

Download patch

ref: 16e404d5f80e9f6dd343eb47d421fc69b3d82728
parent: be45b255275fb26c264361ccd28dd8f8999858a4
parent: 211c7f396a34571a0f8a33dc8ba9f6573c9b4903
author: Simon Howard <fraggle@soulsphere.org>
date: Sun Jul 26 08:42:44 EDT 2020

Merge pull request #1303 from mfrancis95/resolve896

Add separate savegame directories for Freedoom (resolve #896)

--- a/src/d_iwad.c
+++ b/src/d_iwad.c
@@ -928,7 +928,7 @@
 // Get the IWAD name used for savegames.
 //
 
-const char *D_SaveGameIWADName(GameMission_t gamemission)
+const char *D_SaveGameIWADName(GameMission_t gamemission, GameVariant_t gamevariant)
 {
     size_t i;
 
@@ -938,6 +938,22 @@
     // Note that we match on gamemission rather than on IWAD name.
     // This ensures that doom1.wad and doom.wad saves are stored
     // in the same place.
+
+    if (gamevariant == freedoom)
+    {
+        if (gamemission == doom)
+        {
+            return "freedoom1.wad";
+        }
+        else if (gamemission == doom2)
+        {
+            return "freedoom2.wad";
+        }
+    }
+    else if (gamevariant == freedm && gamemission == doom2)
+    {
+        return "freedm.wad";
+    }
 
     for (i=0; i<arrlen(iwads); ++i)
     {
--- a/src/d_iwad.h
+++ b/src/d_iwad.h
@@ -44,7 +44,7 @@
 char *D_TryFindWADByName(const char *filename);
 char *D_FindIWAD(int mask, GameMission_t *mission);
 const iwad_t **D_FindAllIWADs(int mask);
-const char *D_SaveGameIWADName(GameMission_t gamemission);
+const char *D_SaveGameIWADName(GameMission_t gamemission, GameVariant_t gamevariant);
 const char *D_SuggestIWADName(GameMission_t mission, GameMode_t mode);
 const char *D_SuggestGameName(GameMission_t mission, GameMode_t mode);
 void D_CheckCorrectIWAD(GameMission_t mission);
--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -1567,8 +1567,7 @@
         }
 
         // auto-loaded files per IWAD
-
-        autoload_dir = M_GetAutoloadDir(D_SaveGameIWADName(gamemission));
+        autoload_dir = M_GetAutoloadDir(D_SaveGameIWADName(gamemission, gamevariant));
         DEH_AutoLoadPatches(autoload_dir);
         W_AutoLoadWADs(autoload_dir);
         free(autoload_dir);
@@ -1681,7 +1680,7 @@
     // we've finished loading Dehacked patches.
     D_SetGameDescription();
 
-    savegamedir = M_GetSaveGameDir(D_SaveGameIWADName(gamemission));
+    savegamedir = M_GetSaveGameDir(D_SaveGameIWADName(gamemission, gamevariant));
 
     // Check for -file in shareware
     if (modifiedgame && (gamevariant != freedoom))