From 229aa89450a4507c1e817ef9f2667d27f3f48fae Mon Sep 17 00:00:00 2001 From: fickleheart Date: Wed, 26 Dec 2018 14:51:05 -0600 Subject: [PATCH 01/10] Push bouncing players backwards if they get stuck in a wall --- src/doomdef.h | 2 +- src/g_game.c | 4 ++-- src/p_map.c | 17 +++++++++++++++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/doomdef.h b/src/doomdef.h index af56c22e3..7fd95f0b5 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -140,7 +140,7 @@ extern FILE *logstream; #endif -//#define DEVELOP // Disable this for release builds to remove excessive cheat commands and enable MD5 checking and stuff, all in one go. :3 +#define DEVELOP // Disable this for release builds to remove excessive cheat commands and enable MD5 checking and stuff, all in one go. :3 #ifdef DEVELOP #define VERSION 0 // Game version #define SUBVERSION 0 // more precise version number diff --git a/src/g_game.c b/src/g_game.c index 2e7e27f47..77790dd0f 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -4942,11 +4942,11 @@ void G_ConsGhostTic(void) CONS_Alert(CONS_WARNING, M_GetText("Demo playback has desynced!\n")); demosynced = false; - P_UnsetThingPosition(testmo); + /*P_UnsetThingPosition(testmo); testmo->x = oldghost.x; testmo->y = oldghost.y; P_SetThingPosition(testmo); - testmo->z = oldghost.z; + testmo->z = oldghost.z;*/ } if (*demo_p == DEMOMARKER) diff --git a/src/p_map.c b/src/p_map.c index aec6a036b..2477f9443 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1423,7 +1423,7 @@ static boolean PIT_CheckThing(mobj_t *thing) // Make sure they aren't able to damage you ANYWHERE along the Z axis, you have to be TOUCHING the person. && !(thing->z + thing->height < tmthing->z || thing->z > tmthing->z + tmthing->height)) { - + if (tmthing->scale > thing->scale + (FRACUNIT/8)) // SRB2kart - Handle squishes first! K_SquishPlayer(thing->player, tmthing); else if (thing->scale > tmthing->scale + (FRACUNIT/8)) @@ -3181,6 +3181,8 @@ static void P_HitBounceLine(line_t *ld) angle_t lineangle, moveangle, deltaangle; fixed_t movelen; + CONS_Printf("hit bounce line %d\n", leveltime); + if (ld->slopetype == ST_HORIZONTAL) { tmymove = -tmymove; @@ -3840,12 +3842,14 @@ void P_BouncePlayerMove(mobj_t *mo) fixed_t leadx, leady; fixed_t trailx, traily; fixed_t mmomx = 0, mmomy = 0; + fixed_t oldmomx = mo->momx, oldmomy = mo->momy; if (!mo->player) return; if ((mo->eflags & MFE_JUSTBOUNCEDWALL) || (mo->player->spectator)) { + CONS_Printf("just bounced %d\n", leveltime); P_SlideMove(mo, true); return; } @@ -3899,6 +3903,8 @@ void P_BouncePlayerMove(mobj_t *mo) // First calculate remainder. bestslidefrac = FRACUNIT - bestslidefrac; + CONS_Printf("best bounce frac %1.6f %d\n", FIXED_TO_FLOAT(bestslidefrac), leveltime); + if (bestslidefrac > FRACUNIT) bestslidefrac = FRACUNIT; @@ -3928,7 +3934,12 @@ void P_BouncePlayerMove(mobj_t *mo) mo->player->cmomx = tmxmove; mo->player->cmomy = tmymove; - P_TryMove(mo, mo->x + tmxmove, mo->y + tmymove, true); + //CONS_Printf("trymove attempt %s w/ %2.6f %2.6f %d\n", P_TryMove(mo, mo->x + tmxmove, mo->y + tmymove, true) ? "yes" : "no ", FIXED_TO_FLOAT(tmxmove), FIXED_TO_FLOAT(tmymove), leveltime); + + if (!P_TryMove(mo, mo->x + tmxmove, mo->y + tmymove, true)) { + CONS_Printf("trymove attempt failed w/ %2.6f %2.6f %d\n", FIXED_TO_FLOAT(tmxmove), FIXED_TO_FLOAT(tmymove), leveltime); + P_TryMove(mo, mo->x - oldmomx, mo->y - oldmomy, true); + } } // @@ -3952,6 +3963,7 @@ void P_BounceMove(mobj_t *mo) if (mo->player) { + CONS_Printf("bounce player %d\n", leveltime); P_BouncePlayerMove(mo); return; } @@ -4002,6 +4014,7 @@ retry: bounceback: if (P_TryMove(mo, mo->x - mmomx, mo->y - mmomy, true)) { + CONS_Printf("bounceback %d\n", leveltime); mo->momx *= -1; mo->momy *= -1; mo->momx = FixedMul(mo->momx, (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3))); From 9485bbfe10aa7a2ae65adccebf725f23b4c02193 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Wed, 26 Dec 2018 14:51:06 -0600 Subject: [PATCH 02/10] Clean up stuff I did while debugging --- src/doomdef.h | 2 +- src/g_game.c | 4 ++-- src/p_map.c | 11 +---------- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/doomdef.h b/src/doomdef.h index 7fd95f0b5..af56c22e3 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -140,7 +140,7 @@ extern FILE *logstream; #endif -#define DEVELOP // Disable this for release builds to remove excessive cheat commands and enable MD5 checking and stuff, all in one go. :3 +//#define DEVELOP // Disable this for release builds to remove excessive cheat commands and enable MD5 checking and stuff, all in one go. :3 #ifdef DEVELOP #define VERSION 0 // Game version #define SUBVERSION 0 // more precise version number diff --git a/src/g_game.c b/src/g_game.c index 77790dd0f..2e7e27f47 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -4942,11 +4942,11 @@ void G_ConsGhostTic(void) CONS_Alert(CONS_WARNING, M_GetText("Demo playback has desynced!\n")); demosynced = false; - /*P_UnsetThingPosition(testmo); + P_UnsetThingPosition(testmo); testmo->x = oldghost.x; testmo->y = oldghost.y; P_SetThingPosition(testmo); - testmo->z = oldghost.z;*/ + testmo->z = oldghost.z; } if (*demo_p == DEMOMARKER) diff --git a/src/p_map.c b/src/p_map.c index 2477f9443..6dbb9643a 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1423,7 +1423,7 @@ static boolean PIT_CheckThing(mobj_t *thing) // Make sure they aren't able to damage you ANYWHERE along the Z axis, you have to be TOUCHING the person. && !(thing->z + thing->height < tmthing->z || thing->z > tmthing->z + tmthing->height)) { - + if (tmthing->scale > thing->scale + (FRACUNIT/8)) // SRB2kart - Handle squishes first! K_SquishPlayer(thing->player, tmthing); else if (thing->scale > tmthing->scale + (FRACUNIT/8)) @@ -3181,8 +3181,6 @@ static void P_HitBounceLine(line_t *ld) angle_t lineangle, moveangle, deltaangle; fixed_t movelen; - CONS_Printf("hit bounce line %d\n", leveltime); - if (ld->slopetype == ST_HORIZONTAL) { tmymove = -tmymove; @@ -3849,7 +3847,6 @@ void P_BouncePlayerMove(mobj_t *mo) if ((mo->eflags & MFE_JUSTBOUNCEDWALL) || (mo->player->spectator)) { - CONS_Printf("just bounced %d\n", leveltime); P_SlideMove(mo, true); return; } @@ -3903,8 +3900,6 @@ void P_BouncePlayerMove(mobj_t *mo) // First calculate remainder. bestslidefrac = FRACUNIT - bestslidefrac; - CONS_Printf("best bounce frac %1.6f %d\n", FIXED_TO_FLOAT(bestslidefrac), leveltime); - if (bestslidefrac > FRACUNIT) bestslidefrac = FRACUNIT; @@ -3934,8 +3929,6 @@ void P_BouncePlayerMove(mobj_t *mo) mo->player->cmomx = tmxmove; mo->player->cmomy = tmymove; - //CONS_Printf("trymove attempt %s w/ %2.6f %2.6f %d\n", P_TryMove(mo, mo->x + tmxmove, mo->y + tmymove, true) ? "yes" : "no ", FIXED_TO_FLOAT(tmxmove), FIXED_TO_FLOAT(tmymove), leveltime); - if (!P_TryMove(mo, mo->x + tmxmove, mo->y + tmymove, true)) { CONS_Printf("trymove attempt failed w/ %2.6f %2.6f %d\n", FIXED_TO_FLOAT(tmxmove), FIXED_TO_FLOAT(tmymove), leveltime); P_TryMove(mo, mo->x - oldmomx, mo->y - oldmomy, true); @@ -3963,7 +3956,6 @@ void P_BounceMove(mobj_t *mo) if (mo->player) { - CONS_Printf("bounce player %d\n", leveltime); P_BouncePlayerMove(mo); return; } @@ -4014,7 +4006,6 @@ retry: bounceback: if (P_TryMove(mo, mo->x - mmomx, mo->y - mmomy, true)) { - CONS_Printf("bounceback %d\n", leveltime); mo->momx *= -1; mo->momy *= -1; mo->momx = FixedMul(mo->momx, (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3))); From 55e0dcb2e32d5d6daacc49143b87a63669014f1d Mon Sep 17 00:00:00 2001 From: fickleheart Date: Wed, 26 Dec 2018 15:31:19 -0600 Subject: [PATCH 03/10] oops forgot this --- src/p_map.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/p_map.c b/src/p_map.c index 6dbb9643a..25baa8c77 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -3930,7 +3930,6 @@ void P_BouncePlayerMove(mobj_t *mo) mo->player->cmomy = tmymove; if (!P_TryMove(mo, mo->x + tmxmove, mo->y + tmymove, true)) { - CONS_Printf("trymove attempt failed w/ %2.6f %2.6f %d\n", FIXED_TO_FLOAT(tmxmove), FIXED_TO_FLOAT(tmymove), leveltime); P_TryMove(mo, mo->x - oldmomx, mo->y - oldmomy, true); } } From e5f2f39b466b60db47e4f2486d1dd925e07fd742 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Thu, 27 Dec 2018 17:11:16 -0600 Subject: [PATCH 04/10] Use waypoint extrainfo to determine lap it works on This can be useful to improve waypoint tracking on sprint maps. --- src/k_kart.c | 8 ++++---- src/p_mobj.c | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 947f50676..13e7bcca4 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -4639,22 +4639,22 @@ static void K_KartUpdatePosition(player_t *player) mo->y - players[i].mo->y), mo->z - players[i].mo->z) / FRACUNIT; - if (mo->health == player->starpostnum) + if (mo->health == player->starpostnum && (!mo->movecount || mo->movecount == player->laps+1)) { player->kartstuff[k_prevcheck] += pmo; ppcd++; } - if (mo->health == (player->starpostnum + 1)) + if (mo->health == (player->starpostnum + 1) && (!mo->movecount || mo->movecount == player->laps+1)) { player->kartstuff[k_nextcheck] += pmo; pncd++; } - if (mo->health == players[i].starpostnum) + if (mo->health == players[i].starpostnum && (!mo->movecount || mo->movecount == players[i].laps+1)) { players[i].kartstuff[k_prevcheck] += imo; ipcd++; } - if (mo->health == (players[i].starpostnum + 1)) + if (mo->health == (players[i].starpostnum + 1) && (!mo->movecount || mo->movecount == players[i].laps+1)) { players[i].kartstuff[k_nextcheck] += imo; incd++; diff --git a/src/p_mobj.c b/src/p_mobj.c index 585bd016b..1015abda5 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -11876,6 +11876,7 @@ ML_NOCLIMB : Direction not controllable else if (i == MT_BOSS3WAYPOINT) // SRB2kart 120217 - Used to store checkpoint num { mobj->health = mthing->angle; + mobj->movecount = mthing->extrainfo; P_SetTarget(&mobj->tracer, waypointcap); P_SetTarget(&waypointcap, mobj); } From b63e6ab32573be6329533cf60382056d451e6ef3 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Sun, 30 Dec 2018 23:38:38 -0500 Subject: [PATCH 05/10] Fix per-map palette not being reset properly on title --- src/d_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 018390144..206fd0653 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -821,9 +821,9 @@ void D_StartTitle(void) F_StartTitleScreen(); CON_ToggleOff(); - // Reset the palette -- SRB2Kart: actually never mind let's do this in the middle of every fade - /*if (rendermode != render_none) - V_SetPaletteLump("PLAYPAL");*/ + // Reset the palette + if (rendermode != render_none) + V_SetPaletteLump("PLAYPAL"); } // From fddd6fb0d527df90a7f4988714d3837dd9f23ffb Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Mon, 31 Dec 2018 13:35:38 -0500 Subject: [PATCH 06/10] Revert "Fix per-map palette not being reset properly on title" This reverts commit b63e6ab32573be6329533cf60382056d451e6ef3. --- src/d_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 206fd0653..018390144 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -821,9 +821,9 @@ void D_StartTitle(void) F_StartTitleScreen(); CON_ToggleOff(); - // Reset the palette - if (rendermode != render_none) - V_SetPaletteLump("PLAYPAL"); + // Reset the palette -- SRB2Kart: actually never mind let's do this in the middle of every fade + /*if (rendermode != render_none) + V_SetPaletteLump("PLAYPAL");*/ } // From de6c2a84f3ebc0ac77a00714ac75cc8375943e3d Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Mon, 31 Dec 2018 14:18:00 -0500 Subject: [PATCH 07/10] Attempt 1 to properly fix --- src/d_main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 018390144..7161fda85 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -321,7 +321,7 @@ static void D_Display(void) F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK); } - if (wipegamestate == GS_LEVEL && rendermode != render_none) + if (wipegamestate == gamestate && rendermode != render_none) { V_SetPaletteLump("PLAYPAL"); // Reset the palette R_ReInitColormaps(0, LUMPERROR); @@ -821,9 +821,9 @@ void D_StartTitle(void) F_StartTitleScreen(); CON_ToggleOff(); - // Reset the palette -- SRB2Kart: actually never mind let's do this in the middle of every fade - /*if (rendermode != render_none) - V_SetPaletteLump("PLAYPAL");*/ + // Reset the palette + if (rendermode != render_none) + V_SetPaletteLump("PLAYPAL"); } // From 26a257eda7c063d17402be536c4b851527a91afb Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Mon, 31 Dec 2018 18:19:18 -0500 Subject: [PATCH 08/10] Better attempt at fixing this --- src/d_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_main.c b/src/d_main.c index 7161fda85..c2b18727f 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -321,7 +321,7 @@ static void D_Display(void) F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK); } - if (wipegamestate == gamestate && rendermode != render_none) + if ((gamestate != GS_LEVEL && rendermode != render_none)) { V_SetPaletteLump("PLAYPAL"); // Reset the palette R_ReInitColormaps(0, LUMPERROR); From b63f4a66e8532129493091446a99b0442a76abd5 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Mon, 31 Dec 2018 18:34:04 -0500 Subject: [PATCH 09/10] Comment this out again. How did this even get reverted... --- src/d_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index c2b18727f..1cf0620f6 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -821,9 +821,9 @@ void D_StartTitle(void) F_StartTitleScreen(); CON_ToggleOff(); - // Reset the palette - if (rendermode != render_none) - V_SetPaletteLump("PLAYPAL"); + // Reset the palette -- SRB2Kart: actually never mind let's do this in the middle of every fade + /*if (rendermode != render_none) + V_SetPaletteLump("PLAYPAL");*/ } // From 4e0f4ed7094ed78edde46fa07fe4a75357990cd9 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Wed, 2 Jan 2019 13:04:56 -0500 Subject: [PATCH 10/10] Remove double brackets --- src/d_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_main.c b/src/d_main.c index 1cf0620f6..5d7f3c89c 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -321,7 +321,7 @@ static void D_Display(void) F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK); } - if ((gamestate != GS_LEVEL && rendermode != render_none)) + if (gamestate != GS_LEVEL && rendermode != render_none) { V_SetPaletteLump("PLAYPAL"); // Reset the palette R_ReInitColormaps(0, LUMPERROR);