mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Enabled mouse scroll control in barter and loot screens when the cursor is hovering over other lists, also enabled scrolling through the display monitor (from Crafty) #120
Rearraged the code style in dinput.cpp. Updated version number.
This commit is contained in:
+2
-2
@@ -1,5 +1,5 @@
|
||||
;sfall configuration settings
|
||||
;v3.8.6
|
||||
;v3.8.7
|
||||
|
||||
[Main]
|
||||
;Change to 1 if you want to use command line args to tell sfall to use another ini file.
|
||||
@@ -72,7 +72,7 @@ Use32BitHeadGraphics=0
|
||||
|
||||
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
[Input]
|
||||
;Set to 1 to enable the mouse scroll wheel to scroll through your inventory
|
||||
;Set to 1 to enable the mouse scroll wheel to scroll through inventory, barter, and loot screens
|
||||
UseScrollWheel=1
|
||||
|
||||
;The mouse Z position is divided by this modifier to calculate the number of inventory
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "Define.h"
|
||||
#include "FalloutEngine.h"
|
||||
#include "HookScripts.h"
|
||||
#include "input.h"
|
||||
#include "Inventory.h"
|
||||
#include "LoadGameHook.h"
|
||||
|
||||
@@ -633,6 +634,126 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) loot_container_hack2() {
|
||||
__asm {
|
||||
cmp esi, 0x150 // source_down
|
||||
je scroll
|
||||
cmp esi, 0x148 // source_up
|
||||
jne end
|
||||
scroll:
|
||||
push edx
|
||||
push ecx
|
||||
push ebx
|
||||
mov eax, ds:[_i_wid]
|
||||
call GNW_find_
|
||||
mov ebx, [eax+0x8+0x0] // ebx = _i_wid.rect.x
|
||||
mov ecx, [eax+0x8+0x4] // ecx = _i_wid.rect.y
|
||||
mov eax, 297
|
||||
add eax, ebx // x_start
|
||||
add ebx, 297+64 // x_end
|
||||
mov edx, 37
|
||||
add edx, ecx // y_start
|
||||
add ecx, 37+6*48 // y_end
|
||||
call mouse_click_in_
|
||||
pop ebx
|
||||
pop ecx
|
||||
pop edx
|
||||
test eax, eax
|
||||
jz end
|
||||
cmp esi, 0x150 // source_down
|
||||
je targetDown
|
||||
mov esi, 0x18D // target_up
|
||||
jmp end
|
||||
targetDown:
|
||||
mov esi, 0x191 // target_down
|
||||
end:
|
||||
mov eax, ds:[_curr_stack]
|
||||
retn
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) barter_inventory_hack2() {
|
||||
__asm {
|
||||
push edx
|
||||
push ecx
|
||||
push ebx
|
||||
xchg esi, eax
|
||||
cmp esi, 0x150 // source_down
|
||||
je scroll
|
||||
cmp esi, 0x148 // source_up
|
||||
jne end
|
||||
scroll:
|
||||
mov eax, ds:[_i_wid]
|
||||
call GNW_find_
|
||||
mov ebx, [eax+0x8+0x0] // ebx = _i_wid.rect.x
|
||||
mov ecx, [eax+0x8+0x4] // ecx = _i_wid.rect.y
|
||||
push ebx
|
||||
push ecx
|
||||
mov eax, 395
|
||||
add eax, ebx // x_start
|
||||
add ebx, 395+64 // x_end
|
||||
mov edx, 35
|
||||
add edx, ecx // y_start
|
||||
add ecx, 35+3*48 // y_end
|
||||
call mouse_click_in_
|
||||
pop ecx
|
||||
pop ebx
|
||||
test eax, eax
|
||||
jz notTargetScroll
|
||||
cmp esi, 0x150 // source_down
|
||||
je targetDown
|
||||
mov esi, 0x18D // target_up
|
||||
jmp end
|
||||
targetDown:
|
||||
mov esi, 0x191 // target_down
|
||||
jmp end
|
||||
notTargetScroll:
|
||||
push ebx
|
||||
push ecx
|
||||
mov eax, 250
|
||||
add eax, ebx // x_start
|
||||
add ebx, 250+64 // x_end
|
||||
mov edx, 20
|
||||
add edx, ecx // y_start
|
||||
add ecx, 20+3*48 // y_end
|
||||
call mouse_click_in_
|
||||
pop ecx
|
||||
pop ebx
|
||||
test eax, eax
|
||||
jz notTargetBarter
|
||||
cmp esi, 0x150 // source_down
|
||||
je barterTargetDown
|
||||
mov esi, 0x184 // target_barter_up
|
||||
jmp end
|
||||
barterTargetDown:
|
||||
mov esi, 0x176 // target_barter_down
|
||||
jmp end
|
||||
notTargetBarter:
|
||||
mov eax, 165
|
||||
add eax, ebx // x_start
|
||||
add ebx, 165+64 // x_end
|
||||
mov edx, 20
|
||||
add edx, ecx // y_start
|
||||
add ecx, 20+3*48 // y_end
|
||||
call mouse_click_in_
|
||||
test eax, eax
|
||||
jz end
|
||||
cmp esi, 0x150 // source_down
|
||||
je barterSourceDown
|
||||
mov esi, 0x149 // source_barter_up
|
||||
jmp end
|
||||
barterSourceDown:
|
||||
mov esi, 0x151 // source_barter_down
|
||||
end:
|
||||
pop ebx
|
||||
pop ecx
|
||||
pop edx
|
||||
mov eax, esi
|
||||
cmp eax, 0x11
|
||||
retn
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void InventoryInit() {
|
||||
mode=GetPrivateProfileInt("Misc", "CritterInvSizeLimitMode", 0, ini);
|
||||
@@ -701,6 +822,13 @@ void InventoryInit() {
|
||||
|
||||
// Move items to player's main inventory instead of the opened bag/backpack when confirming a trade
|
||||
SafeWrite32(0x475CF2, _stack);
|
||||
|
||||
// Enable mouse scroll control in barter and loot screens when the cursor is hovering over other lists
|
||||
if (UseScrollWheel) {
|
||||
MakeCall(0x473E66, loot_container_hack2);
|
||||
MakeCall(0x4759F1, barter_inventory_hack2);
|
||||
*((DWORD*)_max) = 100;
|
||||
};
|
||||
}
|
||||
void InventoryReset() {
|
||||
invenapcost=GetPrivateProfileInt("Misc", "InventoryApCost", 4, ini);
|
||||
|
||||
+242
-149
File diff suppressed because it is too large
Load Diff
+8
-1
@@ -18,6 +18,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
extern bool UseScrollWheel;
|
||||
|
||||
void SetMPMode(bool active);
|
||||
void SetMDown(bool down, bool right);
|
||||
void SetMPos(int x, int y);
|
||||
@@ -122,7 +124,7 @@ void GetMouse(int* x, int* y);
|
||||
#define DIK_NOCONVERT 0x7B /* (Japanese keyboard) */
|
||||
#define DIK_YEN 0x7D /* (Japanese keyboard) */
|
||||
#define DIK_NUMPADEQUALS 0x8D /* = on numeric keypad (NEC PC98) */
|
||||
#define DIK_CIRCUMFLEX 0x90 /* (Japanese keyboard) */
|
||||
#define DIK_PREVTRACK 0x90 /* Previous Track (DIK_CIRCUMFLEX on Japanese keyboard) */
|
||||
#define DIK_AT 0x91 /* (NEC PC98) */
|
||||
#define DIK_COLON 0x92 /* (NEC PC98) */
|
||||
#define DIK_UNDERLINE 0x93 /* (NEC PC98) */
|
||||
@@ -169,4 +171,9 @@ void GetMouse(int* x, int* y);
|
||||
#define DIK_DOWNARROW DIK_DOWN /* DownArrow on arrow keypad */
|
||||
#define DIK_PGDN DIK_NEXT /* PgDn on arrow keypad */
|
||||
|
||||
/*
|
||||
* Alternate names for keys originally not used on US keyboards.
|
||||
*/
|
||||
#define DIK_CIRCUMFLEX DIK_PREVTRACK /* Japanese keyboard */
|
||||
|
||||
void _stdcall ForceGraphicsRefresh(DWORD);
|
||||
|
||||
+3
-3
@@ -22,12 +22,12 @@
|
||||
|
||||
#define VERSION_MAJOR 3
|
||||
#define VERSION_MINOR 8
|
||||
#define VERSION_BUILD 6
|
||||
#define VERSION_BUILD 7
|
||||
#define VERSION_REV 0
|
||||
#ifdef WIN2K
|
||||
#define VERSION_STRING "3.8.6 win2k"
|
||||
#define VERSION_STRING "3.8.7 win2k"
|
||||
#else
|
||||
#define VERSION_STRING "3.8.6"
|
||||
#define VERSION_STRING "3.8.7"
|
||||
#endif
|
||||
|
||||
#define CHECK_VAL (4)
|
||||
|
||||
Reference in New Issue
Block a user