fix bubble shield trap respawn softlock

This commit is contained in:
Lighto97 2025-03-07 01:11:17 -03:00
parent e6eaaebd89
commit 6c1629868f
5 changed files with 24 additions and 0 deletions

View file

@ -775,6 +775,8 @@ struct player_t
UINT8 curshield; // see kartshields_t UINT8 curshield; // see kartshields_t
UINT8 bubblecool; // Bubble Shield use cooldown UINT8 bubblecool; // Bubble Shield use cooldown
UINT8 bubbleblowup; // Bubble Shield usage blowup UINT8 bubbleblowup; // Bubble Shield usage blowup
mobj_t *bubbletrap; // Bubble player is trapped inside
boolean gotbubbletrapped; //to know if player was got trapped
UINT16 flamedash; // Flame Shield dash power UINT16 flamedash; // Flame Shield dash power
UINT16 flamemeter; // Flame Shield dash meter left UINT16 flamemeter; // Flame Shield dash meter left
UINT8 flamelength; // Flame Shield dash meter, number of segments UINT8 flamelength; // Flame Shield dash meter, number of segments

View file

@ -726,6 +726,12 @@ static void K_DropDashWait(player_t *player)
if (player->pflags & PF_FAULT) if (player->pflags & PF_FAULT)
return; return;
// if player got trapped inside a ubble but lost its bubble object in a unintended way, remove no gravity flag
if ((P_MobjWasRemoved(player->bubbletrap) && player->gotbubbletrapped == true) && (player->mo->flags & MF_NOGRAVITY)
{
player->mo->flags &= ~MF_NOGRAVITY;
}
if (leveltime % 8 == 0) if (leveltime % 8 == 0)
{ {
const UINT8 ns = 8; const UINT8 ns = 8;

View file

@ -430,6 +430,10 @@ static int player_get(lua_State *L)
lua_pushinteger(L, plr->bubblecool); lua_pushinteger(L, plr->bubblecool);
else if (fastcmp(field,"bubbleblowup")) else if (fastcmp(field,"bubbleblowup"))
lua_pushinteger(L, plr->bubbleblowup); lua_pushinteger(L, plr->bubbleblowup);
else if (fastcmp(field,"bubbletrap"))
LUA_PushUserdata(L, plr->bubbletrap, META_MOBJ);
else if (fastcmp(field,"gotbubbletrapped"))
lua_pushboolean(L, plr->gotbubbletrapped);
else if (fastcmp(field,"flamedash")) else if (fastcmp(field,"flamedash"))
lua_pushinteger(L, plr->flamedash); lua_pushinteger(L, plr->flamedash);
else if (fastcmp(field,"counterdash")) else if (fastcmp(field,"counterdash"))
@ -994,6 +998,15 @@ static int player_set(lua_State *L)
plr->bubblecool = luaL_checkinteger(L, 3); plr->bubblecool = luaL_checkinteger(L, 3);
else if (fastcmp(field,"bubbleblowup")) else if (fastcmp(field,"bubbleblowup"))
plr->bubbleblowup = luaL_checkinteger(L, 3); plr->bubbleblowup = luaL_checkinteger(L, 3);
else if (fastcmp(field,"bubbletrap"))
{
mobj_t *mo = NULL;
if (!lua_isnil(L, 3))
mo = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ));
P_SetTarget(&plr->bubbletrap, mo);
}
else if (fastcmp(field,"gotbubbletrapped"))
plr->gotbubbletrapped = luaL_checkboolean(L, 3);
else if (fastcmp(field,"flamedash")) else if (fastcmp(field,"flamedash"))
plr->flamedash = luaL_checkinteger(L, 3); plr->flamedash = luaL_checkinteger(L, 3);
else if (fastcmp(field,"counterdash")) else if (fastcmp(field,"counterdash"))

View file

@ -642,6 +642,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
P_SetTarget(&special->tracer, toucher); P_SetTarget(&special->tracer, toucher);
toucher->flags |= MF_NOGRAVITY; toucher->flags |= MF_NOGRAVITY;
toucher->momz = (8*toucher->scale) * P_MobjFlip(toucher); toucher->momz = (8*toucher->scale) * P_MobjFlip(toucher);
toucher->player->gotbubbletrapped = true;
P_SetTarget(&toucher->player->bubbletrap, special); //allow it to access later on and to know if player is trapped
// Snap to the unfortunate player and quit moving laterally, or we can end up quite far away // Snap to the unfortunate player and quit moving laterally, or we can end up quite far away
special->momx = 0; special->momx = 0;

View file

@ -9387,6 +9387,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
{ {
S_StartSound(mobj->tracer, sfx_s3k77); S_StartSound(mobj->tracer, sfx_s3k77);
mobj->tracer->flags &= ~MF_NOGRAVITY; mobj->tracer->flags &= ~MF_NOGRAVITY;
mobj->tracer->player->gotbubbletrapped = false;
P_KillMobj(mobj, mobj->tracer, mobj->tracer, DMG_NORMAL); P_KillMobj(mobj, mobj->tracer, mobj->tracer, DMG_NORMAL);
break; break;
} }