Reverted speed patch/keys behavior to pre-3.8.15

* Enable in [Speed] is the master switch for all Speed* settings.
* SpeedMultiInitial requires Enable=1, not a standalone setting.
* SpeedModKey=0 allows players to use only numpad keys to change speed.
This commit is contained in:
NovaRain
2024-05-24 21:39:42 +08:00
parent 0095ec212b
commit cfcfa21afe
2 changed files with 9 additions and 17 deletions
+2 -2
View File
@@ -30,7 +30,7 @@ UseCommandLine=0
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[Speed]
;Set to 1 to enable options related to the game speed adjustment (SpeedMulti#, SpeedKey#, SpeedModKey, and SpeedToggleKey)
;Set to 0 to disable everything in this section
Enable=1
;The speeds corresponding to each slot in percent. (i.e. 100 is normal speed)
@@ -239,7 +239,7 @@ OutlineColor=16
ReloadWeaponKey=0
;A key to hold down to let you move/drop a whole stack of items at once without the 'Move Items' window
;Set to 0 if you don't want to use a modifier key, or a DX scancode otherwise
;Set to 0 if you don't want a fast move key, or a DX scancode otherwise
ItemFastMoveKey=29
;Set to 1 to skip the 'Move Items' window when taking items from containers or corpses and not holding down ItemFastMoveKey
+7 -15
View File
@@ -77,7 +77,7 @@ static struct SpeedCfg {
float multiplier;
} *speed = nullptr;
static int modKey[2];
static int modKey[2] = {0};
static int toggleKey;
static bool defaultDelay = true;
@@ -97,7 +97,7 @@ static void SetKeyboardDelay() {
static DWORD __stdcall FakeGetTickCount() {
// Keyboard control
if (modKey[0] && (KeyDown(modKey[0]) || (modKey[1] && KeyDown(modKey[1])))) {
if (!modKey[0] || (modKey[0] && KeyDown(modKey[0])) || (modKey[1] && KeyDown(modKey[1]))) {
if (toggleKey && KeyDown(toggleKey)) {
if (!toggled) {
toggled = true;
@@ -176,8 +176,6 @@ void TimerInit() {
GetLocalTime(&time);
SystemTimeToFileTime(&time, (FILETIME*)&startTime);
if (!modKey[0]) return;
speed = new SpeedCfg[10];
char buf[2], spKey[10] = "SpeedKey#";
@@ -191,16 +189,12 @@ void TimerInit() {
}
void SpeedPatch::init() {
int init = IniReader::GetConfigInt("Speed", "SpeedMultiInitial", 100);
if (IniReader::GetConfigInt("Speed", "Enable", 0)) {
modKey[0] = IniReader::GetConfigInt("Input", "SpeedModKey", 0);
toggleKey = IniReader::GetConfigInt("Input", "SpeedToggleKey", 0);
}
if (init == 100 && !modKey[0]) return;
if (IniReader::GetConfigInt("Speed", "Enable", 0) == 0) return;
dlogr("Applying speed patch.", DL_INIT);
modKey[0] = IniReader::GetConfigInt("Input", "SpeedModKey", -1);
toggleKey = IniReader::GetConfigInt("Input", "SpeedToggleKey", 0);
switch (modKey[0]) {
case -1:
modKey[0] = DIK_LCONTROL;
@@ -214,11 +208,9 @@ void SpeedPatch::init() {
modKey[0] = DIK_LSHIFT;
modKey[1] = DIK_RSHIFT;
break;
default:
modKey[1] = 0;
}
multi = init / 100.0f;
multi = IniReader::GetConfigInt("Speed", "SpeedMultiInitial", 100) / 100.0f;
getTickCountOffs = (DWORD)&FakeGetTickCount;
getLocalTimeOffs = (DWORD)&FakeGetLocalTime;