diff --git a/artifacts/ddraw.ini b/artifacts/ddraw.ini index 36e6fc87..32a5c2ab 100644 --- a/artifacts/ddraw.ini +++ b/artifacts/ddraw.ini @@ -1,5 +1,5 @@ ;sfall configuration settings -;v4.1.9 +;v4.2.0 [Main] ;Change to 1 if you want to use command line args to tell sfall to use another ini file. diff --git a/sfall/InputFuncs.cpp b/sfall/InputFuncs.cpp index 29f71f66..f2087fd8 100644 --- a/sfall/InputFuncs.cpp +++ b/sfall/InputFuncs.cpp @@ -282,9 +282,14 @@ public: for (DWORD i = 0; i < *c; i++) { DWORD dxKey = b[i].dwOfs; DWORD state = b[i].dwData & 0x80; + DWORD oldState = keysDown[dxKey]; + keysDown[dxKey] = state; HookScripts::KeyPressHook(&dxKey, (state > 0), MapVirtualKeyEx(dxKey, MAPVK_VSC_TO_VK, keyboardLayout)); - if (dxKey != b[i].dwOfs && dxKey > 0) b[i].dwOfs = dxKey; // Override key - keysDown[b[i].dwOfs] = state; + if (dxKey > 0 && dxKey != b[i].dwOfs) { + keysDown[b[i].dwOfs] = oldState; + b[i].dwOfs = dxKey; // Override key + keysDown[b[i].dwOfs] = state; + } onKeyPressed.invoke(b[i].dwOfs, (state > 0)); } return hr; diff --git a/sfall/Modules/HookScripts/CombatHs.cpp b/sfall/Modules/HookScripts/CombatHs.cpp index e13b6a8a..1302525a 100644 --- a/sfall/Modules/HookScripts/CombatHs.cpp +++ b/sfall/Modules/HookScripts/CombatHs.cpp @@ -128,7 +128,7 @@ static void __declspec(naked) CalcApCostHook2() { } } -static void __fastcall ComputeDamageHook_Script(fo::ComputeAttackResult &ctd, DWORD rounds, DWORD multiply) { +static void __fastcall ComputeDamageHook_Script(fo::ComputeAttackResult &ctd, DWORD rounds, DWORD multiplier) { BeginHook(); argCount = 12; @@ -140,8 +140,8 @@ static void __fastcall ComputeDamageHook_Script(fo::ComputeAttackResult &ctd, DW args[5] = ctd.attackerFlags; // flagsSource args[6] = (DWORD)ctd.weapon; args[7] = ctd.bodyPart; - args[8] = multiply; // multiply damage - args[9] = rounds; // number rounds + args[8] = multiplier; // damage multiplier + args[9] = rounds; // number of rounds args[10] = ctd.knockbackValue; args[11] = ctd.hitMode; // attack type @@ -166,13 +166,13 @@ static void __fastcall ComputeDamageHook_Script(fo::ComputeAttackResult &ctd, DW static void __declspec(naked) ComputeDamageHook() { __asm { push ecx; - push ebx; // store dmg multiply args[8] - push edx; // store num rounds args[9] + push ebx; // store dmg multiplier args[8] + push edx; // store num of rounds args[9] push eax; // store ctd call fo::funcoffs::compute_damage_; pop ecx; // restore ctd (eax) - pop edx; // restore num rounds - call ComputeDamageHook_Script; // stack - arg multiply + pop edx; // restore num of rounds + call ComputeDamageHook_Script; // stack - arg multiplier pop ecx; retn; } diff --git a/sfall/version.h b/sfall/version.h index bb7f34b3..d31d22a3 100644 --- a/sfall/version.h +++ b/sfall/version.h @@ -23,11 +23,11 @@ #define LEGAL_COPYRIGHT "Copyright (C) 2006-2019, sfall team" #define VERSION_MAJOR 4 -#define VERSION_MINOR 1 -#define VERSION_BUILD 9 +#define VERSION_MINOR 2 +#define VERSION_BUILD 0 #define VERSION_REV 0 -#define VERSION_STRING "4.1.9" +#define VERSION_STRING "4.2.0" //#define CHECK_VAL (4)