Play gravity flip sound on jump in jumpflip sectors, reorganize code

This commit is contained in:
spherallic 2022-09-09 15:35:05 +02:00
parent 9fabddd4bb
commit 8d06145377
4 changed files with 19 additions and 16 deletions

View file

@ -1290,17 +1290,6 @@ static int lib_pInSpaceSector(lua_State *L)
return 1;
}
static int lib_pInJumpFlipSector(lua_State *L)
{
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
//HUDSAFE
INLEVEL
if (!mo)
return LUA_ErrInvalid(L, "mobj_t");
lua_pushboolean(L, P_InJumpFlipSector(mo));
return 1;
}
static int lib_pInQuicksand(lua_State *L)
{
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
@ -1312,6 +1301,17 @@ static int lib_pInQuicksand(lua_State *L)
return 1;
}
static int lib_pInJumpFlipSector(lua_State *L)
{
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
//HUDSAFE
INLEVEL
if (!mo)
return LUA_ErrInvalid(L, "mobj_t");
lua_pushboolean(L, P_InJumpFlipSector(mo));
return 1;
}
static int lib_pSetObjectMomZ(lua_State *L)
{
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
@ -4019,8 +4019,8 @@ static luaL_Reg lib[] = {
{"P_IsObjectInGoop",lib_pIsObjectInGoop},
{"P_IsObjectOnGround",lib_pIsObjectOnGround},
{"P_InSpaceSector",lib_pInSpaceSector},
{"P_InJumpFlipSector",lib_pInJumpFlipSector},
{"P_InQuicksand",lib_pInQuicksand},
{"P_InJumpFlipSector",lib_pInJumpFlipSector},
{"P_SetObjectMomZ",lib_pSetObjectMomZ},
{"P_PlayJingle",lib_pPlayJingle},
{"P_PlayJingleMusic",lib_pPlayJingleMusic},

View file

@ -149,8 +149,8 @@ boolean P_PlayerShouldUseSpinHeight(player_t *player);
boolean P_IsObjectInGoop(mobj_t *mo);
boolean P_IsObjectOnGround(mobj_t *mo);
boolean P_InSpaceSector(mobj_t *mo);
boolean P_InJumpFlipSector(mobj_t *mo);
boolean P_InQuicksand(mobj_t *mo);
boolean P_InJumpFlipSector(mobj_t *mo);
boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff);
void P_SetObjectMomZ(mobj_t *mo, fixed_t value, boolean relative);

View file

@ -5940,7 +5940,7 @@ static void P_ConvertBinarySectorTypes(void)
case 5: //Speed pad
sectors[i].specialflags |= SSF_SPEEDPAD;
break;
case 6: //Gravity flip on jump
case 6: //Gravity flip on jump (think VVVVVV)
sectors[i].specialflags |= SSF_JUMPFLIP;
break;
default:

View file

@ -2516,7 +2516,7 @@ boolean P_InJumpFlipSector(mobj_t *mo) // Returns true if you are in a jumpflip
}
}
return false; // No jumpflip here, Captain!
return false; // No gravity jumping here, Captain Viridian!
}
static boolean P_PlayerCanBust(player_t *player, ffloor_t *rover)
@ -4484,8 +4484,11 @@ void P_DoJump(player_t *player, boolean soundandstate)
if (player->charflags & SF_NOJUMPDAMAGE)
player->pflags &= ~PF_SPINNING;
if (P_InJumpFlipSector(player->mo))
if (P_InJumpFlipSector(player->mo)) // Flip gravity on jump?
{
player->mo->flags2 ^= MF2_OBJECTFLIP;
S_StartSound(player->mo, sfx_s3k73); // Play gravity flip sound
}
if (soundandstate)
{