Cleanup some interface bar functions

This commit is contained in:
Alexander Batalov 2022-12-29 10:21:15 +03:00
parent 34259269a4
commit 73cc93a3e4
3 changed files with 24 additions and 24 deletions

View File

@ -143,7 +143,7 @@ static bool gInterfaceBarSwapHandsInProgress = false;
static bool gInterfaceBarEnabled = false; static bool gInterfaceBarEnabled = false;
// 0x518F14 // 0x518F14
static bool _intfaceHidden = false; static bool gInterfaceBarHidden = false;
// 0x518F18 // 0x518F18
static int gInventoryButton = -1; static int gInventoryButton = -1;
@ -315,7 +315,7 @@ int interfaceInit()
gInterfaceBarEndButtonsRect = { 580 + gInterfaceBarContentOffset, 38, 637 + gInterfaceBarContentOffset, 96 }; gInterfaceBarEndButtonsRect = { 580 + gInterfaceBarContentOffset, 38, 637 + gInterfaceBarContentOffset, 96 };
gInterfaceBarMainActionRect = { 267 + gInterfaceBarContentOffset, 26, 455 + gInterfaceBarContentOffset, 93 }; gInterfaceBarMainActionRect = { 267 + gInterfaceBarContentOffset, 26, 455 + gInterfaceBarContentOffset, 93 };
gInterfaceBarInitialized = 1; gInterfaceBarInitialized = true;
int interfaceBarWindowX = (screenGetWidth() - gInterfaceBarWidth) / 2; int interfaceBarWindowX = (screenGetWidth() - gInterfaceBarWidth) / 2;
int interfaceBarWindowY = screenGetHeight() - INTERFACE_BAR_HEIGHT; int interfaceBarWindowY = screenGetHeight() - INTERFACE_BAR_HEIGHT;
@ -582,7 +582,7 @@ int interfaceInit()
gInterfaceBarEnabled = true; gInterfaceBarEnabled = true;
gInterfaceBarInitialized = false; gInterfaceBarInitialized = false;
_intfaceHidden = 1; gInterfaceBarHidden = true;
return 0; return 0;
} }
@ -593,7 +593,7 @@ void interfaceReset()
interfaceBarEnable(); interfaceBarEnable();
// NOTE: Uninline. // NOTE: Uninline.
intface_hide(); interfaceBarHide();
indicatorBarRefresh(); indicatorBarRefresh();
displayMonitorReset(); displayMonitorReset();
@ -707,11 +707,11 @@ int interfaceLoad(File* stream)
} }
} }
int interfaceBarEnabled; bool interfaceBarEnabled;
if (fileReadInt32(stream, &interfaceBarEnabled) == -1) return -1; if (fileReadBool(stream, &interfaceBarEnabled) == -1) return -1;
int v2; bool interfaceBarHidden;
if (fileReadInt32(stream, &v2) == -1) return -1; if (fileReadBool(stream, &interfaceBarHidden) == -1) return -1;
int interfaceCurrentHand; int interfaceCurrentHand;
if (fileReadInt32(stream, &interfaceCurrentHand) == -1) return -1; if (fileReadInt32(stream, &interfaceCurrentHand) == -1) return -1;
@ -723,11 +723,11 @@ int interfaceLoad(File* stream)
interfaceBarEnable(); interfaceBarEnable();
} }
if (v2) { if (interfaceBarHidden) {
// NOTE: Uninline. // NOTE: Uninline.
intface_hide(); interfaceBarHide();
} else { } else {
_intface_show(); interfaceBarShow();
} }
interfaceRenderHitPoints(false); interfaceRenderHitPoints(false);
@ -763,10 +763,10 @@ int interfaceSave(File* stream)
return -1; return -1;
} }
if (fileWriteInt32(stream, gInterfaceBarEnabled) == -1) return -1; if (fileWriteBool(stream, gInterfaceBarEnabled) == -1) return -1;
if (fileWriteInt32(stream, _intfaceHidden) == -1) return -1; if (fileWriteBool(stream, gInterfaceBarHidden) == -1) return -1;
if (fileWriteInt32(stream, gInterfaceCurrentHand) == -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; return 0;
} }
@ -774,12 +774,12 @@ int interfaceSave(File* stream)
// NOTE: Inlined. // NOTE: Inlined.
// //
// 0x45E9E0 // 0x45E9E0
void intface_hide() void interfaceBarHide()
{ {
if (gInterfaceBarWindow != -1) { if (gInterfaceBarWindow != -1) {
if (!_intfaceHidden) { if (!gInterfaceBarHidden) {
windowHide(gInterfaceBarWindow); windowHide(gInterfaceBarWindow);
_intfaceHidden = 1; gInterfaceBarHidden = true;
} }
} }
@ -790,16 +790,16 @@ void intface_hide()
} }
// 0x45EA10 // 0x45EA10
void _intface_show() void interfaceBarShow()
{ {
if (gInterfaceBarWindow != -1) { if (gInterfaceBarWindow != -1) {
if (_intfaceHidden) { if (gInterfaceBarHidden) {
interfaceUpdateItems(false, INTERFACE_ITEM_ACTION_DEFAULT, INTERFACE_ITEM_ACTION_DEFAULT); interfaceUpdateItems(false, INTERFACE_ITEM_ACTION_DEFAULT, INTERFACE_ITEM_ACTION_DEFAULT);
interfaceRenderHitPoints(false); interfaceRenderHitPoints(false);
interfaceRenderArmorClass(false); interfaceRenderArmorClass(false);
windowShow(gInterfaceBarWindow); windowShow(gInterfaceBarWindow);
sidePanelsShow(); sidePanelsShow();
_intfaceHidden = false; gInterfaceBarHidden = false;
} }
} }
@ -2303,7 +2303,7 @@ static void indicatorBarReset()
// 0x4614CC // 0x4614CC
int indicatorBarRefresh() int indicatorBarRefresh()
{ {
if (gInterfaceBarWindow != -1 && gIndicatorBarIsVisible && !_intfaceHidden) { if (gInterfaceBarWindow != -1 && gIndicatorBarIsVisible && !gInterfaceBarHidden) {
for (int index = 0; index < INDICATOR_SLOTS_COUNT; index++) { for (int index = 0; index < INDICATOR_SLOTS_COUNT; index++) {
gIndicatorSlots[index] = -1; gIndicatorSlots[index] = -1;
} }

View File

@ -44,8 +44,8 @@ void interfaceReset();
void interfaceFree(); void interfaceFree();
int interfaceLoad(File* stream); int interfaceLoad(File* stream);
int interfaceSave(File* stream); int interfaceSave(File* stream);
void intface_hide(); void interfaceBarHide();
void _intface_show(); void interfaceBarShow();
void interfaceBarEnable(); void interfaceBarEnable();
void interfaceBarDisable(); void interfaceBarDisable();
bool interfaceBarEnabled(); bool interfaceBarEnabled();

View File

@ -990,7 +990,7 @@ err:
} }
_partyMemberRecoverLoad(); _partyMemberRecoverLoad();
_intface_show(); interfaceBarShow();
_proto_dude_update_gender(); _proto_dude_update_gender();
_map_place_dude_and_mouse(); _map_place_dude_and_mouse();
fileSetReadProgressHandler(NULL, 0); fileSetReadProgressHandler(NULL, 0);