Skip to content

Commit

Permalink
Doom: Add support for 4-6 episode par times in BEX
Browse files Browse the repository at this point in the history
Co-Authored-By: Michael Day <[email protected]>
  • Loading branch information
Dasperal and mikeday0 committed Jan 22, 2024
1 parent 8dba533 commit f943223
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 46 deletions.
4 changes: 2 additions & 2 deletions src/doom/deh_bexpars.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include "deh_io.h"

int bex_pars[4][10] = {{0}};
int bex_pars[7][10] = {{0}};
int bex_cpars[32] = {0};

static void *DEH_BEXParsStart(deh_context_t *context, char *line)
Expand All @@ -42,7 +42,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 <= 3 && map >= 1 && map <= 9)
if (episode >= 1 && episode <= 6 && map >= 1 && map <= 9)
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,5 +19,5 @@

#pragma once

extern int bex_pars[6][10];
extern int bex_pars[7][10];
extern int bex_cpars[32];
58 changes: 16 additions & 42 deletions src/doom/g_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -1410,12 +1410,15 @@ void G_ScreenShot (void)


// DOOM Par Times
static const int pars[4][10] =
static const int pars[7][10] =
{
{0},
{0, 30, 75, 120, 90, 165, 180, 180, 30, 165}, // Episode 1
{0, 90, 90, 90, 120, 90, 360, 240, 30, 170}, // Episode 2
{0, 90, 45, 90, 150, 90, 90, 165, 30, 135} // Episode 3
{0, 30, 75, 120, 90, 165, 180, 180, 30, 165}, // Episode 1
{0, 90, 90, 90, 120, 90, 360, 240, 30, 170}, // Episode 2
{0, 90, 45, 90, 150, 90, 90, 165, 30, 135}, // Episode 3
{0, 165, 255, 135, 150, 180, 390, 135, 360, 180}, // [crispy] Episode 4 par times from the BFG Edition
{0, 90, 150, 360, 420, 780, 420, 780, 300, 660}, // [JN] Episode 5 par times from Sigil v1.21
{0, 480, 300, 240, 420, 510, 840, 960, 390, 450} // [Dasperal] Episode 6 par times from Sigil II v1.0
};

// DOOM II Par Times
Expand All @@ -1427,24 +1430,6 @@ static const int cpars[32] =
120, 30 // 31-32
};

// [crispy] Episode 4 par times from the BFG Edition
static const int e4pars[10] =
{
0, 165, 255, 135, 150, 180, 390, 135, 360, 180
};

// [JN] Sigil par times
static const int e5pars[10] =
{
0, 90, 150, 360, 420, 780, 420, 780, 300, 660
};

// [Dasperal] Sigil 2 par times
static const int e6pars[10] =
{
0, 480, 300, 240, 420, 510, 840, 960, 390, 450
};

// [JN] Press Beta Par Times
static const int bpars[4][10] =
{
Expand Down Expand Up @@ -1639,6 +1624,7 @@ void G_DoCompleted (void)
switch (gameepisode)
{
case 1:
case 6: // [Dasperal] Sigil 2
wminfo.next = 3;
break;
case 2:
Expand All @@ -1653,9 +1639,6 @@ void G_DoCompleted (void)
case 5: // [crispy] Sigil
wminfo.next = 6;
break;
case 6: // [Dasperal] Sigil 2
wminfo.next = 3;
break;
}
}

Expand Down Expand Up @@ -1690,29 +1673,20 @@ void G_DoCompleted (void)
wminfo.partime = TICRATE*cpars[gamemap-1];
}
}
else if (gameepisode < 4)
else if(gameepisode < 4
|| (gameepisode == 4 && singleplayer)
|| gameepisode == 5
|| gameepisode == 6)
{
// [crispy] support [PARS] sections in BEX files
if (bex_pars[gameepisode][gamemap])
if(bex_pars[gameepisode][gamemap])
{
wminfo.partime = TICRATE*bex_pars[gameepisode][gamemap];
}
else
wminfo.partime = TICRATE*pars[gameepisode][gamemap];
}
else if (gameepisode == 4 && singleplayer)
{
wminfo.partime = TICRATE*e4pars[gamemap];
}
else if (gameepisode == 5)
{
// [JN] Sigil
wminfo.partime = TICRATE*e5pars[gamemap];
}
else if (gameepisode == 6)
{
// [Dasperal] Sigil 2
wminfo.partime = TICRATE*e6pars[gamemap];
{
wminfo.partime = TICRATE * pars[gameepisode][gamemap];
}
}
else
{
Expand Down
5 changes: 4 additions & 1 deletion src/doom/wi_stuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -1769,7 +1769,10 @@ static void WI_drawStats (void)

WI_drawTime((origwidth/2 - SP_TIMEX)+wide_delta, SP_TIMEY, cnt_time, true);

if (wbs->epsd < 4+1+1) // [JN] Sigil + Sigil 2: extra episodes
if(wbs->epsd < 3
|| (wbs->epsd == 3 && singleplayer) // [crispy] Episode 4
|| wbs->epsd == 4 // [crispy] Sigil
|| wbs->epsd == 5) // [crispy] Sigil 2
{
V_DrawShadowedPatchDoom(origwidth/2 + SP_TIMEX, SP_TIMEY,
english_language ? par : par_rus);
Expand Down

0 comments on commit f943223

Please sign in to comment.