Skip to content

Commit

Permalink
Add more support for REKKR and Chex IWADs
Browse files Browse the repository at this point in the history
  • Loading branch information
andrikpowell committed Jul 20, 2024
1 parent 2476bf7 commit 995aa86
Show file tree
Hide file tree
Showing 12 changed files with 109 additions and 49 deletions.
47 changes: 41 additions & 6 deletions prboom2/src/d_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,7 @@ void CheckIWAD(const char *iwadname,GameMode_t *gmode,dboolean *hassec)
++sc;
}
// Arsinikk - Unity WAD Check!
// (Check if any iwad lump (TITLEPIC) is 88.62kb)
// (Check if any iwad lump is 88.62kb)
if ((fileinfo[length].size == 90746))
unityedition++;
if (!strncmp(fileinfo[length].name,"DMENUPIC",8) && !unityedition)
Expand Down Expand Up @@ -1069,16 +1069,37 @@ void AddIWAD(const char *iwad)
haswolflevels = false;
}

if (i >= 9 && !strnicmp(iwad + i - 9, "hexen.wad", 9))
{
if (!dsda_Flag(dsda_arg_hexen))
dsda_UpdateFlag(dsda_arg_hexen, true);

gamemode = commercial;
haswolflevels = false;
}

if (i >= 11 && !strnicmp(iwad + i - 11, "rekkrsa.wad", 11))
{
if (!dsda_Flag(dsda_arg_rekkr))
dsda_UpdateFlag(dsda_arg_rekkr, true);
}

if (i >= 8 && !strnicmp(iwad + i - 8, "chex.wad", 8))
{
if (!dsda_Flag(dsda_arg_chex))
dsda_UpdateFlag(dsda_arg_chex, true);
}

switch(gamemode)
{
case retail:
case registered:
case shareware:
gamemission = doom;
if (i>=11 && !strnicmp(iwad+i-11,"rekkrsa.wad",11))
gamemission = rekkr;
gamemission = pack_rekkr;
else if (i>=8 && !strnicmp(iwad+i-8,"chex.wad",8))
gamemission = chex;
gamemission = pack_chex;
break;
case commercial:
gamemission = doom2;
Expand Down Expand Up @@ -1138,6 +1159,10 @@ static char *FindIWADFile(void)
return I_FindWad("heretic.wad");
else if (dsda_Flag(dsda_arg_hexen) || CheckExeSuffix("-hexen"))
return I_FindWad("hexen.wad");
else if (dsda_Flag(dsda_arg_rekkr) || CheckExeSuffix("-rekkr"))
return I_FindWad("rekkrsa.wad");
else if (dsda_Flag(dsda_arg_chex) || CheckExeSuffix("-chex"))
return I_FindWad("chex.wad");

for (i=0; !iwad && i<nstandard_iwads; i++)
iwad = I_FindWad(standard_iwads[i]);
Expand Down Expand Up @@ -1465,6 +1490,8 @@ static const char *D_AutoLoadGameBase()
{
return hexen ? "hexen-all" :
heretic ? "heretic-all" :
rekkr ? "rekkr-all" :
chex ? "chex-all" :
"doom-all";
}

Expand Down Expand Up @@ -1628,17 +1655,25 @@ static void EvaluateDoomVerStr(void)
{
doomverstr = "Hexen";
}
else if (rekkr)
{
doomverstr = "REKKR";
}
else if (chex)
{
doomverstr = "Chex(R) Quest";
}
else
{
switch ( gamemode )
{
case retail:
switch (gamemission)
{
case chex:
case pack_chex:
doomverstr = "Chex(R) Quest";
break;
case rekkr:
case pack_rekkr:
doomverstr = "REKKR";
break;
default:
Expand Down Expand Up @@ -1947,7 +1982,7 @@ static void D_DoomMainSetup(void)
ProcessDehFile(NULL, D_dehout(), lump);
}
}
if (gamemission == chex)
if (chex)
{
int lump = W_CheckNumForName2("CHEXDEH", ns_prboom);
if (lump != LUMP_NOT_FOUND)
Expand Down
6 changes: 4 additions & 2 deletions prboom2/src/doomdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ typedef enum {
pack_plut, // Plutonia pack
pack_nerve, // No Rest For The Living
hacx, // HACX - Twitch 'n Kill
chex, // Chex Quest
rekkr, // REKKR
pack_chex, // Chex Quest
pack_rekkr, // REKKR
none
} GameMission_t;

Expand Down Expand Up @@ -450,6 +450,8 @@ typedef enum {
// TODO_HEXEN: BLINKTHRESHOLD is (4*35)

extern dboolean heretic;
extern dboolean rekkr;
extern dboolean chex;

//hexen

Expand Down
10 changes: 10 additions & 0 deletions prboom2/src/dsda/args.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,16 @@ static arg_config_t arg_config[dsda_arg_count] = {
"sets the game to hexen",
arg_null,
},
[dsda_arg_rekkr] = {
"-rekkr", NULL, NULL,
"sets the game to rekkr",
arg_null,
},
[dsda_arg_chex] = {
"-chex", NULL, NULL,
"sets the game to chex",
arg_null,
},
[dsda_arg_class] = {
"-class", NULL, NULL,
"sets the player class in hexen",
Expand Down
2 changes: 2 additions & 0 deletions prboom2/src/dsda/args.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ typedef enum {
dsda_arg_shorttics,
dsda_arg_heretic,
dsda_arg_hexen,
dsda_arg_rekkr,
dsda_arg_chex,
dsda_arg_class,
dsda_arg_randclass,
dsda_arg_dsdademo,
Expand Down
2 changes: 1 addition & 1 deletion prboom2/src/dsda/episode.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void dsda_AddOriginalEpisodes(void) {
dsda_AddEpisode("map01", "CLERIC", NULL, 'c', true);
dsda_AddEpisode("map01", "MAGE", NULL, 'm', true);
}
else if (gamemode != commercial && gamemission != chex) {
else if (gamemode != commercial && !chex) {
dsda_AddEpisode("e1m1", NULL, "M_EPI1", 'k', true);
dsda_AddEpisode("e2m1", NULL, "M_EPI2", 't', true);
dsda_AddEpisode("e3m1", NULL, "M_EPI3", 'i', true);
Expand Down
32 changes: 32 additions & 0 deletions prboom2/src/dsda/global.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ const char* g_skyflatname;
dboolean hexen = false;
dboolean heretic = false;
dboolean raven = false;
dboolean rekkr = false;
dboolean chex = false;

static void dsda_InitDoom(void) {
int i;
Expand Down Expand Up @@ -610,11 +612,41 @@ static dboolean dsda_AutoDetectHexen(void)
return false;
}

static dboolean dsda_AutoDetectRekkr(void)
{
dsda_arg_t* arg;
int length;
arg = dsda_Arg(dsda_arg_iwad);
if (arg->found) {
length = strlen(arg->value.v_string);
if (length >= 11 && !strnicmp(arg->value.v_string + length - 11, "rekkrsa.wad", 11))
return true;
}

return false;
}

static dboolean dsda_AutoDetectChex(void)
{
dsda_arg_t* arg;
int length;
arg = dsda_Arg(dsda_arg_iwad);
if (arg->found) {
length = strlen(arg->value.v_string);
if (length >= 8 && !strnicmp(arg->value.v_string + length - 8, "chex.wad", 8))
return true;
}

return false;
}

extern void dsda_ResetNullPClass(void);

void dsda_InitGlobal(void) {
heretic = dsda_Flag(dsda_arg_heretic) || dsda_AutoDetectHeretic();
hexen = dsda_Flag(dsda_arg_hexen) || dsda_AutoDetectHexen();
rekkr = dsda_Flag(dsda_arg_rekkr) || dsda_AutoDetectRekkr();
chex = dsda_Flag(dsda_arg_chex) || dsda_AutoDetectChex();
raven = heretic || hexen;

if (hexen)
Expand Down
2 changes: 1 addition & 1 deletion prboom2/src/dsda/hud_components/sml_armor.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ static void dsda_DrawComponent(void) {
lump = 0;
}
else {
if (gamemission == chex) {
if (chex) {
if (player->armortype < 2)
lump = W_CheckNumForName("CHXARMS1");
else
Expand Down
2 changes: 1 addition & 1 deletion prboom2/src/dsda/hud_components/sml_berserk.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ static local_component_t* local;

static const char* dsda_BerserkName(player_t* player) {
if (player->powers[pw_strength])
if (gamemission == chex) { return "CHXPSTR"; }
if (chex) { return "CHXPSTR"; }
else if (unityedition) { return "STFPSTR2"; }
else { return "STFPSTR"; }
else
Expand Down
8 changes: 4 additions & 4 deletions prboom2/src/dsda/mapinfo/legacy.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ int dsda_LegacyNextMap(int* episode, int* map) {
int dsda_LegacyShowNextLocBehaviour(int* behaviour) {
if (
gamemode != commercial &&
(gamemap == 8 || (gamemission == chex && gamemap == 5))
(gamemap == 8 || (chex && gamemap == 5))
)
*behaviour = WI_SHOW_NEXT_DONE;
else
Expand Down Expand Up @@ -261,7 +261,7 @@ int dsda_LegacyResolveCLEV(int* clev, int* episode, int* map) {
if (dsda_CannotCLEV(*episode, *map))
*clev = false;
else {
if (gamemission == chex)
if (chex)
*episode = 1;

*clev = true;
Expand Down Expand Up @@ -410,7 +410,7 @@ int dsda_LegacyHUTitle(dsda_string_t* str) {
case retail:
// Chex.exe always uses the episode 1 level title
// eg. E2M1 gives the title for E1M1
if (gamemission == chex && gamemap < 10)
if (chex && gamemap < 10)
dsda_StringCat(str, *mapnames[gamemap - 1]);
else if (gameepisode < 6 && gamemap < 10)
dsda_StringCat(str, *mapnames[(gameepisode - 1) * 9 + gamemap - 1]);
Expand Down Expand Up @@ -609,7 +609,7 @@ int dsda_LegacyPrepareFinale(int* result) {
*result = WD_START_FINALE;
else if (gamemap == 8)
*result = WD_VICTORY;
else if (gamemap == 5 && gamemission == chex)
else if (gamemap == 5 && chex)
*result = WD_VICTORY;

if (dsda_FinaleShortcut())
Expand Down
2 changes: 1 addition & 1 deletion prboom2/src/p_inter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1151,7 +1151,7 @@ static void P_KillMobj(mobj_t *source, mobj_t *target)
target->tics = 1;

// In Chex Quest, monsters don't drop items.
if (gamemission == chex)
if (chex)
{
return;
}
Expand Down
43 changes: 11 additions & 32 deletions prboom2/src/st_stuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,6 @@ static int veryfirsttime = 1;

// CPhipps - no longer do direct PLAYPAL handling here

dboolean fullmenu;

// used for timing
static unsigned int st_clock;

Expand Down Expand Up @@ -474,7 +472,7 @@ static void ST_refreshBackground(void)
}

// Set armor hud indicators
if (gamemission == chex)
if (chex)
{
R_SetPatchNum(&armor1icon, "CHXARMS1");
R_SetPatchNum(&armor2icon, "CHXARMS2");
Expand All @@ -494,12 +492,12 @@ static void ST_refreshBackground(void)
}

// Arsinikk - fullmenu is needed to hide indicators in complex menu screens
if (fullmenu)
if (!fullmenu)
{
// Arsinikk - display berserk indicator
if ((plyr->powers[pw_strength]) && (berserk_icon > 0))
{
if (gamemission == chex)
if (chex)
V_DrawNumPatch(ST_BERSERKCHEXX, ST_BERSERKCHEXY, BG, berserk.lumpnum, CR_DEFAULT, flags);
else
V_DrawNumPatch(ST_BERSERKX, ST_BERSERKY, BG, berserk.lumpnum, CR_DEFAULT, flags);
Expand All @@ -508,14 +506,14 @@ static void ST_refreshBackground(void)
// (changes based on lack of armor or type)
if ((plyr->armortype >= 2) && (armor_icon > 0))
{
if (gamemission == chex)
if (chex)
V_DrawNumPatch(ST_ARMORCHEXX, ST_ARMORCHEXY, BG, armor2icon.lumpnum, CR_DEFAULT, flags);
else
V_DrawNumPatch(ST_ARMORICONX, ST_ARMORICONY, BG, armor2icon.lumpnum, CR_DEFAULT, flags);
}
else if ((plyr->armortype == 1) && (armor_icon > 0))
{
if (gamemission == chex)
if (chex)
V_DrawNumPatch(ST_ARMORCHEXX, ST_ARMORCHEXY, BG, armor1icon.lumpnum, CR_DEFAULT, flags);
else
V_DrawNumPatch(ST_ARMORICONX, ST_ARMORICONY, BG, armor1icon.lumpnum, CR_DEFAULT, flags);
Expand Down Expand Up @@ -846,7 +844,7 @@ static void ST_doPaletteStuff(void)
// radiation suit palette is used to tint the screen green,
// as though the player is being covered in goo by an
// attacking flemoid.
if (gamemission == chex)
if (chex)
{
palette = RADIATIONPAL;
}
Expand Down Expand Up @@ -909,7 +907,7 @@ int ST_HealthColor(int health)
return cr_health_super;
}

void ST_drawWidgets(dboolean refresh)
static void ST_drawWidgets(dboolean refresh)
{
int i;

Expand Down Expand Up @@ -1008,29 +1006,10 @@ void ST_Drawer(dboolean refresh)
// from "Pirate Doom II")
//
// Also fixes the new armor and berserk stbar indicators!
if (!(V_IsOpenGLMode()))
{
if ((statusbaron) && !(V_IsOpenGLMode())) {
ST_refreshBackground();
if (!fullmenu)
ST_drawWidgets(true);
}
}
if (statusbaron) {
if (st_firsttime || (V_IsOpenGLMode()))
{
/* If just after ST_Start(), refresh all */
st_firsttime = false;
ST_refreshBackground(); // draw status bar background to off-screen buff
if (!fullmenu)
ST_drawWidgets(true); // and refresh all widgets
}
else
{
/* Otherwise, update as little as possible */
if (!fullmenu)
ST_drawWidgets(false); // update all widgets
}
ST_refreshBackground();
if (!fullmenu)
ST_drawWidgets(true);
}

V_EndUIDraw();
Expand Down Expand Up @@ -1072,7 +1051,7 @@ static void ST_loadGraphics(void)
// Set berserk hud indicators
// Green cross for bfg edition (unity)

if (gamemission == chex) R_SetPatchNum(&berserk, "CHXPSTR");
if (chex) R_SetPatchNum(&berserk, "CHXPSTR");
else if (unityedition) R_SetPatchNum(&berserk, "STFPSTR2");
else R_SetPatchNum(&berserk, "STFPSTR");

Expand Down
2 changes: 1 addition & 1 deletion prboom2/src/umapinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ int ParseUMapInfo(const unsigned char *buffer, size_t length, umapinfo_errorfunc
else if (!stricmp(parsed.mapname, "E2M8")) strcpy(parsed.endpic, "VICTORY2");
else if (!stricmp(parsed.mapname, "E3M8")) strcpy(parsed.endpic, "$BUNNY");
else if (!stricmp(parsed.mapname, "E4M8")) strcpy(parsed.endpic, "ENDPIC");
else if (gamemission == chex && !stricmp(parsed.mapname, "E1M5")) strcpy(parsed.endpic, "CREDIT");
else if (chex && !stricmp(parsed.mapname, "E1M5")) strcpy(parsed.endpic, "CREDIT");
else
{
int ep, map;
Expand Down

0 comments on commit 995aa86

Please sign in to comment.