Merge branch 'battle-powerup-feedme' into 'master'

Battle: Visual and audio feedback for power-ups

See merge request KartKrew/Kart!1986
This commit is contained in:
James R. 2024-03-03 01:30:54 +00:00
commit 5bc7d105cc
8 changed files with 64 additions and 13 deletions

View file

@ -975,6 +975,7 @@ struct player_t
UINT8 defenseLockout; // Committed to universal attack/defense, make 'em vulnerable! No whip/guard. UINT8 defenseLockout; // Committed to universal attack/defense, make 'em vulnerable! No whip/guard.
UINT8 instaWhipChargeLockout; // Input safety UINT8 instaWhipChargeLockout; // Input safety
boolean oldGuard; boolean oldGuard;
UINT8 powerupVFXTimer; // Battle powerup feedback
UINT8 preventfailsafe; // Set when taking damage to prevent cheesing eggboxes UINT8 preventfailsafe; // Set when taking damage to prevent cheesing eggboxes

View file

@ -8900,6 +8900,11 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
player->analoginput = false; player->analoginput = false;
} }
if (player->powerupVFXTimer > 0)
{
player->powerupVFXTimer--;
}
if (player->dotrickfx && !player->mo->hitlag) if (player->dotrickfx && !player->mo->hitlag)
{ {
int i; int i;

View file

@ -8,6 +8,8 @@
#include "k_hud.h" // K_AddMessage #include "k_hud.h" // K_AddMessage
#include "p_mobj.h" #include "p_mobj.h"
#include "s_sound.h" #include "s_sound.h"
#include "p_tick.h"
#include "k_hitlag.h"
tic_t K_PowerUpRemaining(const player_t* player, kartitems_t powerup) tic_t K_PowerUpRemaining(const player_t* player, kartitems_t powerup)
{ {
@ -52,33 +54,44 @@ void K_GivePowerUp(player_t* player, kartitems_t powerup, tic_t time)
Obj_SpawnPowerUpAura(player); Obj_SpawnPowerUpAura(player);
} }
S_StartSound(NULL, sfx_gsha7);
player->flashing = 2*TICRATE; player->flashing = 2*TICRATE;
K_AddHitLag(player->mo, BATTLE_POWERUP_VFX_TIME, false);
player->powerupVFXTimer = BATTLE_POWERUP_VFX_TIME;
g_darkness.start = leveltime;
g_darkness.end = leveltime + BATTLE_POWERUP_VFX_TIME + DARKNESS_FADE_TIME;
switch (powerup) switch (powerup)
{ {
case POWERUP_SMONITOR: case POWERUP_SMONITOR:
S_StartSound(NULL, sfx_bpwrua);
K_AddMessageForPlayer(player, "Got S MONITOR!", true, false); K_AddMessageForPlayer(player, "Got S MONITOR!", true, false);
K_DoInvincibility(player, time); K_DoInvincibility(player, time);
player->powerup.superTimer += time; player->powerup.superTimer += time;
break; break;
case POWERUP_BARRIER: case POWERUP_BARRIER:
S_StartSound(NULL, sfx_bpwrub);
K_AddMessageForPlayer(player, "Got MEGA BARRIER!", true, false); K_AddMessageForPlayer(player, "Got MEGA BARRIER!", true, false);
player->powerup.barrierTimer += time; player->powerup.barrierTimer += time;
Obj_SpawnMegaBarrier(player); Obj_SpawnMegaBarrier(player);
break; break;
case POWERUP_BUMPER: case POWERUP_BUMPER:
S_StartSound(NULL, sfx_bpwruc);
K_AddMessageForPlayer(player, "Got BUMPER RESTOCK!", true, false); K_AddMessageForPlayer(player, "Got BUMPER RESTOCK!", true, false);
K_GiveBumpersToPlayer(player, nullptr, 5); K_GiveBumpersToPlayer(player, nullptr, 5);
break; break;
case POWERUP_BADGE: case POWERUP_BADGE:
S_StartSound(NULL, sfx_bpwrud);
K_AddMessageForPlayer(player, "Got RHYTHM BADGE!", true, false); K_AddMessageForPlayer(player, "Got RHYTHM BADGE!", true, false);
player->powerup.rhythmBadgeTimer += time; player->powerup.rhythmBadgeTimer += time;
break; break;
case POWERUP_SUPERFLICKY: case POWERUP_SUPERFLICKY:
S_StartSound(NULL, sfx_bpwrue);
K_AddMessageForPlayer(player, "Got SUPER FLICKY!", true, false); K_AddMessageForPlayer(player, "Got SUPER FLICKY!", true, false);
if (K_PowerUpRemaining(player, POWERUP_SUPERFLICKY)) if (K_PowerUpRemaining(player, POWERUP_SUPERFLICKY))
{ {
@ -91,6 +104,7 @@ void K_GivePowerUp(player_t* player, kartitems_t powerup, tic_t time)
break; break;
case POWERUP_POINTS: case POWERUP_POINTS:
S_StartSound(NULL, sfx_bpwruf);
K_AddMessageForPlayer(player, "Got 6 POINTS!", true, false); K_AddMessageForPlayer(player, "Got 6 POINTS!", true, false);
K_GivePointsToPlayer(player, nullptr, 6); K_GivePointsToPlayer(player, nullptr, 6);

View file

@ -8,6 +8,8 @@
extern "C" { extern "C" {
#endif #endif
#define BATTLE_POWERUP_VFX_TIME (40)
tic_t K_PowerUpRemaining(const player_t *player, kartitems_t powerup); tic_t K_PowerUpRemaining(const player_t *player, kartitems_t powerup);
UINT32 K_AnyPowerUpRemaining(const player_t *player); // returns POWERUP_BIT mask UINT32 K_AnyPowerUpRemaining(const player_t *player); // returns POWERUP_BIT mask
void K_GivePowerUp(player_t *player, kartitems_t powerup, tic_t timer); void K_GivePowerUp(player_t *player, kartitems_t powerup, tic_t timer);

View file

@ -586,6 +586,7 @@ static void P_NetArchivePlayers(savebuffer_t *save)
WRITEUINT8(save->p, players[i].instaWhipCharge); WRITEUINT8(save->p, players[i].instaWhipCharge);
WRITEUINT8(save->p, players[i].defenseLockout); WRITEUINT8(save->p, players[i].defenseLockout);
WRITEUINT8(save->p, players[i].oldGuard); WRITEUINT8(save->p, players[i].oldGuard);
WRITEUINT8(save->p, players[i].powerupVFXTimer);
WRITEUINT8(save->p, players[i].preventfailsafe); WRITEUINT8(save->p, players[i].preventfailsafe);
@ -1170,6 +1171,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
players[i].instaWhipCharge = READUINT8(save->p); players[i].instaWhipCharge = READUINT8(save->p);
players[i].defenseLockout = READUINT8(save->p); players[i].defenseLockout = READUINT8(save->p);
players[i].oldGuard = READUINT8(save->p); players[i].oldGuard = READUINT8(save->p);
players[i].powerupVFXTimer = READUINT8(save->p);
players[i].preventfailsafe = READUINT8(save->p); players[i].preventfailsafe = READUINT8(save->p);

View file

@ -23,7 +23,18 @@ INT32 R_ThingLightLevel(mobj_t* thing)
if (player) if (player)
{ {
if ((player->instaWhipCharge || player->defenseLockout) && !player->whip && (leveltime & 1)) if (player->powerupVFXTimer)
{
if ((leveltime & 1))
{
lightlevel -= 255;
}
else
{
lightlevel += 255;
}
}
else if ((player->instaWhipCharge || player->defenseLockout) && !player->whip && (leveltime & 1))
{ {
// Darken on every other frame of instawhip cooldown // Darken on every other frame of instawhip cooldown
lightlevel -= 128; lightlevel -= 128;

View file

@ -1275,6 +1275,14 @@ sfxinfo_t S_sfx[NUMSFX] =
{"dmgb3", false, 255, 8, -1, NULL, 0, -1, -1, LUMPERROR, "Damaged"}, {"dmgb3", false, 255, 8, -1, NULL, 0, -1, -1, LUMPERROR, "Damaged"},
{"dmgb4", false, 255, 8, -1, NULL, 0, -1, -1, LUMPERROR, "Damaged"}, {"dmgb4", false, 255, 8, -1, NULL, 0, -1, -1, LUMPERROR, "Damaged"},
// Powerup sounds
{"bpwrua", false, 255, 16, -1, NULL, 0, -1, -1, LUMPERROR, "Super Power"},
{"bpwrub", false, 255, 16, -1, NULL, 0, -1, -1, LUMPERROR, "Mega Barrier"},
{"bpwruc", false, 255, 16, -1, NULL, 0, -1, -1, LUMPERROR, "Bumper Restock"},
{"bpwrud", false, 255, 16, -1, NULL, 0, -1, -1, LUMPERROR, "Rhythm Badge"},
{"bpwrue", false, 255, 16, -1, NULL, 0, -1, -1, LUMPERROR, "Super Flicky"},
{"bpwruf", false, 255, 16, -1, NULL, 0, -1, -1, LUMPERROR, "Bonus"},
// SRB2Kart - Engine sounds // SRB2Kart - Engine sounds
// Engine class A // Engine class A
{"krta00", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR, ""}, {"krta00", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR, ""},

View file

@ -1351,6 +1351,14 @@ typedef enum
sfx_dmgb3, sfx_dmgb3,
sfx_dmgb4, sfx_dmgb4,
// Powerup sounds
sfx_bpwrua, // Super Power
sfx_bpwrub, // Mega Barrier
sfx_bpwruc, // Bumper Restock
sfx_bpwrud, // Rhythm Badge
sfx_bpwrue, // Super Flicky
sfx_bpwruf, // Bonus
// Next up: UNIQUE ENGINE SOUNDS! Hoooooo boy... // Next up: UNIQUE ENGINE SOUNDS! Hoooooo boy...
// Engine class A - Low Speed, Low Weight // Engine class A - Low Speed, Low Weight
sfx_krta00, sfx_krta00,