Prevent unnecessary toggling of the tags in show/hide_iface_tag

This commit is contained in:
NovaRain
2024-07-16 10:43:45 +08:00
parent 9dce219eb1
commit 190ebc417b
3 changed files with 5 additions and 6 deletions
+1
View File
@@ -210,6 +210,7 @@ WRAP_WATCOM_FUNC1(long, obj_lock_is_jammed, fo::GameObject*, object) // Checks/u
WRAP_WATCOM_FUNC1(void, obj_unjam_lock, fo::GameObject*, object)
WRAP_WATCOM_FUNC0(void, object_anim_compact)
WRAP_WATCOM_FUNC1(long, partyMemberGetCurLevel, fo::GameObject*, obj)
WRAP_WATCOM_FUNC1(void, pc_flag_off, long, flag)
WRAP_WATCOM_FUNC1(void, pc_flag_on, long, flag)
WRAP_WATCOM_FUNC2(void, perk_add_effect, fo::GameObject*, critter, long, perkId)
WRAP_WATCOM_FUNC2(long, perk_can_add, fo::GameObject*, critter, long, perkId)
+2 -2
View File
@@ -356,13 +356,13 @@ bool BarBoxes::GetBox(int i) {
}
void BarBoxes::AddBox(int i) {
if (i < 5 || i > BarBoxes::MaxBox()) return;
if (i < 5 || i > BarBoxes::MaxBox() || boxText[i - 5].isActive) return;
boxText[i - 5].isActive = true;
__asm call fo::funcoffs::refresh_box_bar_win_;
}
void BarBoxes::RemoveBox(int i) {
if (i < 5 || i > BarBoxes::MaxBox()) return;
if (i < 5 || i > BarBoxes::MaxBox() || !boxText[i - 5].isActive) return;
boxText[i - 5].isActive = false;
__asm call fo::funcoffs::refresh_box_bar_win_;
}
@@ -238,8 +238,7 @@ void mf_add_iface_tag(OpcodeContext &ctx) {
void op_show_iface_tag(OpcodeContext &ctx) {
int tag = ctx.arg(0).rawValue();
if (tag == 0 || tag == 3 || tag == 4) {
__asm mov eax, tag;
__asm call fo::funcoffs::pc_flag_on_;
if (!fo::func::is_pc_flag(tag)) fo::func::pc_flag_on(tag);
} else {
BarBoxes::AddBox(tag);
}
@@ -248,8 +247,7 @@ void op_show_iface_tag(OpcodeContext &ctx) {
void op_hide_iface_tag(OpcodeContext &ctx) {
int tag = ctx.arg(0).rawValue();
if (tag == 0 || tag == 3 || tag == 4) {
__asm mov eax, tag;
__asm call fo::funcoffs::pc_flag_off_;
if (fo::func::is_pc_flag(tag)) fo::func::pc_flag_off(tag);
} else {
BarBoxes::RemoveBox(tag);
}