From dcaa1c39020dc465846208b2d53de5b9cf6f5ccf Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Sun, 15 Oct 2023 14:38:55 -0700 Subject: [PATCH 01/16] Don't skip signature check steps if server is lagging --- src/d_clisrv.h | 3 +++ src/p_tick.c | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/d_clisrv.h b/src/d_clisrv.h index 06391f159..aff074f51 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -620,6 +620,9 @@ void CL_TimeoutServerList(void); // Is there a game running boolean Playing(void); +// Advance client-to-client pubkey verification flow +void UpdateChallenges(void); + // Broadcasts special packets to other players // to notify of game exit void D_QuitNetGame(void); diff --git a/src/p_tick.c b/src/p_tick.c index 957dc93f0..1ad1c8dd2 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -28,6 +28,7 @@ #include "i_video.h" // rendermode #include "r_main.h" #include "r_fps.h" +#include "d_clisrv.h" // UpdateChallenges // Object place #include "m_cheat.h" @@ -966,6 +967,9 @@ void P_Ticker(boolean run) ps_lua_thinkframe_time = I_GetPreciseTime() - ps_lua_thinkframe_time; } + if (run) + UpdateChallenges(); + // Run shield positioning P_RunOverlays(); From 3c84d82d7f519305ee3741741e8129eabbfbbdc6 Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Sun, 15 Oct 2023 14:51:06 -0700 Subject: [PATCH 02/16] Robust sigchecks: actually stage the entire diff --- src/d_clisrv.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 0a2cbf53d..b5c982a43 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -6838,7 +6838,7 @@ static void CheckPresentPlayers(void) } // Handle "client-to-client" auth challenge flow. -static void UpdateChallenges(void) +void UpdateChallenges(void) { if (!(Playing() && netgame)) return; @@ -6857,7 +6857,7 @@ static void UpdateChallenges(void) } else // client { - if (leveltime <= CHALLENGEALL_START) + if (leveltime < CHALLENGEALL_START) expectChallenge = true; if (leveltime == CHALLENGEALL_START) @@ -7019,8 +7019,6 @@ void NetUpdate(void) UpdatePingTable(); - UpdateChallenges(); - if (client) maketic = neededtic; From 53a001da085487ba0d0d9b34e55acbcb43b5c6d5 Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Sun, 15 Oct 2023 18:03:53 -0700 Subject: [PATCH 03/16] Fix visual type desync on respawned battle items --- src/objects/random-item.c | 5 +---- src/p_inter.c | 5 ++++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/objects/random-item.c b/src/objects/random-item.c index b2dcdc6b9..07aab0bbf 100644 --- a/src/objects/random-item.c +++ b/src/objects/random-item.c @@ -125,10 +125,7 @@ void Obj_RandomItemVisuals(mobj_t *mobj) { mobj->extravalue1++; - if (specialstageinfo.valid) // Setting the timer in this case probably looks kinda goofy, but P_ItemPop checks xval1, not states. - mobj->extravalue1 = max(mobj->extravalue1, RINGBOX_TIME); // I will change this if this logic ever becomes even slightly more complicated. - - if (mobj->extravalue1 == RINGBOX_TIME) + if (mobj->extravalue1 == RINGBOX_TIME || specialstageinfo.valid) { // Sync the position in RINGBOX and RANDOMITEM animations. statenum_t animDelta = mobj->state - states - S_RINGBOX1; diff --git a/src/p_inter.c b/src/p_inter.c index 327b452ed..78ec9864e 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -412,7 +412,10 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) P_SetTarget(&special->target, toucher); P_UpdateLastPickup(player, cheesetype); // P_KillMobj(special, toucher, toucher, DMG_NORMAL); - if (special->extravalue1 >= RINGBOX_TIME) + + statenum_t specialstate = special->state - states; + + if (specialstate >= S_RANDOMITEM1 && specialstate <= S_RANDOMITEM12) K_StartItemRoulette(player, false); else K_StartItemRoulette(player, true); From 38aa1f9d6b04e3419ee5f7349dbb2972fabb5385 Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Tue, 17 Oct 2023 03:54:23 -0700 Subject: [PATCH 04/16] Waypoint flag to block lightsnake --- src/k_respawn.c | 2 +- src/p_mobj.c | 8 ++++++++ src/p_spec.h | 9 +++++---- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/k_respawn.c b/src/k_respawn.c index cec0f57df..36637b52c 100644 --- a/src/k_respawn.c +++ b/src/k_respawn.c @@ -413,7 +413,7 @@ static void K_MovePlayerToRespawnPoint(player_t *player) { size_t nwp = K_NextRespawnWaypointIndex(player->respawn.wp); - if (nwp == SIZE_MAX) + if (nwp == SIZE_MAX || nextwaypoints[nwp]->mobj->movefactor) // movefactor: Block Lightsnake { player->respawn.state = RESPAWNST_DROP; return; diff --git a/src/p_mobj.c b/src/p_mobj.c index 72d1aada1..1db3b22e3 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -13527,6 +13527,14 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj) { mobj->extravalue2 = 0; } + if (mthing->thing_args[2] & TMWPF_BLOCKLIGHTSNAKE) + { + mobj->movefactor = 1; // If a lightsnaking player reaches here, drop instantly. + } + else + { + mobj->movefactor = 0; + } // Sryder 2018-12-7: Grabbed this from the old MT_BOSS3WAYPOINT section so they'll be in the waypointcap instead P_SetTarget(&mobj->tracer, waypointcap); diff --git a/src/p_spec.h b/src/p_spec.h index af0b8e7fe..f1f611213 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -129,10 +129,11 @@ typedef enum typedef enum { - TMWPF_DISABLED = 1, - TMWPF_SHORTCUT = 1<<1, - TMWPF_NORESPAWN = 1<<2, - TMWPF_FINISHLINE = 1<<3, + TMWPF_DISABLED = 1, + TMWPF_SHORTCUT = 1<<1, + TMWPF_NORESPAWN = 1<<2, + TMWPF_FINISHLINE = 1<<3, + TMWPF_BLOCKLIGHTSNAKE = 1<<4 } textmapwaypointflags_t; typedef enum From 5d9e813c5ef715e69ba34e40a015320958b5b5f4 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Tue, 17 Oct 2023 17:56:10 -0400 Subject: [PATCH 05/16] Fixes for titlemaps - Removed all old dev title screen remainders that were interfering with titlemaps. - F_VersionDrawer displays on all title screen types - SA2 intro sound only plays whenever there's am actual title card to show (before it checked for not GS_CEREMONY?) - Removed redundant customversionstring check in menus (F_VersionDrawer already handles customversionstring) --- src/deh_soc.c | 2 -- src/f_finale.c | 85 ++++++++++-------------------------------------- src/f_finale.h | 1 - src/g_game.c | 8 ++--- src/k_menudraw.c | 12 +------ 5 files changed, 22 insertions(+), 86 deletions(-) diff --git a/src/deh_soc.c b/src/deh_soc.c index 9e32abb83..d3a48cb6f 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -3189,8 +3189,6 @@ void readmaincfg(MYFILE *f, boolean mainfile) } else if (fastcmp(word2, "RINGRACERS")) ttmode = TTMODE_RINGRACERS; - else if (fastcmp(word2, "OLD") || fastcmp(word2, "SSNTAILS")) - ttmode = TTMODE_OLD; titlechanged = true; } else if (fastcmp(word, "TITLEPICSNAME")) diff --git a/src/f_finale.c b/src/f_finale.c index 5ded47495..95fb2a53b 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1316,7 +1316,7 @@ static void F_InitMenuPresValues(void) curbgcolor = -1; curbgxspeed = titlescrollxspeed; curbgyspeed = titlescrollyspeed; - curbghide = false; + curbghide = true; curhidepics = hidetitlepics; curttmode = ttmode; @@ -1426,15 +1426,13 @@ static void F_CacheTitleScreen(void) { UINT16 i; - switch(curttmode) + switch (curttmode) { case TTMODE_NONE: break; - case TTMODE_OLD: - break; // idk do we still want this? - case TTMODE_RINGRACERS: + { if (!M_SecretUnlocked(SECRET_ALTTITLE, true)) { CV_StealthSetValue(&cv_alttitle, 0); @@ -1452,6 +1450,7 @@ static void F_CacheTitleScreen(void) } kts_copyright = W_CachePatchName("KTSCR", PU_PATCH_LOWPRIORITY); break; + } case TTMODE_USER: { @@ -1593,36 +1592,34 @@ void F_TitleScreenDrawer(void) { boolean hidepics = false; +#if 0 if (modeattacking) return; // We likely came here from retrying. Don't do a damn thing. +#endif // Draw that sky! if (curbgcolor >= 0) V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, curbgcolor); else if (!curbghide || !titlemapinaction || gamestate == GS_WAITINGPLAYERS) F_SkyScroll(curbgxspeed, curbgyspeed, curbgname); - else - V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); // Don't draw outside of the title screen, or if the patch isn't there. if (gamestate != GS_TITLESCREEN && gamestate != GS_WAITINGPLAYERS) return; - // Don't draw if title mode is set to Old/None and the patch isn't there - /* - if (!ttwing && (curttmode == TTMODE_OLD || curttmode == TTMODE_NONE)) - return; - */ - // rei|miru: use title pics? hidepics = curhidepics; if (hidepics) + { goto luahook; + } - switch(curttmode) + switch (curttmode) { case TTMODE_NONE: + { break; + } case TTMODE_RINGRACERS: { @@ -1657,64 +1654,11 @@ void F_TitleScreenDrawer(void) V_DrawFixedPatch(0, 0, FRACUNIT, 0, kts_bumper, NULL); V_DrawFixedPatch(0, 0, FRACUNIT, 0, kts_copyright, NULL); - - F_VersionDrawer(); break; } - case TTMODE_OLD: -/* - if (finalecount < 50) - { - V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); - - V_DrawSmallScaledPatch(84, 36, 0, ttbanner); - - if (finalecount >= 20) - V_DrawSmallScaledPatch(84, 87, 0, ttkart); - else if (finalecount >= 10) - V_DrawSciencePatch((84<>1; - - V_DrawSciencePatch(0, 0 - FixedMul(40< -1 && ttuser[curttloop]) @@ -1728,8 +1672,11 @@ void F_TitleScreenDrawer(void) V_DrawSciencePatch(curttx< 0) M_DrawMenuMessage(); } diff --git a/src/f_finale.h b/src/f_finale.h index 517b59ce3..b3e4b4545 100644 --- a/src/f_finale.h +++ b/src/f_finale.h @@ -81,7 +81,6 @@ typedef enum { TTMODE_NONE = 0, TTMODE_RINGRACERS, - TTMODE_OLD, TTMODE_USER } ttmode_enum; diff --git a/src/g_game.c b/src/g_game.c index 2ecb144e1..72a580b47 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1213,8 +1213,11 @@ void G_StartTitleCard(void) return; } + // start the title card + WipeStageTitle = (gamestate == GS_LEVEL); + // play the sound - if (gamestate != GS_CEREMONY) + if (WipeStageTitle) { sfxenum_t kstart = sfx_kstart; if (K_CheckBossIntro() == true) @@ -1223,9 +1226,6 @@ void G_StartTitleCard(void) kstart = sfx_ruby2; S_StartSound(NULL, kstart); } - - // start the title card - WipeStageTitle = (gamestate == GS_LEVEL); } // diff --git a/src/k_menudraw.c b/src/k_menudraw.c index 0083ae643..a7c9117c7 100644 --- a/src/k_menudraw.c +++ b/src/k_menudraw.c @@ -785,17 +785,7 @@ void M_Drawer(void) // ... but only in the MAIN MENU. I'm a picky bastard. if (currentMenu == &MainDef) { - if (customversionstring[0] != '\0') - { - V_DrawThinString(vid.dupx, vid.height - 20*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT, "Mod version:"); - V_DrawThinString(vid.dupx, vid.height - 10*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT, customversionstring); - } - else - { - F_VersionDrawer(); - } - - + F_VersionDrawer(); } // Draw message overlay when needed From 170133dac22c74586884033a5d786c9ac8dbfefe Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 17 Oct 2023 19:16:51 -0700 Subject: [PATCH 06/16] HUD: fix FREE PLAY showing up on Tally in non-green resolutions --- src/k_hud.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/k_hud.c b/src/k_hud.c index d3fc3cd14..8a0c241f6 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -5106,7 +5106,7 @@ void K_drawKartFreePlay(void) if (((leveltime-lt_endtime) % TICRATE) < TICRATE/2) return; - INT32 h_snap = (r_splitscreen < 2 || R_GetViewNumber() & 1) ? V_SNAPTORIGHT : V_SNAPTOLEFT; + INT32 h_snap = r_splitscreen < 2 ? V_SNAPTORIGHT | V_SLIDEIN : V_HUDTRANS; fixed_t x = ((r_splitscreen > 1 ? BASEVIDWIDTH/4 : BASEVIDWIDTH - (LAPS_X+6)) * FRACUNIT); fixed_t y = ((r_splitscreen ? BASEVIDHEIGHT/2 : BASEVIDHEIGHT) - 20) * FRACUNIT; @@ -5114,7 +5114,7 @@ void K_drawKartFreePlay(void) FRACUNIT, FRACUNIT, FRACUNIT, - V_HUDTRANS|V_SLIDEIN|V_SNAPTOBOTTOM|h_snap|V_SPLITSCREEN, + V_SNAPTOBOTTOM|h_snap|V_SPLITSCREEN, KART_FONT, "FREE PLAY" ) / (r_splitscreen > 1 ? 2 : 1); @@ -5125,7 +5125,7 @@ void K_drawKartFreePlay(void) FRACUNIT, FRACUNIT, FRACUNIT, - V_HUDTRANS|V_SLIDEIN|V_SNAPTOBOTTOM|h_snap|V_SPLITSCREEN, + V_SNAPTOBOTTOM|h_snap|V_SPLITSCREEN, NULL, KART_FONT, "FREE PLAY" From 3977d3225dfea3faabcc4a70404b1e3583e6540d Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 17 Oct 2023 19:17:46 -0700 Subject: [PATCH 07/16] Tally: fix fade not covering entire screen in non-green resolutions --- src/k_tally.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/k_tally.cpp b/src/k_tally.cpp index 36f5ed0d1..eba1452c8 100644 --- a/src/k_tally.cpp +++ b/src/k_tally.cpp @@ -909,10 +909,13 @@ void level_tally_t::Draw(void) { fade = (5 * transition_f); } + V_DrawFadeFill( - 0, 0, - v_width, v_height, - V_SPLITSCREEN, + (vid.width / 2) * (r_splitscreen > 1 && R_GetViewNumber() & 1), + (vid.height / 2) * (R_GetViewNumber() > (r_splitscreen > 1)), + vid.width / (r_splitscreen > 1 ? 2 : 1), + vid.height / (r_splitscreen ? 2 : 1), + V_NOSCALESTART, 31, fade ); From ecc324e4d802fac06685c00dcff977c44688c199 Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 17 Oct 2023 19:18:00 -0700 Subject: [PATCH 08/16] HUD: fix server splash alignment in non-green resolutions --- src/st_stuff.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/st_stuff.c b/src/st_stuff.c index 451de0f16..305f50266 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -1351,7 +1351,7 @@ void ST_DrawServerSplash(boolean timelimited) V_DrawFixedPatch( gridX, gridY, FRACUNIT, - (V_SNAPTOLEFT|V_SNAPTOBOTTOM) | V_SUBTRACT | V_VFLIP | gridOpacity, + (V_SNAPTOLEFT|V_SNAPTOTOP) | V_SUBTRACT | V_VFLIP | gridOpacity, gridPatch, NULL ); @@ -1369,7 +1369,7 @@ void ST_DrawServerSplash(boolean timelimited) V_DrawFixedPatch( iconX, iconY, FRACUNIT, - (V_SNAPTORIGHT|V_SNAPTOBOTTOM) | opacityFlag, + (V_SNAPTORIGHT|V_SNAPTOTOP) | opacityFlag, iconPatch, NULL ); @@ -1379,7 +1379,7 @@ void ST_DrawServerSplash(boolean timelimited) V_DrawRightAlignedStringAtFixed( textX, textY, - (V_SNAPTORIGHT|V_SNAPTOBOTTOM) | opacityFlag, + (V_SNAPTORIGHT|V_SNAPTOTOP) | opacityFlag, connectedservername ); From 218fc1aeb39f0a45c43a4bf3418d109b8dea1748 Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Tue, 17 Oct 2023 20:37:13 -0700 Subject: [PATCH 09/16] Block Lightsnake: unfuck build --- src/k_respawn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_respawn.c b/src/k_respawn.c index 36637b52c..05071b633 100644 --- a/src/k_respawn.c +++ b/src/k_respawn.c @@ -413,7 +413,7 @@ static void K_MovePlayerToRespawnPoint(player_t *player) { size_t nwp = K_NextRespawnWaypointIndex(player->respawn.wp); - if (nwp == SIZE_MAX || nextwaypoints[nwp]->mobj->movefactor) // movefactor: Block Lightsnake + if (nwp == SIZE_MAX || player->respawn.wp->nextwaypoints[nwp]->mobj->movefactor) // movefactor: Block Lightsnake { player->respawn.state = RESPAWNST_DROP; return; From 5235408b0eec1f0658c5b3f83a7dd518528b9c5e Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Tue, 17 Oct 2023 21:31:20 -0700 Subject: [PATCH 10/16] Update respawn waypoint on fastfall bounce --- src/d_player.h | 2 +- src/k_kart.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/d_player.h b/src/d_player.h index 57b33bcf4..7a42351cb 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -67,7 +67,7 @@ typedef enum { PF_GODMODE = 1<<0, // Immortal. No lightsnake from pits either - // free: 1<<1 + PF_UPDATEMYRESPAWN = 1<<1, // Scripted sequences / fastfall can set this to force a respawn waypoint update PF_AUTOROULETTE = 1<<2, // Accessibility: Non-deterministic item box, no manual stop. diff --git a/src/k_kart.c b/src/k_kart.c index b65553acc..af38c6f82 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -8953,6 +8953,12 @@ static waypoint_t *K_GetPlayerNextWaypoint(player_t *player) updaterespawn = false; } + if (player->pflags & PF_UPDATEMYRESPAWN) + { + updaterespawn = true; + player->pflags &= ~PF_UPDATEMYRESPAWN; + } + // Respawn point should only be updated when we're going to a nextwaypoint if ((updaterespawn) && (player->respawn.state == RESPAWNST_NONE) && @@ -10688,6 +10694,8 @@ boolean K_FastFallBounce(player_t *player) if (player->mo->eflags & MFE_UNDERWATER) bounce = (117 * bounce) / 200; + player->pflags |= PF_UPDATEMYRESPAWN; + player->mo->momz = bounce * P_MobjFlip(player->mo); player->fastfall = 0; From f1eaa1509f7cc4eff4037fd28f4874a963541d66 Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Tue, 17 Oct 2023 21:48:05 -0700 Subject: [PATCH 11/16] Opaque tripwire on subtractnum maps --- src/p_setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_setup.c b/src/p_setup.c index b8eae1c28..307d6969a 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3334,7 +3334,7 @@ static void P_ProcessLinedefsAfterSidedefs(void) if (ld->tripwire) { - ld->blendmode = (subtractTripwire ? AST_SUBTRACT : AST_ADD); + ld->blendmode = (subtractTripwire ? AST_COPY : AST_ADD); ld->alpha = FRACUNIT; } From f0d0a0f07bc1facfcb9dbdea5825d71aaf17b187 Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Tue, 17 Oct 2023 22:18:49 -0700 Subject: [PATCH 12/16] Reset player lap when they reset to track --- src/d_player.h | 2 ++ src/k_kart.c | 1 + src/k_respawn.c | 7 ++++++- src/lua_playerlib.c | 4 ++++ src/p_saveg.c | 4 ++++ 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/d_player.h b/src/d_player.h index 7a42351cb..1b9744efb 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -852,6 +852,8 @@ struct player_t UINT8 sliptideZipDelay; // How long since the last sliptide? Only boost once you've been straightened out for a bit. UINT16 sliptideZipBoost; // The actual boost granted from sliptideZip. + UINT8 lastsafelap; + mobj_t *stumbleIndicator; mobj_t *sliptideZipIndicator; mobj_t *whip; diff --git a/src/k_kart.c b/src/k_kart.c index af38c6f82..1b3e02257 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -8968,6 +8968,7 @@ static waypoint_t *K_GetPlayerNextWaypoint(player_t *player) (K_GetWaypointIsEnabled(bestwaypoint) == true)) { player->respawn.wp = bestwaypoint; + player->lastsafelap = player->laps; } } diff --git a/src/k_respawn.c b/src/k_respawn.c index cec0f57df..852459810 100644 --- a/src/k_respawn.c +++ b/src/k_respawn.c @@ -403,7 +403,12 @@ static void K_MovePlayerToRespawnPoint(player_t *player) P_SetThingPosition(player->mo); // We are no longer traveling from death location to 1st waypoint, so use standard timings - player->respawn.fast = false; + // (and reset their lap so they can't cross the finish the wrong way!) + if (player->respawn.fast) + { + player->respawn.fast = false; + player->laps = player->lastsafelap; + } // At the first valid waypoint, permit extra player control options. player->respawn.init = false; diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 65844d2f0..6fe1e325d 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -329,6 +329,8 @@ static int player_get(lua_State *L) lua_pushinteger(L, plr->sliptideZipDelay); else if (fastcmp(field,"sliptideZipBoost")) lua_pushinteger(L, plr->sliptideZipBoost); + else if (fastcmp(field,"lastsafelap")) + lua_pushinteger(L, plr->lastsafelap); else if (fastcmp(field,"instaWhipCharge")) lua_pushinteger(L, plr->instaWhipCharge); else if (fastcmp(field,"instaWhipCooldown")) @@ -809,6 +811,8 @@ static int player_set(lua_State *L) plr->sliptideZipDelay = luaL_checkinteger(L, 3); else if (fastcmp(field,"sliptideZipBoost")) plr->sliptideZipBoost = luaL_checkinteger(L, 3); + else if (fastcmp(field,"lastsafelap")) + plr->lastsafelap = luaL_checkinteger(L, 3); else if (fastcmp(field,"instaWhipCharge")) plr->instaWhipCharge = luaL_checkinteger(L, 3); else if (fastcmp(field,"instaWhipCooldown")) diff --git a/src/p_saveg.c b/src/p_saveg.c index dd8714cb1..4a8fd3027 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -539,6 +539,8 @@ static void P_NetArchivePlayers(savebuffer_t *save) WRITEUINT8(save->p, players[i].sliptideZipDelay); WRITEUINT16(save->p, players[i].sliptideZipBoost); + WRITEUINT8(save->p, players[i].lastsafelap); + WRITEMEM(save->p, players[i].public_key, PUBKEYLENGTH); WRITEUINT8(save->p, players[i].instaWhipCharge); @@ -1052,6 +1054,8 @@ static void P_NetUnArchivePlayers(savebuffer_t *save) players[i].sliptideZipDelay = READUINT8(save->p); players[i].sliptideZipBoost = READUINT16(save->p); + players[i].lastsafelap = READUINT8(save->p); + READMEM(save->p, players[i].public_key, PUBKEYLENGTH); players[i].instaWhipCharge = READUINT8(save->p); From 1b19ad889061b0bb7ae5e5cab436251ee3b4f692 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 16 Oct 2023 05:00:09 -0700 Subject: [PATCH 13/16] Frame skipping Skip up to 3 frames of rendering if the time between tics exceeds TICRATE. If rendering is a significant source of that slowdown, skipping some frames can speed up the game loop and improve input responsiveness. --- src/d_main.cpp | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/src/d_main.cpp b/src/d_main.cpp index 2343a837c..32ee3bd4e 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -328,8 +328,9 @@ gamestate_t wipegamestate = GS_LEVEL; INT16 wipetypepre = -1; INT16 wipetypepost = -1; -static void D_Display(void) +static bool D_Display(void) { + bool ranwipe = false; boolean forcerefresh = false; static boolean wipe = false; INT32 wipedefindex = 0; @@ -340,7 +341,7 @@ static void D_Display(void) if (!dedicated) { if (nodrawers) - return; // for comparative timing/profiling + return false; // for comparative timing/profiling // Lactozilla: Switching renderers works by checking // if the game has to do it right when the frame @@ -409,6 +410,7 @@ static void D_Display(void) F_WipeColorFill(31); F_WipeEndScreen(); F_RunWipe(wipedefindex, wipetypepre, gamestate != GS_MENU, "FADEMAP0", false, false); + ranwipe = true; } if (G_GamestateUsesLevel() == false && rendermode != render_none) @@ -422,6 +424,7 @@ static void D_Display(void) else //dedicated servers { F_RunWipe(wipedefindex, wipedefs[wipedefindex], gamestate != GS_MENU, "FADEMAP0", false, false); + ranwipe = true; wipegamestate = gamestate; } @@ -431,7 +434,7 @@ static void D_Display(void) wipetypepre = -1; if (dedicated) //bail out after wipe logic - return; + return false; // Catch runaway clipping rectangles. V_ClearClipRect(); @@ -708,6 +711,7 @@ static void D_Display(void) F_WipeEndScreen(); F_RunWipe(wipedefindex, wipedefs[wipedefindex], gamestate != GS_MENU && gamestate != GS_TITLESCREEN, "FADEMAP0", true, false); + ranwipe = true; } // reset counters so timedemo doesn't count the wipe duration @@ -763,6 +767,8 @@ static void D_Display(void) I_FinishUpdate(); // page flip or blit buffer ps_swaptime = I_GetPreciseTime() - ps_swaptime; } + + return ranwipe; } // ========================================================================= @@ -779,6 +785,7 @@ void D_SRB2Loop(void) boolean interp = false; boolean doDisplay = false; + int frameskip = 0; if (dedicated) server = true; @@ -827,6 +834,8 @@ void D_SRB2Loop(void) capbudget = (precise_t) budget; } + bool ranwipe = false; + I_UpdateTime(cv_timescale.value); if (lastwipetic) @@ -923,9 +932,9 @@ void D_SRB2Loop(void) rendertimefrac_unpaused = FRACUNIT; } - if (interp || doDisplay) + if ((interp || doDisplay) && !frameskip) { - D_Display(); + ranwipe = D_Display(); } #ifdef HWRENDER @@ -976,6 +985,23 @@ void D_SRB2Loop(void) finishprecise = I_GetPreciseTime(); deltasecs = (double)((INT64)(finishprecise - enterprecise)) / I_GetPrecisePrecision(); deltatics = deltasecs * NEWTICRATE; + + // If time spent this game loop exceeds a single tic, + // it's probably because of rendering. + // + // Skip rendering the next frame, up to a limit of 3 + // frames before a frame is rendered no matter what. + // + // Wipes run an inner loop and artificially increase + // the measured time. + if (!ranwipe && frameskip < 3 && deltatics > 1.0) + { + frameskip++; + } + else + { + frameskip = 0; + } } } From 8c113510e7c4a4d5af3b0df9a31b5877dae84c31 Mon Sep 17 00:00:00 2001 From: James R Date: Wed, 18 Oct 2023 18:00:50 -0700 Subject: [PATCH 14/16] PLAYERFLAG_LIST: add PF_UPDATEMYRESPAWN --- src/deh_tables.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/deh_tables.c b/src/deh_tables.c index cc992f471..9c0fc670c 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -5999,7 +5999,7 @@ const char *const MAPTHINGFLAG_LIST[4] = { const char *const PLAYERFLAG_LIST[] = { "GODMODE", - "\x01", // free: 1<<1 (name un-matchable) + "UPDATEMYRESPAWN", // Scripted sequences / fastfall can set this to force a respawn waypoint update "AUTOROULETTE", // Item box accessibility From 6f65d550096bab70401713ab5fac76e495f2e6c1 Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Wed, 18 Oct 2023 22:40:24 -0700 Subject: [PATCH 15/16] Correct to safelap instantly to prevent finish distance spike --- src/k_hud.c | 7 ++++--- src/k_respawn.c | 5 +---- src/p_spec.c | 2 ++ 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/k_hud.c b/src/k_hud.c index d3fc3cd14..7ae5a78fc 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -5244,11 +5244,12 @@ static void K_DrawWaypointDebugger(void) if (netgame) { - V_DrawString(8, 146, 0, va("Online griefing: [%u, %u]", stplyr->griefValue/TICRATE, stplyr->griefStrikes)); + V_DrawString(8, 136, 0, va("Online griefing: [%u, %u]", stplyr->griefValue/TICRATE, stplyr->griefStrikes)); } - V_DrawString(8, 156, 0, va("Current Waypoint ID: %d", K_GetWaypointID(stplyr->currentwaypoint))); - V_DrawString(8, 166, 0, va("Next Waypoint ID: %d%s", K_GetWaypointID(stplyr->nextwaypoint), ((stplyr->pflags & PF_WRONGWAY) ? " (WRONG WAY)" : ""))); + V_DrawString(8, 146, 0, va("Current Waypoint ID: %d", K_GetWaypointID(stplyr->currentwaypoint))); + V_DrawString(8, 156, 0, va("Next Waypoint ID: %d%s", K_GetWaypointID(stplyr->nextwaypoint), ((stplyr->pflags & PF_WRONGWAY) ? " (WRONG WAY)" : ""))); + V_DrawString(8, 166, 0, va("Respawn Waypoint ID: %d", K_GetWaypointID(stplyr->respawn.wp))); V_DrawString(8, 176, 0, va("Finishline Distance: %d", stplyr->distancetofinish)); if (numcheatchecks > 0) diff --git a/src/k_respawn.c b/src/k_respawn.c index 852459810..975f7fca6 100644 --- a/src/k_respawn.c +++ b/src/k_respawn.c @@ -289,6 +289,7 @@ void K_DoIngameRespawn(player_t *player) player->respawn.init = true; player->respawn.fast = true; player->respawn.returnspeed = 0; + player->laps = player->lastsafelap; player->respawn.airtimer = player->airtime; player->respawn.truedeath = !!(player->pflags & PF_FAULT); @@ -403,12 +404,8 @@ static void K_MovePlayerToRespawnPoint(player_t *player) P_SetThingPosition(player->mo); // We are no longer traveling from death location to 1st waypoint, so use standard timings - // (and reset their lap so they can't cross the finish the wrong way!) if (player->respawn.fast) - { player->respawn.fast = false; - player->laps = player->lastsafelap; - } // At the first valid waypoint, permit extra player control options. player->respawn.init = false; diff --git a/src/p_spec.c b/src/p_spec.c index 33609787a..5071735a8 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2142,6 +2142,8 @@ static void K_HandleLapDecrement(player_t *player) { if (player) { + if (player->respawn.state == RESPAWNST_MOVE) + return; if ((player->cheatchecknum == 0) && (player->laps > 0)) { player->cheatchecknum = numcheatchecks; From 645a6df76596311e3f9e7a5defa5c906fc9f1e1f Mon Sep 17 00:00:00 2001 From: VelocitOni Date: Thu, 19 Oct 2023 12:24:08 -0400 Subject: [PATCH 16/16] Adjusted cup icon offsets Made the Chaotix Monitor & Sonic Advance capsule cup icons have proper icon offsets. --- src/k_menudraw.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/k_menudraw.c b/src/k_menudraw.c index a7c9117c7..c327f0dc0 100644 --- a/src/k_menudraw.c +++ b/src/k_menudraw.c @@ -2660,12 +2660,20 @@ void M_DrawCupSelect(void) if (monitor == '2') { - icony = 5; + icony = 5; // by default already 7px down, so this is really 2px further up } + else if (monitor == '3') + { + icony = 6; + } } else { monitor = 'A' + (templevelsearch.cup->monitor - 10); + if (monitor == 'X') + { + icony = 11; + } } }