diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 051c3e4d4..43bd85b0d 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -4361,7 +4361,7 @@ void D_ClientServerInit(void) playerinfo[i].node = 255; gametic = 0; - localgametic = 0; + leveltime = 0; // do not send anything before the real begin SV_StopServer(); @@ -6819,7 +6819,7 @@ boolean TryRunTics(tic_t realtics) { boolean update_stats = !(paused || P_AutoPause()); - DEBFILE(va("============ Running tic %d (local %d)\n", gametic, localgametic)); + DEBFILE(va("============ Running tic %d (local %d)\n", gametic, leveltime)); if (update_stats) PS_START_TIMING(ps_tictime); diff --git a/src/d_main.c b/src/d_main.c index 943309b1e..dd808ca94 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -828,14 +828,14 @@ void D_SRB2Loop(void) for (;;) { + precise_t elapsed; + precise_t enterprecise, finishprecise; + if (I_Interrupted()) { I_Quit(); } - precise_t elapsed; - precise_t enterprecise, finishprecise; - enterprecise = I_GetPreciseTime(); boolean ranwipe = false; @@ -2277,8 +2277,8 @@ void D_SRB2Main(void) if (dedicated && server) { - levelstarttic = gametic; G_SetGamestate(GS_LEVEL); + if (!P_SetupLevel(false, false)) I_Quit(); // fail so reset game stuff } diff --git a/src/dedicated/i_system.c b/src/dedicated/i_system.c index 9359b69d2..49d68ca04 100644 --- a/src/dedicated/i_system.c +++ b/src/dedicated/i_system.c @@ -1430,6 +1430,7 @@ void I_Quit(void) /* prevent recursive I_Quit() */ if (quiting) goto death; + quiting = false; I_ShutdownConsole(); M_SaveConfig(NULL); //save game config, cvars.. @@ -1447,14 +1448,17 @@ void I_Quit(void) // use this for 1.28 19990220 by Kin I_ShutdownGraphics(); I_ShutdownSystem(); + /* if option -noendtxt is set, don't print the text */ if (!M_CheckParm("-noendtxt") && W_CheckNumForName("ENDOOM") != LUMPERROR) { printf("\r"); ShowEndTxt(); } + if (myargmalloc) free(myargv); // Deallocate allocated memory + death: W_Shutdown(); exit(0); diff --git a/src/dehacked.c b/src/dehacked.c index a4082c6f2..9f7889945 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -2503,26 +2503,12 @@ static void readmaincfg(MYFILE *f) { flashingtics = (UINT16)get_number(word2); } - else if (fastcmp(word, "TAILSFLYTICS")) - { - tailsflytics = (UINT16)get_number(word2); - } - else if (fastcmp(word, "UNDERWATERTICS")) - { - underwatertics = (UINT16)get_number(word2); - } - else if (fastcmp(word, "SPACETIMETICS")) - { - spacetimetics = (UINT16)get_number(word2); - } else if (fastcmp(word, "EXTRALIFETICS")) { + // this modifies player->powers[pw_extralife] + // which still has some game behaviour attached to it... extralifetics = (UINT16)get_number(word2); } - else if (fastcmp(word, "GAMEOVERTICS")) - { - gameovertics = get_number(word2); - } else if (fastcmp(word, "INTROTOPLAY")) { @@ -2546,10 +2532,7 @@ static void readmaincfg(MYFILE *f) if (creditscutscene > 128) creditscutscene = 128; } - else if (fastcmp(word, "NUMDEMOS")) - { - numDemos = (UINT8)get_number(word2); - } + else if (fastcmp(word, "DEMODELAYTIME")) { demoDelayTime = get_number(word2); @@ -2562,10 +2545,6 @@ static void readmaincfg(MYFILE *f) { use1upSound = (UINT8)(value || word2[0] == 'T' || word2[0] == 'Y'); } - else if (fastcmp(word, "MAXXTRALIFE")) - { - continue; // unused - } else if (fastcmp(word, "GAMEDATA")) { // just ignore it but dont throw a warning @@ -2604,6 +2583,30 @@ static void readmaincfg(MYFILE *f) { strlcpy(customversionstring, word2, sizeof (customversionstring)); } + else if (fastcmp(word, "NUMDEMOS")) + { + continue; // unused + } + else if (fastcmp(word, "TAILSFLYTICS")) + { + continue; // unused + } + else if (fastcmp(word, "UNDERWATERTICS")) + { + continue; // unused + } + else if (fastcmp(word, "SPACETIMETICS")) + { + continue; // unused + } + else if (fastcmp(word, "GAMEOVERTICS")) + { + continue; // unused + } + else if (fastcmp(word, "MAXXTRALIFE")) + { + continue; // unused + } else deh_warning("Maincfg: unknown word '%s'", word); } @@ -8572,13 +8575,13 @@ FUNCINLINE static ATTRINLINE int lib_getenum(lua_State *L) const char *word; boolean mathlib = lua_toboolean(L, UV_MATHLIB); - if (lua_type(L,2) != LUA_TSTRING) + if (lua_type(L, 2) != LUA_TSTRING) return 0; - word = lua_tostring(L,2); + word = lua_tostring(L, 2); /* First check actions, as they can be overridden. */ - if (!mathlib && fastncmp("A_",word,2)) + if (!mathlib && fastncmp("A_", word, 2)) { char *caps; // Try to get a Lua action first. diff --git a/src/doomstat.h b/src/doomstat.h index f8216cc1e..e8eae7a4f 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -54,7 +54,6 @@ extern INT16 maptol; extern UINT8 globalweather; extern INT32 curWeather; extern INT32 cursaveslot; -extern INT16 lastmapsaved; extern boolean gamecomplete; #define PRECIP_NONE 0 @@ -78,7 +77,6 @@ extern boolean imcontinuing; // Temporary flag while continuing extern UINT8 modeattacking; // menu demo things -extern UINT8 numDemos; extern UINT32 demoDelayTime; extern UINT32 demoIdleTime; @@ -114,7 +112,6 @@ extern UINT8 paused; // Game paused? extern UINT8 window_notinfocus; // are we in focus? (backend independant -- handles auto pausing and display of "focus lost" message) extern boolean nodrawers; -extern boolean noblit; extern boolean lastdraw; #ifdef MOTIONBLUR @@ -402,9 +399,6 @@ extern boolean CheckForReverseGravity; extern UINT16 invulntics; extern UINT16 sneakertics; extern UINT16 flashingtics; -extern UINT16 tailsflytics; -extern UINT16 underwatertics; -extern UINT16 spacetimetics; extern UINT16 extralifetics; // SRB2kart @@ -490,7 +484,6 @@ extern UINT32 timesBeatenWithEmeralds; // WAD, partly set at startup time. extern tic_t gametic; -#define localgametic leveltime // Player spawn spots. extern mapthing_t *playerstarts[MAXPLAYERS]; // Cooperative diff --git a/src/f_finale.c b/src/f_finale.c index f7efbbced..624b64739 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1110,14 +1110,6 @@ void F_TitleScreenTicker(boolean run) return; } - // Replay intro when done cycling through demos - /*if (curDemo == numDemos) -- uuuh... we have a LOT of maps AND a big devteam... probably not gonna see a repeat unless you're super unlucky :V - { - curDemo = 0; - F_StartIntro(); - return; - }*/ - mapname = G_BuildMapName(G_RandMap(TOL_RACE, -2, false, 0, false, NULL)+1); numstaff = 1; diff --git a/src/g_demo.c b/src/g_demo.c index c36b3273b..850e08048 100644 --- a/src/g_demo.c +++ b/src/g_demo.c @@ -66,12 +66,10 @@ #include // menu demo things -UINT8 numDemos = 0; //3; -- i'm FED UP of losing my skincolour to a broken demo. change this back when we make new ones UINT32 demoDelayTime = 15*TICRATE; UINT32 demoIdleTime = 3*TICRATE; boolean nodrawers = false; // for comparative timing purposes -boolean noblit = false; // for comparative timing purposes static tic_t demostarttime; // for comparative timing purposes //@TODO put these all in a struct for namespacing purposes? @@ -3512,10 +3510,11 @@ static INT32 restorecv_vidwait; void G_TimeDemo(const char *name) { nodrawers = M_CheckParm("-nodraw"); - noblit = M_CheckParm("-noblit"); + restorecv_vidwait = cv_vidwait.value; if (cv_vidwait.value) CV_Set(&cv_vidwait, "0"); + demo.timing = true; singletics = true; framecount = 0; diff --git a/src/g_game.c b/src/g_game.c index 24490f2a0..662f0a228 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -88,7 +88,6 @@ INT16 maptol = 0; UINT8 globalweather = 0; INT32 curWeather = PRECIP_NONE; INT32 cursaveslot = -1; // Auto-save 1p savegame slot -INT16 lastmapsaved = 0; // Last map we auto-saved at boolean gamecomplete = false; UINT16 mainwads = 0; @@ -109,7 +108,6 @@ INT32 consoleplayer = 0; // player taking events and displaying INT32 displayplayers[MAXSPLITSCREENPLAYERS] = {}; // view being displayed tic_t gametic = 0; -tic_t levelstarttic = 0; // gametic at level start UINT32 totalrings = 0; // for intermission INT16 lastmap = 0; // last level you were at (returning from special stages) tic_t timeinmap = 0; // Ticker for time spent in level (used for levelcard display) @@ -187,9 +185,6 @@ boolean CheckForReverseGravity = false; UINT16 invulntics = 20*TICRATE; UINT16 sneakertics = 20*TICRATE; UINT16 flashingtics = 3*TICRATE/2; // SRB2kart -UINT16 tailsflytics = 8*TICRATE; -UINT16 underwatertics = 30*TICRATE; -UINT16 spacetimetics = 11*TICRATE + (TICRATE/2); UINT16 extralifetics = 4*TICRATE; // SRB2kart @@ -207,8 +202,6 @@ const INT32 wipeoutslowtime = 20; const INT32 wantedreduce = 5*TICRATE; const INT32 wantedfrequency = 10*TICRATE; -INT32 gameovertics = 15*TICRATE; - UINT8 use1upSound = 0; UINT8 introtoplay = 0; @@ -1299,8 +1292,6 @@ static void G_DoLoadLevel(boolean resetplayer) // Make sure objectplace is OFF when you first start the level! OP_ResetObjectplace(); - levelstarttic = gametic; // for time calculation - if (wipegamestate == GS_LEVEL) wipegamestate = -1; // force a wipe diff --git a/src/g_game.h b/src/g_game.h index 6ecc69dfa..76759d257 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -39,12 +39,8 @@ extern INT32 player_name_changes[MAXPLAYERS]; extern player_t players[MAXPLAYERS]; extern boolean playeringame[MAXPLAYERS]; -// gametic at level start -extern tic_t levelstarttic; - // for modding? extern INT16 prevmap, nextmap; -extern INT32 gameovertics; extern tic_t timeinmap; // Ticker for time spent in level (used for levelcard display) extern INT16 rw_maximums[NUM_WEAPONS]; diff --git a/src/k_hud.c b/src/k_hud.c index 2d38a9c5b..203c22fff 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -4024,6 +4024,7 @@ static void K_drawBattleFullscreen(void) { if (stplyrnum == 0) V_DrawFadeScreen(0xFF00, 16); + if (stplyr->exiting < 6*TICRATE && !stplyr->spectator) { if (stplyr->kartstuff[k_position] == 1) @@ -4339,7 +4340,7 @@ static void K_drawInput(void) } else { - const boolean analogjoystickmove = cv_usejoystick[stplyrnum].value && !Joystick[stplyrnum].bGamepadStyle; + const boolean analogjoystickmove = cv_usejoystick[stplyrnum].value && !Joystick[stplyrnum].bGamepadStyle; const boolean gamepadjoystickmove = cv_usejoystick[stplyrnum].value && Joystick[stplyrnum].bGamepadStyle; const UINT8 ssplayer = stplyrnum+1; @@ -4356,9 +4357,10 @@ static void K_drawInput(void) { hudforward += KART_FULLTURN; } + if (InputDown(gc_aimbackward, ssplayer) || (gamepadjoystickmove && axis > 0)) { - hudforward-= KART_FULLTURN; + hudforward -= KART_FULLTURN; } } @@ -4444,6 +4446,7 @@ static void K_drawChallengerScreen(void) 19,20,19,20,19,20,19,20,19,20, // frame 20-21, 1 tic, 5 alternating: all text vibrates from impact 21,22,23,24 // frame 22-25, 1 tic: CHALLENGER turns gold }; + const UINT8 offset = min(52-1, (3*TICRATE)-mapreset); V_DrawFadeScreen(0xFF00, 16); // Fade out @@ -4545,6 +4548,7 @@ static void K_drawDistributionDebugger(void) kp_orbinaut[4], kp_jawz[1] }; + INT32 useodds = 0; INT32 pingame = 0, bestbumper = 0; INT32 i; @@ -4561,8 +4565,10 @@ static void K_drawDistributionDebugger(void) if (!playeringame[i] || players[i].spectator) continue; pingame++; + if (players[i].exiting) dontforcespb = true; + if (players[i].kartstuff[k_bumper] > bestbumper) bestbumper = players[i].kartstuff[k_bumper]; } @@ -4716,6 +4722,7 @@ void K_drawKartHUD(void) { if (LUA_HudEnabled(hud_battlefullscreen)) K_drawBattleFullscreen(); + return; } diff --git a/src/p_saveg.c b/src/p_saveg.c index 64686dfd4..667ee5c47 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -3308,8 +3308,6 @@ FUNCINLINE static ATTRINLINE void P_ArchiveMisc(savebuffer_t *save) else WRITEINT16(save->p, gamemap); - lastmapsaved = gamemap; - WRITEUINT16(save->p, (botskin ? (emeralds|(1<<10)) : emeralds)+357); WRITESTRINGN(save->p, timeattackfolder, sizeof(timeattackfolder)); } @@ -3333,8 +3331,6 @@ FUNCINLINE static ATTRINLINE void P_UnArchiveSPGame(savebuffer_t *save, INT16 ma if (!mapheaderinfo[gamemap-1]) P_AllocMapHeader(gamemap-1); - lastmapsaved = gamemap; - tokenlist = 0; token = 0; diff --git a/src/p_tick.c b/src/p_tick.c index 9365f5669..24142a823 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -706,6 +706,7 @@ void P_Ticker(boolean run) if (indirectitemcooldown > 0) indirectitemcooldown--; + if (hyubgone > 0) hyubgone--; @@ -713,8 +714,7 @@ void P_Ticker(boolean run) { K_UpdateSpectateGrief(); } - - if (G_BattleGametype()) + else if (G_BattleGametype()) { if (wantedcalcdelay && --wantedcalcdelay <= 0) K_CalculateBattleWanted(); diff --git a/src/r_segs.cpp b/src/r_segs.cpp index 89b01ba1a..f94e72b4c 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -1167,7 +1167,6 @@ static inline void R_ExpandPlaneY(visplane_t *pl, INT32 x, INT16 top, INT16 bott // CALLED: CORE LOOPING ROUTINE. // - static std::vector holecol(256); // used for R_DrawWallColumn diff --git a/src/s_sound.c b/src/s_sound.c index 7e5172e6d..39ad5086d 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -1364,8 +1364,8 @@ void S_LoadMusicDefs(UINT16 wadnum) for (int k = 0; k < 2; k++) { - const char *lumpname = (k == 1 ? "MUSCINFO" : "MUSICDEF"); - lumpnum = W_CheckNumForNamePwad(lumpname, wadnum, 0); //check for MUSCINFO lump on 2nd iteration + const char *lumpname = (k == 1 ? "MUSCINFO" : "MUSICDEF"); //check for MUSCINFO lump on 2nd iteration + lumpnum = W_CheckNumForNamePwad(lumpname, wadnum, 0); if (lumpnum == INT16_MAX) continue;