Merge branch 'fix-bungee-softlock' into 'master'

Add Obj_EndBungee, end bungee state when P_ResetPlayer and when player is damaged in any way

Closes #760

See merge request KartKrew/Kart!1641
This commit is contained in:
Oni 2023-11-17 09:06:06 +00:00
commit c24f10a7e7
4 changed files with 28 additions and 7 deletions

View file

@ -249,6 +249,7 @@ void Obj_getPlayerOffRideroid(mobj_t *mo); // used in p_map.c to get off of em w
/* LSZ Bungee */
void Obj_BungeeSpecial(mobj_t *mo, player_t *p); // used when the player touches the bungee, to be used in p_inter.c
void Obj_playerBungeeThink(player_t *p); // player interaction with the bungee. The bungee is to be stored in p->mo->tracer.
void Obj_EndBungee(player_t *p);
/* LSZ Balls */
void Obj_EggBallSpawnerThink(mobj_t *mo);

View file

@ -85,19 +85,13 @@ void Obj_playerBungeeThink(player_t *p)
if ((p->mo->eflags & MFE_VERTICALFLIP && p->mo->z < bungee->z)
|| (!(p->mo->eflags & MFE_VERTICALFLIP) && p->mo->z > bungee->z ))
{
p->mo->flags &= ~MF_NOGRAVITY;
p->mo->flags &= ~MF_NOCLIPTHING;
p->pflags &= ~PF_NOFASTFALL;
p->bungee = BUNGEE_NONE;
P_InstaThrust(p->mo, bungee->angle, p->mo->momz/8);
p->mo->momz = (p->mo->momz*3)/4;
p->springstars = TICRATE; // these are used as a buffer not to latch to vines again.
p->springcolor = SKINCOLOR_EMERALD;
P_RemoveMobj(bungee);
P_SetTarget(&p->mo->tracer, NULL);
Obj_EndBungee(p);
return;
}
}
@ -117,3 +111,26 @@ void Obj_playerBungeeThink(player_t *p)
seg->fuse = 2;
}
}
void Obj_EndBungee(player_t *p)
{
if (p->bungee == BUNGEE_NONE)
{
return;
}
p->pflags &= ~PF_NOFASTFALL;
p->bungee = BUNGEE_NONE;
if (!P_MobjWasRemoved(p->mo))
{
p->mo->flags &= ~MF_NOGRAVITY;
p->mo->flags &= ~MF_NOCLIPTHING;
if (!P_MobjWasRemoved(p->mo->tracer))
{
P_RemoveMobj(p->mo->tracer);
}
P_SetTarget(&p->mo->tracer, NULL);
}
}

View file

@ -3130,6 +3130,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
player->glanceDir = 0;
player->preventfailsafe = TICRATE*3;
player->pflags &= ~PF_GAINAX;
Obj_EndBungee(player);
if (player->spectator == false && !(player->charflags & SF_IRONMAN))
{

View file

@ -66,6 +66,7 @@
#include "k_profiles.h"
#include "music.h"
#include "k_tally.h"
#include "k_objects.h"
#ifdef HWRENDER
#include "hardware/hw_light.h"
@ -481,6 +482,7 @@ void P_ResetPlayer(player_t *player)
player->trickpanel = TRICKSTATE_NONE;
player->glanceDir = 0;
player->fastfall = 0;
Obj_EndBungee(player);
if (player->mo != NULL && P_MobjWasRemoved(player->mo) == false)
{