Skip to content

Commit

Permalink
- RR progression fixes.
Browse files Browse the repository at this point in the history
* E1L7 abuses an 'end the game' command to progress to E2L1, this needs special treatment.
* handle ENDGAME.MAP more cleanly by injecting an 'engine.con' into the compilation chain to define its map record. The main issue with this is that it needs to be defined before the regular CONs run.
* check the already defined 'clearinventory' and 'clearweapons' flags that are exposed through RMAPINFO (Duke/RR only so far.)
  • Loading branch information
coelckers committed May 2, 2021
1 parent 9bc210f commit dbd179b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 26 deletions.
1 change: 1 addition & 0 deletions source/core/mapinfo.h
Expand Up @@ -29,6 +29,7 @@ enum EMapFlags
LEVEL_SECRETEXITOVERRIDE = 2, // when given an explicit level number, override with secret exit in the map, mainly for compiling episodes out of single levels.
LEVEL_CLEARINVENTORY = 4,
LEVEL_CLEARWEAPONS = 8,
LEVEL_FORCENOEOG = 16, // RR E1L7 needs this to override its boss's death ending the game.
};

enum EMapGameFlags
Expand Down
32 changes: 9 additions & 23 deletions source/games/duke/src/gamedef.cpp
Expand Up @@ -3239,8 +3239,15 @@ void FixMapinfo()
{
if (isRR() && map->cluster == 1)
{
auto nextmap = FindMapByIndexOnly(map->cluster + 1, 1);
if (nextmap) map->NextMap = nextmap->labelName;
if (!FindMapByIndexOnly(map->cluster, map->mapindex + 1))
{
auto nextmap = FindMapByIndexOnly(map->cluster + 1, 1);
if (nextmap)
{
map->NextMap = nextmap->labelName;
map->flags |= LEVEL_FORCENOEOG;
}
}
}
}

Expand All @@ -3256,27 +3263,6 @@ void FixMapinfo()
if (maprec) maprec->NextMap = "e1l5";
}
}
else if (isRR())
{
if (!isRRRA())
{
// RR does not define its final level and crudely hacked it into the progression. This puts it into the E2L8 slot so that the game can naturally progress there.
auto maprec1 = FindMapByLevelNum(makelevelnum(1, 6)); // E2L7 must exist
auto maprec2 = FindMapByLevelNum(makelevelnum(1, 7)); // E2L8 must not exist
auto maprec3 = FindMapByName("endgame"); // endgame must not have a map record already
int num3 = fileSystem.FindFile("endgame.map"); // endgame.map must exist.
if (maprec1 && !maprec2 && !maprec3 && num3 >= 0)
{
auto maprec = AllocateMap();
maprec->designerTime = 0;
maprec->parTime = 0;
maprec->SetFileName("endgame.map");
maprec->SetName("$TXT_CLOSEENCOUNTERS");
maprec->levelNumber = makelevelnum(1, 7);
maprec->cluster = 2;
}
}
}
}

END_DUKE_NS
7 changes: 4 additions & 3 deletions source/games/duke/src/premap.cpp
Expand Up @@ -911,7 +911,7 @@ void enterlevel(MapRecord *mi, int gamemode)

for (int i = connecthead; i >= 0; i = connectpoint2[i])
{
bool clearweapon = false;
bool clearweapon = !!(currentLevel->flags & LEVEL_CLEARWEAPONS);
int pn = sector[ps[i].GetActor()->s->sectnum].floorpicnum;
if (pn == TILE_HURTRAIL || pn == TILE_FLOORSLIME || pn == TILE_FLOORPLASMA)
{
Expand All @@ -928,6 +928,7 @@ void enterlevel(MapRecord *mi, int gamemode)
ps[i].kickback_pic = 0;
ps[i].okickback_pic = ps[i].kickback_pic = 0;
}
if (currentLevel->flags & LEVEL_CLEARINVENTORY) resetinventory(i);
}
resetmys();

Expand Down Expand Up @@ -992,10 +993,10 @@ void GameInterface::NewGame(MapRecord* map, int skill, bool)

bool setnextmap(bool checksecretexit)
{
MapRecord* map = nullptr;;
MapRecord* map = nullptr;
MapRecord* from_bonus = nullptr;

if (ud.eog)
if (ud.eog && !(currentLevel->flags & LEVEL_FORCENOEOG))
{
}
else if (checksecretexit && ud.from_bonus == 0)
Expand Down
1 change: 1 addition & 0 deletions wadsrc/static/filter/redneck.redneck/engine/engine.con
@@ -0,0 +1 @@
definelevelname 1 7 endgame.map 02:00 02:00 $TXT_CLOSEENCOUNTERS

0 comments on commit dbd179b

Please sign in to comment.