mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'reset-cooldowns-when-hurt' into 'master'
Refactor guard/whip cooldown checks Closes #880 See merge request KartKrew/Kart!1803
This commit is contained in:
commit
7b08c78f1b
8 changed files with 41 additions and 41 deletions
|
|
@ -961,9 +961,9 @@ struct player_t
|
|||
mobj_t *flickyAttacker;
|
||||
|
||||
UINT8 instaWhipCharge;
|
||||
UINT8 instaWhipCooldown;
|
||||
UINT8 instaWhipChargeLockout;
|
||||
UINT8 guardCooldown;
|
||||
UINT8 defenseLockout; // Committed to universal attack/defense, make 'em vulnerable! No whip/guard.
|
||||
UINT8 instaWhipChargeLockout; // Input safety
|
||||
boolean oldGuard;
|
||||
|
||||
UINT8 preventfailsafe; // Set when taking damage to prevent cheesing eggboxes
|
||||
|
||||
|
|
|
|||
|
|
@ -873,7 +873,6 @@ boolean K_InstaWhipCollide(mobj_t *shield, mobj_t *victim)
|
|||
attackerPlayer->spindashboost = 0;
|
||||
attackerPlayer->sneakertimer = 0;
|
||||
attackerPlayer->instaWhipCharge = 0;
|
||||
attackerPlayer->guardCooldown = GUARDBREAK_COOLDOWN;
|
||||
attackerPlayer->flashing = 0;
|
||||
|
||||
// Localized broly for a local event.
|
||||
|
|
|
|||
44
src/k_kart.c
44
src/k_kart.c
|
|
@ -1493,7 +1493,7 @@ static void K_UpdateDraft(player_t *player)
|
|||
}
|
||||
|
||||
// Want to berserk attack? Get your speed FIRST.
|
||||
if (player->instaWhipCharge >= INSTAWHIP_TETHERBLOCK || player->instaWhipCooldown)
|
||||
if (player->instaWhipCharge >= INSTAWHIP_TETHERBLOCK || player->defenseLockout)
|
||||
return;
|
||||
|
||||
// Not enough speed to draft.
|
||||
|
|
@ -3827,7 +3827,6 @@ void K_DoGuardBreak(mobj_t *t1, mobj_t *t2) {
|
|||
return;
|
||||
|
||||
t1->player->instaWhipCharge = 0;
|
||||
t1->player->guardCooldown = GUARDBREAK_COOLDOWN;
|
||||
|
||||
S_StartSound(t1, sfx_gbrk);
|
||||
K_AddHitLag(t1, 24, true);
|
||||
|
|
@ -8561,8 +8560,19 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
|||
player->powerup.superTimer--;
|
||||
}
|
||||
|
||||
if (player->guardCooldown)
|
||||
player->guardCooldown--;
|
||||
if (K_PlayerGuard(player))
|
||||
{
|
||||
if (!player->oldGuard)
|
||||
S_StartSound(player->mo, sfx_s1af);
|
||||
|
||||
player->oldGuard = true;
|
||||
player->instaWhipCharge = 0;
|
||||
}
|
||||
else if (player->oldGuard)
|
||||
{
|
||||
player->defenseLockout = PUNISHWINDOW;
|
||||
player->oldGuard = false;
|
||||
}
|
||||
|
||||
if (player->startboost > 0 && onground == true)
|
||||
{
|
||||
|
|
@ -8718,18 +8728,10 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
|||
if (player->justbumped > 0)
|
||||
player->justbumped--;
|
||||
|
||||
if (K_PressingEBrake(player) == true && onground)
|
||||
{
|
||||
if (gametyperules & GTR_BUMPERS)
|
||||
player->instaWhipCooldown = INSTAWHIP_DROPGUARD; // Delay whip out of spindash and guard.
|
||||
else
|
||||
player->instaWhipCharge = 0; // Not that important in race, avoid black flash.
|
||||
}
|
||||
|
||||
if (player->instaWhipCooldown)
|
||||
if (player->defenseLockout)
|
||||
{
|
||||
player->instaWhipCharge = 0;
|
||||
player->instaWhipCooldown--;
|
||||
player->defenseLockout--;
|
||||
}
|
||||
|
||||
if (player->dotrickfx && !player->mo->hitlag)
|
||||
|
|
@ -8821,7 +8823,11 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
|||
player->incontrol = max(player->incontrol, -5*TICRATE);
|
||||
|
||||
if (P_PlayerInPain(player) || player->respawn.state != RESPAWNST_NONE)
|
||||
{
|
||||
player->lastpickuptype = -1; // got your ass beat, go grab anything
|
||||
player->defenseLockout = 0; // and reenable defensive tools just in case
|
||||
}
|
||||
|
||||
|
||||
if (player->tumbleBounces > 0)
|
||||
{
|
||||
|
|
@ -10760,7 +10766,7 @@ boolean K_PlayerEBrake(const player_t *player)
|
|||
|
||||
boolean K_PlayerGuard(const player_t *player)
|
||||
{
|
||||
if (player->guardCooldown != 0)
|
||||
if (player->defenseLockout != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -11612,10 +11618,9 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
}
|
||||
|
||||
chargingwhip = false;
|
||||
player->instaWhipCooldown = 0;
|
||||
}
|
||||
|
||||
if (leveltime < starttime || player->itemflags & (IF_ITEMOUT|IF_EGGMANOUT) || player->rocketsneakertimer || player->instaWhipCooldown)
|
||||
if (leveltime < starttime || player->itemflags & (IF_ITEMOUT|IF_EGGMANOUT) || player->rocketsneakertimer || (player->defenseLockout && !K_PowerUpRemaining(player, POWERUP_BADGE)))
|
||||
{
|
||||
chargingwhip = false;
|
||||
player->instaWhipCharge = 0;
|
||||
|
|
@ -11657,11 +11662,10 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
else
|
||||
{
|
||||
player->instaWhipCharge = 0;
|
||||
player->instaWhipCooldown = INSTAWHIP_COOLDOWN;
|
||||
player->guardCooldown = INSTAWHIP_DROPGUARD;
|
||||
player->defenseLockout = PUNISHWINDOW;
|
||||
if (!K_PowerUpRemaining(player, POWERUP_BARRIER))
|
||||
{
|
||||
player->guardCooldown = INSTAWHIP_CHARGETIME;
|
||||
player->defenseLockout = INSTAWHIP_CHARGETIME;
|
||||
}
|
||||
|
||||
S_StartSound(player->mo, sfx_iwhp);
|
||||
|
|
|
|||
|
|
@ -31,13 +31,11 @@ Make sure this matches the actual number of states
|
|||
|
||||
#define INSTAWHIP_DURATION (12)
|
||||
#define INSTAWHIP_CHARGETIME (3*TICRATE/4)
|
||||
#define INSTAWHIP_COOLDOWN (5*TICRATE/4)
|
||||
#define INSTAWHIP_DROPGUARD (12)
|
||||
#define INSTAWHIP_RINGDRAINEVERY (TICRATE/2)
|
||||
#define INSTAWHIP_HOLD_DELAY (TICRATE*2)
|
||||
// MUST be longer or equal to INSTAWHIP_CHARGETIME.
|
||||
#define INSTAWHIP_TETHERBLOCK (TICRATE*4)
|
||||
#define GUARDBREAK_COOLDOWN (TICRATE*4)
|
||||
#define PUNISHWINDOW (7*TICRATE/10)
|
||||
|
||||
#define FLAMESHIELD_MAX (120)
|
||||
|
||||
|
|
|
|||
|
|
@ -347,10 +347,10 @@ static int player_get(lua_State *L)
|
|||
lua_pushinteger(L, plr->lastsafelap);
|
||||
else if (fastcmp(field,"instaWhipCharge"))
|
||||
lua_pushinteger(L, plr->instaWhipCharge);
|
||||
else if (fastcmp(field,"instaWhipCooldown"))
|
||||
lua_pushinteger(L, plr->instaWhipCooldown);
|
||||
else if (fastcmp(field,"guardCooldown"))
|
||||
lua_pushinteger(L, plr->guardCooldown);
|
||||
else if (fastcmp(field,"defenseLockout"))
|
||||
lua_pushinteger(L, plr->defenseLockout);
|
||||
else if (fastcmp(field,"oldGuard"))
|
||||
lua_pushinteger(L, plr->oldGuard);
|
||||
else if (fastcmp(field,"preventfailsafe"))
|
||||
lua_pushinteger(L, plr->preventfailsafe);
|
||||
/*
|
||||
|
|
@ -865,10 +865,10 @@ static int player_set(lua_State *L)
|
|||
plr->lastsafelap = luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"instaWhipCharge"))
|
||||
plr->instaWhipCharge = luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"instaWhipCooldown"))
|
||||
plr->instaWhipCharge = luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"guardCooldown"))
|
||||
plr->guardCooldown = luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"defenseLockout"))
|
||||
plr->defenseLockout = luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"oldGuard"))
|
||||
plr->oldGuard = luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"preventfailsafe"))
|
||||
plr->preventfailsafe = luaL_checkinteger(L, 3);
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
#include "../info.h"
|
||||
#include "../k_objects.h"
|
||||
#include "../p_local.h"
|
||||
#include "../k_kart.h" // INSTAWHIP_COOLDOWN
|
||||
|
||||
#define recharge_target(o) ((o)->target)
|
||||
#define recharge_offset(o) ((o)->movedir)
|
||||
|
|
|
|||
|
|
@ -574,8 +574,8 @@ static void P_NetArchivePlayers(savebuffer_t *save)
|
|||
WRITEMEM(save->p, players[i].public_key, PUBKEYLENGTH);
|
||||
|
||||
WRITEUINT8(save->p, players[i].instaWhipCharge);
|
||||
WRITEUINT8(save->p, players[i].instaWhipCooldown);
|
||||
WRITEUINT8(save->p, players[i].guardCooldown);
|
||||
WRITEUINT8(save->p, players[i].defenseLockout);
|
||||
WRITEUINT8(save->p, players[i].oldGuard);
|
||||
|
||||
WRITEUINT8(save->p, players[i].preventfailsafe);
|
||||
|
||||
|
|
@ -1143,8 +1143,8 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
|
|||
READMEM(save->p, players[i].public_key, PUBKEYLENGTH);
|
||||
|
||||
players[i].instaWhipCharge = READUINT8(save->p);
|
||||
players[i].instaWhipCooldown = READUINT8(save->p);
|
||||
players[i].guardCooldown = READUINT8(save->p);
|
||||
players[i].defenseLockout = READUINT8(save->p);
|
||||
players[i].oldGuard = READUINT8(save->p);
|
||||
|
||||
players[i].preventfailsafe = READUINT8(save->p);
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ INT32 R_ThingLightLevel(mobj_t* thing)
|
|||
|
||||
if (player)
|
||||
{
|
||||
if ((player->instaWhipCharge || player->instaWhipCooldown) && !player->whip && (leveltime & 1))
|
||||
if ((player->instaWhipCharge || player->defenseLockout) && !player->whip && (leveltime & 1))
|
||||
{
|
||||
// Darken on every other frame of instawhip cooldown
|
||||
lightlevel -= 128;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue