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

@ -409,7 +409,7 @@ struct botvars_t
typedef enum typedef enum
{ {
UFOD_GENERIC = 1, UFOD_GENERIC = 1,
UFOD_BOOST = 1<<1, UFOD_BOOST = 1<<1,
UFOD_WHIP = 1<<2, UFOD_WHIP = 1<<2,
UFOD_BANANA = 1<<3, UFOD_BANANA = 1<<3,
@ -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

@ -3831,14 +3831,14 @@ void K_DoPowerClash(mobj_t *t1, mobj_t *t2) {
{ {
t1->player->instashield = 1; t1->player->instashield = 1;
t1->player->speedpunt += 20; t1->player->speedpunt += 20;
lag1 -= min(lag1, t1->player->speedpunt/10); lag1 -= min(lag1, t1->player->speedpunt/10);
} }
if (t2->player) if (t2->player)
{ {
t2->player->instashield = 1; t2->player->instashield = 1;
t2->player->speedpunt += 20; t2->player->speedpunt += 20;
lag2 -= min(lag1, t2->player->speedpunt/10); lag2 -= min(lag1, t2->player->speedpunt/10);
} }
S_StartSound(t1, sfx_parry); S_StartSound(t1, sfx_parry);
@ -8235,7 +8235,7 @@ static void K_UpdateTripwire(player_t *player)
if (triplevel != TRIPWIRE_CONSUME) if (triplevel != TRIPWIRE_CONSUME)
player->tripwireLeniency = max(player->tripwireLeniency, TRIPWIRETIME); player->tripwireLeniency = max(player->tripwireLeniency, TRIPWIRETIME);
} }
// TRIPWIRE_CONSUME is only applied in very specific cases (currently, riding Garden Top) // TRIPWIRE_CONSUME is only applied in very specific cases (currently, riding Garden Top)
// and doesn't need leniency; however, it should track leniency from other pass conditions, // and doesn't need leniency; however, it should track leniency from other pass conditions,
// so that stripping Garden Top feels consistent. // so that stripping Garden Top feels consistent.
@ -8584,10 +8584,10 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
if (P_PlayerInPain(player)) if (P_PlayerInPain(player))
{ {
player->ringboost = 0; player->ringboost = 0;
} }
else if (player->ringboost) else if (player->ringboost)
{ {
// These values can get FUCKED ever since ring-stacking speed changes. // These values can get FUCKED ever since ring-stacking speed changes.
// If we're not actively being awarded rings, roll off extreme ringboost durations. // If we're not actively being awarded rings, roll off extreme ringboost durations.
if (player->superring == 0) if (player->superring == 0)
@ -8612,7 +8612,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
if (player->flamedash) if (player->flamedash)
{ {
player->flamedash--; player->flamedash--;
if (player->flamedash == 0) if (player->flamedash == 0)
S_StopSoundByID(player->mo, sfx_fshld1); S_StopSoundByID(player->mo, sfx_fshld1);
else if (player->flamedash == 3 && player->curshield == KSHIELD_FLAME) // "Why 3?" We can't blend sounds so this is the best shit I've got else if (player->flamedash == 3 && player->curshield == KSHIELD_FLAME) // "Why 3?" We can't blend sounds so this is the best shit I've got
@ -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;
@ -9074,7 +9079,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
else else
{ {
player->eggmanexplode--; player->eggmanexplode--;
if (!S_SoundPlaying(player->mo, sfx_kc51)) if (!S_SoundPlaying(player->mo, sfx_kc51))
S_StartSound(player->mo, sfx_kc51); S_StartSound(player->mo, sfx_kc51);
if (player->eggmanexplode == 5*TICRATE/2) if (player->eggmanexplode == 5*TICRATE/2)
@ -11844,7 +11849,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
UINT32 behind = K_GetItemRouletteDistance(player, player->itemRoulette.playing); UINT32 behind = K_GetItemRouletteDistance(player, player->itemRoulette.playing);
UINT32 behindMulti = behind / 500; UINT32 behindMulti = behind / 500;
behindMulti = min(behindMulti, 60); behindMulti = min(behindMulti, 60);
UINT32 award = 5*player->ringboxaward + 10; UINT32 award = 5*player->ringboxaward + 10;
if (!cv_thunderdome.value) if (!cv_thunderdome.value)
@ -12337,7 +12342,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
player->ballhogcharge++; player->ballhogcharge++;
if (player->ballhogcharge % BALLHOGINCREMENT == 0) if (player->ballhogcharge % BALLHOGINCREMENT == 0)
{ {
sfxenum_t hogsound[] = sfxenum_t hogsound[] =
{ {
sfx_bhog00, sfx_bhog00,
sfx_bhog01, sfx_bhog01,
@ -12996,7 +13001,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
if (P_MobjWasRemoved(player->trickIndicator) == false) if (P_MobjWasRemoved(player->trickIndicator) == false)
trickcolor = player->trickIndicator->color; trickcolor = player->trickIndicator->color;
if (player->trickpanel == TRICKSTATE_FORWARD) if (player->trickpanel == TRICKSTATE_FORWARD)
{ {
for (j = 0; j < 2; j++) for (j = 0; j < 2; j++)
{ {

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);
@ -6051,7 +6053,7 @@ static inline void P_ArchiveMisc(savebuffer_t *save)
if (mapnum < nummapheaders && mapheaderinfo[mapnum] != NULL) if (mapnum < nummapheaders && mapheaderinfo[mapnum] != NULL)
{ {
WRITEUINT8(save->p, roundqueue.entries[i].overridden); WRITEUINT8(save->p, roundqueue.entries[i].overridden);
if (roundqueue.entries[i].overridden == true) if (roundqueue.entries[i].overridden == true)
{ {
WRITESTRINGL(save->p, mapheaderinfo[mapnum]->lumpname, MAXMAPLUMPNAME); WRITESTRINGL(save->p, mapheaderinfo[mapnum]->lumpname, MAXMAPLUMPNAME);

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,