From 74f13c0889239d4a46dece87dd6e79379a4fd571 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 af56c22e..7fd95f0b 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 2e7e27f4..77790dd0 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 aec6a036..2477f944 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 6954689b96ac72d647ca54d832d3a90d67791c24 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 7fd95f0b..af56c22e 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 77790dd0..2e7e27f4 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 2477f944..6dbb9643 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 2b870ef6d4478b7a75467a24f983c7e495e3a9d6 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 6dbb9643..25baa8c7 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 90e553d81a771dcfe5c4418ecbb0f1210c1d661b 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 947f5067..13e7bcca 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 585bd016..1015abda 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 1bb6ff27c83b985bc998447c335bbbb261657b8d 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 01839014..206fd065 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 18fea4f3b19c1068ff6a9722a18f3af1df0623f3 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 1bb6ff27c83b985bc998447c335bbbb261657b8d. --- 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 206fd065..01839014 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 749bc65caa04f5fce32322c3c3fdbd7ede9256e6 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 01839014..7161fda8 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 6ad2c145d773ecc1f4564316dcff50cfefce8dc9 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 7161fda8..c2b18727 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 d6178a3a408f2dfacf5aef7332c03697182a4532 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 c2b18727..1cf0620f 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 3273924743419a8fa75d46d933c08d16b4eedc2a 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 1cf0620f..5d7f3c89 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);