From 73cc93a3e47e7e5c986f475f1f8173cf46609989 Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Thu, 29 Dec 2022 10:21:15 +0300 Subject: [PATCH] Cleanup some interface bar functions --- src/interface.cc | 42 +++++++++++++++++++++--------------------- src/interface.h | 4 ++-- src/map.cc | 2 +- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/interface.cc b/src/interface.cc index 2f7e104..e6bd9fa 100644 --- a/src/interface.cc +++ b/src/interface.cc @@ -143,7 +143,7 @@ static bool gInterfaceBarSwapHandsInProgress = false; static bool gInterfaceBarEnabled = false; // 0x518F14 -static bool _intfaceHidden = false; +static bool gInterfaceBarHidden = false; // 0x518F18 static int gInventoryButton = -1; @@ -315,7 +315,7 @@ int interfaceInit() gInterfaceBarEndButtonsRect = { 580 + gInterfaceBarContentOffset, 38, 637 + gInterfaceBarContentOffset, 96 }; gInterfaceBarMainActionRect = { 267 + gInterfaceBarContentOffset, 26, 455 + gInterfaceBarContentOffset, 93 }; - gInterfaceBarInitialized = 1; + gInterfaceBarInitialized = true; int interfaceBarWindowX = (screenGetWidth() - gInterfaceBarWidth) / 2; int interfaceBarWindowY = screenGetHeight() - INTERFACE_BAR_HEIGHT; @@ -582,7 +582,7 @@ int interfaceInit() gInterfaceBarEnabled = true; gInterfaceBarInitialized = false; - _intfaceHidden = 1; + gInterfaceBarHidden = true; return 0; } @@ -593,7 +593,7 @@ void interfaceReset() interfaceBarEnable(); // NOTE: Uninline. - intface_hide(); + interfaceBarHide(); indicatorBarRefresh(); displayMonitorReset(); @@ -707,11 +707,11 @@ int interfaceLoad(File* stream) } } - int interfaceBarEnabled; - if (fileReadInt32(stream, &interfaceBarEnabled) == -1) return -1; + bool interfaceBarEnabled; + if (fileReadBool(stream, &interfaceBarEnabled) == -1) return -1; - int v2; - if (fileReadInt32(stream, &v2) == -1) return -1; + bool interfaceBarHidden; + if (fileReadBool(stream, &interfaceBarHidden) == -1) return -1; int interfaceCurrentHand; if (fileReadInt32(stream, &interfaceCurrentHand) == -1) return -1; @@ -723,11 +723,11 @@ int interfaceLoad(File* stream) interfaceBarEnable(); } - if (v2) { + if (interfaceBarHidden) { // NOTE: Uninline. - intface_hide(); + interfaceBarHide(); } else { - _intface_show(); + interfaceBarShow(); } interfaceRenderHitPoints(false); @@ -763,10 +763,10 @@ int interfaceSave(File* stream) return -1; } - if (fileWriteInt32(stream, gInterfaceBarEnabled) == -1) return -1; - if (fileWriteInt32(stream, _intfaceHidden) == -1) return -1; + if (fileWriteBool(stream, gInterfaceBarEnabled) == -1) return -1; + if (fileWriteBool(stream, gInterfaceBarHidden) == -1) return -1; if (fileWriteInt32(stream, gInterfaceCurrentHand) == -1) return -1; - if (fileWriteInt32(stream, gInterfaceBarEndButtonsIsVisible) == -1) return -1; + if (fileWriteBool(stream, gInterfaceBarEndButtonsIsVisible) == -1) return -1; return 0; } @@ -774,12 +774,12 @@ int interfaceSave(File* stream) // NOTE: Inlined. // // 0x45E9E0 -void intface_hide() +void interfaceBarHide() { if (gInterfaceBarWindow != -1) { - if (!_intfaceHidden) { + if (!gInterfaceBarHidden) { windowHide(gInterfaceBarWindow); - _intfaceHidden = 1; + gInterfaceBarHidden = true; } } @@ -790,16 +790,16 @@ void intface_hide() } // 0x45EA10 -void _intface_show() +void interfaceBarShow() { if (gInterfaceBarWindow != -1) { - if (_intfaceHidden) { + if (gInterfaceBarHidden) { interfaceUpdateItems(false, INTERFACE_ITEM_ACTION_DEFAULT, INTERFACE_ITEM_ACTION_DEFAULT); interfaceRenderHitPoints(false); interfaceRenderArmorClass(false); windowShow(gInterfaceBarWindow); sidePanelsShow(); - _intfaceHidden = false; + gInterfaceBarHidden = false; } } @@ -2303,7 +2303,7 @@ static void indicatorBarReset() // 0x4614CC int indicatorBarRefresh() { - if (gInterfaceBarWindow != -1 && gIndicatorBarIsVisible && !_intfaceHidden) { + if (gInterfaceBarWindow != -1 && gIndicatorBarIsVisible && !gInterfaceBarHidden) { for (int index = 0; index < INDICATOR_SLOTS_COUNT; index++) { gIndicatorSlots[index] = -1; } diff --git a/src/interface.h b/src/interface.h index 3dcb66a..07772df 100644 --- a/src/interface.h +++ b/src/interface.h @@ -44,8 +44,8 @@ void interfaceReset(); void interfaceFree(); int interfaceLoad(File* stream); int interfaceSave(File* stream); -void intface_hide(); -void _intface_show(); +void interfaceBarHide(); +void interfaceBarShow(); void interfaceBarEnable(); void interfaceBarDisable(); bool interfaceBarEnabled(); diff --git a/src/map.cc b/src/map.cc index 9836774..ba5cd03 100644 --- a/src/map.cc +++ b/src/map.cc @@ -990,7 +990,7 @@ err: } _partyMemberRecoverLoad(); - _intface_show(); + interfaceBarShow(); _proto_dude_update_gender(); _map_place_dude_and_mouse(); fileSetReadProgressHandler(NULL, 0);