Adding ShieldSpecial hook. (Activates under different circumstances to the JumpSpinSpecial hook, and can be used to cancel existing shield actions.)

This commit is contained in:
toasterbabe 2016-10-24 13:52:36 +01:00
parent 162c04c370
commit 0ee2937392
3 changed files with 8 additions and 1 deletions

View File

@ -44,6 +44,7 @@ enum hook {
hook_HurtMsg,
hook_PlayerSpawn,
hook_ShieldSpawn,
hook_ShieldSpecial,
hook_MAX // last hook
};
@ -79,5 +80,6 @@ boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg); // Hook fo
boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source); // Hook for hurt messages
#define LUAh_PlayerSpawn(player) LUAh_PlayerHook(player, hook_PlayerSpawn) // Hook for G_SpawnPlayer
#define LUAh_ShieldSpawn(player) LUAh_PlayerHook(player, hook_ShieldSpawn) // Hook for P_SpawnShieldOrb
#define LUAh_ShieldSpecial(player) LUAh_PlayerHook(player, hook_ShieldSpecial) // Hook for shield abilities
#endif

View File

@ -55,6 +55,7 @@ const char *const hookNames[hook_MAX+1] = {
"HurtMsg",
"PlayerSpawn",
"ShieldSpawn",
"ShieldSpecial",
NULL
};

View File

@ -6978,10 +6978,14 @@ static void P_MovePlayer(player_t *player)
//STUFF! //
///////////////////////////
if (player->pflags & PF_JUMPED)
if (player->pflags & PF_JUMPED && !player->exiting && player->mo->health)
{
if (cmd->buttons & BT_USE) // Spin button effects
{
#ifdef HAVE_BLUA
if (LUAh_ShieldSpecial(player))
return;
#endif
if (!(player->pflags & (PF_USEDOWN|PF_GLIDING|PF_SLIDING|PF_SHIELDABILITY)) // If the player is not holding down BT_USE, or having used an ability previously
&& (!(player->pflags & PF_THOKKED) || ((player->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP && player->secondjump == UINT8_MAX))) // thokked is optional if you're bubblewrapped
{