Skip to content

Commit

Permalink
doom: support Sigil II loaded as pwad
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeday0 committed Dec 21, 2023
1 parent 66497c4 commit 19459a7
Show file tree
Hide file tree
Showing 15 changed files with 113 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/crispy.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ typedef struct
boolean fliplevels;
boolean flipweapons;
boolean haved1e5;
boolean haved1e6;
boolean havee1m10;
boolean havemap33;
boolean havessg;
Expand Down
20 changes: 20 additions & 0 deletions src/doom/d_englsh.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,16 @@
#define HUSTR_E5M8 "E5M8: Halls of Perdition"
#define HUSTR_E5M9 "E5M9: Realm of Iblis"

#define HUSTR_E6M1 "E6M1: Cursed Darkness"
#define HUSTR_E6M2 "E6M2: Violent Hatred"
#define HUSTR_E6M3 "E6M3: Twilight Desolation"
#define HUSTR_E6M4 "E6M4: Fragments of Sanity"
#define HUSTR_E6M5 "E6M5: Wrathful Reckoning"
#define HUSTR_E6M6 "E6M6: Vengeance Unleashed"
#define HUSTR_E6M7 "E6M7: Descent Into Terror"
#define HUSTR_E6M8 "E6M8: Abyss of Despair"
#define HUSTR_E6M9 "E6M9: Shattered Homecoming"

#define HUSTR_1 "level 1: entryway"
#define HUSTR_2 "level 2: underhalls"
#define HUSTR_3 "level 3: the gantlet"
Expand Down Expand Up @@ -511,6 +521,16 @@
"\n"\
"Lock and load. Rip and tear."

#define E6TEXT \
"Satan erred in casting you to Hell's\n"\
"darker depths. His plan failed. He has\n"\
"tried for so long to destroy you, and he\n"\
"has lost every single time. His only\n"\
"option is to flood Earth with demons\n"\
"and hope you go down fighting.\n"\
"\n"\
"Prepare for HELLION!"

// after level 6, put this:

#define C1TEXT \
Expand Down
6 changes: 6 additions & 0 deletions src/doom/d_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2132,6 +2132,12 @@ void D_DoomMain (void)
(W_CheckNumForName("e5m1") != -1) &&
(W_CheckNumForName("wilv40") != -1);

// [crispy] check for presence of a 6th episode
crispy->haved1e6 = (gameversion == exe_ultimate) &&
(W_CheckNumForName("m_epi6") != -1) &&
(W_CheckNumForName("e6m1") != -1) &&
(W_CheckNumForName("wilv50") != -1);

// [crispy] check for presence of E1M10
crispy->havee1m10 = (gamemode == retail) &&
(W_CheckNumForName("e1m10") != -1) &&
Expand Down
4 changes: 2 additions & 2 deletions src/doom/deh_bexpars.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "deh_bexpars.h"
#include "deh_io.h"

int bex_pars[6][10] = {{0}};
int bex_pars[7][10] = {{0}};

Check warning on line 25 in src/doom/deh_bexpars.c

View workflow job for this annotation

GitHub Actions / cpp-linter (clang)

src/doom/deh_bexpars.c:25:5 [cppcoreguidelines-avoid-non-const-global-variables]

variable 'bex_pars' is non-const and globally accessible, consider making it const
int bex_cpars[32] = {0};

static void *DEH_BEXParsStart(deh_context_t *context, char *line)
Expand All @@ -43,7 +43,7 @@ static void DEH_BEXParsParseLine(deh_context_t *context, char *line, void *tag)

if (sscanf(line, "par %32d %32d %32d", &episode, &map, &partime) == 3)
{
if (episode >= 1 && episode <= 5 && map >= 1 && map <= 9)
if (episode >= 1 && episode <= 6 && map >= 1 && map <= 9)

Check warning on line 46 in src/doom/deh_bexpars.c

View workflow job for this annotation

GitHub Actions / cpp-linter (clang)

src/doom/deh_bexpars.c:46:59 [readability-braces-around-statements]

statement should be inside braces
bex_pars[episode][map] = partime;
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/doom/deh_bexpars.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#ifndef DEH_BEXPARS_H
#define DEH_BEXPARS_H

extern int bex_pars[6][10];
extern int bex_pars[7][10];

Check warning on line 22 in src/doom/deh_bexpars.h

View workflow job for this annotation

GitHub Actions / cpp-linter (clang)

src/doom/deh_bexpars.h:22:12 [cppcoreguidelines-avoid-non-const-global-variables]

variable 'bex_pars' is non-const and globally accessible, consider making it const
extern int bex_cpars[32];

#endif /* #ifndef DEH_BEXPARS_H */
2 changes: 2 additions & 0 deletions src/doom/f_finale.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ static textscreen_t textscreens[] =
{ doom, 3, 8, "MFLR8_4", E3TEXT},
{ doom, 4, 8, "MFLR8_3", E4TEXT},
{ doom, 5, 8, "FLOOR7_2", E5TEXT}, // [crispy] Sigil
{ doom, 6, 8, "FLOOR7_2", E6TEXT}, // [crispy] Sigil II

{ doom2, 1, 6, "SLIME16", C1TEXT},
{ doom2, 1, 11, "RROCK14", C2TEXT},
Expand Down Expand Up @@ -1012,6 +1013,7 @@ static void F_ArtScreenDrawer(void)
break;
// [crispy] Sigil
case 5:
case 6:
lumpname = "SIGILEND";
if (W_CheckNumForName(DEH_String(lumpname)) == -1)
{
Expand Down
16 changes: 14 additions & 2 deletions src/doom/g_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -1733,7 +1733,7 @@ void G_ScreenShot (void)


// DOOM Par Times
static const int pars[6][10] =
static const int pars[7][10] =
{
{0},
{0,30,75,120,90,165,180,180,30,165},
Expand All @@ -1743,6 +1743,8 @@ static const int pars[6][10] =
,{0,165,255,135,150,180,390,135,360,180}
// [crispy] Episode 5 par times from Sigil v1.21
,{0,90,150,360,420,780,420,780,300,660}
// [crispy] Episode 6 par times from Sigil II v1.0
,{0,480,300,240,420,510,840,960,390,450}
};

// DOOM II Par Times
Expand Down Expand Up @@ -2011,6 +2013,7 @@ void G_DoCompleted (void)
switch (gameepisode)
{
case 1:
case 6:
wminfo.next = 3;
break;
case 2:
Expand Down Expand Up @@ -2072,7 +2075,9 @@ void G_DoCompleted (void)
// [crispy] single player par times for episode 4
(gameepisode == 4 && crispy->singleplayer) ||
// [crispy] par times for Sigil
gameepisode == 5)
gameepisode == 5 ||
// [crispy] par times for Sigil II
gameepisode == 6)
{
// [crispy] support [PARS] sections in BEX files
if (bex_pars[gameepisode][gamemap])
Expand Down Expand Up @@ -2672,6 +2677,13 @@ G_InitNew
skytexturename = "SKY3";
}
break;
case 6: // [crispy] Sigil II
skytexturename = "SKY6_ZD";
if (R_CheckTextureNumForName(DEH_String(skytexturename)) == -1)
{
skytexturename = "SKY3";
}
break;
}
skytexturename = DEH_String(skytexturename);
skytexture = R_TextureNumForName(skytexturename);
Expand Down
11 changes: 11 additions & 0 deletions src/doom/hu_stuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,17 @@ const char *mapnames[] = // DOOM shareware/registered/retail (Ultimate) names.
HUSTR_E5M8,
HUSTR_E5M9,

// [crispy] Sigil II
HUSTR_E6M1,
HUSTR_E6M2,
HUSTR_E6M3,
HUSTR_E6M4,
HUSTR_E6M5,
HUSTR_E6M6,
HUSTR_E6M7,
HUSTR_E6M8,
HUSTR_E6M9,

"NEWLEVEL",
"NEWLEVEL",
"NEWLEVEL",
Expand Down
25 changes: 24 additions & 1 deletion src/doom/m_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ enum
ep3,
ep4,
ep5, // [crispy] Sigil
ep6, // [crispy] Sigil II
ep_end
} episodes_e;

Expand All @@ -326,6 +327,17 @@ menuitem_t EpisodeMenu[]=
{1,"M_EPI3", M_Episode,'i'},
{1,"M_EPI4", M_Episode,'t'}
,{1,"M_EPI5", M_Episode,'s'} // [crispy] Sigil
,{1,"M_EPI6", M_Episode,'s'} // [crispy] Sigil II
};

// [crispy] have Sigil II but not Sigil
menuitem_t EpisodeMenuSII[]=

Check warning on line 334 in src/doom/m_menu.c

View workflow job for this annotation

GitHub Actions / cpp-linter (clang)

src/doom/m_menu.c:334:12 [cppcoreguidelines-avoid-non-const-global-variables]

variable 'EpisodeMenuSII' is non-const and globally accessible, consider making it const
{
{1,"M_EPI1", M_Episode,'k'},
{1,"M_EPI2", M_Episode,'t'},
{1,"M_EPI3", M_Episode,'i'},
{1,"M_EPI4", M_Episode,'t'}
,{1,"M_EPI6", M_Episode,'s'} // [crispy] Sigil II
};

menu_t EpiDef =
Expand Down Expand Up @@ -1352,6 +1364,9 @@ void M_Episode(int choice)
}

epi = choice;
// [crispy] have Sigil II loaded but not Sigil
if (epi == 4 && crispy->haved1e6 && !crispy->haved1e5)

Check warning on line 1368 in src/doom/m_menu.c

View workflow job for this annotation

GitHub Actions / cpp-linter (clang)

src/doom/m_menu.c:1368:59 [readability-braces-around-statements]

statement should be inside braces
epi = 5;
M_SetupNextMenu(&NewDef);
}

Expand Down Expand Up @@ -3294,10 +3309,18 @@ void M_Init (void)
}

// [crispy] Sigil
if (!crispy->haved1e5)
if (!crispy->haved1e5 && !crispy->haved1e6)
{
EpiDef.numitems = 4;
}
else if (crispy->haved1e5 != crispy->haved1e6)
{
EpiDef.numitems = 5;
if (crispy->haved1e6)
{
EpiDef.menuitems = EpisodeMenuSII;
}
}

// Versions of doom.exe before the Ultimate Doom release only had
// three episodes; if we're emulating one of those then don't try
Expand Down
4 changes: 4 additions & 0 deletions src/doom/p_enemy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1720,6 +1720,10 @@ static boolean CheckBossEnd(mobjtype_t motype)
case 5:
return (gamemap == 8 && !critical->havesigil);

// [crispy] no trigger for Sigil II E6
case 6:
return 0;

default:
return gamemap == 8;
}
Expand Down
2 changes: 1 addition & 1 deletion src/doom/s_sound.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ void S_Start(void)
mus_e1m9, // Tim e4m9
};

if (gameepisode < 4 || gameepisode == 5) // [crispy] Sigil
if (gameepisode < 4 || gameepisode == 5 || gameepisode == 6) // [crispy] Sigil
{
mnum = mus_e1m1 + (gameepisode-1)*9 + gamemap-1;
}
Expand Down
10 changes: 10 additions & 0 deletions src/doom/sounds.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@ musicinfo_t S_music[] =
MUSIC("e5m7"),
MUSIC("e5m8"),
MUSIC("e5m9"),
// [crispy] Sigil II
MUSIC("e6m1"),
MUSIC("e6m2"),
MUSIC("e6m3"),
MUSIC("e6m4"),
MUSIC("e6m5"),
MUSIC("e6m6"),
MUSIC("e6m7"),
MUSIC("e6m8"),
MUSIC("e6m9"),
MUSIC("sigint"),
MUSIC("inter"),
MUSIC("intro"),
Expand Down
10 changes: 10 additions & 0 deletions src/doom/sounds.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@ typedef enum
mus_e5m7,
mus_e5m8,
mus_e5m9,
// [crispy] Sigil II
mus_e6m1,
mus_e6m2,
mus_e6m3,
mus_e6m4,
mus_e6m5,
mus_e6m6,
mus_e6m7,
mus_e6m8,
mus_e6m9,
mus_sigint,
mus_inter,
mus_intro,
Expand Down
3 changes: 2 additions & 1 deletion src/doom/st_stuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,8 @@ ST_Responder (event_t* ev)
if (epsd > 4)
{
// [crispy] Sigil
if (!(crispy->haved1e5 && epsd == 5))
if (!(crispy->haved1e5 && epsd == 5) &&
!(crispy->haved1e6 && epsd == 6))

Check warning on line 1191 in src/doom/st_stuff.c

View workflow job for this annotation

GitHub Actions / cpp-linter (clang)

src/doom/st_stuff.c:1191:52 [readability-braces-around-statements]

statement should be inside braces
return false;
}
if (epsd == 4 && gameversion < exe_ultimate)
Expand Down
6 changes: 5 additions & 1 deletion src/doom/wi_stuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -1555,7 +1555,7 @@ static boolean WI_drawParTime (void)
}

// [crispy] PWAD: par times for Sigil
if (wbs->epsd == 4)
if (wbs->epsd == 4 || wbs->epsd == 5)
{
result = true;
}
Expand Down Expand Up @@ -1875,6 +1875,10 @@ static void WI_loadUnloadData(load_callback_t callback)
{
M_StringCopy(name, DEH_String("SIGILINT"), sizeof(name));
}
else if (crispy->haved1e6 && wbs->epsd == 5 && W_CheckNumForName(DEH_String("SIGILIN2")) != -1) // [crispy] Sigil
{
M_StringCopy(name, DEH_String("SIGILIN2"), sizeof(name));
}
else
{
DEH_snprintf(name, sizeof(name), "WIMAP%d", wbs->epsd);
Expand Down

0 comments on commit 19459a7

Please sign in to comment.