mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-16 09:02:06 +00:00
Revert P_SuperReady to a boolean transform type
This commit is contained in:
parent
90958614f3
commit
34afebfc06
4 changed files with 17 additions and 60 deletions
|
@ -5315,11 +5315,6 @@ struct int_const_s const INT_CONST[] = {
|
|||
//// Masks
|
||||
{"DMG_CANHURTSELF",DMG_CANHURTSELF},
|
||||
{"DMG_DEATHMASK",DMG_DEATHMASK},
|
||||
// For P_SuperReady
|
||||
{"SUPERREADY_CLASSIC",SUPERREADY_CLASSIC},
|
||||
{"SUPERREADY_TRANSFORM",SUPERREADY_TRANSFORM},
|
||||
{"SUPERREADY_DETRANSFORM",SUPERREADY_DETRANSFORM},
|
||||
{"NUMSUPERREADY",NUMSUPERREADY},
|
||||
|
||||
// Intermission types
|
||||
{"int_none",int_none},
|
||||
|
|
|
@ -1712,14 +1712,12 @@ static int lib_pResetCamera(lua_State *L)
|
|||
static int lib_pSuperReady(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
superready_t type = luaL_optinteger(L, 2, SUPERREADY_CLASSIC);
|
||||
boolean transform = (boolean)lua_opttrueboolean(L, 2);
|
||||
//HUDSAFE
|
||||
INLEVEL
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
if (type < 0 || type >= NUMSUPERREADY)
|
||||
return luaL_error(L, "superready type %d out of range (0 - %d)", type, NUMSUPERREADY-1);
|
||||
lua_pushboolean(L, P_SuperReady(player, type));
|
||||
lua_pushboolean(L, P_SuperReady(player, transform));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -113,14 +113,6 @@ typedef struct camera_s
|
|||
fixed_t momx, momy, momz;
|
||||
} camera_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SUPERREADY_CLASSIC, // Two-button play mode, when Spin and Shield are bound to the same button (pressed on the same tic)
|
||||
SUPERREADY_TRANSFORM,
|
||||
SUPERREADY_DETRANSFORM,
|
||||
NUMSUPERREADY
|
||||
} superready_t;
|
||||
|
||||
extern camera_t camera, camera2;
|
||||
extern consvar_t cv_cam_dist, cv_cam_still, cv_cam_height;
|
||||
extern consvar_t cv_cam_speed, cv_cam_rotate, cv_cam_rotspeed, cv_cam_turnmultiplier, cv_cam_orbit, cv_cam_adjust;
|
||||
|
@ -211,7 +203,7 @@ mobj_t *P_LookForEnemies(player_t *player, boolean nonenemies, boolean bullet);
|
|||
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, superready_t type);
|
||||
boolean P_SuperReady(player_t *player, boolean transform);
|
||||
void P_DoJump(player_t *player, boolean soundandstate, boolean allowflip);
|
||||
void P_DoSpinDashDust(player_t *player);
|
||||
#define P_AnalogMove(player) (P_ControlStyle(player) == CS_LMAOGALOG)
|
||||
|
|
56
src/p_user.c
56
src/p_user.c
|
@ -4431,47 +4431,18 @@ static void P_DoSuperStuff(player_t *player)
|
|||
//
|
||||
// Returns true if player is ready to transform or detransform
|
||||
//
|
||||
boolean P_SuperReady(player_t *player, superready_t type)
|
||||
boolean P_SuperReady(player_t *player, boolean transform)
|
||||
{
|
||||
switch (type) // Transformation-type-specific checks
|
||||
{
|
||||
case SUPERREADY_CLASSIC:
|
||||
// Pressed Spin and Shield on the same tic? Then you've probably bound them to the same button,
|
||||
// so let's match the earlier Spin-only button behaviour to still support two-button play
|
||||
if (!player->powers[pw_super]
|
||||
&& !player->powers[pw_invulnerability]
|
||||
&& !player->powers[pw_tailsfly]
|
||||
&& (player->charflags & SF_SUPER)
|
||||
&& (player->pflags & PF_JUMPED)
|
||||
&& !(player->powers[pw_shield] & SH_NOSTACK)
|
||||
&& !(maptol & TOL_NIGHTS)
|
||||
&& ALL7EMERALDS(emeralds)
|
||||
&& (player->rings >= 50))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
break;
|
||||
if (!transform &&
|
||||
(player->powers[pw_super] < TICRATE*3/2
|
||||
|| !G_CoopGametype())) // No turning back in competitive!
|
||||
return false;
|
||||
else if (transform
|
||||
&& (player->powers[pw_super]
|
||||
|| !ALL7EMERALDS(emeralds)
|
||||
|| !(player->rings >= 50)))
|
||||
return false;
|
||||
|
||||
case SUPERREADY_TRANSFORM:
|
||||
// Turning Super by pressing Shield?
|
||||
if (player->powers[pw_super]
|
||||
|| !ALL7EMERALDS(emeralds)
|
||||
|| !(player->rings >= 50))
|
||||
return false;
|
||||
break;
|
||||
|
||||
case SUPERREADY_DETRANSFORM:
|
||||
// Reverting from Super by pressing Shield?
|
||||
if ((player->powers[pw_super] < TICRATE*3/2) // No spamming the transformation sound!
|
||||
|| !G_CoopGametype()) // No turning back in competitive!
|
||||
return false;
|
||||
break;
|
||||
|
||||
default: // "type" is an enum, so having a case for every enum value pleases the compiler
|
||||
break;
|
||||
}
|
||||
|
||||
// These checks apply to both SUPERREADY_TRANSFORM and SUPERREADY_DETRANSFORM
|
||||
if (player->mo
|
||||
&& !player->powers[pw_tailsfly]
|
||||
&& !player->powers[pw_carry]
|
||||
|
@ -5335,7 +5306,8 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd, boolean spinshieldhac
|
|||
;
|
||||
else if (cmd->buttons & BT_SPIN)
|
||||
{
|
||||
if (spinshieldhack && !(player->pflags & PF_SPINDOWN) && P_SuperReady(player, SUPERREADY_CLASSIC))
|
||||
if (spinshieldhack && !(player->pflags & PF_SPINDOWN) && P_SuperReady(player, true)
|
||||
&& !player->powers[pw_invulnerability] && !(player->powers[pw_shield] & SH_NOSTACK)) // These two checks are no longer in P_SuperReady
|
||||
{
|
||||
// If you're using two-button play, can turn Super and aren't already,
|
||||
// and you don't have a shield, then turn Super!
|
||||
|
@ -8827,11 +8799,11 @@ void P_MovePlayer(player_t *player)
|
|||
if ((cmd->buttons & BT_SHIELD) && !(player->pflags & PF_SHIELDDOWN) && !spinshieldhack)
|
||||
{
|
||||
// Transform into super if we can!
|
||||
if (P_SuperReady(player, SUPERREADY_TRANSFORM))
|
||||
if (P_SuperReady(player, true))
|
||||
P_DoSuperTransformation(player, false);
|
||||
|
||||
// Detransform from super if we can!
|
||||
else if (P_SuperReady(player, SUPERREADY_DETRANSFORM))
|
||||
else if (P_SuperReady(player, false))
|
||||
P_DoSuperDetransformation(player);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue