Fixed key_pressed function not working in KEYPRESS hook (#248)

Minor text edits to CombatHs.cpp.
Updated version number.
This commit is contained in:
NovaRain
2019-07-15 09:54:41 +08:00
parent 361ebbe939
commit e127be29e8
4 changed files with 18 additions and 13 deletions
+1 -1
View File
@@ -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.
+7 -2
View File
@@ -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;
+7 -7
View File
@@ -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;
}
+3 -3
View File
@@ -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)