Skip to content
This repository has been archived by the owner on Jun 23, 2023. It is now read-only.

Commit

Permalink
- implemented customizable intermissions. For stability reasons the n…
Browse files Browse the repository at this point in the history
…ew code got offloaded to a separate set of functions because its requirements are just different enough to make it problematic to keep it in the existing ones.
  • Loading branch information
coelckers committed Apr 21, 2017
1 parent 76b03f0 commit 3fc2570
Show file tree
Hide file tree
Showing 7 changed files with 144 additions and 41 deletions.
1 change: 1 addition & 0 deletions prboom2/VisualC2015/Doom.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,7 @@
<ClCompile Include="..\src\e6y.c" />
<ClCompile Include="..\src\e6y_launcher.c" />
<ClCompile Include="..\src\f_finale.c" />
<ClCompile Include="..\src\f_finale2.c" />
<ClCompile Include="..\src\f_wipe.c" />
<ClCompile Include="..\src\gl_clipper.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug NOASM|Win32'">true</ExcludedFromBuild>
Expand Down
3 changes: 3 additions & 0 deletions prboom2/VisualC2015/Doom.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,9 @@
<ClCompile Include="..\src\umapinfo.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\f_finale2.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\am_map.h">
Expand Down
45 changes: 33 additions & 12 deletions prboom2/src/f_finale.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,23 @@
#include "d_deh.h" // Ty 03/22/98 - externalizations
#include "f_finale.h" // CPhipps - hmm...


// The implementation for UMAPINFO is kept separate to avoid demo sync issues
void FMI_Ticker (void);
void FMI_Drawer (void);
void FMI_StartFinale (void);
int using_FMI;


// Stage of animation:
// 0 = text, 1 = art screen, 2 = character cast
static int finalestage; // cph -
static int finalecount; // made static
static const char* finaletext; // cph -
static const char* finaleflat; // made static const
int finalestage; // cph -
int finalecount; // made static
const char* finaletext; // cph -
const char* finaleflat; // made static const

// defines for the end mission display text // phares

#define TEXTSPEED 3 // original value // phares
#define TEXTWAIT 250 // original value // phares
#define NEWTEXTSPEED 0.01f // new value // phares
#define NEWTEXTWAIT 1000 // new value // phares

// CPhipps - removed the old finale screen text message strings;
// they were commented out for ages already
// Ty 03/22/98 - ... the new s_WHATEVER extern variables are used
Expand All @@ -68,7 +71,7 @@ void F_CastDrawer (void);

void WI_checkForAccelerate(void); // killough 3/28/98: used to
extern int acceleratestage; // accelerate intermission screens
static int midstage; // whether we're in "mid-stage"
int midstage; // whether we're in "mid-stage"

//
// F_StartFinale
Expand All @@ -82,6 +85,12 @@ void F_StartFinale (void)
// killough 3/28/98: clear accelerative text flags
acceleratestage = midstage = 0;

if (gamemapinfo)
{
FMI_StartFinale();
return;
}

// Okay - IWAD dependend stuff.
// This has been changed severly, and
// some stuff might have changed in the process.
Expand Down Expand Up @@ -195,7 +204,7 @@ dboolean F_Responder (event_t *event)
// Get_TextSpeed() returns the value of the text display speed // phares
// Rewritten to allow user-directed acceleration -- killough 3/28/98

static float Get_TextSpeed(void)
float Get_TextSpeed(void)
{
return midstage ? NEWTEXTSPEED : (midstage=acceleratestage) ?
acceleratestage=0, NEWTEXTSPEED : TEXTSPEED;
Expand All @@ -217,6 +226,12 @@ static float Get_TextSpeed(void)

void F_Ticker(void)
{
if (using_FMI)
{
FMI_Ticker();
return;
}

int i;
if (!demo_compatibility)
WI_checkForAccelerate(); // killough 3/28/98: check for acceleration
Expand Down Expand Up @@ -276,7 +291,7 @@ void F_Ticker(void)
extern patchnum_t hu_font[HU_FONTSIZE];


static void F_TextWrite (void)
void F_TextWrite (void)
{
V_DrawBackground(finaleflat, 0);
{ // draw some of the text onto the screen
Expand Down Expand Up @@ -642,6 +657,12 @@ static void F_BunnyScroll (void)
//
void F_Drawer (void)
{
if (using_FMI)
{
FMI_Drawer();
return;
}

if (finalestage == 2)
{
F_CastDrawer ();
Expand Down
16 changes: 16 additions & 0 deletions prboom2/src/f_finale.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,22 @@
* FINALE
*/

// Stage of animation:
// 0 = text, 1 = art screen, 2 = character cast
extern int finalestage; // cph -
extern int finalecount; // made static
extern const char* finaletext; // cph -
extern const char* finaleflat; // made static const

// defines for the end mission display text // phares

#define TEXTSPEED 3 // original value // phares
#define TEXTWAIT 250 // original value // phares
#define NEWTEXTSPEED 0.01f // new value // phares
#define NEWTEXTWAIT 1000 // new value // phares



/* Called by main loop. */
dboolean F_Responder (event_t* ev);

Expand Down
19 changes: 12 additions & 7 deletions prboom2/src/g_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -1540,7 +1540,7 @@ int cpars[34] = {
120,30,30,30 // 31-34
};

static dboolean secretexit;
dboolean secretexit;

void G_ExitLevel (void)
{
Expand Down Expand Up @@ -1581,7 +1581,7 @@ void G_DoCompleted (void)
wminfo.nextmapinfo = NULL;
if (gamemapinfo)
{
if (gamemapinfo->endpic[0])
if (gamemapinfo->endpic[0] && gamemapinfo->nointermission)
{
gameaction = ga_victory;
return;
Expand Down Expand Up @@ -1763,18 +1763,23 @@ void G_WorldDone (void)
{
if (gamemapinfo->intertextsecret && secretexit)
{
if (gamemapinfo->intertextsecret[0] == '-') return; // '-' means that any default intermission was cleared.
F_StartFinale();
if (gamemapinfo->intertextsecret[0] != '-') // '-' means that any default intermission was cleared.
F_StartFinale();

return;
}
else if (gamemapinfo->intertext && !secretexit)
{
if (gamemapinfo->intertext[0] == '-') return; // '-' means that any default intermission was cleared.
F_StartFinale();
if (gamemapinfo->intertext[0] != '-') // '-' means that any default intermission was cleared.
F_StartFinale();

return;
}
else if (gamemapinfo->endpic[0] && gamemapinfo->nointermission)
else if (gamemapinfo->endpic[0])
{
// game ends without a status screen.
gameaction = ga_victory;
return;
}
// if nothing applied, use the defaults.
}
Expand Down
62 changes: 59 additions & 3 deletions prboom2/src/umapinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "m_misc.h"
#include "g_game.h"
#include "doomdef.h"
#include "doomstat.h"

/*
UMAOINFO uses an INI-like format,
Expand Down Expand Up @@ -245,6 +246,18 @@ static char *ParseString(struct ParseState *state, int error)

static char *ParseMultiString(struct ParseState *state, int error)
{
if (*state->position == 'c' && state->end - state->position > 5)
{
char cmp[6];
memcpy(cmp, state->position, 5);
cmp[5] = 0;
if (!stricmp(cmp, "clear"))
{
state->position += 5;
return strdup("-"); // this was explicitly deleted to override the default.
}
}

char *build = NULL;
for (;;)
{
Expand All @@ -257,14 +270,17 @@ static char *ParseMultiString(struct ParseState *state, int error)
if (build == NULL) build = str;
else
{
size_t newlen = strlen(build) + strlen(str);
size_t oldlen = strlen(build);
size_t newlen = oldlen + strlen(str) + 1;

build = realloc(build, newlen);
strcpy(build + strlen(build), str);
build[oldlen] = '\n';
strcpy(build + oldlen + 1, str);
build[newlen] = 0;
}
SkipWhitespace(state, false);
if (*state->position != ',') return build;
state->position++;
SkipWhitespace(state, true);
}
}
Expand Down Expand Up @@ -562,6 +578,21 @@ static int ParseStandardProperty(struct ParseState *state, struct MapEntry *mape
{
ParseLumpName(state, mape->endpic, 1);
}
else if (!stricmp(pname, "endcast"))
{
if (ParseInt(state, true)) strcpy(mape->endpic, "$CAST");
else strcpy(mape->endpic, "-");
}
else if (!stricmp(pname, "endbunny"))
{
if (ParseInt(state, true)) strcpy(mape->endpic, "$BUNNY");
else strcpy(mape->endpic, "-");
}
else if (!stricmp(pname, "endgame"))
{
if (ParseInt(state, true)) strcpy(mape->endpic, "!");
else strcpy(mape->endpic, "-");
}
else if (!stricmp(pname, "exitpic"))
{
ParseLumpName(state, mape->exitpic, 1);
Expand Down Expand Up @@ -683,7 +714,6 @@ static int ParseMapEntry(struct ParseState *state, struct MapEntry *val)
}
}


// -----------------------------------------------
//
// Parses a complete UMAPINFO lump
Expand Down Expand Up @@ -718,6 +748,32 @@ int ParseUMapInfo(const unsigned char *buffer, size_t length, umapinfo_errorfunc
return 0;
}

// Set default level progression here to simplify the checks elsewhere. Doing this lets us skip all normal code for this if nothing has been defined.
if (parsed.endpic[0])
{
parsed.nextmap[0] = parsed.nextsecret[0] = 0;
if (parsed.endpic[0] == '!') parsed.endpic[0] = 0;
}
if (!parsed.nextmap[0] && !parsed.endpic[0])
{
if (!stricmp(parsed.mapname, "MAP30")) strcpy(parsed.endpic, "$CAST");
else if (!stricmp(parsed.mapname, "E1M8")) strcpy(parsed.endpic, gamemode == retail? "CREDIT" : "HELP2");
else if (!stricmp(parsed.mapname, "E2M8")) strcpy(parsed.endpic, "VICTORY");
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
{
int ep, map;
G_ValidateMapName(parsed.mapname, &ep, &map);
map++;
if (gamemode == commercial)
sprintf(parsed.nextmap, "MAP%02d", map);
else
sprintf(parsed.nextmap, "E%dM%d", ep, map);
}
}

// Does this property already exist? If yes, replace it.
for(i = 0; i < Maps.mapcount; i++)
{
Expand Down
39 changes: 20 additions & 19 deletions prboom2/src/wi_stuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -965,30 +965,31 @@ void WI_initShowNextLoc(void)
G_WorldDone();
return;
}
state = ShowNextLoc;
}
if ((gamemode != commercial) && (gamemap == 8)) {
else if ((gamemode != commercial) && (gamemap == 8)) {
G_WorldDone();
return;
}
}
else
state = ShowNextLoc;

acceleratestage = 0;

// e6y: That was pretty easy - only a HEX editor and luck
// There is no more desync on ddt-tas.zip\e4tux231.lmp
// --------- tasdoom.idb ---------
// .text:00031194 loc_31194: ; CODE XREF: WI_updateStats+3A9j
// .text:00031194 mov ds:state, 1
// .text:0003119E mov ds:acceleratestage, 0
// .text:000311A8 mov ds:cnt, 3Ch
// nowhere no hide
if (compatibility_level == tasdoom_compatibility)
cnt = 60;
else
cnt = SHOWNEXTLOCDELAY * TICRATE;

state = ShowNextLoc;
acceleratestage = 0;

// e6y: That was pretty easy - only a HEX editor and luck
// There is no more desync on ddt-tas.zip\e4tux231.lmp
// --------- tasdoom.idb ---------
// .text:00031194 loc_31194: ; CODE XREF: WI_updateStats+3A9j
// .text:00031194 mov ds:state, 1
// .text:0003119E mov ds:acceleratestage, 0
// .text:000311A8 mov ds:cnt, 3Ch
// nowhere no hide
if (compatibility_level == tasdoom_compatibility)
cnt = 60;
else
cnt = SHOWNEXTLOCDELAY * TICRATE;

WI_initAnimatedBack(true);
WI_initAnimatedBack(true);
}


Expand Down

1 comment on commit 3fc2570

@LavenderMoon
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I'm just reading this wrong, but it looks like you didn't commit f_finale2.c.

Please sign in to comment.