From 74f13c0889239d4a46dece87dd6e79379a4fd571 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Wed, 26 Dec 2018 14:51:05 -0600 Subject: [PATCH 1/3] 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 2/3] 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 3/3] 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); } }