mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Tweaked the position of item counter/timer window
* now they are centered in the game view (CE style) except when in dialog screen with DIALOG_SCRN_BACKGROUND=0.
This commit is contained in:
@@ -53,7 +53,7 @@ static long __fastcall CreateWinDialog(long height, long yPos, long xPos, long c
|
||||
|
||||
// move items window
|
||||
fo::var::iscr_data[fo::INV_WIN_TYPE_MOVE_ITEMS].x = xPos + 190;
|
||||
fo::var::iscr_data[fo::INV_WIN_TYPE_MOVE_ITEMS].y = yPos + 115;
|
||||
fo::var::iscr_data[fo::INV_WIN_TYPE_MOVE_ITEMS].y = yPos + 109;
|
||||
// barter window
|
||||
fo::var::iscr_data[fo::INV_WIN_TYPE_TRADE].x = xPos + 80;
|
||||
fo::var::iscr_data[fo::INV_WIN_TYPE_TRADE].y = yPos + 290;
|
||||
|
||||
@@ -29,9 +29,9 @@ static long __fastcall CreateWin(long height, long yPos, long xPos, long width,
|
||||
fo::var::iscr_data[mode].x = x;
|
||||
fo::var::iscr_data[mode].y = y;
|
||||
}
|
||||
// set move items window position relative to the active inventory window
|
||||
fo::var::iscr_data[fo::INV_WIN_TYPE_MOVE_ITEMS].x = fo::var::iscr_data[mode].x + 60;
|
||||
fo::var::iscr_data[fo::INV_WIN_TYPE_MOVE_ITEMS].y = fo::var::iscr_data[mode].y + 80;
|
||||
// set move items window position to the center of the game view
|
||||
fo::var::iscr_data[fo::INV_WIN_TYPE_MOVE_ITEMS].x = (Setting::ScreenWidth() - fo::var::iscr_data[fo::INV_WIN_TYPE_MOVE_ITEMS].width) / 2;
|
||||
fo::var::iscr_data[fo::INV_WIN_TYPE_MOVE_ITEMS].y = (fo::var::buf_length_2 - fo::var::iscr_data[fo::INV_WIN_TYPE_MOVE_ITEMS].height) / 2;
|
||||
|
||||
xPos -= 80;
|
||||
xPos += fo::var::iscr_data[mode].x;
|
||||
@@ -67,9 +67,9 @@ static __declspec(naked) void inventory_hook_mouse_click_in() {
|
||||
}
|
||||
|
||||
void Inventory::init() {
|
||||
// set timer window position to the screen center
|
||||
// set timer window position to the center of the game view
|
||||
fo::var::iscr_data[fo::INV_WIN_TYPE_SET_TIMER].x = (Setting::ScreenWidth() - fo::var::iscr_data[fo::INV_WIN_TYPE_SET_TIMER].width) / 2;
|
||||
fo::var::iscr_data[fo::INV_WIN_TYPE_SET_TIMER].y = (Setting::ScreenHeight() - fo::var::iscr_data[fo::INV_WIN_TYPE_SET_TIMER].height) / 2;
|
||||
fo::var::iscr_data[fo::INV_WIN_TYPE_SET_TIMER].y = (Setting::ScreenHeight() - 100 - fo::var::iscr_data[fo::INV_WIN_TYPE_SET_TIMER].height) / 2;
|
||||
|
||||
sf::HookCall(0x46ED0E, setup_inventory_hook_win_add);
|
||||
sf::HookCalls(inventory_hook_mouse_click_in, {
|
||||
|
||||
@@ -1118,26 +1118,11 @@ inPref:
|
||||
}
|
||||
|
||||
// Player's inventory, "use item on", and loot windows
|
||||
static __declspec(naked) void setup_inventory_hack0() {
|
||||
static __declspec(naked) void setup_inventory_hack() {
|
||||
__asm {
|
||||
lea edx, [edi + edi * 4]; // edi - inventory mode
|
||||
mov eax, ds:[FO_VAR_iscr_data + edx * 4 + 12]; // iscr_data[mode].x
|
||||
mov ebp, eax; // add to i_wid_max_x later
|
||||
// Set move items window position relative to the active inventory window
|
||||
lea edx, [eax + 60];
|
||||
mov ds:[FO_VAR_iscr_data + 20 * 4 + 12], edx; // iscr_data[TYPE_MOVE_ITEMS].x
|
||||
mov dword ptr ds:[FO_VAR_iscr_data + 20 * 4 + 16], 80; // iscr_data[TYPE_MOVE_ITEMS].y
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
// barter/trade window
|
||||
static __declspec(naked) void setup_inventory_hack1() {
|
||||
__asm {
|
||||
mov eax, 80; // overwritten engine code
|
||||
// Set move items window position to the screen center
|
||||
mov dword ptr ds:[FO_VAR_iscr_data + 20 * 4 + 12], 190; // iscr_data[TYPE_MOVE_ITEMS].x
|
||||
mov dword ptr ds:[FO_VAR_iscr_data + 20 * 4 + 16], 115; // iscr_data[TYPE_MOVE_ITEMS].y
|
||||
retn;
|
||||
}
|
||||
}
|
||||
@@ -1508,8 +1493,7 @@ void Interface::init() {
|
||||
|
||||
// Center inventory windows horizontally when not using HRP (vanilla 640x480 screen)
|
||||
if (!HRP::Setting::IsEnabled() && !HRP::Setting::ExternalEnabled()) {
|
||||
MakeCall(0x46ECF1, setup_inventory_hack0);
|
||||
MakeCall(0x46EDB4, setup_inventory_hack1);
|
||||
MakeCall(0x46ECF1, setup_inventory_hack);
|
||||
long idata = 0x90EA01;
|
||||
SafeWriteBytes(0x46ED1E, (BYTE*)&idata, 3); // add edx, 80 > add edx, ebp (add to i_wid_max_x)
|
||||
|
||||
@@ -1517,9 +1501,11 @@ void Interface::init() {
|
||||
fo::var::iscr_data[fo::INV_WIN_TYPE_NORMAL].x = 70; // (640 - 499) / 2
|
||||
fo::var::iscr_data[fo::INV_WIN_TYPE_USE_ITEM_ON].x = 174; // (640 - 292) / 2
|
||||
fo::var::iscr_data[fo::INV_WIN_TYPE_LOOT].x = 51; // (640 - 537) / 2
|
||||
// Set timer window position to the screen center
|
||||
fo::var::iscr_data[fo::INV_WIN_TYPE_SET_TIMER].x = 190; // (640 - 259) / 2
|
||||
fo::var::iscr_data[fo::INV_WIN_TYPE_SET_TIMER].y = 159; // (480 - 162) / 2
|
||||
// Set move items and timer window position to the center of the game view
|
||||
fo::var::iscr_data[fo::INV_WIN_TYPE_MOVE_ITEMS].x = 190; // (640 - 259) / 2
|
||||
fo::var::iscr_data[fo::INV_WIN_TYPE_MOVE_ITEMS].y = 109; // (380 - 162) / 2
|
||||
fo::var::iscr_data[fo::INV_WIN_TYPE_SET_TIMER].x = 190;
|
||||
fo::var::iscr_data[fo::INV_WIN_TYPE_SET_TIMER].y = 109;
|
||||
}
|
||||
|
||||
LoadGameHook::OnGameInit() += []() {
|
||||
|
||||
Reference in New Issue
Block a user