From 63eaec916bafc573dd61c64071f864c6a94acdf9 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 7 Jul 2020 21:38:20 +0200 Subject: [PATCH] - fixed a few things. Basic level progression is working, special cases still need testing, but for now it's good enough. --- source/games/duke/src/cheats.cpp | 4 ++-- source/games/duke/src/gamedef.cpp | 30 ++++++++++++++++++++++++++++- source/games/duke/src/premap.cpp | 3 ++- source/games/duke/src/zz_premap.cpp | 2 +- source/rr/src/premap.cpp | 1 - 5 files changed, 34 insertions(+), 6 deletions(-) diff --git a/source/games/duke/src/cheats.cpp b/source/games/duke/src/cheats.cpp index 9440f7ccf..26afcee15 100644 --- a/source/games/duke/src/cheats.cpp +++ b/source/games/duke/src/cheats.cpp @@ -173,7 +173,7 @@ bool cheatStuff(cheatseq_t *) static bool cheatLevel(cheatseq_t *s) { // Fixme: This should be broadcast as a net event once things are up again. - g_lastLevel = 0; + lastlevel = 0; int volnume,levnume; volnume = s->Args[0] - '0' - 1; levnume = (s->Args[1] - '0')*10+(s->Args[2]-'0') - 1; @@ -261,7 +261,7 @@ static bool cheatCashman(cheatseq_t *) static bool cheatSkill(cheatseq_t *s) { - g_lastLevel = 0; + lastlevel = 0; ud.m_player_skill = ud.player_skill = s->Args[0] - '1'; ps[myconnectindex].gm |= MODE_RESTART; FX_StopAllSounds(); diff --git a/source/games/duke/src/gamedef.cpp b/source/games/duke/src/gamedef.cpp index a8c07dd8f..4340f73ee 100644 --- a/source/games/duke/src/gamedef.cpp +++ b/source/games/duke/src/gamedef.cpp @@ -788,12 +788,12 @@ int parsecommand() tempMusic.Reserve(1); tempMusic.Last().levnum = levelnum(k, i); tempMusic.Last().music = parsebuffer.Data(); - textptr += j; } else { specialmusic.Push(parsebuffer.Data()); } + textptr += j; i++; } @@ -1728,6 +1728,34 @@ void loadcons(const char* filenam) auto map = FindMapByLevelNum(tm.levnum); if (map) map->music = tm.music; } + if (isRRRA()) + { + // RRRA goes directly to the second episode after E1L7 to continue the game. + int num = fileSystem.CheckNumForName("e1l7.map"); + int file = fileSystem.GetFileContainer(num); + if (file <= fileSystem.GetMaxIwadNum()) + { + auto maprec = FindMapByName("e1l7"); + if (maprec) maprec->nextLevel = levelnum(1, 0); + } + } + else if (isRR()) + { + // 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(levelnum(1, 6)); + auto maprec2 = FindMapByLevelNum(levelnum(1, 7)); + auto maprec3 = FindMapByName("endgame"); + int num3 = fileSystem.CheckNumForName("endgame.map"); + 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 = levelnum(1, 7); + } + } tempMusic.Clear(); } diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index fe79f5edf..3c96331c0 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -967,7 +967,8 @@ int exitlevel(void) if (ps[myconnectindex].gm & MODE_RESTART) { - ud.nextLevel = currentLevel; + // If no level was set, restart the current one. + if (!ud.nextLevel) ud.nextLevel = currentLevel; } if (ps[myconnectindex].gm & MODE_EOL) diff --git a/source/games/duke/src/zz_premap.cpp b/source/games/duke/src/zz_premap.cpp index a858555a3..1ec81375c 100644 --- a/source/games/duke/src/zz_premap.cpp +++ b/source/games/duke/src/zz_premap.cpp @@ -94,7 +94,7 @@ void G_NewGame(MapRecord *map, int skillNum) int const UserMap = false;// Menu_HaveUserMap(); // we don't want the intro to play after the multiplayer setup screen. - if (!isRR() && (!g_netServer && ud.multimode < 2) && UserMap == 0 && currentLevel->levelNumber == levelnum(3, 0)) + if (!isRR() && (!g_netServer && ud.multimode < 2) && UserMap == 0 && map->levelNumber == levelnum(3, 0)) { e4intro([](bool) {}); } diff --git a/source/rr/src/premap.cpp b/source/rr/src/premap.cpp index cbc9bca91..49a31e54f 100644 --- a/source/rr/src/premap.cpp +++ b/source/rr/src/premap.cpp @@ -2241,7 +2241,6 @@ static void G_FadeLoad(int32_t r, int32_t g, int32_t b, int32_t start, int32_t e int G_EnterLevel(int gameMode) { int32_t i, mii; - char levelName[BMAX_PATH]; // flushpackets(); // waitforeverybody();