From e3168946bac6d164aaafc6fbefb16cbda31dbe7e Mon Sep 17 00:00:00 2001 From: NovaRain Date: Sat, 22 Feb 2020 15:50:06 +0800 Subject: [PATCH] Minor code fix for Graphics.cpp Added notes/correction to hookscripts.txt. --- artifacts/scripting/hookscripts.txt | 4 +++- sfall/Graphics.cpp | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/artifacts/scripting/hookscripts.txt b/artifacts/scripting/hookscripts.txt index b384a942..16da08a4 100644 --- a/artifacts/scripting/hookscripts.txt +++ b/artifacts/scripting/hookscripts.txt @@ -126,6 +126,7 @@ int ret1 - The new AP cost HOOK_DEATHANIM1 (hs_deathanim1.int) Runs before Fallout tries to calculate the death animation. Lets you switch out which weapon Fallout sees +Does not run for critters in the knockdown/out state. int arg1 - The pid of the weapon performing the attack. (May be -1 if the attack is unarmed) critter arg2 - The attacker @@ -139,7 +140,8 @@ int ret1 - The pid of an object to override the attacking weapon with HOOK_DEATHANIM2 (hs_deathanim2.int) Runs after Fallout has calculated the death animation. Lets you set your own custom frame id, so more powerful than hs_deathanim1, but performs no validation. -When using critter_dmg function, this script will also run. In that case weapon pid will be -1 and target will point to an object with obj_art_fid == 0x20001F5. +When using critter_dmg function, this script will also run. In that case weapon pid will be -1 and attacker will point to an object with obj_art_fid == 0x20001F5. +Does not run for critters in the knockdown/out state. item arg1 - The pid of the weapon performing the attack. (May be -1 if the attack is unarmed) critter arg2 - The attacker diff --git a/sfall/Graphics.cpp b/sfall/Graphics.cpp index f9bc768d..60ff716d 100644 --- a/sfall/Graphics.cpp +++ b/sfall/Graphics.cpp @@ -68,7 +68,7 @@ static DWORD palette[256]; static DWORD gWidth; static DWORD gHeight; -static short moveWindowKey[2]; +static long moveWindowKey[2]; static bool windowInit = false; static DWORD windowLeft = 0; @@ -1199,7 +1199,7 @@ HRESULT _stdcall FakeDirectDrawCreate2(void*, IDirectDraw** b, void*) { else if (GPUBlt == 2) GPUBlt = 0; // Use CPU if (GraphicsMode == 5) { - moveWindowKey[0] = (short)GetConfigInt("Input", "WindowScrollKey", 0); + moveWindowKey[0] = GetConfigInt("Input", "WindowScrollKey", 0); if (moveWindowKey[0] < 0) { switch (moveWindowKey[0]) { case -1: @@ -1217,6 +1217,8 @@ HRESULT _stdcall FakeDirectDrawCreate2(void*, IDirectDraw** b, void*) { default: moveWindowKey[0] = 0; } + } else { + moveWindowKey[0] &= 0xFF; } }