Charge instawhip test fixups 2

This commit is contained in:
AJ Martinez 2023-10-14 05:56:42 -07:00
parent 0b341a02aa
commit b67aa8af4f
8 changed files with 26 additions and 4 deletions

View file

@ -858,6 +858,7 @@ struct player_t
mobj_t *flickyAttacker;
UINT8 instaWhipCharge;
UINT8 instaWhipCooldown;
UINT8 instaWhipChargeLockout;
UINT8 guardCooldown;

View file

@ -8266,6 +8266,12 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
if (player->justbumped > 0)
player->justbumped--;
if (player->instaWhipCooldown)
{
player->instaWhipCharge = 0;
player->instaWhipCooldown--;
}
// Don't screw up chain ring pickup/usage with instawhip charge.
// If the button stays held, delay charge a bit.
if (player->instaWhipChargeLockout)
@ -8278,7 +8284,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
if (player->instaWhipCharge && player->instaWhipCharge < INSTAWHIP_CHARGETIME)
{
if (!S_SoundPlaying(player->mo, sfx_wchrg1))
S_StartSound(player->mo, sfx_wchrg1);
S_StartSoundAtVolume(player->mo, sfx_wchrg1, 255/2);
}
else
{
@ -8288,7 +8294,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
if (player->instaWhipCharge >= INSTAWHIP_CHARGETIME)
{
if (!S_SoundPlaying(player->mo, sfx_wchrg2))
S_StartSound(player->mo, sfx_wchrg2);
S_StartSoundAtVolume(player->mo, sfx_wchrg2, 255/3);
}
else
{
@ -11031,7 +11037,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
player->instaWhipCharge = INSTAWHIP_CHARGETIME;
}
if (leveltime < starttime || player->spindash || player->pflags & (PF_ITEMOUT|PF_EGGMANOUT) || player->rocketsneakertimer)
if (leveltime < starttime || player->spindash || player->pflags & (PF_ITEMOUT|PF_EGGMANOUT) || player->rocketsneakertimer || player->instaWhipCooldown)
{
chargingwhip = false;
player->instaWhipCharge = 0;
@ -11073,6 +11079,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
else
{
player->instaWhipCharge = 0;
player->instaWhipCooldown = INSTAWHIP_COOLDOWN;
player->guardCooldown = INSTAWHIP_DROPGUARD;
if (!K_PowerUpRemaining(player, POWERUP_BARRIER))
{

View file

@ -31,6 +31,7 @@ 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)

View file

@ -331,6 +331,8 @@ static int player_get(lua_State *L)
lua_pushinteger(L, plr->sliptideZipBoost);
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);
/*
@ -809,6 +811,8 @@ static int player_set(lua_State *L)
plr->sliptideZipBoost = 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);
/*

View file

@ -39,6 +39,7 @@ static const struct monitor_part_config {
#define monitor_emerald(o) ((o)->extravalue1)
#define monitor_damage(o) ((o)->extravalue2)
#define monitor_rammingspeed(o) ((o)->movefactor)
#define monitor_combohit(o) ((o)->cusval)
static inline UINT8
get_monitor_itemcount (const mobj_t *monitor)
@ -590,6 +591,11 @@ Obj_MonitorGetDamage
{
fixed_t damage;
if (leveltime - monitor_combohit(monitor) < 35) // Fast combo hits destroy monitors.
return FRACUNIT;
monitor_combohit(monitor) = leveltime;
switch (damagetype & DMG_TYPEMASK)
{
case DMG_VOLTAGE:

View file

@ -404,6 +404,7 @@ struct mobj_t
// Custom values are not to be altered by us!
// They are for SOCs to store things in.
// (This rule is already broken by a bunch of shit so I'm just gonna believe in dreams - Tyron 2023-10-14)
INT32 cusval;
INT32 cvmem;

View file

@ -542,6 +542,7 @@ 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].handtimer);
@ -1052,6 +1053,7 @@ 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].handtimer = READUINT8(save->p);

View file

@ -23,7 +23,7 @@ INT32 R_ThingLightLevel(mobj_t* thing)
if (player)
{
if (player->instaWhipCharge && !player->whip && (player->rings <= 0) && (leveltime & 1))
if ((player->instaWhipCharge || player->instaWhipCooldown) && !player->whip && (leveltime & 1))
{
// Darken on every other frame of instawhip cooldown
lightlevel -= 128;