diff --git a/source/games/duke/src/actors_lava.cpp b/source/games/duke/src/actors_lava.cpp index a96a26832..56b01ed19 100644 --- a/source/games/duke/src/actors_lava.cpp +++ b/source/games/duke/src/actors_lava.cpp @@ -162,7 +162,7 @@ void addjaildoor(int p1, int p2, int iht, int jlt, int p3, int j) void addminecart(int p1, int p2, int i, int iht, int p3, int childsectnum) { if (minecartcnt >= 16) - G_GameExit("\nToo many minecart sectors"); + I_Error("Too many minecart sectors"); minecartdist[minecartcnt] = p1; minecartspeed[minecartcnt] = p2; minecartsect[minecartcnt] = i; diff --git a/source/games/duke/src/game.h b/source/games/duke/src/game.h index e541f670b..b80ae7002 100644 --- a/source/games/duke/src/game.h +++ b/source/games/duke/src/game.h @@ -245,8 +245,6 @@ void G_DrawFrags(void); void G_HandleMirror(int32_t x, int32_t y, int32_t z, fix16_t a, fix16_t horiz, int32_t smoothratio); void G_DrawRooms(int32_t playerNum,int32_t smoothratio); void G_DrawTXDigiNumZ(int32_t starttile,int32_t x,int32_t y,int32_t n,int32_t s,int32_t pal,int32_t cs,int32_t x1,int32_t y1,int32_t x2,int32_t y2,int32_t z); -void G_GameExit(const char *msg) ATTRIBUTE((noreturn)); -void G_GameQuit(void); void G_HandleLocalKeys(void); void G_HandleSpecialKeys(void); //void G_SE40(int32_t smoothratio); diff --git a/source/games/duke/src/game_main.cpp b/source/games/duke/src/game_main.cpp index de9f44d52..1d0b82342 100644 --- a/source/games/duke/src/game_main.cpp +++ b/source/games/duke/src/game_main.cpp @@ -35,6 +35,8 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au) #include "mapinfo.h" #include "texturemanager.h" #include "statusbar.h" +#include "st_start.h" +#include "i_interface.h" BEGIN_DUKE_NS @@ -118,6 +120,28 @@ void checkcommandline() } } +//--------------------------------------------------------------------------- +// +// fixme: Menu does not call this +// +//--------------------------------------------------------------------------- + +void gameexitfrommenu() +{ + // MP scoreboard + if (playerswhenstarted > 1 && g_player[myconnectindex].ps->gm & MODE_GAME && GTFLAGS(GAMETYPE_SCORESHEET)) + { + G_BonusScreen(1); + } + + // shareware and TEN screens + if (!VOLUMEALL && !RR) + showtwoscreens([](bool) {}); + + endoomName = RR ? "redneck.bin" : VOLUMEALL ? "duke3d.bin" : "dukesw.bin"; + ST_Endoom(); +} + //--------------------------------------------------------------------------- // // diff --git a/source/games/duke/src/zz_game.cpp b/source/games/duke/src/zz_game.cpp index ee5a1d2cf..0bb6845c7 100644 --- a/source/games/duke/src/zz_game.cpp +++ b/source/games/duke/src/zz_game.cpp @@ -93,38 +93,6 @@ int32_t g_levelTextTime = 0; extern char forcegl; #endif -enum gametokens -{ - T_INCLUDE = 0, - T_INTERFACE = 0, - T_LOADGRP = 1, - T_MODE = 1, - T_CACHESIZE = 2, - T_ALLOW = 2, - T_NOAUTOLOAD, - T_INCLUDEDEFAULT, - T_MUSIC, - T_SOUND, - T_FILE, - T_CUTSCENE, - T_ANIMSOUNDS, - T_NOFLOORPALRANGE, - T_ID, - T_MINPITCH, - T_MAXPITCH, - T_PRIORITY, - T_TYPE, - T_DISTANCE, - T_VOLUME, - T_DELAY, - T_RENAMEFILE, - T_GLOBALGAMEFLAGS, - T_ASPECT, - T_FORCEFILTER, - T_FORCENOFILTER, - T_TEXTUREFILTER, -}; - static void gameTimerHandler(void) { S_Update(); @@ -144,65 +112,8 @@ void G_HandleSpecialKeys(void) if (!(g_player[myconnectindex].ps->gm & MODE_GAME)) OSD_DispatchQueued(); - if (g_quickExit == 0 && inputState.GetKeyStatus(sc_LeftControl) && inputState.GetKeyStatus(sc_LeftAlt) && (inputState.GetKeyStatus(sc_Delete)||inputState.GetKeyStatus(sc_End))) - { - g_quickExit = 1; - G_GameExit("Quick Exit."); - } } -void G_GameQuit(void) -{ - if (numplayers < 2) - G_GameExit(" "); - - if (g_gameQuit == 0) - { - g_gameQuit = 1; - g_quitDeadline = (int32_t) totalclock+120; - //g_netDisconnect = 1; - } - - if ((totalclock > g_quitDeadline) && (g_gameQuit == 1)) - g_netDisconnect = 1; - //G_GameExit("Timed out."); -} - - - - -void G_GameExit(const char *msg) -{ - if (*msg != 0) g_player[myconnectindex].ps->palette = BASEPAL; - - // JBF: fixes crash on demo playback - // PK: modified from original - - if (!g_quickExit) - { - - if (playerswhenstarted > 1 && g_player[myconnectindex].ps->gm&MODE_GAME && GTFLAGS(GAMETYPE_SCORESHEET) && *msg == ' ') - { - G_BonusScreen(1); - } - - // shareware and TEN screens - if (*msg != 0 && *(msg+1) != 'V' && *(msg+1) != 'Y' && !VOLUMEALL && !RR) - showtwoscreens([](bool) {}); - } - - if (*msg != 0) - { - if (!(msg[0] == ' ' && msg[1] == 0)) - { - I_Error("%s", msg); - } - } - endoomName = RR? "redneck.bin" : VOLUMEALL ? "duke3d.bin" : "dukesw.bin"; - ST_Endoom(); -} - - static int32_t G_DoThirdPerson(const DukePlayer_t *pp, vec3_t *vect, int16_t *vsectnum, int16_t ang, int16_t horiz) { @@ -1079,27 +990,6 @@ void G_DumpDebugInfo(void) } } -// if is true, set the moveflag unconditionally, -// else only if it equals 0. -static int32_t G_InitActor(int32_t i, int32_t tilenum, int32_t set_movflag_uncond) -{ - if (actorinfo[tilenum].scriptaddress) - { - auto sa = &ScriptCode[actorinfo[tilenum].scriptaddress]; - SH(i) = sa[0]; - AC_ACTION_ID(actor[i].t_data) = sa[1]; - AC_MOVE_ID(actor[i].t_data) = sa[2]; - - if (set_movflag_uncond || (sa[3] && SHT(i) == 0)) // AC_MOVFLAGS - SHT(i) = sa[3]; - - return 1; - } - - return 0; -} - - static int G_MaybeTakeOnFloorPal(tspritetype *pSprite, int sectNum) { int const floorPal = sector[sectNum].floorpal; @@ -1452,7 +1342,7 @@ static void G_CompileScripts(void) fi.initactorflags(); if ((uint32_t)labelcnt > MAXSPRITES*sizeof(spritetype)/64) // see the arithmetic above for why - G_GameExit("Error: too many labels defined!"); + I_FatalError("Error: too many labels defined!"); { char *newlabel; @@ -1554,7 +1444,7 @@ static void G_Startup(void) Printf("Multiplayer initialized.\n"); if (TileFiles.artLoadFiles("tiles%03i.art") < 0) - G_GameExit("Failed loading art."); + I_FatalError("Failed loading art."); fi.InitFonts(); @@ -1966,8 +1856,6 @@ MAIN_LOOP_RESTART: } else updateviewport(); -// G_GameExit(" "); /// - ud.showweapons = ud.config.ShowOpponentWeapons; P_SetupMiscInputSettings(); g_player[myconnectindex].pteam = playerteam; diff --git a/source/games/duke/src/zz_net.cpp b/source/games/duke/src/zz_net.cpp index 63c532df0..9caddb9d5 100644 --- a/source/games/duke/src/zz_net.cpp +++ b/source/games/duke/src/zz_net.cpp @@ -54,15 +54,6 @@ void faketimerhandler(void) {} void Net_GetPackets(void) { - if (g_netDisconnect) - { - g_netDisconnect = 0; - - if (g_gameQuit) - G_GameExit(" "); - - return; - } } END_DUKE_NS diff --git a/source/games/duke/src/zz_savegame.cpp b/source/games/duke/src/zz_savegame.cpp index a88676e01..67da55f2d 100644 --- a/source/games/duke/src/zz_savegame.cpp +++ b/source/games/duke/src/zz_savegame.cpp @@ -185,8 +185,7 @@ int32_t G_LoadPlayer(const char *path) { // in theory, we could load into an initial dump first and trivially // recover if things go wrong... - Bsprintf(tempbuf, "Loading save game file \"%s\" failed (code %d), cannot recover.", path, status); - G_GameExit(tempbuf); + I_Error("Loading save game file \"%s\" failed (code %d), cannot recover.", path, status); } sv_postudload(); // ud.m_XXX = ud.XXX