Merge branch 'setflip' into 'next'

Add "allowflip" Parameter to P_DoJump

See merge request STJr/SRB2!2158
This commit is contained in:
Logan Aerl Arias 2024-01-02 02:38:19 +00:00
commit 474d112ae4
3 changed files with 13 additions and 12 deletions

View file

@ -1712,11 +1712,12 @@ static int lib_pDoJump(lua_State *L)
{ {
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
boolean soundandstate = (boolean)lua_opttrueboolean(L, 2); boolean soundandstate = (boolean)lua_opttrueboolean(L, 2);
boolean allowflip = (boolean)lua_opttrueboolean(L, 3);
NOHUD NOHUD
INLEVEL INLEVEL
if (!player) if (!player)
return LUA_ErrInvalid(L, "player_t"); return LUA_ErrInvalid(L, "player_t");
P_DoJump(player, soundandstate); P_DoJump(player, soundandstate, allowflip);
return 0; return 0;
} }

View file

@ -204,7 +204,7 @@ void P_NukeEnemies(mobj_t *inflictor, mobj_t *source, fixed_t radius);
void P_Earthquake(mobj_t *inflictor, mobj_t *source, fixed_t radius); void P_Earthquake(mobj_t *inflictor, mobj_t *source, fixed_t radius);
boolean P_HomingAttack(mobj_t *source, mobj_t *enemy); /// \todo doesn't belong in p_user boolean P_HomingAttack(mobj_t *source, mobj_t *enemy); /// \todo doesn't belong in p_user
boolean P_SuperReady(player_t *player, boolean transform); boolean P_SuperReady(player_t *player, boolean transform);
void P_DoJump(player_t *player, boolean soundandstate); void P_DoJump(player_t *player, boolean soundandstate, boolean allowflip);
void P_DoSpinDashDust(player_t *player); void P_DoSpinDashDust(player_t *player);
#define P_AnalogMove(player) (P_ControlStyle(player) == CS_LMAOGALOG) #define P_AnalogMove(player) (P_ControlStyle(player) == CS_LMAOGALOG)
boolean P_TransferToNextMare(player_t *player); boolean P_TransferToNextMare(player_t *player);

View file

@ -4482,7 +4482,7 @@ boolean P_SuperReady(player_t *player, boolean transform)
// //
// Jump routine for the player // Jump routine for the player
// //
void P_DoJump(player_t *player, boolean soundandstate) void P_DoJump(player_t *player, boolean soundandstate, boolean allowflip)
{ {
fixed_t factor; fixed_t factor;
const fixed_t dist6 = FixedMul(FixedDiv(player->speed, player->mo->scale), player->actionspd)/20; const fixed_t dist6 = FixedMul(FixedDiv(player->speed, player->mo->scale), player->actionspd)/20;
@ -4655,7 +4655,7 @@ void P_DoJump(player_t *player, boolean soundandstate)
if (player->charflags & SF_NOJUMPDAMAGE) if (player->charflags & SF_NOJUMPDAMAGE)
player->pflags &= ~PF_SPINNING; player->pflags &= ~PF_SPINNING;
if (P_InJumpFlipSector(player->mo)) // Flip gravity on jump? if (allowflip && P_InJumpFlipSector(player->mo)) // Flip gravity on jump?
{ {
player->mo->flags2 ^= MF2_OBJECTFLIP; player->mo->flags2 ^= MF2_OBJECTFLIP;
S_StartSound(player->mo, sfx_s3k73); // Play gravity flip sound S_StartSound(player->mo, sfx_s3k73); // Play gravity flip sound
@ -4876,7 +4876,7 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd)
#if 0 #if 0
if ((player->charability == CA_TWINSPIN) && (player->speed > FixedMul(player->runspeed, player->mo->scale))) if ((player->charability == CA_TWINSPIN) && (player->speed > FixedMul(player->runspeed, player->mo->scale)))
{ {
P_DoJump(player, false); P_DoJump(player, false, false);
player->pflags &= ~PF_STARTJUMP; player->pflags &= ~PF_STARTJUMP;
player->mo->momz = FixedMul(player->mo->momz, 3*FRACUNIT/2); // NOT 1.5 times the jump height, but 2.25 times. player->mo->momz = FixedMul(player->mo->momz, 3*FRACUNIT/2); // NOT 1.5 times the jump height, but 2.25 times.
P_SetMobjState(player->mo, S_PLAY_TWINSPIN); P_SetMobjState(player->mo, S_PLAY_TWINSPIN);
@ -4956,7 +4956,7 @@ void P_DoJumpShield(player_t *player)
return; return;
player->pflags &= ~PF_JUMPED; player->pflags &= ~PF_JUMPED;
P_DoJump(player, false); P_DoJump(player, false, true);
player->secondjump = 0; player->secondjump = 0;
player->pflags |= PF_THOKKED|PF_SHIELDABILITY; player->pflags |= PF_THOKKED|PF_SHIELDABILITY;
player->pflags &= ~(PF_STARTJUMP|PF_SPINNING|PF_BOUNCING); player->pflags &= ~(PF_STARTJUMP|PF_SPINNING|PF_BOUNCING);
@ -5002,7 +5002,7 @@ void P_DoBubbleBounce(player_t *player)
player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE|PF_SHIELDABILITY); player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE|PF_SHIELDABILITY);
S_StartSound(player->mo, sfx_s3k44); S_StartSound(player->mo, sfx_s3k44);
P_MobjCheckWater(player->mo); P_MobjCheckWater(player->mo);
P_DoJump(player, false); P_DoJump(player, false, false);
if (player->charflags & SF_NOJUMPSPIN) if (player->charflags & SF_NOJUMPSPIN)
P_SetMobjState(player->mo, S_PLAY_FALL); P_SetMobjState(player->mo, S_PLAY_FALL);
else else
@ -5032,7 +5032,7 @@ void P_DoAbilityBounce(player_t *player, boolean changemomz)
else if (player->mo->eflags & MFE_UNDERWATER) else if (player->mo->eflags & MFE_UNDERWATER)
prevmomz /= 2; prevmomz /= 2;
P_DoJump(player, false); P_DoJump(player, false, false);
player->pflags &= ~(PF_STARTJUMP|PF_JUMPED); player->pflags &= ~(PF_STARTJUMP|PF_JUMPED);
minmomz = FixedMul(player->mo->momz, 3*FRACUNIT/2); minmomz = FixedMul(player->mo->momz, 3*FRACUNIT/2);
@ -5405,7 +5405,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
// Jump S3&K style while in quicksand. // Jump S3&K style while in quicksand.
else if (P_InQuicksand(player->mo)) else if (P_InQuicksand(player->mo))
{ {
P_DoJump(player, true); P_DoJump(player, true, false);
player->secondjump = 0; player->secondjump = 0;
player->pflags &= ~PF_THOKKED; player->pflags &= ~PF_THOKKED;
} }
@ -5418,7 +5418,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
// can't jump while in air, can't jump while jumping // can't jump while in air, can't jump while jumping
else if (onground || player->climbing || player->powers[pw_carry]) else if (onground || player->climbing || player->powers[pw_carry])
{ {
P_DoJump(player, true); P_DoJump(player, true, true);
player->secondjump = 0; player->secondjump = 0;
player->pflags &= ~PF_THOKKED; player->pflags &= ~PF_THOKKED;
} }
@ -5448,7 +5448,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
if ((player->charability == CA_JUMPTHOK) && !(player->pflags & PF_THOKKED)) if ((player->charability == CA_JUMPTHOK) && !(player->pflags & PF_THOKKED))
{ {
player->pflags &= ~PF_JUMPED; player->pflags &= ~PF_JUMPED;
P_DoJump(player, false); P_DoJump(player, false, true);
} }
P_InstaThrust(player->mo, player->mo->angle, FixedMul(actionspd, player->mo->scale)); P_InstaThrust(player->mo, player->mo->angle, FixedMul(actionspd, player->mo->scale));
@ -5557,7 +5557,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
{ {
player->pflags |= PF_THOKKED; player->pflags |= PF_THOKKED;
player->pflags &= ~(PF_JUMPED|PF_SPINNING); player->pflags &= ~(PF_JUMPED|PF_SPINNING);
P_DoJump(player, true); P_DoJump(player, true, true);
player->secondjump++; player->secondjump++;
} }
break; break;