From 8da59dc288f734d0926c39de853a94f8d0ee02ca Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 1 Jan 2025 17:36:47 +0100 Subject: [PATCH] slightly cleanup rumble and led ticker --- src/d_main.c | 7 +++++-- src/p_tick.c | 17 +++++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index a44c12ad6..f9e1ca27e 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -171,14 +171,17 @@ static inline void D_DeviceLEDTick(void) UINT16 color[MAXSPLITSCREENPLAYERS]; UINT16 curcolor[MAXSPLITSCREENPLAYERS]; - if (I_NumJoys() == 0 || (cv_gamepadled[0].value == 0 && cv_gamepadled[1].value == 0 && cv_gamepadled[2].value == 0 && cv_gamepadled[3].value == 0)) + if (I_NumJoys() == 0) { return; } for (i = 0; i <= splitscreen; i++) { - if (cv_usejoystick[i].value == 0) + if (!cv_usejoystick[i].value) + continue; + + if (!cv_gamepadled[i].value) continue; color[i] = G_GetSkinColor(i); diff --git a/src/p_tick.c b/src/p_tick.c index 3b0cadde8..9d5c8539b 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -354,21 +354,25 @@ static void P_DeviceRumbleTick(void) { UINT8 i; - if (I_NumJoys() == 0 || (cv_rumble[0].value == 0 && cv_rumble[1].value == 0 && cv_rumble[2].value == 0 && cv_rumble[3].value == 0)) + if (I_NumJoys() == 0 || gamestate != GS_LEVEL) { return; } for (i = 0; i <= splitscreen; i++) { - player_t *player = &players[displayplayers[i]]; UINT16 low = 0; UINT16 high = 0; - if (!P_IsLocalPlayer(player)) + if (!cv_usejoystick[i].value) continue; - if (cv_usejoystick[i].value == 0) + if (!cv_rumble[i].value) + continue; + + player_t *player = &players[displayplayers[i]]; + + if (!P_IsLocalPlayer(player)) continue; if (!playeringame[displayplayers[i]] || player->spectator) @@ -402,10 +406,11 @@ static void P_DeviceRumbleTick(void) high = 65536 / 256; } - if (low == 0 && high == 0) + // hack alert! i just dont want this thing constantly resetting the rumble lol + if (low == 0 && high == 0) continue; - G_PlayerDeviceRumble(i, low, high, 57); // hack alert! i just dont want this think constantly resetting the rumble lol + G_PlayerDeviceRumble(i, low, high, 57); } }