From f3a715eae181093b9ff071c5c8f0a2a12096d08c Mon Sep 17 00:00:00 2001 From: SteelT Date: Sat, 17 Feb 2024 12:27:57 -0500 Subject: [PATCH 1/6] Battle powerup feedback sound definitions --- src/sounds.c | 8 ++++++++ src/sounds.h | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/src/sounds.c b/src/sounds.c index 894580328..165405621 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -1275,6 +1275,14 @@ sfxinfo_t S_sfx[NUMSFX] = {"dmgb3", 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, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Super Power"}, + {"bpwrub", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Mega Barrier"}, + {"bpwruc", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Bumper Restock"}, + {"bpwrud", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Rhythm Badge"}, + {"bpwrue", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Super Flicky"}, + {"bpwruf", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Bonus"}, + // SRB2Kart - Engine sounds // Engine class A {"krta00", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR, ""}, diff --git a/src/sounds.h b/src/sounds.h index 32aa96d94..e240a8f23 100644 --- a/src/sounds.h +++ b/src/sounds.h @@ -1351,6 +1351,14 @@ typedef enum sfx_dmgb3, 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... // Engine class A - Low Speed, Low Weight sfx_krta00, From 5181c7a6c21241b053e692015d4ba259e2effc2f Mon Sep 17 00:00:00 2001 From: SteelT Date: Sun, 18 Feb 2024 14:43:32 -0500 Subject: [PATCH 2/6] Associate sounds with powerups and set g_darkness --- src/k_powerup.cpp | 11 +++++++++++ src/k_powerup.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/src/k_powerup.cpp b/src/k_powerup.cpp index 70e762897..70a9e41c3 100644 --- a/src/k_powerup.cpp +++ b/src/k_powerup.cpp @@ -8,6 +8,7 @@ #include "k_hud.h" // K_AddMessage #include "p_mobj.h" #include "s_sound.h" +#include "p_tick.h" tic_t K_PowerUpRemaining(const player_t* player, kartitems_t powerup) { @@ -52,33 +53,42 @@ void K_GivePowerUp(player_t* player, kartitems_t powerup, tic_t time) Obj_SpawnPowerUpAura(player); } + S_StartSound(NULL, sfx_gsha7); player->flashing = 2*TICRATE; + g_darkness.start = leveltime; + g_darkness.end = leveltime + BATTLE_POWERUP_ANIM_TIME + DARKNESS_FADE_TIME; + switch (powerup) { case POWERUP_SMONITOR: + S_StartSound(NULL, sfx_bpwrua); K_AddMessageForPlayer(player, "Got S MONITOR!", true, false); K_DoInvincibility(player, time); player->powerup.superTimer += time; break; case POWERUP_BARRIER: + S_StartSound(NULL, sfx_bpwrub); K_AddMessageForPlayer(player, "Got MEGA BARRIER!", true, false); player->powerup.barrierTimer += time; Obj_SpawnMegaBarrier(player); break; case POWERUP_BUMPER: + S_StartSound(NULL, sfx_bpwruc); K_AddMessageForPlayer(player, "Got BUMPER RESTOCK!", true, false); K_GiveBumpersToPlayer(player, nullptr, 5); break; case POWERUP_BADGE: + S_StartSound(NULL, sfx_bpwrud); K_AddMessageForPlayer(player, "Got RHYTHM BADGE!", true, false); player->powerup.rhythmBadgeTimer += time; break; case POWERUP_SUPERFLICKY: + S_StartSound(NULL, sfx_bpwrue); K_AddMessageForPlayer(player, "Got SUPER FLICKY!", true, false); if (K_PowerUpRemaining(player, POWERUP_SUPERFLICKY)) { @@ -91,6 +101,7 @@ void K_GivePowerUp(player_t* player, kartitems_t powerup, tic_t time) break; case POWERUP_POINTS: + S_StartSound(NULL, sfx_bpwruf); K_AddMessageForPlayer(player, "Got 6 POINTS!", true, false); K_GivePointsToPlayer(player, nullptr, 6); diff --git a/src/k_powerup.h b/src/k_powerup.h index 0a94edf39..bb5ebeaa7 100644 --- a/src/k_powerup.h +++ b/src/k_powerup.h @@ -8,6 +8,8 @@ extern "C" { #endif +#define BATTLE_POWERUP_ANIM_TIME (40) + tic_t K_PowerUpRemaining(const player_t *player, kartitems_t powerup); UINT32 K_AnyPowerUpRemaining(const player_t *player); // returns POWERUP_BIT mask void K_GivePowerUp(player_t *player, kartitems_t powerup, tic_t timer); From 255c9222b04d64d6f2bf8d5625408fb978230e4b Mon Sep 17 00:00:00 2001 From: VelocitOni Date: Mon, 19 Feb 2024 03:41:19 -0500 Subject: [PATCH 3/6] More priority sounds Raised priority from 64 -> 255, even if I manually raised them in sounds.pk3, we may as well keep this change. --- src/sounds.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/sounds.c b/src/sounds.c index 165405621..3aaa10d36 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -1276,12 +1276,12 @@ sfxinfo_t S_sfx[NUMSFX] = {"dmgb4", false, 255, 8, -1, NULL, 0, -1, -1, LUMPERROR, "Damaged"}, // Powerup sounds - {"bpwrua", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Super Power"}, - {"bpwrub", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Mega Barrier"}, - {"bpwruc", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Bumper Restock"}, - {"bpwrud", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Rhythm Badge"}, - {"bpwrue", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Super Flicky"}, - {"bpwruf", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Bonus"}, + {"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 // Engine class A From 126c43b250b030bcb5bd57af03cd46c78478372d Mon Sep 17 00:00:00 2001 From: SteelT Date: Sat, 24 Feb 2024 22:44:41 -0500 Subject: [PATCH 4/6] Rename BATTLE_POWERUP_ANIM_TIME to BATTLE_POWERUP_VFX_TIME --- src/k_powerup.cpp | 2 +- src/k_powerup.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/k_powerup.cpp b/src/k_powerup.cpp index 70a9e41c3..6764bc9d8 100644 --- a/src/k_powerup.cpp +++ b/src/k_powerup.cpp @@ -57,7 +57,7 @@ void K_GivePowerUp(player_t* player, kartitems_t powerup, tic_t time) player->flashing = 2*TICRATE; g_darkness.start = leveltime; - g_darkness.end = leveltime + BATTLE_POWERUP_ANIM_TIME + DARKNESS_FADE_TIME; + g_darkness.end = leveltime + BATTLE_POWERUP_VFX_TIME + DARKNESS_FADE_TIME; switch (powerup) { diff --git a/src/k_powerup.h b/src/k_powerup.h index bb5ebeaa7..2804211e1 100644 --- a/src/k_powerup.h +++ b/src/k_powerup.h @@ -8,7 +8,7 @@ extern "C" { #endif -#define BATTLE_POWERUP_ANIM_TIME (40) +#define BATTLE_POWERUP_VFX_TIME (40) tic_t K_PowerUpRemaining(const player_t *player, kartitems_t powerup); UINT32 K_AnyPowerUpRemaining(const player_t *player); // returns POWERUP_BIT mask From cb21a9c8cdb326364affda70c14aaa8850c8e599 Mon Sep 17 00:00:00 2001 From: SteelT Date: Wed, 28 Feb 2024 21:21:34 -0500 Subject: [PATCH 5/6] Flicker player and add hitlag when collecting a powerup --- src/d_player.h | 3 ++- src/k_kart.c | 25 +++++++++++++++---------- src/k_powerup.cpp | 3 +++ src/p_saveg.c | 4 +++- src/r_spritefx.cpp | 13 ++++++++++++- 5 files changed, 35 insertions(+), 13 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 9659340ed..b5f93d1c9 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -409,7 +409,7 @@ struct botvars_t typedef enum { - UFOD_GENERIC = 1, + UFOD_GENERIC = 1, UFOD_BOOST = 1<<1, UFOD_WHIP = 1<<2, UFOD_BANANA = 1<<3, @@ -972,6 +972,7 @@ struct player_t UINT8 defenseLockout; // Committed to universal attack/defense, make 'em vulnerable! No whip/guard. UINT8 instaWhipChargeLockout; // Input safety boolean oldGuard; + tic_t powerupVFXTimer; // Battle powerup feedback UINT8 preventfailsafe; // Set when taking damage to prevent cheesing eggboxes diff --git a/src/k_kart.c b/src/k_kart.c index 341cd407a..513dfd905 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3827,14 +3827,14 @@ void K_DoPowerClash(mobj_t *t1, mobj_t *t2) { { t1->player->instashield = 1; t1->player->speedpunt += 20; - lag1 -= min(lag1, t1->player->speedpunt/10); + lag1 -= min(lag1, t1->player->speedpunt/10); } if (t2->player) { t2->player->instashield = 1; t2->player->speedpunt += 20; - lag2 -= min(lag1, t2->player->speedpunt/10); + lag2 -= min(lag1, t2->player->speedpunt/10); } S_StartSound(t1, sfx_parry); @@ -8231,7 +8231,7 @@ static void K_UpdateTripwire(player_t *player) if (triplevel != TRIPWIRE_CONSUME) player->tripwireLeniency = max(player->tripwireLeniency, TRIPWIRETIME); } - + // 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, // so that stripping Garden Top feels consistent. @@ -8580,10 +8580,10 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) if (P_PlayerInPain(player)) { - player->ringboost = 0; + player->ringboost = 0; } else if (player->ringboost) - { + { // 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 (player->superring == 0) @@ -8608,7 +8608,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) if (player->flamedash) { player->flamedash--; - + if (player->flamedash == 0) 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 @@ -8893,6 +8893,11 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) player->analoginput = false; } + if (player->powerupVFXTimer > 0) + { + player->powerupVFXTimer--; + } + if (player->dotrickfx && !player->mo->hitlag) { int i; @@ -9067,7 +9072,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) else { player->eggmanexplode--; - + if (!S_SoundPlaying(player->mo, sfx_kc51)) S_StartSound(player->mo, sfx_kc51); if (player->eggmanexplode == 5*TICRATE/2) @@ -11830,7 +11835,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) UINT32 behind = K_GetItemRouletteDistance(player, player->itemRoulette.playing); UINT32 behindMulti = behind / 500; behindMulti = min(behindMulti, 60); - + UINT32 award = 5*player->ringboxaward + 10; if (!cv_thunderdome.value) @@ -12323,7 +12328,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) player->ballhogcharge++; if (player->ballhogcharge % BALLHOGINCREMENT == 0) { - sfxenum_t hogsound[] = + sfxenum_t hogsound[] = { sfx_bhog00, sfx_bhog01, @@ -12982,7 +12987,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if (P_MobjWasRemoved(player->trickIndicator) == false) trickcolor = player->trickIndicator->color; - if (player->trickpanel == TRICKSTATE_FORWARD) + if (player->trickpanel == TRICKSTATE_FORWARD) { for (j = 0; j < 2; j++) { diff --git a/src/k_powerup.cpp b/src/k_powerup.cpp index 6764bc9d8..4ecc1efe1 100644 --- a/src/k_powerup.cpp +++ b/src/k_powerup.cpp @@ -9,6 +9,7 @@ #include "p_mobj.h" #include "s_sound.h" #include "p_tick.h" +#include "k_hitlag.h" tic_t K_PowerUpRemaining(const player_t* player, kartitems_t powerup) { @@ -55,6 +56,8 @@ void K_GivePowerUp(player_t* player, kartitems_t powerup, tic_t time) S_StartSound(NULL, sfx_gsha7); 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; diff --git a/src/p_saveg.c b/src/p_saveg.c index 8a423f5ec..820313fac 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -584,6 +584,7 @@ static void P_NetArchivePlayers(savebuffer_t *save) WRITEUINT8(save->p, players[i].instaWhipCharge); WRITEUINT8(save->p, players[i].defenseLockout); WRITEUINT8(save->p, players[i].oldGuard); + WRITEUINT8(save->p, players[i].powerupVFXTimer); WRITEUINT8(save->p, players[i].preventfailsafe); @@ -1166,6 +1167,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save) players[i].instaWhipCharge = READUINT8(save->p); players[i].defenseLockout = READUINT8(save->p); players[i].oldGuard = READUINT8(save->p); + players[i].powerupVFXTimer = READUINT8(save->p); players[i].preventfailsafe = READUINT8(save->p); @@ -6047,7 +6049,7 @@ static inline void P_ArchiveMisc(savebuffer_t *save) if (mapnum < nummapheaders && mapheaderinfo[mapnum] != NULL) { WRITEUINT8(save->p, roundqueue.entries[i].overridden); - + if (roundqueue.entries[i].overridden == true) { WRITESTRINGL(save->p, mapheaderinfo[mapnum]->lumpname, MAXMAPLUMPNAME); diff --git a/src/r_spritefx.cpp b/src/r_spritefx.cpp index 9eac77188..ae3edcf84 100644 --- a/src/r_spritefx.cpp +++ b/src/r_spritefx.cpp @@ -23,7 +23,18 @@ INT32 R_ThingLightLevel(mobj_t* thing) 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 lightlevel -= 128; From 13af88b3180aa3a2d8bc83ebcda7e51ffc979b4f Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 1 Mar 2024 17:54:00 -0800 Subject: [PATCH 6/6] player_t.powerupVFXTimer tic_t -> UINT8 --- src/d_player.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_player.h b/src/d_player.h index b5f93d1c9..76350caed 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -972,7 +972,7 @@ struct player_t UINT8 defenseLockout; // Committed to universal attack/defense, make 'em vulnerable! No whip/guard. UINT8 instaWhipChargeLockout; // Input safety boolean oldGuard; - tic_t powerupVFXTimer; // Battle powerup feedback + UINT8 powerupVFXTimer; // Battle powerup feedback UINT8 preventfailsafe; // Set when taking damage to prevent cheesing eggboxes