Skip to content

Commit

Permalink
Add secretIntermissionText to DMAPINFO
Browse files Browse the repository at this point in the history
  • Loading branch information
viciious committed Jul 9, 2024
1 parent 9a7a612 commit 0a8ef11
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
4 changes: 4 additions & 0 deletions d_mapinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ static void G_AddMapinfoKey(char* key, char* value, dmapinfo_t* mi)
mi->songNum = S_SongForName(value);
else if (!D_strcasecmp(key, "intermissionText"))
mi->interText = value;
else if (!D_strcasecmp(key, "secretIntermissionText"))
mi->secretInterText = value;
}

static void G_FixSPCMDirList(dgameinfo_t *gi)
Expand Down Expand Up @@ -484,6 +486,8 @@ dmapinfo_t **G_LoadMaplist(int *pmapcount, dgameinfo_t* gi)
D_memset(mi, 0, sizeof(*mi));
mi->skyTexture = -1;
mi->songNum = mus_none;
mi->interText = "";
mi->secretInterText = "";

linecount = G_ParseMapinfo(zsection, (kvcall_t)&G_AddMapinfoKey, mi);
if (linecount < 2 || mi->mapNumber <= 0)
Expand Down
2 changes: 1 addition & 1 deletion d_mapinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ typedef struct
char *secretNext;
char *lumpName;
char *interText;
char *secretInterText;
} dmapinfo_t;

typedef struct
Expand All @@ -68,7 +69,6 @@ typedef struct
VINT noAttractDemo;
VINT stopFireTime;
VINT titleStartPos;
char* interText;
char* endText;
void* data;
} dgameinfo_t;
Expand Down
11 changes: 9 additions & 2 deletions f_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -622,9 +622,16 @@ void F_Drawer (void)
if (!--fin->textdelay)
{
char str[2];
const char *text = finale ? gameinfo.endText : gamemapinfo.interText;
const char *text;

if (!text)
if (finale)
text = gameinfo.endText;
else if (gameaction == ga_secretexit && *gamemapinfo.secretInterText)
text = gamemapinfo.secretInterText;
else
text = gamemapinfo.interText;

if (!text || !*text)
return;
str[1] = 0;
str[0] = text[fin->textindex];
Expand Down
16 changes: 9 additions & 7 deletions g_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ void G_RunGame (void)
#ifdef JAGUAR
int nextmap;
#endif
boolean finale_ = false;
boolean finale_ = false, secretexit;

/* run a level until death or completion */
MiniLoop(P_Start, P_Stop, P_Ticker, P_Drawer, P_Update);
Expand Down Expand Up @@ -623,7 +623,8 @@ void G_RunGame (void)
continue; /* skip intermission */
}

if (gameaction == ga_secretexit && gamemapinfo.secretNext)
secretexit = gameaction == ga_secretexit && gamemapinfo.secretNext;
if (secretexit)
nextmapl = gamemapinfo.secretNext;
else
nextmapl = gamemapinfo.next;
Expand Down Expand Up @@ -669,14 +670,15 @@ void G_RunGame (void)
MiniLoop (IN_Start, IN_Stop, IN_Ticker, IN_Drawer, I_Update);

/* run a text screen */
if (gamemapinfo.interText && *gamemapinfo.interText && netgame != gt_deathmatch)
{
if (netgame != gt_deathmatch)
if (*gamemapinfo.secretInterText || *gamemapinfo.interText)
{
#ifdef MARS
MiniLoop(F_Start, F_Stop, F_Ticker, F_Drawer, I_Update);
MiniLoop(F_Start, F_Stop, F_Ticker, F_Drawer, I_Update);
#else
MiniLoop(F_Start, F_Stop, F_Ticker, F_Drawer, UpdateBuffer);
MiniLoop(F_Start, F_Stop, F_Ticker, F_Drawer, UpdateBuffer);
#endif
}
}

/* run the finale if needed */
finale = finale_;
Expand Down

0 comments on commit 0a8ef11

Please sign in to comment.