make Controller Rumble strength use changable

613d646627
This commit is contained in:
NepDisk 2025-11-23 13:21:10 -05:00
parent 413c346d82
commit 37982ed7b2
5 changed files with 19 additions and 3 deletions

View file

@ -94,7 +94,7 @@
#define ASSET_HASH_TEXTURES_KART 0xb4211b2f32b6a291
#define ASSET_HASH_CHARS_KART 0x1e68a3e01aa5c68b
#define ASSET_HASH_MAPS_KART 0x38558ed00da41ce9
#define ASSET_HASH_MAIN_PK3 0x222fb65703f1091b
#define ASSET_HASH_MAIN_PK3 0xb1730fd0965adcb1
#define ASSET_HASH_MAPPATCH_PK3 0x0afd8afc6fc50175
#define ASSET_HASH_BONUSCHARS_KART 0x60e6f13d822a7461
#ifdef USE_PATCH_FILE

View file

@ -1257,6 +1257,7 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_litesteer[i]);
CV_RegisterVar(&cv_turnsmooth[i]);
CV_RegisterVar(&cv_rumble[i]);
CV_RegisterVar(&cv_rumblestrength[i]);
CV_RegisterVar(&cv_gamepadled[i]);
}

View file

@ -72,6 +72,15 @@ consvar_t cv_rumble[MAXSPLITSCREENPLAYERS] = {
CVAR_INIT ("rumble4", "On", CV_SAVE, CV_OnOff, rumble_off_handle4)
};
static CV_PossibleValue_t rumblestrength_cons_t[] = {{FRACUNIT/4, "MIN"}, {FRACUNIT*4, "MAX"}, {0, NULL}};
consvar_t cv_rumblestrength[MAXSPLITSCREENPLAYERS] = {
CVAR_INIT ("rumblestrength", "1.0", CV_SAVE|CV_FLOAT, rumblestrength_cons_t, NULL),
CVAR_INIT ("rumblestrength2", "1.0", CV_SAVE|CV_FLOAT, rumblestrength_cons_t, NULL),
CVAR_INIT ("rumblestrength3", "1.0", CV_SAVE|CV_FLOAT, rumblestrength_cons_t, NULL),
CVAR_INIT ("rumblestrength4", "1.0", CV_SAVE|CV_FLOAT, rumblestrength_cons_t, NULL)
};
static CV_PossibleValue_t gamepadled_cons_t[] = {{0, "Off"}, {1, "Skincolor"}, {2, "Mobjcolor"}, {0, NULL}};
consvar_t cv_gamepadled[MAXSPLITSCREENPLAYERS] = {
CVAR_INIT ("gamepadled", "Skincolor", CV_SAVE|CV_CALL|CV_NOINIT, gamepadled_cons_t, led_off_handle),
@ -616,6 +625,12 @@ void G_PlayerDeviceRumble(INT32 playernum, UINT16 low_strength, UINT16 high_stre
return;
}
// doesent need to be super precise
// but ensure this is within range (0-65535)
// placed here so it applies to lua aswell
low_strength = (UINT16)min(FixedMul(low_strength, cv_rumblestrength[playernum].value), UINT16_MAX);
high_strength = (UINT16)min(FixedMul(high_strength, cv_rumblestrength[playernum].value), UINT16_MAX);
I_GamepadRumble(playernum, low_strength, high_strength, duration);
}
@ -628,8 +643,6 @@ enum
RUMBLE_WEAK = FRACUNIT / 128, // 512
RUMBLE_VERYWEAK = FRACUNIT / 256, // 256
};
// TODO: multiplier to make them user changable
// due to some controllers being more/less sensitive than others
// Controller rumble!
// this keeps track of a bunch of things

View file

@ -98,6 +98,7 @@ extern consvar_t cv_controlperkey;
extern consvar_t cv_litesteer[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_turnsmooth[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_rumble[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_rumblestrength[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_gamepadled[MAXSPLITSCREENPLAYERS];
// current state of the keys: JOYAXISRANGE or 0 when boolean.

View file

@ -7929,6 +7929,7 @@ INT32 MR_SetupControlsMenu(INT32 arg)
M_SetItemCvar(MN_OP_CHANGECONTROLS, "LITESTEER", &cv_litesteer[arg]);
M_SetItemCvar(MN_OP_CHANGECONTROLS, "LEDCOLOR", &cv_gamepadled[arg]);
M_SetItemCvar(MN_OP_CHANGECONTROLS, "RUMBLE", &cv_rumble[arg]);
M_SetItemCvar(MN_OP_CHANGECONTROLS, "RUMBLESTR", &cv_rumblestrength[arg]);
M_SetItemVisible(MN_OP_CHANGECONTROLS, "TALK", player1); // Chat
//M_SetItemVisible(MN_OP_CHANGECONTROLS, "TEAM", player1); // Team-chat