remove GameVariant_t, add more *-all autoload folders (#1623)

* remove pack_freedoom
This commit is contained in:
Roman Fomin 2024-03-31 23:19:59 +07:00 committed by GitHub
parent 4aab690db3
commit d2c8914adb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 81 additions and 45 deletions

View File

@ -46,7 +46,7 @@ typedef enum
// Fallback IWADs to use if no IWADs are detected.
static const iwad_t fallback_iwads[] = {
{ "doom.wad", doom, retail, vanilla, "Doom" }
{ "doom.wad", doom, retail, "Doom" }
};
// Array of IWADs found to be installed

View File

@ -28,22 +28,17 @@
#include "m_misc.h"
static const iwad_t iwads[] = {
{"doom2.wad", doom2, commercial, vanilla, "Doom II" },
{"plutonia.wad", pack_plut, commercial, vanilla,
"Final Doom: Plutonia Experiment" },
{"tnt.wad", pack_tnt, commercial, vanilla, "Final Doom: TNT: Evilution"},
// "doom.wad" may be retail or registered
{"doom.wad", doom, indetermined, vanilla, "Doom" },
{"doom1.wad", doom, indetermined, vanilla, "Doom Shareware" },
{"doom2f.wad", doom2, commercial, vanilla, "Doom II: L'Enfer sur Terre"},
{"chex.wad", pack_chex, retail, vanilla, "Chex Quest" },
{"hacx.wad", pack_hacx, commercial, vanilla, "Hacx" },
{"freedoom2.wad", doom2, commercial, freedoom, "Freedoom: Phase 2" },
{"freedoom1.wad", doom, retail, freedoom, "Freedoom: Phase 1" },
{"freedm.wad", doom2, commercial, freedoom, "FreeDM" },
{"rekkrsa.wad", pack_rekkr, retail, vanilla, "REKKR" },
{"rekkrsl.wad", pack_rekkr, retail, vanilla, "REKKR: Sunken Land" },
{"miniwad.wad", doom2, commercial, miniwad, "miniwad" }
{"doom2.wad", doom2, commercial, "Doom II" },
{"plutonia.wad", pack_plut, commercial, "Final Doom: Plutonia Experiment"},
{"tnt.wad", pack_tnt, commercial, "Final Doom: TNT: Evilution" },
// "doom.wad" may be retail or registered
{"doom.wad", doom, indetermined, "Doom" },
{"doom1.wad", doom, indetermined, "Doom Shareware" },
{"doom2f.wad", doom2, commercial, "Doom II: L'Enfer sur Terre" },
{"chex.wad", pack_chex, retail, "Chex Quest" },
{"hacx.wad", pack_hacx, commercial, "Hacx" },
{"rekkrsa.wad", pack_rekkr, retail, "REKKR" },
{"rekkrsl.wad", pack_rekkr, retail, "REKKR: Sunken Land" },
};
// "128 IWAD search directories should be enough for anybody".
@ -727,8 +722,7 @@ char *D_TryFindWADByName(const char *filename)
// D_FindIWADFile
//
char *D_FindIWADFile(GameMode_t *mode, GameMission_t *mission,
GameVariant_t *variant)
char *D_FindIWADFile(GameMode_t *mode, GameMission_t *mission)
{
char *result;
@ -784,7 +778,6 @@ char *D_FindIWADFile(GameMode_t *mode, GameMission_t *mission,
{
*mode = iwads[i].mode;
*mission = iwads[i].mission;
*variant = iwads[i].variant;
break;
}
}
@ -837,3 +830,16 @@ const iwad_t **D_GetIwads(void)
return result;
}
GameMission_t D_GetGameMissionByIWADName(const char *name)
{
for (int i = 0; i < arrlen(iwads); ++i)
{
if (!strcasecmp(name, iwads[i].name))
{
return iwads[i].mission;
}
}
return none;
}

View File

@ -26,16 +26,15 @@ typedef struct
const char *name;
GameMission_t mission;
GameMode_t mode;
GameVariant_t variant;
const char *description;
} iwad_t;
char *D_DoomExeDir(void); // killough 2/16/98: path to executable's dir
char *D_FindWADByName(const char *filename);
char *D_TryFindWADByName(const char *filename);
char *D_FindIWADFile(GameMode_t *mode, GameMission_t *mission,
GameVariant_t *variant);
char *D_FindIWADFile(GameMode_t *mode, GameMission_t *mission);
boolean D_IsIWADName(const char *name);
const iwad_t **D_GetIwads(void);
GameMission_t D_GetGameMissionByIWADName(const char *name);
#endif

View File

@ -1144,7 +1144,7 @@ void IdentifyVersion (void)
// locate the IWAD and determine game mode from it
iwad = D_FindIWADFile(&gamemode, &gamemission, &gamevariant);
iwad = D_FindIWADFile(&gamemode, &gamemission);
if (iwad && *iwad)
{
@ -1729,14 +1729,34 @@ static void D_AutoloadIWadDir()
{
char *autoload_dir;
autoload_dir = GetAutoloadDir(*base, "all-all", true);
AutoLoadWADs(autoload_dir);
free(autoload_dir);
GameMission_t local_gamemission = D_GetGameMissionByIWADName(M_BaseName(wadfiles[0]));
// common auto-loaded files for all Doom flavors
if (gamemission < pack_chex &&
gamevariant != freedoom &&
gamevariant != miniwad)
if (local_gamemission != none)
{
autoload_dir = GetAutoloadDir(*base, "doom-all", true);
AutoLoadWADs(autoload_dir);
free(autoload_dir);
if (local_gamemission < pack_chex)
{
autoload_dir = GetAutoloadDir(*base, "doom-all", true);
AutoLoadWADs(autoload_dir);
free(autoload_dir);
}
if (local_gamemission == doom)
{
autoload_dir = GetAutoloadDir(*base, "doom1-all", true);
AutoLoadWADs(autoload_dir);
free(autoload_dir);
}
else if (local_gamemission >= doom2 && local_gamemission <= pack_plut)
{
autoload_dir = GetAutoloadDir(*base, "doom2-all", true);
AutoLoadWADs(autoload_dir);
free(autoload_dir);
}
}
// auto-loaded files per IWAD
@ -1796,14 +1816,34 @@ static void D_AutoloadDehDir()
{
char *autoload_dir;
autoload_dir = GetAutoloadDir(*base, "all-all", true);
AutoLoadPatches(autoload_dir);
free(autoload_dir);
GameMission_t local_gamemission = D_GetGameMissionByIWADName(M_BaseName(wadfiles[0]));
// common auto-loaded files for all Doom flavors
if (gamemission < pack_chex &&
gamevariant != freedoom &&
gamevariant != miniwad)
if (local_gamemission != none)
{
autoload_dir = GetAutoloadDir(*base, "doom-all", true);
AutoLoadPatches(autoload_dir);
free(autoload_dir);
if (local_gamemission < pack_chex)
{
autoload_dir = GetAutoloadDir(*base, "doom-all", true);
AutoLoadPatches(autoload_dir);
free(autoload_dir);
}
if (local_gamemission == doom)
{
autoload_dir = GetAutoloadDir(*base, "doom1-all", true);
AutoLoadPatches(autoload_dir);
free(autoload_dir);
}
else if (local_gamemission >= doom2 && local_gamemission <= pack_plut)
{
autoload_dir = GetAutoloadDir(*base, "doom2-all", true);
AutoLoadPatches(autoload_dir);
free(autoload_dir);
}
}
// auto-loaded files per IWAD

View File

@ -43,13 +43,6 @@ typedef enum {
none
} GameMission_t;
typedef enum
{
vanilla, // Vanilla Doom
freedoom, // FreeDoom: Phase 1 + 2 and FreeDM
miniwad // miniwad
} GameVariant_t;
// Identify language to use, software localization.
typedef enum {
english,

View File

@ -23,7 +23,6 @@
// Game Mode - identify IWAD as shareware, retail etc.
GameMode_t gamemode = indetermined;
GameMission_t gamemission = doom;
GameVariant_t gamevariant = vanilla;
// [FG] emulate a specific version of Doom
GameVersion_t gameversion = exe_doom_1_9;

View File

@ -50,7 +50,6 @@ extern int screenblocks; // killough 11/98
extern GameMode_t gamemode;
extern GameMission_t gamemission;
extern GameVariant_t gamevariant;
// [FG] emulate a specific version of Doom
extern GameVersion_t gameversion;