Add driftpulse controller rumble

inspired by radioracers, this does a "weak" rumble pulse the moment the sparks pulse (this is slightly after reaching the new driftlevel)
may want a toggle for this
This commit is contained in:
Alug committed 2025-08-03 15:38:55 +02:00
1 parent 5f77dbb946
commit 267ccae3a9
4 files changed
+33 -3

No files matched your search

+2
View File
@@ -568,6 +568,8 @@ typedef struct player_s
squishdance_t squishdance;
fixed_t fovadd; // adjust FOV for hw rendering
SINT8 driftlevel; // just for controller rumble for now
} player_t;
#endif
+16 -3
View File
@@ -6029,14 +6029,27 @@ static void K_KartDrift(player_t *player, boolean onground)
if (player->speed > minspeed*2)
player->kartstuff[k_getsparks] = 1;
const boolean driftblue = (player->kartstuff[k_driftcharge] < dsone && player->kartstuff[k_driftcharge]+driftadditive >= dsone);
const boolean driftred = (player->kartstuff[k_driftcharge] < dstwo && player->kartstuff[k_driftcharge]+driftadditive >= dstwo);
const boolean driftrainbow = (player->kartstuff[k_driftcharge] < dsthree && player->kartstuff[k_driftcharge]+driftadditive >= dsthree);
// Sound whenever you get a different tier of sparks
if ((player->kartstuff[k_driftcharge] < dsone && player->kartstuff[k_driftcharge]+driftadditive >= dsone)
|| (player->kartstuff[k_driftcharge] < dstwo && player->kartstuff[k_driftcharge]+driftadditive >= dstwo)
|| (player->kartstuff[k_driftcharge] < dsthree && player->kartstuff[k_driftcharge]+driftadditive >= dsthree))
if (driftblue
|| driftred
|| driftrainbow)
{
//S_StartSound(player->mo, sfx_s3ka2);
if (P_IsLocalPlayer(player)) // UGHGHGH...
{
S_StartSoundAtVolume(player->mo, sfx_s3ka2, 192); // Ugh...
}
if (driftrainbow)
player->driftlevel = 3;
else if (driftred)
player->driftlevel = 2;
else if (driftblue)
player->driftlevel = 1;
player->driftsparkGrowTimer = DRIFTSPARKGROWTICS;
}
+13
View File
@@ -545,6 +545,19 @@ static void P_DeviceRumbleTick(void)
high = CLAMP((high + FRACUNIT / 256), 0, UINT16_MAX);
}
// pulse when gettin new driftlevel
// let this come last
if (player->kartstuff[k_driftcharge]
&& player->driftlevel)
{
high = CLAMP((high + FRACUNIT / 256), 0, UINT16_MAX);
if (player->driftlevel == 2)
lenght = 114;
else if (player->driftlevel == 3)
lenght = 174;
}
// hack alert! i just dont want this thing constantly resetting the rumble lol
if (low == 0 && high == 0)
{
+2
View File
@@ -4455,6 +4455,8 @@ void P_PlayerThink(player_t *player)
I_Error("p_playerthink: players[%s].mo == NULL", sizeu1(playeri));
#endif
player->driftlevel = 0; // idk where to put this
// todo: Figure out what is actually causing these problems in the first place...
if ((player->health <= 0 || player->mo->health <= 0) && player->playerstate == PST_LIVE) //you should be DEAD!
{