From d07c41664190a12c4f56d2e71eae8aa41f40ce21 Mon Sep 17 00:00:00 2001 From: theo3 Date: Thu, 28 Dec 2023 21:58:54 -0800 Subject: [PATCH] message definitions --- asm/src/enemy.s | 2 +- asm/src/projectileUpdate.s | 2 +- include/entity.h | 9 ++-- include/message.h | 4 +- include/player.h | 2 +- include/structures.h | 2 +- src/collision.c | 4 +- src/common.c | 4 +- src/cutscene.c | 8 ++-- src/enemy/businessScrub.c | 6 +-- src/enemy/chuchuBoss.c | 12 ++--- src/enemy/gleerok.c | 6 +-- src/enemy/octorokBoss.c | 12 ++--- src/enemy/vaatiTransfigured.c | 2 +- src/enemy/vaatiTransfiguredEye.c | 4 +- src/enemy/vaatiWrath.c | 2 +- src/enterPortalSubtask.c | 2 +- src/entity.c | 24 +++++----- src/game.c | 8 ++-- src/interrupts.c | 6 +-- src/manager.c | 2 +- src/manager/enterRoomTextboxManager.c | 4 +- src/manager/entitySpawnManager.c | 2 +- src/manager/ezloHintManager.c | 2 +- src/manager/lightManager.c | 67 +++++++++++---------------- src/manager/vaati3StartManager.c | 4 +- src/menu/kinstoneMenu.c | 2 +- src/message.c | 24 +++++----- src/npc.c | 2 +- src/npc/beedle.c | 2 +- src/npc/bigGoron.c | 2 +- src/npc/brocco.c | 2 +- src/npc/castleMaid.c | 2 +- src/npc/cat.c | 2 +- src/npc/epona.c | 2 +- src/npc/ghostBrothers.c | 4 +- src/npc/goron.c | 2 +- src/npc/goronMerchant.c | 4 +- src/npc/guard.c | 4 +- src/npc/kid.c | 2 +- src/npc/mountainMinish.c | 2 +- src/npc/npc23.c | 2 +- src/npc/npc9.c | 2 +- src/npc/percy.c | 4 +- src/npc/pina.c | 2 +- src/npc/postman.c | 2 +- src/npc/stamp.c | 2 +- src/npc/stockwell.c | 12 ++--- src/npc/sturgeon.c | 2 +- src/npc/talon.c | 2 +- src/npc/townMinish.c | 2 +- src/npc/townsperson.c | 2 +- src/npc/windTribespeople.c | 2 +- src/object.c | 2 +- src/object/bird.c | 12 ++--- src/object/book.c | 6 +-- src/object/bush.c | 2 +- src/object/cameraTarget.c | 2 +- src/object/cloud.c | 2 +- src/object/crenelBeanSprout.c | 2 +- src/object/cutsceneMiscObject.c | 2 +- src/object/ezloCap.c | 4 +- src/object/fourElements.c | 2 +- src/object/frozenOctorok.c | 2 +- src/object/gleerokParticle.c | 2 +- src/object/itemForSale.c | 2 +- src/object/lilypadLarge.c | 4 +- src/object/linkAnimation.c | 2 +- src/object/moleMittsParticle.c | 2 +- src/object/octorokBossObject.c | 2 +- src/object/well.c | 2 +- src/object/windTribeTeleporter.c | 12 ++--- src/objectUtils.c | 2 +- src/player.c | 14 +++--- src/playerItem.c | 2 +- src/playerUtils.c | 6 +-- src/script.c | 6 +-- src/scroll.c | 4 +- src/staffroll.c | 2 +- src/subtask.c | 2 +- src/ui.c | 6 +-- 81 files changed, 200 insertions(+), 206 deletions(-) diff --git a/asm/src/enemy.s b/asm/src/enemy.s index 4bada3c6..a19f232f 100644 --- a/asm/src/enemy.s +++ b/asm/src/enemy.s @@ -18,7 +18,7 @@ EnemyUpdate: @ 0x080011C4 bne _080011EA bl DeleteThisEntity _080011DC: - bl EntityIsDeleted + bl EntityDisabled cmp r0, #0 bne _0800120A adds r0, r4, #0 diff --git a/asm/src/projectileUpdate.s b/asm/src/projectileUpdate.s index 590744ce..2888a5fb 100644 --- a/asm/src/projectileUpdate.s +++ b/asm/src/projectileUpdate.s @@ -18,7 +18,7 @@ ProjectileUpdate: @ 0x08016AE4 bne _08016B0A bl DeleteThisEntity _08016AFC: - bl EntityIsDeleted + bl EntityDisabled cmp r0, #0 bne _08016B22 adds r0, r4, #0 diff --git a/include/entity.h b/include/entity.h index cbb54201..5b5c328d 100644 --- a/include/entity.h +++ b/include/entity.h @@ -389,9 +389,12 @@ Entity* FindEntity(u32 kind, u32 id, u32 listIndex, u32 type, u32 type2); void SetEntityPriority(Entity* entity, u32 prio); /** - * Check if entity will be deleted next frame. + * Check if entity is disabled. Entities are disabled if: + * - They are deleted. + * - There is an event and the entity doesn't have priority + * (n/a if entity is in action 0). */ -bool32 EntityIsDeleted(Entity* entity); +bool32 EntityDisabled(Entity* entity); /** * Check if system or entity is blocking updates. @@ -477,7 +480,7 @@ void SetInitializationPriority(void); /** * Reset the system update priority. */ -void ResetSystemPriority(void); +void ClearEventPriority(void); void sub_0805E958(void); diff --git a/include/message.h b/include/message.h index 344bf4ed..32f9f582 100644 --- a/include/message.h +++ b/include/message.h @@ -5,8 +5,10 @@ #include "entity.h" #include "structures.h" +#define MESSAGE_ACTIVE 0x7f + typedef struct { - u8 doTextBox; + u8 state; u8 unk; u8 textSpeed; u8 unk3; // HI? diff --git a/include/player.h b/include/player.h index db8c1f08..38e186e5 100644 --- a/include/player.h +++ b/include/player.h @@ -720,7 +720,7 @@ s32 AddInteractableObject(Entity*, u32, u32); void RemoveInteractableObject(Entity*); s32 GetInteractableObjectIndex(); void sub_08078AC0(u32, u32, u32); -void sub_08078B48(void); +void PausePlayer(void); void sub_08078E84(Entity*, Entity*); void sub_08078FB0(Entity*); void sub_080792BC(s32, u32, u32); diff --git a/include/structures.h b/include/structures.h index 0cbe9c71..6125cba9 100644 --- a/include/structures.h +++ b/include/structures.h @@ -191,7 +191,7 @@ extern ItemBehavior gActiveItems[MAX_ACTIVE_ITEMS]; static_assert(sizeof(gActiveItems) == 0x70); typedef struct { - u8 sys_priority; // system requested priority + u8 event_priority; // system requested priority u8 ent_priority; // entity requested priority u8 queued_priority; u8 queued_priority_reset; diff --git a/src/collision.c b/src/collision.c index 402c9bfa..7fb08ca4 100644 --- a/src/collision.c +++ b/src/collision.c @@ -63,8 +63,8 @@ void CollisionMain(void) { u32 prio; // pick highest priority - prio = gPriorityHandler.sys_priority; - if (gPriorityHandler.sys_priority <= gPriorityHandler.ent_priority) + prio = gPriorityHandler.event_priority; + if (gPriorityHandler.event_priority <= gPriorityHandler.ent_priority) prio = gPriorityHandler.ent_priority; // if any priority is set, dont do collision diff --git a/src/common.c b/src/common.c index 81cec6d1..10e200c0 100644 --- a/src/common.c +++ b/src/common.c @@ -747,7 +747,7 @@ void Fuse_Action0(void) { } void Fuse_Action1(void) { - if ((gMessage.doTextBox & 0x7F) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { MenuFadeIn(4, 0); gFuseInfo.fusionState = FUSION_STATE_4; gFuseInfo.action = 2; @@ -773,7 +773,7 @@ void Fuse_Action2(void) { } void Fuse_Action3(void) { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { if (gFuseInfo.entity != NULL) { gFuseInfo.entity->updatePriority = gFuseInfo.prevUpdatePriority; } diff --git a/src/cutscene.c b/src/cutscene.c index 93ea6eac..bb1f7187 100644 --- a/src/cutscene.c +++ b/src/cutscene.c @@ -52,7 +52,7 @@ void sub_080535AC(void) { void sub_080535F4(void) { if (gFadeControl.active == 0) { - ResetSystemPriority(); + ClearEventPriority(); gMenu.overlayType = 2; } } @@ -234,7 +234,7 @@ void sub_08053758(void) { gScreen.bg1.control = 0x1c4e; gScreen.bg2.control = 0x1dc1; SoundReq(BGM_STORY); - ResetSystemPriority(); + ClearEventPriority(); SetFade(FADE_IN_OUT | FADE_INSTANT, 0x100); } @@ -344,7 +344,7 @@ void sub_08053A1C(void) { } void sub_08053A5C(void) { - if (((gMessage.doTextBox & 0x7f) == 0) && --gMenu.transitionTimer == 0) { + if (((gMessage.state & MESSAGE_ACTIVE) == 0) && --gMenu.transitionTimer == 0) { gMenu.overlayType++; SetFade(FADE_IN_OUT | FADE_INSTANT, 8); } @@ -451,7 +451,7 @@ void sub_08053B74(void) { gMenu.overlayType++; gUpdateVisibleTiles = 1; LoadRoomEntityList(gUnk_080FCDE0); - ResetSystemPriority(); + ClearEventPriority(); ResetEntityPriority(); SetFade(FADE_IN_OUT | FADE_INSTANT, 0x100); } diff --git a/src/enemy/businessScrub.c b/src/enemy/businessScrub.c index 873ff039..14c52621 100644 --- a/src/enemy/businessScrub.c +++ b/src/enemy/businessScrub.c @@ -247,7 +247,7 @@ void BusinessScrub_Action5(Entity* this) { struct SalesOffering* offer = (struct SalesOffering*)this->field_0x7c.WORD; u32 subtype; - if ((gMessage.doTextBox & 0x7f) == 0 && sub_0802915C(this) && !sub_08056338()) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0 && sub_0802915C(this) && !sub_08056338()) { if (offer->price <= gSave.stats.rupees) { if (BusinessScrub_CheckRefillFitsBag(this)) { /* Bag full. */ @@ -316,11 +316,11 @@ void BusinessScrub_Action6(Entity* this) { } void BusinessScrub_Action7(Entity* this) { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { struct SalesOffering* offer = (struct SalesOffering*)this->field_0x7c.WORD; this->action = 4; - this->subAction = gMessage.doTextBox & 0x7f; + this->subAction = gMessage.state & MESSAGE_ACTIVE; this->timer = 1; if (!CheckLocalFlag(offer->local_flag)) { SetLocalFlag(offer->local_flag); diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index 2ea26212..e0ebdb24 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -270,7 +270,7 @@ void ChuchuBoss_OnDeath(ChuchuBossEntity* this) { Entity* child; Entity* parent; - sub_08078B48(); + PausePlayer(); if (super->type == 0) { if (super->subAction != 12) { super->subAction = 12; @@ -464,7 +464,7 @@ void sub_08026090(ChuchuBossEntity* this) { } CopyPosition(super->child, super); } else { - sub_08078B48(); + PausePlayer(); if (super->timer-- == 0) { gRoomControls.camera_target = &gPlayerEntity; DeleteThisEntity(); @@ -543,7 +543,7 @@ void sub_0802626C(ChuchuBossEntity* this) { gPauseMenuOptions.disabled = 1; gUnk_080CC20C[this->unk_84->unk_03](this); if (gPlayerEntity.action != PLAYER_ROOMTRANSITION && gPlayerEntity.action != PLAYER_ROOM_EXIT) { - sub_08078B48(); + PausePlayer(); } } @@ -1127,7 +1127,7 @@ void sub_08026E1C(ChuchuBossEntity* this) { } if ((sub_08027C54(this)) && this->unk_84->unk_04 == 2) { sub_08027C7C(this, 0x3f); - sub_08078B48(); + PausePlayer(); } } @@ -1156,7 +1156,7 @@ void sub_08026FA4(ChuchuBossEntity* this) { ChuchuBossEntity* pEVar3; ChuchuBossEntity* pEVar4; - sub_08078B48(); + PausePlayer(); COLLISION_OFF(super); pEVar4 = (ChuchuBossEntity*)super->child; pEVar3 = (ChuchuBossEntity*)super->parent; @@ -1362,7 +1362,7 @@ void sub_080272D4(ChuchuBossEntity* this) { if (sub_08027C54(super->child) == 0 || ((ChuchuBossEntity*)super->child)->unk_84->unk_04 != 2) { SoundReq(SFX_BOSS_HIT); } else { - sub_08078B48(); + PausePlayer(); gRoomControls.camera_target = super->child; gPauseMenuOptions.disabled = 1; gRoomControls.camera_target->subAction = 9; diff --git a/src/enemy/gleerok.c b/src/enemy/gleerok.c index b04a0d24..6773d849 100644 --- a/src/enemy/gleerok.c +++ b/src/enemy/gleerok.c @@ -145,7 +145,7 @@ void Gleerok(GleerokEntity* this) { } void Gleerok_OnDeath(GleerokEntity* this) { - sub_08078B48(); + PausePlayer(); switch (super->type) { case 2: @@ -420,7 +420,7 @@ void sub_0802D3B8(GleerokEntity* this) { void sub_0802D650(GleerokEntity* this) { #ifdef EU - sub_08078B48(); + PausePlayer(); #endif gUnk_080CD7E4[super->subAction](this); @@ -1014,7 +1014,7 @@ void sub_0802E0B8(GleerokEntity* this) { if (this->unk_79 > 1) { super->health = 0; super->action = 0; - sub_08078B48(); + PausePlayer(); SoundReq(SFX_BOSS_DIE); return; } else { diff --git a/src/enemy/octorokBoss.c b/src/enemy/octorokBoss.c index d8931e9c..7a59d4a9 100644 --- a/src/enemy/octorokBoss.c +++ b/src/enemy/octorokBoss.c @@ -113,17 +113,17 @@ void OctorokBoss_Hit(OctorokBossEntity* this) { if (super->subAction != 3) { gRoomControls.camera_target = &this->heap->tailObjects[0]->base; this->heap->field_0x7 = 0x5a; - sub_08078B48(); + PausePlayer(); } } else { if (this->heap->field_0x7 != 0) { this->heap->field_0x7--; - sub_08078B48(); + PausePlayer(); } } OctorokBoss_Hit_SubActions[super->subAction](this); if (super->subAction > 3) { - sub_08078B48(); + PausePlayer(); } sub_0800445C(super); SetAffineInfo(super, this->unk_76, this->unk_74, this->angle.HWORD); @@ -136,7 +136,7 @@ void OctorokBoss_Hit_SubAction0(OctorokBossEntity* this) { if (this->bossPhase == 4) { super->subAction = 4; gPauseMenuOptions.disabled = 1; - sub_08078B48(); + PausePlayer(); SoundReq(SFX_BOSS_DIE); } else { if (IS_FROZEN(this) == FALSE) { @@ -442,7 +442,7 @@ void OctorokBoss_Intro(OctorokBossEntity* this) { OctorokBoss_Intro_SubAction0, OctorokBoss_Intro_SubAction1, OctorokBoss_Intro_SubAction2, OctorokBoss_Intro_SubAction3, OctorokBoss_Intro_SubAction4, OctorokBoss_Intro_SubAction5, }; - sub_08078B48(); + PausePlayer(); gPauseMenuOptions.disabled = 1; sub_08036F60(this); OctorokBoss_Intro_SubActions[super->subAction](this); @@ -796,7 +796,7 @@ void OctorokBoss_Action1_Attack(OctorokBossEntity* this) { gPlayerEntity.spriteSettings.draw = 0; gPlayerEntity.flags &= ~ENT_COLLIDE; gPlayerEntity.collisionLayer = 2; - sub_08078B48(); + PausePlayer(); PutAwayItems(); gPlayerEntity.parent = super; sub_08036914(&gPlayerEntity, (u8) - (this->angle.HALF.HI + 0x80), 0x3800); diff --git a/src/enemy/vaatiTransfigured.c b/src/enemy/vaatiTransfigured.c index 6b58c2af..57b830d6 100644 --- a/src/enemy/vaatiTransfigured.c +++ b/src/enemy/vaatiTransfigured.c @@ -547,7 +547,7 @@ void VaatiTransfiguredType0Action7(Entity* this) { Entity* pEVar3; u32 uVar4; - sub_08078B48(); + PausePlayer(); if (this->timer) { if (--this->timer == 0) { SetRoomFlag(2); diff --git a/src/enemy/vaatiTransfiguredEye.c b/src/enemy/vaatiTransfiguredEye.c index f56a6eb0..2d180951 100644 --- a/src/enemy/vaatiTransfiguredEye.c +++ b/src/enemy/vaatiTransfiguredEye.c @@ -99,8 +99,8 @@ void VaatiTransfiguredEyeFunction0Action0(Entity* this) { Entity* child; u8 bVar2; - bVar2 = gMessage.doTextBox & 0x7f; - if ((gMessage.doTextBox & 0x7f) == 0) { + bVar2 = gMessage.state & MESSAGE_ACTIVE; + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { this->action = 1; this->spriteSettings.draw = 0; this->field_0x80.HALF.LO = bVar2; diff --git a/src/enemy/vaatiWrath.c b/src/enemy/vaatiWrath.c index 1c4e74ac..20bd4a17 100644 --- a/src/enemy/vaatiWrath.c +++ b/src/enemy/vaatiWrath.c @@ -634,7 +634,7 @@ void sub_08041D14(Entity* this) { Entity* pEVar1; GetNextFrame(((VaatiWrathHeapStruct*)this->myHeap)->type2); - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { if (this->timer != 0) { this->timer--; } else { diff --git a/src/enterPortalSubtask.c b/src/enterPortalSubtask.c index 3bac0702..3d445fd6 100644 --- a/src/enterPortalSubtask.c +++ b/src/enterPortalSubtask.c @@ -189,7 +189,7 @@ void Subtask_PortalCutscene_0(void) { gUsedPalettes |= 0x200000; EraseAllEntities(); LoadRoomEntityList(gUnk_080D4110[portalId]); - ResetSystemPriority(); + ClearEventPriority(); gArea.filler3[0]++; SetFade(FADE_INSTANT, 8); } diff --git a/src/entity.c b/src/entity.c index 1a9ac121..b93fa3a3 100644 --- a/src/entity.c +++ b/src/entity.c @@ -89,7 +89,7 @@ void SetEntityPriority(Entity* ent, u32 prio) { ent->updatePriority = prio; } -bool32 EntityIsDeleted(Entity* this) { +bool32 EntityDisabled(Entity* this) { u32 value; if (this->flags & ENT_DELETED) @@ -98,19 +98,19 @@ bool32 EntityIsDeleted(Entity* this) { return FALSE; // pick highest - if (gPriorityHandler.sys_priority > gPriorityHandler.ent_priority) - value = gPriorityHandler.sys_priority; + if (gPriorityHandler.event_priority > gPriorityHandler.ent_priority) + value = gPriorityHandler.event_priority; else value = gPriorityHandler.ent_priority; - if (gMessage.doTextBox & 0x7F) + if (gMessage.state & MESSAGE_ACTIVE) value = max(value, PRIO_MESSAGE); return value > this->updatePriority; } bool32 AnyPrioritySet(void) { - u32 prio = gPriorityHandler.sys_priority; - if (gPriorityHandler.sys_priority <= gPriorityHandler.ent_priority) + u32 prio = gPriorityHandler.event_priority; + if (gPriorityHandler.event_priority <= gPriorityHandler.ent_priority) prio = gPriorityHandler.ent_priority; return prio != PRIO_MIN; } @@ -180,12 +180,12 @@ static void UpdatePriorityTimer(void) { } void SetPlayerEventPriority(void) { - gPriorityHandler.sys_priority = PRIO_PLAYER_EVENT; + gPriorityHandler.event_priority = PRIO_PLAYER_EVENT; gPlayerEntity.updatePriority = PRIO_PLAYER_EVENT; } void ResetPlayerEventPriority(void) { - gPriorityHandler.sys_priority = PRIO_MIN; + gPriorityHandler.event_priority = PRIO_MIN; gPlayerEntity.updatePriority = PRIO_PLAYER; } @@ -195,15 +195,15 @@ void RevokePriority(Entity* e) { } void SetRoomReloadPriority(void) { - gPriorityHandler.sys_priority = PRIO_PLAYER_EVENT; + gPriorityHandler.event_priority = PRIO_PLAYER_EVENT; } void SetInitializationPriority(void) { - gPriorityHandler.sys_priority = PRIO_HIGHEST; + gPriorityHandler.event_priority = PRIO_HIGHEST; } -void ResetSystemPriority(void) { - gPriorityHandler.sys_priority = PRIO_MIN; +void ClearEventPriority(void) { + gPriorityHandler.event_priority = PRIO_MIN; } void UpdateEntities(void) { diff --git a/src/game.c b/src/game.c index e1a0822f..84b99bc8 100644 --- a/src/game.c +++ b/src/game.c @@ -208,7 +208,7 @@ static void GameMain_ChangeRoom(void) { return; UpdatePlayerMapCoords(); - ResetSystemPriority(); + ClearEventPriority(); UpdateWindcrests(); sub_080300C4(); gMain.substate = GAMEMAIN_UPDATE; @@ -252,8 +252,8 @@ static void GameMain_Update(void) { return; } - if ((gMessage.doTextBox & 0x7f) || gPriorityHandler.priority_timer != 0) - sub_08078B48(); + if ((gMessage.state & MESSAGE_ACTIVE) || gPriorityHandler.priority_timer != 0) + PausePlayer(); FlushSprites(); UpdateEntities(); @@ -305,7 +305,7 @@ static void GameMain_BarrelUpdate(void) { CheckGameOver(); CopyOAM(); if (!gFadeControl.active) - ResetSystemPriority(); + ClearEventPriority(); } static void GameMain_ChangeArea(void) { diff --git a/src/interrupts.c b/src/interrupts.c index 69a0f137..44b59a73 100644 --- a/src/interrupts.c +++ b/src/interrupts.c @@ -204,7 +204,7 @@ void PlayerUpdate(Entity* this) { else gPlayerState.flags &= ~PL_DRUGGED; - if (!EntityIsDeleted(this)) { + if (!EntityDisabled(this)) { if (gPlayerState.flags & PL_MOLDWORM_CAPTURED) { PutAwayItems(); if (gPlayerState.flags & PL_MOLDWORM_RELEASED) { @@ -258,7 +258,7 @@ static void HandlePlayerLife(Entity* this) { return; } - if ((gPlayerState.controlMode != CONTROL_ENABLED) || (gMessage.doTextBox & 0x7f)) + if ((gPlayerState.controlMode != CONTROL_ENABLED) || (gMessage.state & 0x7f)) return; #ifdef EU @@ -274,7 +274,7 @@ static void HandlePlayerLife(Entity* this) { } } #else - gRoomVars.unk2 = gMessage.doTextBox & 0x7f; + gRoomVars.unk2 = gMessage.state & MESSAGE_ACTIVE; temp = gSave.stats.maxHealth / 4; if (temp > 24) temp = 24; diff --git a/src/manager.c b/src/manager.c index 338d2d7d..6c649a9c 100644 --- a/src/manager.c +++ b/src/manager.c @@ -61,6 +61,6 @@ void (*const gMiscManagerunctions[])() = { NULL, EnterRoomTextboxManager_Main }; void ManagerUpdate(Entity* this) { - if (!EntityIsDeleted(this)) + if (!EntityDisabled(this)) gMiscManagerunctions[this->id](this); } diff --git a/src/manager/enterRoomTextboxManager.c b/src/manager/enterRoomTextboxManager.c index a720a788..61276437 100644 --- a/src/manager/enterRoomTextboxManager.c +++ b/src/manager/enterRoomTextboxManager.c @@ -34,7 +34,7 @@ void sub_0805E1F8(u32, bool32); void EnterRoomTextboxManager_Main(EnterRoomTextboxManager* this) { EnterRoomTextboxManager_Actions[super->action](this); - if ((gRoomControls.room != this->unk_20) || (gMessage.doTextBox & 0x7F)) { + if ((gRoomControls.room != this->unk_20) || (gMessage.state & MESSAGE_ACTIVE)) { sub_0805E1D8(this); } } @@ -56,7 +56,7 @@ void sub_0805E18C(EnterRoomTextboxManager* this) { if (--super->subtimer == 0) { super->type2 = 0; gPlayerState.controlMode = CONTROL_1; - ResetSystemPriority(); + ClearEventPriority(); } } if (--super->timer == 0) { diff --git a/src/manager/entitySpawnManager.c b/src/manager/entitySpawnManager.c index 900b6480..6303d998 100644 --- a/src/manager/entitySpawnManager.c +++ b/src/manager/entitySpawnManager.c @@ -26,7 +26,7 @@ void EntitySpawnManager_Main(EntitySpawnManager* this) { if (super->type2 != 0) { super->type2 = 0; SetPlayerControl(0xff); - sub_08078B48(); + PausePlayer(); } if (this->spawnTimer == 0) { if (this->sound != 0) { diff --git a/src/manager/ezloHintManager.c b/src/manager/ezloHintManager.c index f98b97f3..4f6a2723 100644 --- a/src/manager/ezloHintManager.c +++ b/src/manager/ezloHintManager.c @@ -69,7 +69,7 @@ static void EzloHintManager_Action2(EzloHintManager* this) { if (!PlayerStateValid(this)) return; SetPlayerControl(3); - sub_08078B48(); + PausePlayer(); SetPlayerEventPriority(); super->action = 3; super->subAction = 0; diff --git a/src/manager/lightManager.c b/src/manager/lightManager.c index c8d8241d..c34c4755 100644 --- a/src/manager/lightManager.c +++ b/src/manager/lightManager.c @@ -20,8 +20,8 @@ extern void sub_0801E120(void); extern void sub_0801E154(u32); extern void sub_0801E160(u32, u32, u32); -bool32 sub_0805BA78(); -void sub_0805BAD4(); +bool32 LerpLightLevel(); +void UpdateLightAlpha(); void LightManager_Main(LightManager* this) { s32 sVar1; @@ -43,8 +43,8 @@ void LightManager_Main(LightManager* this) { } if (gMain.substate == GAMEMAIN_UPDATE) { gScreen.lcd.displayControl |= DISPCNT_BG3_ON; - sub_0805BA78(); - sub_0805BAD4(); + LerpLightLevel(); + UpdateLightAlpha(); } if (gArea.lightType == 2) { gScreen.lcd.displayControl &= ~DISPCNT_WIN0_ON; @@ -87,44 +87,33 @@ void LightManager_Main(LightManager* this) { #define ABS(x) ((unsigned)(x < 0 ? -(x) : x)) -bool32 sub_0805BA78() { - u32 uVar1; - s32 iVar1; - s32 iVar2; +bool32 LerpLightLevel() { + s32 tgt; + s32 cur; - iVar2 = (short)gArea.lightLevel; - iVar1 = gRoomVars.lightLevel; + cur = (short)gArea.lightLevel; + tgt = gRoomVars.lightLevel; - if (iVar1 < 0) { - iVar1 = 0; - } + tgt = max(tgt, 0); + tgt = min(tgt, 0x100); - if (0x100 < iVar1) { - iVar1 = 0x100; - } - - if (iVar2 != iVar1) { - if (ABS(iVar1 - iVar2) <= 4) { - iVar2 = iVar1; - } else { - if (iVar1 < iVar2) { - iVar2 = iVar2 - 4; - } else { - if (iVar1 > iVar2) { - iVar2 = iVar2 + 4; - } - } + if (cur != tgt) { + if (ABS(tgt - cur) <= 4) { + cur = tgt; + } else if (tgt < cur) { + cur -= 4; + } else if (tgt > cur) { + cur += 4; } - gArea.lightLevel = iVar2; - } else { - return FALSE; + gArea.lightLevel = cur; + return TRUE; } - return TRUE; + return FALSE; } extern u16 gUnk_08108CA8[]; -void sub_0805BAD4() { +void UpdateLightAlpha() { static const u16 gUnk_08108CA8[] = { 0x10, 0x10f, 0x20e, 0x30d, 0x40c, 0x50b, 0x60a, 0x709, 0x808, 0x907, 0xa06, 0xb05, 0xc04, 0xd03, 0xe02, 0xf01, 0x1000, 0x00 }; if (gArea.lightType != 0) { @@ -164,8 +153,8 @@ void sub_0805BB74(s32 lightLevel) { if (manager) { LightManager_Main(manager); gScreen.lcd.displayControl |= DISPCNT_BG3_ON; - sub_0805BA78(); - sub_0805BAD4(); + LerpLightLevel(); + UpdateLightAlpha(); } } @@ -175,9 +164,9 @@ bool32 UpdateLightLevel() { iVar1 = FALSE; if (gArea.lightType && gRoomVars.lightLevel < (s16)gArea.lightLevel) { gScreen.lcd.displayControl |= DISPCNT_BG3_ON; - iVar1 = sub_0805BA78(); + iVar1 = LerpLightLevel(); if (iVar1) { - sub_0805BAD4(); + UpdateLightAlpha(); } } return iVar1; @@ -189,9 +178,9 @@ s32 sub_0805BC04(void) { iVar1 = 0; if (gArea.lightType && gRoomVars.lightLevel > (short)gArea.lightLevel) { gScreen.lcd.displayControl |= DISPCNT_BG3_ON; - iVar1 = sub_0805BA78(); + iVar1 = LerpLightLevel(); if (iVar1) { - sub_0805BAD4(); + UpdateLightAlpha(); } } return iVar1; diff --git a/src/manager/vaati3StartManager.c b/src/manager/vaati3StartManager.c index 6d1c666d..c30c1e4b 100644 --- a/src/manager/vaati3StartManager.c +++ b/src/manager/vaati3StartManager.c @@ -70,7 +70,7 @@ void Vaati3StartManager_Type0_Action1(Vaati3StartManager* this) { super->subAction = 0; super->timer = 120; SetPlayerControl(2); - sub_08078B48(); + PausePlayer(); object = CreateObject(THUNDERBOLT, 0, 0); if (object != NULL) { object->x.HALF.HI = gRoomControls.origin_x + 0x88; @@ -100,7 +100,7 @@ void Vaati3StartManager_Type0_Action2(Vaati3StartManager* this) { } void Vaati3StartManager_Type0_Action3(Vaati3StartManager* this) { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { if (super->timer != 0) { super->timer--; } else { diff --git a/src/menu/kinstoneMenu.c b/src/menu/kinstoneMenu.c index b41d3707..cfc0473a 100644 --- a/src/menu/kinstoneMenu.c +++ b/src/menu/kinstoneMenu.c @@ -331,7 +331,7 @@ void KinstoneMenu_Type5_Overlay0(void) { } void KinstoneMenu_Type5_Overlay1(void) { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { gMenu.overlayType = 2; SoundReq(SFX_147); } diff --git a/src/message.c b/src/message.c index 165c58d1..87d6e461 100644 --- a/src/message.c +++ b/src/message.c @@ -49,7 +49,7 @@ static void StatusUpdate(u32 status); static void SwitchChoice(u32 to, u32 from); static void MsgChangeLine(u32 lineNo); -static void SetDoTextBox(u32 doTextbox); +static void SetState(u32 status); static void DeleteWindow(void); static u32 ChangeWindowSize(u32 delta); @@ -122,14 +122,14 @@ s32 sub_08056338(void) { s32 result; result = -1; - if (((gMessage.doTextBox & 0x7f) == 0) && (gUnk_02000040.unk_00 == 3)) + if (((gMessage.state & MESSAGE_ACTIVE) == 0) && (gUnk_02000040.unk_00 == 3)) result = gUnk_02000040.unk_01; return result; } void MessageClose(void) { - if ((gMessage.doTextBox & 0x7f) != 0) { - gMessage.doTextBox = 0x88; + if (gMessage.state & MESSAGE_ACTIVE) { + gMessage.state = 0x88; } } @@ -173,7 +173,7 @@ void MessageRequest(u32 index) { gMessage.textWindowHeight = 4; gMessage.textWindowPosX = 1; gMessage.textWindowPosY = 12; - gMessage.doTextBox = 1; + gMessage.state = 1; } void MessageInitialize(void) { @@ -190,7 +190,7 @@ void MessageMain(void) { [MSG_OPEN] = MsgOpen, [MSG_CLOSE] = MsgClose, [MSG_DIE] = MsgDie, }; - if (gMessage.doTextBox == 1) { + if (gMessage.state == 1) { MemClear((u32*)&gTextRender, sizeof(gTextRender)); StatusUpdate(MSG_INIT); } @@ -258,7 +258,7 @@ u32 MsgInit(void) { gTextRender.curToken._c = &gUnk_08107BE0; gTextRender._50.unk8 = gTextGfxBuffer; gTextRender._50.unk4 = 0xd0; - SetDoTextBox(2); + SetState(2); MsgChangeLine(0); StatusUpdate(MSG_UPDATE); return 1; @@ -295,7 +295,7 @@ static u32 MsgClose(void) { } static u32 MsgDie(void) { - SetDoTextBox(0); + SetState(0); StatusUpdate(MSG_IDLE); return 0; } @@ -306,7 +306,7 @@ static u32 MsgUpdate(void) { [RENDER_WAIT] = TextDispWait, [RENDER_ROLL] = TextDispRoll, [RENDER_ENQUIRY] = TextDispEnquiry, }; - SetDoTextBox(4); + SetState(4); gTextDispFunctions[gTextRender.renderStatus](&gTextRender); ChangeWindowSize(0); return 0; @@ -604,7 +604,7 @@ static void TextDispRoll(TextRender* this) { static void TextDispDie(TextRender* this) { gMessage.unk = 0; - SetDoTextBox(7); + SetState(7); if ((this->_8e != 1) && (this->_8e == 2 || MESSAGE_PRESS_ANY_ADVANCE_KEYS)) { StatusUpdate(MSG_CLOSE); } @@ -628,8 +628,8 @@ static void MsgChangeLine(u32 lineNo) { PaletteChange(&gTextRender, gTextRender._8f | 0x40); } -static void SetDoTextBox(u32 doTextbox) { - gMessage.doTextBox = gTextRender.message.doTextBox = doTextbox; +static void SetState(u32 status) { + gMessage.state = gTextRender.message.state = status; } static void DeleteWindow(void) { diff --git a/src/npc.c b/src/npc.c index 94896d5e..1609e901 100644 --- a/src/npc.c +++ b/src/npc.c @@ -14,7 +14,7 @@ void NPCUpdate(Entity* this) { DeleteThisEntity(); if (this->action == 0 && (this->flags & ENT_DID_INIT) == 0) NPCInit(this); - if (!EntityIsDeleted(this)) + if (!EntityDisabled(this)) gNPCFunctions[this->id][0](this); if (this->next != NULL) { if (gNPCFunctions[this->id][1] != NULL) diff --git a/src/npc/beedle.c b/src/npc/beedle.c index 38bcb381..07a3d0fc 100644 --- a/src/npc/beedle.c +++ b/src/npc/beedle.c @@ -94,7 +94,7 @@ void Beedle_Action1(Entity* this) { } void Beedle_Action2(Entity* this) { - if ((gMessage.doTextBox & 0x7F) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { this->action++; InitializeAnimation(this, 8); } diff --git a/src/npc/bigGoron.c b/src/npc/bigGoron.c index 0767433b..ce6d1bab 100644 --- a/src/npc/bigGoron.c +++ b/src/npc/bigGoron.c @@ -266,7 +266,7 @@ void sub_0806D274(BigGoronEntity* this) { case 0: case 1: default: - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { super->frameIndex = 2; break; } diff --git a/src/npc/brocco.c b/src/npc/brocco.c index 9236bb60..ea14ac04 100644 --- a/src/npc/brocco.c +++ b/src/npc/brocco.c @@ -72,7 +72,7 @@ void sub_08063584(Entity* this) { } void sub_08063608(Entity* this) { - u8 tmp = gMessage.doTextBox & 0x7f; + u8 tmp = gMessage.state & MESSAGE_ACTIVE; if (tmp == 0) { this->action = 1; this->subtimer = tmp; diff --git a/src/npc/castleMaid.c b/src/npc/castleMaid.c index 2001f0d2..f5e888e3 100644 --- a/src/npc/castleMaid.c +++ b/src/npc/castleMaid.c @@ -99,7 +99,7 @@ void sub_08064570(CastleMaidEntity* this) { } break; case 2: - if ((gMessage.doTextBox & 0x7f) != 0) { + if ((gMessage.state & MESSAGE_ACTIVE) != 0) { return; } super->action = 1; diff --git a/src/npc/cat.c b/src/npc/cat.c index d2f42aec..eb364e8f 100644 --- a/src/npc/cat.c +++ b/src/npc/cat.c @@ -219,7 +219,7 @@ void sub_0806797C(CatEntity* this) { void sub_0806799C(CatEntity* this) { UpdateAnimationSingleFrame(super); - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { sub_08067B08(this); SetEntityPriority(super, PRIO_PLAYER); } diff --git a/src/npc/epona.c b/src/npc/epona.c index 91bfc6de..a852af99 100644 --- a/src/npc/epona.c +++ b/src/npc/epona.c @@ -54,7 +54,7 @@ void sub_08065A00(EponaEntity* this) { } void sub_08065A10(EponaEntity* this) { - if ((gMessage.doTextBox & 0x7F) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { super->action = 1; InitAnimationForceUpdate(super, super->animationState / 2); } diff --git a/src/npc/ghostBrothers.c b/src/npc/ghostBrothers.c index 9458205b..6628b572 100644 --- a/src/npc/ghostBrothers.c +++ b/src/npc/ghostBrothers.c @@ -162,7 +162,7 @@ void sub_08065D74(GhostBrothersEntity* this) { void sub_08065DB8(GhostBrothersEntity* this) { switch (super->subAction) { case 0: { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { super->subAction++; super->timer = 60; InitAnimationForceUpdate(super, 4); @@ -188,7 +188,7 @@ void sub_08065DB8(GhostBrothersEntity* this) { break; } case 4: { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { super->subAction++; super->timer = 30; this->unk_6c = gUnk_0811022E; diff --git a/src/npc/goron.c b/src/npc/goron.c index 6ed59d26..422fe6cc 100644 --- a/src/npc/goron.c +++ b/src/npc/goron.c @@ -72,7 +72,7 @@ void sub_08069328(Entity* this) { void sub_08069390(Entity* this) { UpdateAnimationSingleFrame(this); - if ((gMessage.doTextBox & 0x7F) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { this->action = 1; this->interactType = INTERACTION_NONE; RevokePriority(this); diff --git a/src/npc/goronMerchant.c b/src/npc/goronMerchant.c index 24bb04e7..2f497dff 100644 --- a/src/npc/goronMerchant.c +++ b/src/npc/goronMerchant.c @@ -57,9 +57,9 @@ void sub_080695AC(Entity* this) { void sub_080695E8(Entity* this) { UpdateAnimationSingleFrame(this); - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { this->action = 1; - this->interactType = gMessage.doTextBox & 0x7f; + this->interactType = gMessage.state & MESSAGE_ACTIVE; RevokePriority(this); InitAnimationForceUpdate(this, this->animationState); } diff --git a/src/npc/guard.c b/src/npc/guard.c index cb1b7060..617d5d13 100644 --- a/src/npc/guard.c +++ b/src/npc/guard.c @@ -346,7 +346,7 @@ void sub_08063E54(Entity* this) { } void sub_08063E6C(Entity* this) { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { this->action = 1; InitializeAnimation(this, this->animationState + 4); } @@ -397,7 +397,7 @@ void sub_08063F20(GuardEntity* this) { } void sub_08063F78(GuardEntity* this) { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { super->action = super->action - 1; InitializeAnimation(super, (super->animationState >> 1) + 4 + this->unk_70); } diff --git a/src/npc/kid.c b/src/npc/kid.c index 957b4426..70e94ee3 100644 --- a/src/npc/kid.c +++ b/src/npc/kid.c @@ -319,7 +319,7 @@ void sub_080621AC(KidEntity* this) { break; case 2: GetNextFrame(super); - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { super->action = 1; } break; diff --git a/src/npc/mountainMinish.c b/src/npc/mountainMinish.c index baf3e231..6f68a069 100644 --- a/src/npc/mountainMinish.c +++ b/src/npc/mountainMinish.c @@ -150,7 +150,7 @@ void sub_08067EF0(MountainMinishEntity* this) { } break; case 2: - if ((gMessage.doTextBox & 0x7f) != 0) + if ((gMessage.state & MESSAGE_ACTIVE) != 0) break; super->action = 1; InitializeAnimation(super, (super->animationState >> 1) + 4); diff --git a/src/npc/npc23.c b/src/npc/npc23.c index e3dab558..51ef213e 100644 --- a/src/npc/npc23.c +++ b/src/npc/npc23.c @@ -101,7 +101,7 @@ void sub_080663D4(NPC23Entity* this) { } ProcessMovement0(super); } - sub_08078B48(); + PausePlayer(); GetNextFrame(super); } diff --git a/src/npc/npc9.c b/src/npc/npc9.c index 6e66716b..71a45f04 100644 --- a/src/npc/npc9.c +++ b/src/npc/npc9.c @@ -51,7 +51,7 @@ void sub_08062B48(Entity* this) { } void sub_08062B70(Entity* this) { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { InitializeAnimation(this, 2); this->action = 1; RevokePriority(this); diff --git a/src/npc/percy.c b/src/npc/percy.c index 5c6108cd..c0d0eac2 100644 --- a/src/npc/percy.c +++ b/src/npc/percy.c @@ -149,13 +149,13 @@ void sub_0806B540(Entity* this) { SetLocalFlag(0x3f); break; case 1: - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { context->unk_18 = 2; MessageNoOverlap(TEXT_INDEX(TEXT_PERCY, 0x15), this); } break; case 2: - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { context->unk_18 = 3; if (gSave.stats.hasAllFigurines != 0) { InitItemGetSequence(ITEM_RUPEE100, 0, 0); diff --git a/src/npc/pina.c b/src/npc/pina.c index cb73eabc..a7a2448d 100644 --- a/src/npc/pina.c +++ b/src/npc/pina.c @@ -74,7 +74,7 @@ void sub_08063AC0(Entity* this) { } void sub_08063B44(Entity* this) { - u8 tmp = gMessage.doTextBox & 0x7f; + u8 tmp = gMessage.state & MESSAGE_ACTIVE; if (tmp == 0) { this->action = 1; this->subtimer = tmp; diff --git a/src/npc/postman.c b/src/npc/postman.c index 12711abc..1ae6aa81 100644 --- a/src/npc/postman.c +++ b/src/npc/postman.c @@ -273,7 +273,7 @@ void sub_08060528(PostmanEntity* this) { break; case 2: UpdateAnimationSingleFrame(super); - if ((gMessage.doTextBox & 0x7f) != 0) { + if ((gMessage.state & MESSAGE_ACTIVE) != 0) { break; } super->action = 1; diff --git a/src/npc/stamp.c b/src/npc/stamp.c index 380e5be4..59322c18 100644 --- a/src/npc/stamp.c +++ b/src/npc/stamp.c @@ -64,7 +64,7 @@ void sub_08062C24(Entity* this) { } void sub_08062C54(Entity* this) { - if ((gMessage.doTextBox & 127) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { this->action = 1; InitializeAnimation(this, 0); RevokePriority(this); diff --git a/src/npc/stockwell.c b/src/npc/stockwell.c index 68d63b46..2c9dbe00 100644 --- a/src/npc/stockwell.c +++ b/src/npc/stockwell.c @@ -108,8 +108,8 @@ void sub_080650CC(StockwellEntity* this) { void sub_080651AC(StockwellEntity* this) { GetNextFrame(super); - if ((gMessage.doTextBox & 0x7f) == 0) { - super->interactType = gMessage.doTextBox & 0x7f; + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { + super->interactType = gMessage.state & MESSAGE_ACTIVE; super->action = 1; InitializeAnimation(super, 4); } @@ -164,7 +164,7 @@ void sub_0806528C(Entity* this) { } void sub_080652B0(Entity* this) { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { this->subAction++; this->timer = 10; gRoomVars.animFlags = this->subtimer; @@ -184,16 +184,16 @@ void sub_080652E4(Entity* this) { } void sub_08065314(Entity* this) { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { this->subAction++; MenuFadeIn(3, 3); } } void sub_08065338(Entity* this) { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { this->action = 1; - this->subAction = gMessage.doTextBox & 0x7f; + this->subAction = gMessage.state & MESSAGE_ACTIVE; gRoomVars.animFlags = this->subtimer; InitializeAnimation(this, 4); } diff --git a/src/npc/sturgeon.c b/src/npc/sturgeon.c index 6367bf76..4ba1906e 100644 --- a/src/npc/sturgeon.c +++ b/src/npc/sturgeon.c @@ -127,7 +127,7 @@ void sub_08064B88(SturgeonEntity* this) { } void sub_08064C2C(SturgeonEntity* this) { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { super->action = 1; InitializeAnimation(super, (u32)super->subtimer); } diff --git a/src/npc/talon.c b/src/npc/talon.c index 4b62dd22..7a93007e 100644 --- a/src/npc/talon.c +++ b/src/npc/talon.c @@ -119,7 +119,7 @@ void sub_08065680(TalonEntity* this) { } void sub_080656A4(TalonEntity* this) { - if ((gMessage.doTextBox & 0x7F) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { super->action = this->unk_69; InitAnimationForceUpdate(super, this->unk_6a); } diff --git a/src/npc/townMinish.c b/src/npc/townMinish.c index d818f4fa..e8914c76 100644 --- a/src/npc/townMinish.c +++ b/src/npc/townMinish.c @@ -250,7 +250,7 @@ void sub_0806ACC4(TownMinishEntity* this) { } break; case 2: - if (gMessage.doTextBox & 0x7f) + if (gMessage.state & MESSAGE_ACTIVE) break; super->action = 1; diff --git a/src/npc/townsperson.c b/src/npc/townsperson.c index 9feb45ea..593c3160 100644 --- a/src/npc/townsperson.c +++ b/src/npc/townsperson.c @@ -153,7 +153,7 @@ void sub_08061D64(TownspersonEntity* this) { void sub_08061E24(TownspersonEntity* this) { GetNextFrame(super); - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { super->action = 1; InitializeAnimation(super, this->unk_69); } diff --git a/src/npc/windTribespeople.c b/src/npc/windTribespeople.c index 41eb3567..ef37526f 100644 --- a/src/npc/windTribespeople.c +++ b/src/npc/windTribespeople.c @@ -78,7 +78,7 @@ void sub_0806C7D4(Entity* this) { } void sub_0806C834(Entity* this) { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { --this->action; InitializeAnimation(this, (this->animationState / 2) + 4); } diff --git a/src/object.c b/src/object.c index 58806614..8f23887e 100644 --- a/src/object.c +++ b/src/object.c @@ -205,7 +205,7 @@ void ObjectUpdate(Entity* this) { ObjectInit(this); if (this->iframes != 0) this->iframes++; - if (!EntityIsDeleted(this)) { + if (!EntityDisabled(this)) { gObjectFunctions[this->id](this); this->contactFlags &= ~0x80; } diff --git a/src/object/bird.c b/src/object/bird.c index 2b4b0dac..485c0695 100644 --- a/src/object/bird.c +++ b/src/object/bird.c @@ -225,7 +225,7 @@ void Bird_Type8(BirdEntity* this) { super->speed = 0x300; } - if ((gPlayerEntity.flags & ENT_COLLIDE) && (gMessage.doTextBox & 0x7f) == 0 && + if ((gPlayerEntity.flags & ENT_COLLIDE) && (gMessage.state & MESSAGE_ACTIVE) == 0 && gPlayerEntity.action != PLAYER_SLEEP && gPlayerEntity.action != PLAYER_BOUNCE && gPlayerEntity.action != PLAYER_MINISH && gPlayerState.framestate != PL_STATE_CLIMB && gPlayerState.framestate != PL_STATE_JUMP && gPlayerState.framestate != PL_STATE_PARACHUTE && @@ -240,21 +240,21 @@ void Bird_Type8(BirdEntity* this) { super->speed = 0x300; this->gravity = Q_8_8(-32.0); PlayerDropHeldObject(); - sub_08078B48(); + PausePlayer(); ResetPlayerAnimationAndAction(); PutAwayItems(); gPlayerState.swim_state = 0; gPlayerState.jump_status = 0; gPlayerEntity.flags &= ~0x80; gPlayerEntity.spriteSettings.draw = 0; - gPriorityHandler.sys_priority = 6; + gPriorityHandler.event_priority = 6; gPauseMenuOptions.disabled = 1; } } } break; default: - sub_08078B48(); + PausePlayer(); gPlayerEntity.spriteSettings.draw = 0; break; } @@ -313,7 +313,7 @@ void Bird_Type9(BirdEntity* this) { SoundReq(SFX_123); super->spritePriority.b1 = 2; InitAnimationForceUpdate(super, 0); - sub_08078B48(); + PausePlayer(); } else if (super->action == 1) { gPlayerEntity.spriteSettings.draw = 0; child = super->child; @@ -324,7 +324,7 @@ void Bird_Type9(BirdEntity* this) { child->spriteRendering.b3 = super->spriteRendering.b3; child->spriteOrientation.flipY = super->spriteOrientation.flipY; } - sub_08078B48(); + PausePlayer(); if (gRoomControls.scroll_x + 0x78 < super->x.HALF.HI) { super->action++; super->spritePriority.b1 = 1; diff --git a/src/object/book.c b/src/object/book.c index 36f76c6a..4ebd3f7d 100644 --- a/src/object/book.c +++ b/src/object/book.c @@ -208,10 +208,10 @@ void Book_Action5(BookEntity* this) { break; } case 1: { - u8 doTextBox = gMessage.doTextBox & 0x7f; - if (!doTextBox) { + u8 status = gMessage.state & MESSAGE_ACTIVE; + if (!status) { super->spriteSettings.draw = 1; - super->subAction = doTextBox; + super->subAction = status; } break; } diff --git a/src/object/bush.c b/src/object/bush.c index e12d3883..857e63f7 100644 --- a/src/object/bush.c +++ b/src/object/bush.c @@ -38,7 +38,7 @@ void Bush(BushEntity* this) { Bush_Action1, Bush_Action2, }; - if (!EntityIsDeleted(super)) { + if (!EntityDisabled(super)) { Bush_Actions[super->action](this); } } diff --git a/src/object/cameraTarget.c b/src/object/cameraTarget.c index e19d0499..e21b2f7d 100644 --- a/src/object/cameraTarget.c +++ b/src/object/cameraTarget.c @@ -53,7 +53,7 @@ void CameraTarget(Entity* this) { case FUSION_STATE_0: case FUSION_STATE_1: case FUSION_STATE_2: - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { break; } default: diff --git a/src/object/cloud.c b/src/object/cloud.c index 1252aca6..9f99213d 100644 --- a/src/object/cloud.c +++ b/src/object/cloud.c @@ -104,7 +104,7 @@ void sub_0809F5F0(CloudEntity* this) { super->action = 2; super->timer = 120; SetPlayerControl(3); - sub_08078B48(); + PausePlayer(); gRoomControls.camera_target = super; } } diff --git a/src/object/crenelBeanSprout.c b/src/object/crenelBeanSprout.c index 74db801c..7480ba07 100644 --- a/src/object/crenelBeanSprout.c +++ b/src/object/crenelBeanSprout.c @@ -266,7 +266,7 @@ void CrenelBeanSprout_Action6(CrenelBeanSproutEntity* this) { CrenelBeanSprout_Action6SubAction2, }; if (super->subAction != 2) { - sub_08078B48(); + PausePlayer(); } CrenelBeanSprout_Action6SubActions[super->subAction](this); } diff --git a/src/object/cutsceneMiscObject.c b/src/object/cutsceneMiscObject.c index 00fdc5e7..44fc603f 100644 --- a/src/object/cutsceneMiscObject.c +++ b/src/object/cutsceneMiscObject.c @@ -457,7 +457,7 @@ void CutsceneMiscObject_Type7(CutsceneMiscObjectEntity* this) { } break; case 2: - if ((gMessage.doTextBox & 0x7F) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { CreateItemEntity(ITEM_JABBERNUT, 0, 0); DeleteThisEntity(); } diff --git a/src/object/ezloCap.c b/src/object/ezloCap.c index 6465dad9..4c7f39bb 100644 --- a/src/object/ezloCap.c +++ b/src/object/ezloCap.c @@ -81,11 +81,11 @@ void EzloCap_Type0Action1(EzloCapEntity* this) { static const u8 gUnk_0811F16C[] = { 4, 0, 2, 6, 10, 8, 9, 5, 1, 0, 0, 0 }; u32 tmp = gPlayerEntity.palette.b.b0; super->palette.b.b0 = tmp; - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { DeleteEntity(super); return; } - if ((gMessage.doTextBox & 0x7f) != 5) { + if ((gMessage.state & MESSAGE_ACTIVE) != 5) { if (((gMessage.unk == 0xa) || (gMessage.unk == 0)) || ((gMessage.unk & 0xf) > 9)) { if (super->animIndex != (super->subtimer | 3)) { InitAnimationForceUpdate(super, super->subtimer | 3); diff --git a/src/object/fourElements.c b/src/object/fourElements.c index 1c3942ea..bb99e701 100644 --- a/src/object/fourElements.c +++ b/src/object/fourElements.c @@ -138,7 +138,7 @@ void FourElements_Action5(FourElementsEntity* this) { void FourElements_Action6(FourElementsEntity* this) { RequestPriorityDuration(NULL, 10); - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { SetPriorityTimer(90); gPlayerState.controlMode = 1; EnablePauseMenu(); diff --git a/src/object/frozenOctorok.c b/src/object/frozenOctorok.c index 540a85dd..089436dc 100644 --- a/src/object/frozenOctorok.c +++ b/src/object/frozenOctorok.c @@ -267,7 +267,7 @@ void FrozenOctorok_Action1SubAction0(FrozenOctorokEntity* this) { void FrozenOctorok_Action1SubAction1(FrozenOctorokEntity* this) { Entity* obj; - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { if (this->unk_79-- == 0) { obj = CreateObjectWithParent(super, FROZEN_OCTOROK, 7, 0); if (obj != NULL) { diff --git a/src/object/gleerokParticle.c b/src/object/gleerokParticle.c index 5595ccda..67efcb36 100644 --- a/src/object/gleerokParticle.c +++ b/src/object/gleerokParticle.c @@ -82,7 +82,7 @@ void GleerokParticle_Init(GleerokParticleEntity* this) { DeleteThisEntity(); } } - sub_08078B48(); + PausePlayer(); return; case 0: super->direction = gUnk_081229D0[super->type2].direction; diff --git a/src/object/itemForSale.c b/src/object/itemForSale.c index 9a87f5c6..0106fb63 100644 --- a/src/object/itemForSale.c +++ b/src/object/itemForSale.c @@ -96,7 +96,7 @@ void ItemForSale_Action1(ItemForSaleEntity* this) { if (super->interactType != INTERACTION_NONE) { super->interactType = INTERACTION_NONE; super->subAction = 1; - sub_08078B48(); + PausePlayer(); ResetActiveItems(); gPlayerState.heldObject = 4; gNewPlayerEntity.unk_74 = super; diff --git a/src/object/lilypadLarge.c b/src/object/lilypadLarge.c index 5c1e9949..5571ca47 100644 --- a/src/object/lilypadLarge.c +++ b/src/object/lilypadLarge.c @@ -325,7 +325,7 @@ void LilypadLarge_Action2(LilypadLargeEntity* this) { }; subActionFuncs[super->subAction](this); gPlayerState.flags |= PL_FLAGS2; - sub_08078B48(); + PausePlayer(); } void sub_08085A44(LilypadLargeEntity* this) { @@ -460,7 +460,7 @@ void sub_08085D28(LilypadLargeEntity* this) { (GetRelativeCollisionTile(super, 0, 0x18) == 0x11)) { super->action = 2; super->subAction = 0; - sub_08078B48(); + PausePlayer(); } } diff --git a/src/object/linkAnimation.c b/src/object/linkAnimation.c index c811373c..5f790559 100644 --- a/src/object/linkAnimation.c +++ b/src/object/linkAnimation.c @@ -93,7 +93,7 @@ void LinkAnimation_ItemGet(LinkAnimationEntity* this) { break; case ITEMGET_WAIT: UpdateAnimationSingleFrame(super); - if ((gMessage.doTextBox & 0x7f) != 0) { + if ((gMessage.state & MESSAGE_ACTIVE) != 0) { return; } if (super->frame & ANIM_DONE) { diff --git a/src/object/moleMittsParticle.c b/src/object/moleMittsParticle.c index 93a0379c..02f3e72e 100644 --- a/src/object/moleMittsParticle.c +++ b/src/object/moleMittsParticle.c @@ -18,7 +18,7 @@ void MoleMittsParticle(Entity* this) { MoleMittsParticle_Init, MoleMittsParticle_Action1, }; - if (!EntityIsDeleted(this)) { + if (!EntityDisabled(this)) { MoleMittsParticle_Actions[this->action](this); } } diff --git a/src/object/octorokBossObject.c b/src/object/octorokBossObject.c index 4619d170..1410d0d1 100644 --- a/src/object/octorokBossObject.c +++ b/src/object/octorokBossObject.c @@ -316,7 +316,7 @@ void OctorokBossObject_Action1(OctorokBossObjectEntity* this) { } break; case 9: - sub_08078B48(); + PausePlayer(); if ((this->unk_78.WORD_U)-- == 0) { gRoomControls.camera_target = &gPlayerEntity; DeleteThisEntity(); diff --git a/src/object/well.c b/src/object/well.c index 8b26a476..ed033493 100644 --- a/src/object/well.c +++ b/src/object/well.c @@ -40,7 +40,7 @@ void Well_Init(WellEntity* this) { void Well_Action1(WellEntity* this) { u32 tileIndex = GetTileType(this->unk_80, 1); if (tileIndex != 0x407D) { - sub_08078B48(); + PausePlayer(); gPlayerEntity.x.WORD = super->x.WORD; gPlayerEntity.y.HALF.HI = super->y.HALF.HI + 4; DeleteThisEntity(); diff --git a/src/object/windTribeTeleporter.c b/src/object/windTribeTeleporter.c index 997a91d0..fd785ab9 100644 --- a/src/object/windTribeTeleporter.c +++ b/src/object/windTribeTeleporter.c @@ -21,7 +21,7 @@ void WindTribeTeleporter_Action1(WindTribeTeleporterEntity*); void WindTribeTeleporter_Action2(WindTribeTeleporterEntity*); void WindTribeTeleporter_Action3(WindTribeTeleporterEntity*); void sub_080A11E0(WindTribeTeleporterEntity*); -bool32 sub_080A11C0(WindTribeTeleporterEntity*); +static bool32 PlayerCollidingTeleporter(WindTribeTeleporterEntity*); void WindTribeTeleporter(WindTribeTeleporterEntity* this) { static void (*const WindTribeTeleporter_Actions[])(WindTribeTeleporterEntity*) = { @@ -40,11 +40,11 @@ void WindTribeTeleporter_Init(WindTribeTeleporterEntity* this) { super->spritePriority.b0 = 7; super->hitbox = (Hitbox*)&gHitbox_22; SetEntityPriority(super, 6); - if (sub_080A11C0(this)) { + if (PlayerCollidingTeleporter(this)) { gPlayerEntity.x.HALF.HI = super->x.HALF.HI; gPlayerEntity.y.HALF.HI = super->y.HALF.HI; SetPlayerControl(CONTROL_DISABLED); - sub_08078B48(); + PausePlayer(); SetPlayerEventPriority(); SoundReq(SFX_112); super->action = 3; @@ -54,12 +54,12 @@ void WindTribeTeleporter_Init(WindTribeTeleporterEntity* this) { } void WindTribeTeleporter_Action1(WindTribeTeleporterEntity* this) { - if (sub_080A11C0(this)) { + if (PlayerCollidingTeleporter(this)) { if (this->unk_68 == 0) { gPlayerEntity.x.HALF.HI = super->x.HALF.HI; gPlayerEntity.y.HALF.HI = super->y.HALF.HI; SetPlayerControl(CONTROL_DISABLED); - sub_08078B48(); + PausePlayer(); SetPlayerEventPriority(); SoundReq(SFX_112); super->action = 2; @@ -177,7 +177,7 @@ void WindTribeTeleporter_Action3(WindTribeTeleporterEntity* this) { } } -bool32 sub_080A11C0(WindTribeTeleporterEntity* this) { +static bool32 PlayerCollidingTeleporter(WindTribeTeleporterEntity* this) { if (gPlayerEntity.z.HALF.HI != 0) { return FALSE; } else { diff --git a/src/objectUtils.c b/src/objectUtils.c index 254be88f..e3db7806 100644 --- a/src/objectUtils.c +++ b/src/objectUtils.c @@ -42,7 +42,7 @@ Entity* CreateLinkAnimation(Entity* parent, u32 type, u32 type2) { AppendEntityToList(e, 6); PrependEntityToList(e, 6); CopyPosition(&gPlayerEntity, e); - gPriorityHandler.sys_priority = 6; + gPriorityHandler.event_priority = 6; gPauseMenuOptions.disabled = 1; // store player state diff --git a/src/player.c b/src/player.c index 90a10af1..bb2b14f9 100644 --- a/src/player.c +++ b/src/player.c @@ -280,7 +280,7 @@ extern ScriptExecutionContext gPlayerScriptExecutionContext; bool32 CheckInitPauseMenu(void) { u32 framestate; if (((gInput.newKeys & START_BUTTON) == 0 || gFadeControl.active || gPauseMenuOptions.disabled || - (gMessage.doTextBox & 0x7F) || gSave.stats.health == 0 || !gSave.inventory[0] || + (gMessage.state & MESSAGE_ACTIVE) || gSave.stats.health == 0 || !gSave.inventory[0] || gPlayerState.controlMode != 0 || gPriorityHandler.priority_timer != 0)) { return FALSE; } @@ -728,7 +728,7 @@ static void sub_08070E9C(Entity* this) { static void sub_08070EDC(Entity* this) { this->updatePriority = PRIO_MESSAGE; - if ((gMessage.doTextBox & 0x7f) != 0) + if (gMessage.state & MESSAGE_ACTIVE) this->subAction = 1; if ((gPlayerState.flags & PL_MINISH) == 0) @@ -739,7 +739,7 @@ static void sub_08070EDC(Entity* this) { static void sub_08070f24(Entity* this) { UpdateAnimationSingleFrame(this); - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { this->updatePriority = this->updatePriorityPrev; ResetPlayerAnimationAndAction(); } @@ -808,7 +808,7 @@ static void sub_08071038(Entity* this) { UpdateAnimationSingleFrame(this); // player is still reading message - if (CheckQueuedAction() || (gMessage.doTextBox & 0x7f)) + if (CheckQueuedAction() || (gMessage.state & MESSAGE_ACTIVE)) return; if (this->frame & ANIM_DONE) { @@ -1286,7 +1286,7 @@ static void PlayerTalkEzlo_Init(Entity* this) { ResetActiveItems(); gActiveItems[ACTIVE_ITEM_LANTERN].animPriority = 0; this->iframes = 0; - gPriorityHandler.sys_priority = PRIO_PLAYER_EVENT; + gPriorityHandler.event_priority = PRIO_PLAYER_EVENT; this->updatePriority = PRIO_PLAYER_EVENT; if (gPlayerState.flags & PL_MINISH) { @@ -1335,7 +1335,7 @@ static void PlayerTalkEzlo_CreateMessage(Entity* this) { static void PlayerTalkEzlo_MessageIdle(Entity* this) { u32 rightOrLeft; - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { this->subAction++; if ((gPlayerState.flags & PL_MINISH) == 0) { if (this->animationState == IdleEast) @@ -1380,7 +1380,7 @@ static void PlayerTalkEzlo_Leave(Entity* this) { } static void reset_priority(void) { - gPriorityHandler.sys_priority = PRIO_MIN; + gPriorityHandler.event_priority = PRIO_MIN; gPlayerEntity.updatePriority = gPlayerEntity.updatePriorityPrev; } diff --git a/src/playerItem.c b/src/playerItem.c index f6fbd5bf..69b1557e 100644 --- a/src/playerItem.c +++ b/src/playerItem.c @@ -72,7 +72,7 @@ void ItemUpdate(Entity* this) { if ((this->flags & ENT_DID_INIT) == 0 && this->action == 0 && this->subAction == 0) ItemInit(this); - if (!EntityIsDeleted(this)) { + if (!EntityDisabled(this)) { gPlayerItemFunctions[this->id](this); this->contactFlags &= ~0x80; if (this->iframes != 0) { diff --git a/src/playerUtils.c b/src/playerUtils.c index c987c761..2cd630f7 100644 --- a/src/playerUtils.c +++ b/src/playerUtils.c @@ -988,7 +988,7 @@ bool32 sub_08078140(ChargeState* info) { void ForceSetPlayerState(u32 framestate) { gPlayerState.framestate = framestate; gPlayerEntity.flags &= ~ENT_COLLIDE; - sub_08078B48(); + PausePlayer(); } void DetermineRButtonInteraction(void) { @@ -1504,7 +1504,7 @@ void SetPlayerItemGetState(Entity* item, u8 param_2, u8 param_3) { DeleteClones(); } -void sub_08078B48(void) { +void PausePlayer(void) { gPlayerState.field_0x7 |= 0x80; gPlayerState.keepFacing |= 0x80; gPlayerState.field_0xa |= 0x80; @@ -2494,7 +2494,7 @@ u32 sub_08079FD4(Entity* this, u32 param_2) { void UpdatePlayerPalette(void) { u32 palette; - if ((gPlayerState.hurtBlinkSpeed != 0) && ((gMessage.doTextBox & 0x7f) == 0)) { + if ((gPlayerState.hurtBlinkSpeed != 0) && ((gMessage.state & MESSAGE_ACTIVE) == 0)) { gPlayerState.hurtBlinkSpeed--; } palette = GetPlayerPalette(FALSE); diff --git a/src/script.c b/src/script.c index 8216a438..278ad227 100644 --- a/src/script.c +++ b/src/script.c @@ -1054,7 +1054,7 @@ void ScriptCommand_0807E858(Entity* entity, ScriptExecutionContext* context) { void ScriptCommand_SetPlayerIdle(Entity* entity, ScriptExecutionContext* context) { gPlayerState.controlMode = CONTROL_DISABLED; - sub_08078B48(); + PausePlayer(); } void ScriptCommand_EnablePlayerControl(Entity* entity, ScriptExecutionContext* context) { @@ -1129,7 +1129,7 @@ void ScriptCommand_0807E974(Entity* entity, ScriptExecutionContext* context) { MessageFromTarget(context->scriptInstructionPointer[1]); break; case 1: - if (gMessage.doTextBox & 0x7F) + if (gMessage.state & MESSAGE_ACTIVE) break; context->unk_18 = 2; context->unk_19 = 0xF; @@ -1191,7 +1191,7 @@ void ScriptCommand_AddInteractableFuser(Entity* entity, ScriptExecutionContext* } void ScriptCommand_WaitUntilTextboxCloses(Entity* entity, ScriptExecutionContext* context) { - if (gMessage.doTextBox & 0x7F) { + if (gMessage.state & MESSAGE_ACTIVE) { gActiveScriptInfo.commandSize = 0; } } diff --git a/src/scroll.c b/src/scroll.c index abb3c136..25c20cd6 100644 --- a/src/scroll.c +++ b/src/scroll.c @@ -268,7 +268,7 @@ void sub_0807FF1C(RoomControls* controls) { gUpdateVisibleTiles = 3; if (++controls->unk_18 > 0x13) { controls->scrollAction = 0; - ResetSystemPriority(); + ClearEventPriority(); } } } @@ -408,7 +408,7 @@ void sub_080801BC(RoomControls* controls) { if (controls->unk_1c == 0) { controls->scrollAction = 0; controls->reload_flags = 0; - ResetSystemPriority(); + ClearEventPriority(); gScreen.lcd.displayControl &= ~DISPCNT_WIN1_ON; gScreen.controls.windowInsideControl &= 0xff; gScreen.controls.windowOutsideControl &= 0xff00; diff --git a/src/staffroll.c b/src/staffroll.c index a2df531f..dcd0fad7 100644 --- a/src/staffroll.c +++ b/src/staffroll.c @@ -93,7 +93,7 @@ void StaffrollTask_State0(void) { gScreen.bg1.control = 0x1e4d; gScreen.bg2.control = 0x1dc3; InitSoundPlayingInfo(); - ResetSystemPriority(); + ClearEventPriority(); SetFade(FADE_IN_OUT | FADE_INSTANT, 0x100); } diff --git a/src/subtask.c b/src/subtask.c index e801bade..ab9a4500 100644 --- a/src/subtask.c +++ b/src/subtask.c @@ -278,7 +278,7 @@ void Subtask_Die(void) { gMain.substate = gUI.pauseFadeIn; gUI.nextToLoad = gFadeControl.active; gUI.lastState = gFadeControl.active; - ResetSystemPriority(); + ClearEventPriority(); } } diff --git a/src/ui.c b/src/ui.c index 1bff0dae..95a10ef4 100644 --- a/src/ui.c +++ b/src/ui.c @@ -626,7 +626,7 @@ void ButtonUIElement_Action1(UIElement* element) { MAX_MOVEMENT = (!element->type2) ? 4 : 8; - if (element->type2 == 0 && (((gUnk_0200AF00.unk_1 >> element->type) & 1) || (gMessage.doTextBox & 0x7f) != 0)) { + if (element->type2 == 0 && (((gUnk_0200AF00.unk_1 >> element->type) & 1) || (gMessage.state & MESSAGE_ACTIVE) != 0)) { y = (s16)gUnk_0200AF00.buttonY[element->type] - 0x28; } else { y = (s16)gUnk_0200AF00.buttonY[element->type]; @@ -792,7 +792,7 @@ void HeartUIElement(UIElement* element) { u32 health; u32 frameIndex; element->unk_0_1 = 0; - if (((gUnk_0200AF00.unk_1 & 0x10) == 0) && ((gMessage.doTextBox & 0x7f) == 0)) { + if (((gUnk_0200AF00.unk_1 & 0x10) == 0) && ((gMessage.state & MESSAGE_ACTIVE) == 0)) { health = gUnk_0200AF00.health; if (health != 0) { element->unk_0_1 = 1; @@ -845,7 +845,7 @@ void EzloNagUIElement_Action1(UIElement* element) { } void EzloNagUIElement_Action2(UIElement* element) { - if (gUnk_0200AF00.ezloNagFuncIndex >= 5 || (gMessage.doTextBox & 0x7f)) { + if (gUnk_0200AF00.ezloNagFuncIndex >= 5 || (gMessage.state & MESSAGE_ACTIVE)) { element->action = 0; element->unk_0_1 = 0; return;