mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-29 07:32:02 +00:00
Add "allowflip" Parameter to P_DoJump
This commit is contained in:
parent
2a896538d9
commit
ecf950e749
3 changed files with 13 additions and 12 deletions
|
@ -1659,11 +1659,12 @@ static int lib_pDoJump(lua_State *L)
|
|||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
boolean soundandstate = (boolean)lua_opttrueboolean(L, 2);
|
||||
boolean allowflip = (boolean)lua_opttrueboolean(L, 3);
|
||||
NOHUD
|
||||
INLEVEL
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
P_DoJump(player, soundandstate);
|
||||
P_DoJump(player, soundandstate, allowflip);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -203,7 +203,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);
|
||||
boolean P_HomingAttack(mobj_t *source, mobj_t *enemy); /// \todo doesn't belong in p_user
|
||||
boolean P_SuperReady(player_t *player);
|
||||
void P_DoJump(player_t *player, boolean soundandstate);
|
||||
void P_DoJump(player_t *player, boolean soundandstate, boolean allowflip);
|
||||
#define P_AnalogMove(player) (P_ControlStyle(player) == CS_LMAOGALOG)
|
||||
boolean P_TransferToNextMare(player_t *player);
|
||||
UINT8 P_FindLowestMare(void);
|
||||
|
|
20
src/p_user.c
20
src/p_user.c
|
@ -4415,7 +4415,7 @@ boolean P_SuperReady(player_t *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;
|
||||
const fixed_t dist6 = FixedMul(FixedDiv(player->speed, player->mo->scale), player->actionspd)/20;
|
||||
|
@ -4588,7 +4588,7 @@ void P_DoJump(player_t *player, boolean soundandstate)
|
|||
if (player->charflags & SF_NOJUMPDAMAGE)
|
||||
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;
|
||||
S_StartSound(player->mo, sfx_s3k73); // Play gravity flip sound
|
||||
|
@ -4806,7 +4806,7 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd)
|
|||
#if 0
|
||||
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->mo->momz = FixedMul(player->mo->momz, 3*FRACUNIT/2); // NOT 1.5 times the jump height, but 2.25 times.
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_TWINSPIN);
|
||||
|
@ -4886,7 +4886,7 @@ void P_DoJumpShield(player_t *player)
|
|||
return;
|
||||
|
||||
player->pflags &= ~PF_JUMPED;
|
||||
P_DoJump(player, false);
|
||||
P_DoJump(player, false, true);
|
||||
player->secondjump = 0;
|
||||
player->pflags |= PF_THOKKED|PF_SHIELDABILITY;
|
||||
player->pflags &= ~(PF_STARTJUMP|PF_SPINNING|PF_BOUNCING);
|
||||
|
@ -4929,7 +4929,7 @@ void P_DoBubbleBounce(player_t *player)
|
|||
player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE|PF_SHIELDABILITY);
|
||||
S_StartSound(player->mo, sfx_s3k44);
|
||||
P_MobjCheckWater(player->mo);
|
||||
P_DoJump(player, false);
|
||||
P_DoJump(player, false, false);
|
||||
if (player->charflags & SF_NOJUMPSPIN)
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_FALL);
|
||||
else
|
||||
|
@ -4959,7 +4959,7 @@ void P_DoAbilityBounce(player_t *player, boolean changemomz)
|
|||
else if (player->mo->eflags & MFE_UNDERWATER)
|
||||
prevmomz /= 2;
|
||||
|
||||
P_DoJump(player, false);
|
||||
P_DoJump(player, false, false);
|
||||
player->pflags &= ~(PF_STARTJUMP|PF_JUMPED);
|
||||
minmomz = FixedMul(player->mo->momz, 3*FRACUNIT/2);
|
||||
|
||||
|
@ -5332,7 +5332,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
|
|||
// Jump S3&K style while in quicksand.
|
||||
else if (P_InQuicksand(player->mo))
|
||||
{
|
||||
P_DoJump(player, true);
|
||||
P_DoJump(player, true, false);
|
||||
player->secondjump = 0;
|
||||
player->pflags &= ~PF_THOKKED;
|
||||
}
|
||||
|
@ -5345,7 +5345,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
|
|||
// can't jump while in air, can't jump while jumping
|
||||
else if (onground || player->climbing || player->powers[pw_carry])
|
||||
{
|
||||
P_DoJump(player, true);
|
||||
P_DoJump(player, true, true);
|
||||
player->secondjump = 0;
|
||||
player->pflags &= ~PF_THOKKED;
|
||||
}
|
||||
|
@ -5381,7 +5381,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
|
|||
if ((player->charability == CA_JUMPTHOK) && !(player->pflags & PF_THOKKED))
|
||||
{
|
||||
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));
|
||||
|
@ -5490,7 +5490,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
|
|||
{
|
||||
player->pflags |= PF_THOKKED;
|
||||
player->pflags &= ~(PF_JUMPED|PF_SPINNING);
|
||||
P_DoJump(player, true);
|
||||
P_DoJump(player, true, true);
|
||||
player->secondjump++;
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue