diff options
| author | octorock <79596758+octorock@users.noreply.github.com> | 2022-12-22 23:47:13 +0100 |
|---|---|---|
| committer | octorock <79596758+octorock@users.noreply.github.com> | 2022-12-22 23:47:13 +0100 |
| commit | ea9b7e7848ae5c194acd7bb13fb40b1ccfe49e1e (patch) | |
| tree | 5433636373843e18fa182c44b630b7612639fa9d /src | |
| parent | c28018843601b99907ab79ef3fd9e689b078e384 (diff) | |
Fix palette groups
Diffstat (limited to 'src')
| -rw-r--r-- | src/beanstalkSubtask.c | 6 | ||||
| -rw-r--r-- | src/fileselect.c | 10 | ||||
| -rw-r--r-- | src/gameUtils.c | 2 | ||||
| -rw-r--r-- | src/interrupts.c | 12 | ||||
| -rw-r--r-- | src/item/itemTryPickupObject.c | 2 | ||||
| -rw-r--r-- | src/itemUtils.c | 4 | ||||
| -rw-r--r-- | src/menu/figurineMenu.c | 2 | ||||
| -rw-r--r-- | src/menu/pauseMenu.c | 6 | ||||
| -rw-r--r-- | src/object/crenelBeanSprout.c | 6 | ||||
| -rw-r--r-- | src/object/itemForSale.c | 12 | ||||
| -rw-r--r-- | src/player.c | 4 | ||||
| -rw-r--r-- | src/playerUtils.c | 14 | ||||
| -rw-r--r-- | src/script.c | 4 | ||||
| -rw-r--r-- | src/subtask.c | 24 | ||||
| -rw-r--r-- | src/ui.c | 227 |
15 files changed, 169 insertions, 166 deletions
diff --git a/src/beanstalkSubtask.c b/src/beanstalkSubtask.c index e2b77f97..4612e66b 100644 --- a/src/beanstalkSubtask.c +++ b/src/beanstalkSubtask.c @@ -310,7 +310,7 @@ u32 UpdatePlayerCollision(void) { if (gPlayerEntity.animationState != 0) { return 0; } - gUnk_0200AF00.unk_2d = 4; + gHUD.unk_2d = 4; if ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_40)) == 0) { return 0; } @@ -324,7 +324,7 @@ u32 UpdatePlayerCollision(void) { if ((gPlayerState.flags & 0x4080) != 0) { return 0; } - gUnk_0200AF00.unk_2d = 6; + gHUD.unk_2d = 6; if ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_8)) == 0) { return 0; } @@ -335,7 +335,7 @@ u32 UpdatePlayerCollision(void) { if (HasDungeonMap() == 0) { return 0; } - gUnk_0200AF00.unk_2d = 6; + gHUD.unk_2d = 6; if ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_8)) == 0) { return 0; } diff --git a/src/fileselect.c b/src/fileselect.c index 5324661c..bc54c39b 100644 --- a/src/fileselect.c +++ b/src/fileselect.c @@ -404,7 +404,7 @@ static void HandleFileScreenEnter(void) { ClearTilemaps(); ResetPalettes(); ResetPaletteTable(0); - MemClear(&gUnk_0200AF00, sizeof(gUnk_0200AF00)); + MemClear(&gHUD, sizeof(gHUD)); MemClear(&gMapDataBottomSpecial, sizeof(gMapDataBottomSpecial)); gMapDataBottomSpecial.unk3 = 7; gMapDataBottomSpecial.unk6 = gSaveHeader->language > LANGUAGE_EN ? 3 : 0; @@ -543,13 +543,13 @@ void sub_08050790(void) { } static void HideButtonR(void) { - gUnk_0200AF00.buttonX[2] = 0x140; - gUnk_0200AF00.buttonY[2] = 0x24; + gHUD.buttonX[2] = 0x140; + gHUD.buttonY[2] = 0x24; } static void ShowButtonR(void) { - gUnk_0200AF00.buttonX[2] = 0xD0; - gUnk_0200AF00.buttonY[2] = 0x24; + gHUD.buttonX[2] = 0xD0; + gHUD.buttonY[2] = 0x24; } static void HandleFileSelect(void) { diff --git a/src/gameUtils.c b/src/gameUtils.c index d9a9319b..75ec1ca5 100644 --- a/src/gameUtils.c +++ b/src/gameUtils.c @@ -432,7 +432,7 @@ bool32 CanDispEzloMessage(void) { s32 tmp = PL_STATE_WALK; if (!(gInput.heldKeys & SELECT_BUTTON) || gPlayerState.controlMode != CONTROL_ENABLED || - gPauseMenuOptions.disabled || gUnk_0200AF00.unk_1) + gPauseMenuOptions.disabled || gHUD.hideFlags != HUD_HIDE_NONE) return FALSE; if ((gPlayerState.flags & (PL_NO_CAP | PL_CAPTURED | PL_DISABLE_ITEMS)) || (gPlayerState.framestate_last > tmp) || diff --git a/src/interrupts.c b/src/interrupts.c index 33a7d5e7..db6cb6c2 100644 --- a/src/interrupts.c +++ b/src/interrupts.c @@ -225,9 +225,9 @@ void PlayerUpdate(Entity* this) { static void HandlePlayerLife(Entity* this) { u32 temp; - gUnk_0200AF00.unk_2f = 0; - gUnk_0200AF00.unk_2d = 0; - gUnk_0200AF00.unk_2e = 0; + gHUD.unk_2f = 0; + gHUD.unk_2d = 0; + gHUD.unk_2e = 0; if ((gPlayerEntity.contactFlags & 0x80) && (gPlayerEntity.iframes > 0)) SoundReq(SFX_86); @@ -255,7 +255,7 @@ static void HandlePlayerLife(Entity* this) { return; #ifdef EU - if ((gUnk_0200AF00.unk_1 == 0) && gRoomTransition.frameCount % 90 == 0) { + if ((gHUD.hideFlags == HUD_HIDE_NONE) && gRoomTransition.frameCount % 90 == 0) { temp = gSave.stats.maxHealth / 4; if (temp > 24) temp = 24; @@ -276,7 +276,7 @@ static void HandlePlayerLife(Entity* this) { if (gSave.stats.health <= temp) { gRoomVars.unk2 = 1; - if ((gUnk_0200AF00.unk_1 == 0) && gRoomTransition.frameCount % 90 == 0) { + if ((gHUD.hideFlags == HUD_HIDE_NONE) && gRoomTransition.frameCount % 90 == 0) { EnqueueSFX(SFX_LOW_HEALTH); } } @@ -323,7 +323,7 @@ static void sub_080171F0(void) { sub_080028E0(&gPlayerEntity); if (gPlayerState.flags & PL_CLONING) - gUnk_0200AF00.unk_2f = 1; + gHUD.unk_2f = 1; sub_08078180(); gPlayerState.field_0x7 &= ~0x80; diff --git a/src/item/itemTryPickupObject.c b/src/item/itemTryPickupObject.c index 8a7b40dc..ace68c5d 100644 --- a/src/item/itemTryPickupObject.c +++ b/src/item/itemTryPickupObject.c @@ -95,7 +95,7 @@ void ItemPickupCheck(ItemBehavior* this, u32 index) { carried->subAction = 5; gPlayerState.framestate = PL_STATE_THROW; sub_080762C4(this, carried, 2, index); - gUnk_0200AF00.unk_2e = 8; + gHUD.unk_2e = 8; SoundReq(SFX_102); break; case 1: diff --git a/src/itemUtils.c b/src/itemUtils.c index 36ed6bbf..c77bfa84 100644 --- a/src/itemUtils.c +++ b/src/itemUtils.c @@ -304,8 +304,8 @@ void ForceEquipItem(u32 itemId, u32 equipSlot) { } gSave.stats.itemButtons[equipSlot] = itemId; gSave.stats.itemButtons[otherItemSlot] = otherItem; - gUnk_0200AF00.unk_13 = 0x7f; - gUnk_0200AF00.unk_14 = 0x7f; + gHUD.unk_13 = 0x7f; + gHUD.unk_14 = 0x7f; } } diff --git a/src/menu/figurineMenu.c b/src/menu/figurineMenu.c index 2a19f06d..5e0c7563 100644 --- a/src/menu/figurineMenu.c +++ b/src/menu/figurineMenu.c @@ -592,7 +592,7 @@ void sub_080A4DB8(u32 param_1) { MemClear(&gBG0Buffer, sizeof(gBG0Buffer)); MemClear(&gBG1Buffer, sizeof(gBG1Buffer)); MemClear(&gBG2Buffer, sizeof(gBG2Buffer)); - MemClear(gUnk_0200AF00.elements, sizeof(gUnk_0200AF00.elements)); + MemClear(gHUD.elements, sizeof(gHUD.elements)); MemClear(&gFigurineMenu, sizeof(gFigurineMenu)); gFigurineMenu.unk2e = -1; gMenu.field_0x3 = gPauseMenuOptions.unk2[param_1]; diff --git a/src/menu/pauseMenu.c b/src/menu/pauseMenu.c index 39573fe5..652522fd 100644 --- a/src/menu/pauseMenu.c +++ b/src/menu/pauseMenu.c @@ -763,13 +763,13 @@ void sub_080A56A0(void) { case 0: case 2: if (gGenericMenu.unk10.a[gMenu.field_0x3] != 0) { - gUnk_0200AF00.buttonY[0] = 0x10; + gHUD.buttonY[0] = 0x10; } else { - gUnk_0200AF00.buttonY[0] = 0xfff0; + gHUD.buttonY[0] = 0xfff0; } break; default: - gUnk_0200AF00.buttonY[0] = 0xfff0; + gHUD.buttonY[0] = 0xfff0; break; } diff --git a/src/object/crenelBeanSprout.c b/src/object/crenelBeanSprout.c index a0fb206d..70279d9a 100644 --- a/src/object/crenelBeanSprout.c +++ b/src/object/crenelBeanSprout.c @@ -172,9 +172,9 @@ void CrenelBeanSprout_Action1(CrenelBeanSproutEntity* this) { this->unk_70 = ((super->x.HALF.HI + (s8)gUnk_08123184[tmp]) & -0x10) | 8; this->unk_72 = ((super->y.HALF.HI + (s8)gUnk_08123184[(tmp) + 1]) & -0x10) | 8; if (sub_080B1AB4(this->unk_70, this->unk_72, super->collisionLayer) == 0x19) { - gUnk_0200AF00.unk_2f = 3; + gHUD.unk_2f = 3; } else { - gUnk_0200AF00.unk_2f = 0; + gHUD.unk_2f = 0; } PositionRelative(&gPlayerEntity, super, 0, 0x10000); if (GetTileUnderEntity(super) == 0x19) { @@ -184,7 +184,7 @@ void CrenelBeanSprout_Action1(CrenelBeanSproutEntity* this) { if ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_40)) == 0) { return; } - if (gUnk_0200AF00.unk_2f != 3) { + if (gHUD.unk_2f != 3) { return; } gPlayerState.heldObject = 0; diff --git a/src/object/itemForSale.c b/src/object/itemForSale.c index e4629fa1..dfef44de 100644 --- a/src/object/itemForSale.c +++ b/src/object/itemForSale.c @@ -85,7 +85,7 @@ void ItemForSale_Init(ItemForSaleEntity* this) { void ItemForSale_Action1(ItemForSaleEntity* this) { if (super->subAction != 0) { super->action = 2; - gUnk_0200AF00.unk_2f = 2; + gHUD.unk_2f = 2; } else { if (super->type == 0x36) { if (super->interactType != 0) { @@ -102,7 +102,7 @@ void ItemForSale_Action1(ItemForSaleEntity* this) { ResetActiveItems(); gPlayerState.heldObject = 4; gNewPlayerEntity.unk_74 = super; - gUnk_0200AF00.unk_2f = 2; + gHUD.unk_2f = 2; MessageClose(); } } @@ -112,14 +112,14 @@ void ItemForSale_Action1(ItemForSaleEntity* this) { void ItemForSale_Action2(ItemForSaleEntity* this) { void* ptr; - gUnk_0200AF00.unk_2f = 2; + gHUD.unk_2f = 2; super->spriteSettings.draw = gPlayerEntity.spriteSettings.draw; if ((gPlayerState.heldObject == 0) || (super != gNewPlayerEntity.unk_74)) { sub_080819B4(this); } else { ptr = sub_080784E4(); if (((*(int*)(ptr + 8) == 0) || - ((*(u8*)(ptr + 1) != 1 || (gUnk_0200AF00.unk_2f = 7, (gPlayerState.playerInput.newInput & + ((*(u8*)(ptr + 1) != 1 || (gHUD.unk_2f = 7, (gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_8)) == 0)))) && ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_10 | PLAYER_INPUT_8)) != 0)) { sub_080819B4(this); @@ -130,7 +130,7 @@ void ItemForSale_Action2(ItemForSaleEntity* this) { void sub_080819B4(ItemForSaleEntity* this) { Entity* parent; u8* puVar2; - struct_0200AF00* ptr; + HUD* ptr; if (gRoomVars.shopItemType == 0) { if (super->parent != NULL) { @@ -140,7 +140,7 @@ void sub_080819B4(ItemForSaleEntity* this) { } gPlayerState.heldObject = 0; gNewPlayerEntity.unk_74 = 0; - ptr = &gUnk_0200AF00; + ptr = &gHUD; gRoomVars.shopItemType = 0; ptr->unk_2c = 0; ptr->unk_2f = 0; diff --git a/src/player.c b/src/player.c index d5f7a4e7..cd32e8c9 100644 --- a/src/player.c +++ b/src/player.c @@ -1830,7 +1830,7 @@ static void PlayerPull(Entity* this) { gPlayerState.framestate = PL_STATE_PULL; sPlayerPullStates[this->subAction](this); - gUnk_0200AF00.unk_2e = 8; + gHUD.unk_2e = 8; } static void sub_08072214(Entity* this) { @@ -2756,7 +2756,7 @@ static void sub_08073584(Entity* this) { return; } - gUnk_0200AF00.unk_2f = 1; + gHUD.unk_2f = 1; if (sub_0807A2F8(0)) { this->subAction++; this->direction = 4 * (this->animationState & 6); diff --git a/src/playerUtils.c b/src/playerUtils.c index e73e6dff..ffacff28 100644 --- a/src/playerUtils.c +++ b/src/playerUtils.c @@ -208,7 +208,7 @@ bool32 IsPreventedFromUsingItem(void) { } return FALSE; default: - if ((((gUnk_0200AF00.unk_2c == 0xc) && (gPlayerState.field_0x1c == 0)) && + if ((((gHUD.unk_2c == 0xc) && (gPlayerState.field_0x1c == 0)) && (gPlayerState.floor_type != SURFACE_SWAMP)) && ((((gPlayerState.playerInput.heldInput & PLAYER_INPUT_ANY_DIRECTION) != 0 && ((gPlayerState.flags & (PL_BURNING | PL_ROLLING)) == 0)) && @@ -970,21 +970,21 @@ void sub_08078180(void) { u8 uVar3; struct_03003DF8* ptr; - if (gUnk_0200AF00.unk_2f != 0) + if (gHUD.unk_2f != 0) return; uVar1 = 0; if ((gPlayerState.jump_status == 0) && ((gPlayerState.flags & (PL_IN_HOLE | PL_FROZEN | PL_BURNING | PL_DISABLE_ITEMS | PL_DRUGGED)) == 0)) { if ((u8)(gPlayerState.heldObject - 1) < 4) { - if (gUnk_0200AF00.unk_2e != 0) { - uVar1 = gUnk_0200AF00.unk_2e; + if (gHUD.unk_2e != 0) { + uVar1 = gHUD.unk_2e; } else { uVar1 = 3; } } else { - if (gUnk_0200AF00.unk_2d != 0) { - uVar1 = gUnk_0200AF00.unk_2d; + if (gHUD.unk_2d != 0) { + uVar1 = gHUD.unk_2d; } else { ptr = sub_080784E4(); if (ptr->entity->interactType == 0) { @@ -1034,7 +1034,7 @@ void sub_08078180(void) { } } } - gUnk_0200AF00.unk_2c = uVar1; + gHUD.unk_2c = uVar1; } bool32 sub_080782C0(void) { diff --git a/src/script.c b/src/script.c index 78e355b1..29cee3df 100644 --- a/src/script.c +++ b/src/script.c @@ -446,13 +446,13 @@ void DisablePauseMenuAndPutAwayItems(void) { } void DisablePauseMenu(void) { - gUnk_0200AF00.unk_1 = 0xff; + gHUD.hideFlags = HUD_HIDE_ALL; gPauseMenuOptions.disabled = 0xff; } void EnablePauseMenu(void) { gPauseMenuOptions.disabled = 0; - gUnk_0200AF00.unk_1 = 0; + gHUD.hideFlags = HUD_HIDE_NONE; RecoverUI(0, 0); ResetPlayerAnimationAndAction(); PlayerDropHeldObject(); diff --git a/src/subtask.c b/src/subtask.c index 864d3550..3cae246b 100644 --- a/src/subtask.c +++ b/src/subtask.c @@ -117,18 +117,18 @@ void sub_080A7040(u32 param_1) { } void sub_080A70AC(const KeyButtonLayout* layout) { - MemClear(&gUnk_0200AF00.elements, 0x300); - gUnk_0200AF00.unk_13 = 0x7f; - gUnk_0200AF00.unk_14 = 0x7f; - gUnk_0200AF00.buttonX[0] = layout->aButtonX; - gUnk_0200AF00.buttonY[0] = (s8)layout->aButtonY; - gUnk_0200AF00.unk_30[0] = layout->aButtonText; - gUnk_0200AF00.buttonX[1] = layout->bButtonX; - gUnk_0200AF00.buttonY[1] = (s8)layout->bButtonY; - gUnk_0200AF00.unk_30[1] = layout->bButtonText; - gUnk_0200AF00.buttonX[2] = layout->rButtonX; - gUnk_0200AF00.buttonY[2] = (s8)layout->rButtonY; - gUnk_0200AF00.unk_32 = layout->rButtonText; + MemClear(&gHUD.elements, 0x300); + gHUD.unk_13 = 0x7f; + gHUD.unk_14 = 0x7f; + gHUD.buttonX[0] = layout->aButtonX; + gHUD.buttonY[0] = (s8)layout->aButtonY; + gHUD.unk_30[0] = layout->aButtonText; + gHUD.buttonX[1] = layout->bButtonX; + gHUD.buttonY[1] = (s8)layout->bButtonY; + gHUD.unk_30[1] = layout->bButtonText; + gHUD.buttonX[2] = layout->rButtonX; + gHUD.buttonY[2] = (s8)layout->rButtonY; + gHUD.unk_32 = layout->rButtonText; layout++; do { CreateUIElement(layout->aButtonX, layout->aButtonY); @@ -1,13 +1,14 @@ +#include "area.h" +#include "common.h" +#include "functions.h" +#include "game.h" #include "global.h" -#include "sound.h" #include "message.h" -#include "functions.h" -#include "screen.h" -#include "common.h" -#include "save.h" #include "player.h" -#include "area.h" -#include "game.h" +#include "save.h" +#include "screen.h" +#include "sound.h" +#include "structures.h" extern void sub_0805ECEC(u32, u32, u32, u32); extern bool32 ItemIsBottle(u32); @@ -106,7 +107,7 @@ void UpdateUIElements(void) { UIElement* element; const UIElementDefinition* definition; for (index = 0; index < MAX_UI_ELEMENTS; index++) { - element = &gUnk_0200AF00.elements[index]; + element = &gHUD.elements[index]; if (element->used != 0) { definition = &gUIElementDefinitions[element->type]; definition->updateFunction(element); @@ -120,7 +121,7 @@ void DrawUIElements(void) { UIElementDefinition* definition; index = 0; for (index = 0; index < MAX_UI_ELEMENTS; index++) { - element = &gUnk_0200AF00.elements[index]; + element = &gHUD.elements[index]; if (element->used == 1 && element->unk_0_1 == 1) { gOamCmd.x = element->x; gOamCmd.y = element->y; @@ -140,7 +141,7 @@ void sub_0801C25C(void) { UIElement* element; for (index = 0; index < MAX_UI_ELEMENTS; index++) { - element = &gUnk_0200AF00.elements[index]; + element = &gHUD.elements[index]; if (((element->used) == 1) && ((element->unk_0_1) == 1)) { u8 temp = element->unk_0_2; if (temp == 1) { @@ -149,14 +150,14 @@ void sub_0801C25C(void) { } } } - if (gUnk_0200AF00.unk_13 < 0) { - tmp = gUnk_0200AF00.unk_13 & 0x7f; - gUnk_0200AF00.unk_13 = tmp; + if (gHUD.unk_13 < 0) { + tmp = gHUD.unk_13 & 0x7f; + gHUD.unk_13 = tmp; sub_0801C2F0(0x11a, tmp); } - if (gUnk_0200AF00.unk_14 < 0) { - tmp = gUnk_0200AF00.unk_14 & 0x7f; - gUnk_0200AF00.unk_14 = tmp; + if (gHUD.unk_14 < 0) { + tmp = gHUD.unk_14 & 0x7f; + gHUD.unk_14 = tmp; sub_0801C2F0(0x126, tmp); } } @@ -177,12 +178,12 @@ void sub_0801C2F0(u32 param_1, u32 param_2) { } void DrawUI(void) { - gUnk_0200AF00.unk_0 &= ~gUnk_0200AF00.unk_1; + gHUD.unk_0 &= ~gHUD.hideFlags; DrawHearts(); DrawChargeBar(); DrawRupees(); DrawKeys(); - gUnk_0200AF00.unk_0 = 0; + gHUD.unk_0 = 0; UpdateUIElements(); } @@ -194,13 +195,13 @@ void InitUI(bool32 keepHealthAndRupees) { health = gSave.stats.health >> 1; rupees = gSave.stats.rupees; } else { - health = gUnk_0200AF00.health; - rupees = gUnk_0200AF00.rupees; + health = gHUD.health; + rupees = gHUD.rupees; } - MemClear(&gUnk_0200AF00, sizeof(struct_0200AF00)); - gUnk_0200AF00.health = health; - gUnk_0200AF00.rupees = rupees; - gUnk_0200AF00.maxHealth = gSave.stats.maxHealth >> 1; + MemClear(&gHUD, sizeof(HUD)); + gHUD.health = health; + gHUD.rupees = rupees; + gHUD.maxHealth = gSave.stats.maxHealth >> 1; LoadPaletteGroup(0xc); LoadGfxGroup(0x10); MemClear(&gBG0Buffer, sizeof(gBG0Buffer)); @@ -210,21 +211,21 @@ void InitUI(bool32 keepHealthAndRupees) { gOAMControls.unk[0].unk7 = 1; gOAMControls.unk[0].unk6 = 1; gOAMControls.unk[1].unk6 = 1; - gUnk_0200AF00.unk_13 = 0x7f; - gUnk_0200AF00.unk_14 = 0x7f; - gUnk_0200AF00.unk_8 = 0x7f; + gHUD.unk_13 = 0x7f; + gHUD.unk_14 = 0x7f; + gHUD.unk_8 = 0x7f; DrawHearts(); DrawRupees(); DrawChargeBar(); DrawKeys(); - gUnk_0200AF00.buttonX[0] = 0xd0; - gUnk_0200AF00.buttonX[1] = 0xb8; - gUnk_0200AF00.buttonX[2] = 0xd8; - gUnk_0200AF00.buttonY[0] = 0x1c; - gUnk_0200AF00.buttonY[1] = 0x1c; - gUnk_0200AF00.buttonY[2] = 0xe; + gHUD.buttonX[0] = 0xd0; + gHUD.buttonX[1] = 0xb8; + gHUD.buttonX[2] = 0xd8; + gHUD.buttonY[0] = 0x1c; + gHUD.buttonY[1] = 0x1c; + gHUD.buttonY[2] = 0xe; // TODO why is this array cleared again? Is it filled by the function calls in the mean time? - MemClear(gUnk_0200AF00.elements, sizeof(gUnk_0200AF00.elements)); + MemClear(gHUD.elements, sizeof(gHUD.elements)); CreateUIElement(UI_ELEMENT_TEXT_R, 9); CreateUIElement(UI_ELEMENT_ITEM_A, 0); CreateUIElement(UI_ELEMENT_ITEM_B, 0); @@ -240,9 +241,9 @@ void RefreshUI(void) { } void RecoverUI(u32 bottomPt, u32 topPt) { - gUnk_0200AF00.unk_2 = 0; - gUnk_0200AF00.unk_10 = 0; - gUnk_0200AF00.unk_a = 0; + gHUD.unk_2 = 0; + gHUD.unk_10 = 0; + gHUD.unk_a = 0; } void DrawRupees(void) { @@ -254,9 +255,9 @@ void DrawRupees(void) { const u16* ptr3; struct_02035160* ptr4; - if ((gUnk_0200AF00.unk_1 & 0x40) != 0) { - if (gUnk_0200AF00.unk_a != 0) { - gUnk_0200AF00.unk_a = 0; + if (gHUD.hideFlags & HUD_HIDE_RUPEES) { + if (gHUD.unk_a != 0) { + gHUD.unk_a = 0; ptr4 = &gUnk_02035160; ptr = &ptr4->unk_0; ptr->unk_0 = 0; @@ -273,8 +274,8 @@ void DrawRupees(void) { gScreen.bg0.updated = 1; } } else { - if (gUnk_0200AF00.unk_a == 0) { - gUnk_0200AF00.unk_a = 2; + if (gHUD.unk_a == 0) { + gHUD.unk_a = 2; ptr4 = &gUnk_02035160; ptr2 = &ptr4->unk_40; ptr3 = gWalletSizes; @@ -295,33 +296,35 @@ void DrawRupees(void) { cVar1 = 0; } - if (gUnk_0200AF00.rupees != gSave.stats.rupees) { - if (gUnk_0200AF00.rupees < gSave.stats.rupees) { - gUnk_0200AF00.rupees++; + if (gHUD.rupees != gSave.stats.rupees) { + if (gHUD.rupees < gSave.stats.rupees) { + gHUD.rupees++; } else { - gUnk_0200AF00.rupees--; + gHUD.rupees--; } cVar1 = 2; } switch (cVar1) { case 2: - temp = gUnk_0200AF00.unk_c; + temp = gHUD.unk_c; temp &= 3; if ((temp) == 0) { SoundReq(SFX_RUPEE_GET); } case 1: - DrawDigits(0x70, gUnk_0200AF00.rupees, - (u16)gWalletSizes[(u32)gSave.stats.walletType * 2] <= gUnk_0200AF00.rupees, 3); - cVar1 = gUnk_0200AF00.unk_c + 1; + DrawDigits(0x70, gHUD.rupees, + (u16)gWalletSizes[(u32)gSave.stats.walletType * 2] <= gHUD.rupees, 3); + cVar1 = gHUD.unk_c + 1; default: - gUnk_0200AF00.unk_c = cVar1; + gHUD.unk_c = cVar1; break; } } } -// Draw icon with text for rupees or keys +/** + * Draw icon with text for rupees or keys +*/ void DrawDigits(u32 iconVramIndex, u32 count, u32 isTextYellow, u32 digits) { int iVar2; int iVar3; @@ -357,9 +360,9 @@ void sub_0801C66C(void) { struct_02034CF0* ptr; s32 index; - if (gUnk_0200AF00.unk_2 != 0) { - gUnk_0200AF00.unk_2 = 0; - if (gUnk_0200AF00.maxHealth > 0x28) { + if (gHUD.unk_2 != 0) { + gHUD.unk_2 = 0; + if (gHUD.maxHealth > 0x28) { index = 2; } else { index = 1; @@ -390,14 +393,14 @@ void DrawHearts(void) { s32 tmp1; u16* ptr2; - if ((gUnk_0200AF00.unk_1 & 0x10) != 0) { + if (gHUD.hideFlags & HUD_HIDE_HEARTS) { sub_0801C824(); sub_0801C66C(); return; } maxHealth = gSave.stats.maxHealth / 2; - if (maxHealth != gUnk_0200AF00.maxHealth) { - gUnk_0200AF00.maxHealth = maxHealth; + if (maxHealth != gHUD.maxHealth) { + gHUD.maxHealth = maxHealth; sub_0801C824(); sub_0801C66C(); } @@ -410,35 +413,35 @@ void DrawHearts(void) { health = maxHealth; } maxHealth = 0; - if (health != gUnk_0200AF00.health) { + if (health != gHUD.health) { maxHealth = 1; - if (health > gUnk_0200AF00.health) { + if (health > gHUD.health) { maxHealth = 2; } } switch (maxHealth) { case 2: - uVar1 = gUnk_0200AF00.unk_5++; + uVar1 = gHUD.unk_5++; if ((uVar1 & 1) == 0) { if ((uVar1 & 7) == 0) { SoundReq(SFX_HEART_GET); } - gUnk_0200AF00.health++; + gHUD.health++; } else { maxHealth = 0; } break; case 1: - gUnk_0200AF00.health--; + gHUD.health--; // fallthough default: - gUnk_0200AF00.unk_5 = 0; + gHUD.unk_5 = 0; break; } - if ((gUnk_0200AF00.unk_2 == 0) || (maxHealth != 0)) { - gUnk_0200AF00.unk_2 = 2; - uVar2 = gUnk_0200AF00.health >> 2; + if ((gHUD.unk_2 == 0) || (maxHealth != 0)) { + gHUD.unk_2 = 2; + uVar2 = gHUD.health >> 2; if (uVar2 > 10) { tmp1 = 10; uVar6 = uVar2 - 10; @@ -447,7 +450,7 @@ void DrawHearts(void) { uVar6 = 0; } - maxHealth = gUnk_0200AF00.maxHealth >> 2; + maxHealth = gHUD.maxHealth >> 2; uVar1 = maxHealth; if (maxHealth > 10) { maxHealth = 10; @@ -463,12 +466,12 @@ void DrawHearts(void) { DmaSet(3, gUnk_080C8F2C + (10 - tmp1), ptr2 + 1, maxHealth | 0x80000000); - if ((gUnk_0200AF00.health & 3) != 0) { + if ((gHUD.health & 3) != 0) { if (9 < uVar2) { uVar2 -= 10; ptr2 += 0x20; } - ptr2[uVar2 + 1] = ((gUnk_0200AF00.health & 3) + 0x11) | 0xf000; + ptr2[uVar2 + 1] = ((gHUD.health & 3) + 0x11) | 0xf000; } gScreen.bg0.updated = 1; } @@ -477,9 +480,9 @@ void DrawHearts(void) { void sub_0801C824(void) { struct_02034CF0* ptr; - if (gUnk_0200AF00.unk_6 != 0) { - gUnk_0200AF00.unk_6 = 0; - if (gUnk_0200AF00.maxHealth > 4 * 10) { + if (gHUD.unk_6 != 0) { + gHUD.unk_6 = 0; + if (gHUD.maxHealth > 4 * 10) { ptr = &gUnk_02034D30.unk_40; // Show second row of hearts } else { ptr = &gUnk_02034D30.unk_0; @@ -503,22 +506,22 @@ void DrawChargeBar(void) { u32 tmp5; tmp1 = FALSE; - if ((gUnk_0200AF00.unk_1 & 0x20) == 0) { + if ((gHUD.hideFlags & HUD_HIDE_CHARGE_BAR) == 0) { tmp1 = gPlayerState.chargeState.action != 0; } if (!tmp1) return sub_0801C824(); - ptr1 = (gUnk_0200AF00.maxHealth > 0x28) ? (u16*)((u8*)(&gUnk_02034D30) + 0x40) : (u16*)&gUnk_02034D30.unk_0; + ptr1 = (gHUD.maxHealth > 0x28) ? (u16*)((u8*)(&gUnk_02034D30) + 0x40) : (u16*)&gUnk_02034D30.unk_0; tmp2 = Div(gPlayerState.chargeState.chargeTimer + 19, 20); if (tmp2 > 40) { tmp2 = 40; } - if (gUnk_0200AF00.unk_6 == 0 || gUnk_0200AF00.unk_7 != tmp2) { - gUnk_0200AF00.unk_6 = 1; - gUnk_0200AF00.unk_7 = tmp2; + if (gHUD.unk_6 == 0 || gHUD.unk_7 != tmp2) { + gHUD.unk_6 = 1; + gHUD.unk_7 = tmp2; tmp3 = Div(tmp2, 4); tmp5 = rem; ptr1[0] = 0xf016; @@ -533,16 +536,16 @@ void DrawChargeBar(void) { switch (gPlayerState.chargeState.action) { case 4: case 5: - gUnk_0200AF00.unk_9 += (gPlayerState.chargeState.action == 4) ? 2 : 1; - tmp3 = gUnk_0200AF00.unk_9 >> 4 & 3; + gHUD.unk_9 += (gPlayerState.chargeState.action == 4) ? 2 : 1; + tmp3 = gHUD.unk_9 >> 4 & 3; break; default: tmp3 = 0; break; } - if (tmp3 != gUnk_0200AF00.unk_8) { - gUnk_0200AF00.unk_8 = tmp3; + if (tmp3 != gHUD.unk_8) { + gHUD.unk_8 = tmp3; ptr1 = (u16*)0x600c2c0; DmaSet(3, gUnk_080C8F7C[tmp3], ptr1, 0x84000030); } @@ -554,9 +557,9 @@ void DrawKeys(void) { substruct_0E2* ptr2; u32 temp; - if (!(((gUnk_0200AF00.unk_1 & 0x80) == 0) && (AreaHasKeys()))) { - if (gUnk_0200AF00.unk_10 != 0) { - gUnk_0200AF00.unk_10 = 0; + if (!(((gHUD.hideFlags & HUD_HIDE_KEYS) == 0) && (AreaHasKeys()))) { + if (gHUD.unk_10 != 0) { + gHUD.unk_10 = 0; ptr1 = &gUnk_020350E2.unk_0[0]; ptr1->unk_0 = 0; ptr1->unk_2 = 0; @@ -569,7 +572,7 @@ void DrawKeys(void) { gScreen.bg0.updated = 1; } } else { - if (gUnk_0200AF00.unk_10 == 0) { + if (gHUD.unk_10 == 0) { ptr1 = &gUnk_020350E2.unk_0[0]; ptr2 = &gUnk_020350E2.unk_0[1]; temp = 0xf01c; @@ -584,10 +587,10 @@ void DrawKeys(void) { ptr2->unk_6 = temp + 3; gScreen.bg0.updated = 1; } - if ((gUnk_0200AF00.dungeonKeys != gSave.dungeonKeys[gArea.dungeon_idx]) || (gUnk_0200AF00.unk_10 == 0)) { - gUnk_0200AF00.unk_10 = 2; - gUnk_0200AF00.dungeonKeys = gSave.dungeonKeys[gArea.dungeon_idx]; - DrawDigits(0x76, gUnk_0200AF00.dungeonKeys, 0, 2); + if ((gHUD.dungeonKeys != gSave.dungeonKeys[gArea.dungeon_idx]) || (gHUD.unk_10 == 0)) { + gHUD.unk_10 = 2; + gHUD.dungeonKeys = gSave.dungeonKeys[gArea.dungeon_idx]; + DrawDigits(0x76, gHUD.dungeonKeys, 0, 2); } } } @@ -599,7 +602,7 @@ void CreateUIElement(u32 type, u32 type2) { for (index = 0; index < MAX_UI_ELEMENTS; index++) { - element = gUnk_0200AF00.elements; + element = gHUD.elements; element += index; if (!element->used) { @@ -665,8 +668,8 @@ void ButtonUIElement(UIElement* element) { } void ButtonUIElement_Action0(UIElement* element) { - element->x = gUnk_0200AF00.buttonX[element->type]; - element->y = gUnk_0200AF00.buttonY[element->type] - 0x20; + element->x = gHUD.buttonX[element->type]; + element->y = gHUD.buttonY[element->type] - 0x20; element->action = 1; element->unk_0_1 = 1; sub_0801CAFC(element, element->type); @@ -681,10 +684,10 @@ 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)) { - y = (s16)gUnk_0200AF00.buttonY[element->type] - 0x28; + if (element->type2 == 0 && (((gHUD.hideFlags >> element->type) & 1) || (gMessage.doTextBox & 0x7f) != 0)) { + y = (s16)gHUD.buttonY[element->type] - 0x28; } else { - y = (s16)gUnk_0200AF00.buttonY[element->type]; + y = (s16)gHUD.buttonY[element->type]; } y -= (s16)element->y; @@ -700,7 +703,7 @@ void ButtonUIElement_Action1(UIElement* element) { element->y += y_diff; } - x = (short)gUnk_0200AF00.buttonX[element->type]; + x = (short)gHUD.buttonX[element->type]; x -= (short)element->x; x_diff = (x < 0) ? -x : x; @@ -752,9 +755,9 @@ void ItemUIElement(UIElement* element) { uiElementType = 0; } - psVar8 = &gUnk_0200AF00.unk_13; + psVar8 = &gHUD.unk_13; if (uiElementType != 0) { - psVar8 = &gUnk_0200AF00.unk_14; + psVar8 = &gHUD.unk_14; } switch ((s32)element->unk_8) { @@ -797,12 +800,12 @@ void ItemUIElement(UIElement* element) { void TextUIElement(UIElement* element) { UIElement* buttonUIElement; u32 tmp; - extern struct_0200AF00* ptr; + extern HUD* ptr; u32 tmp1; UIElement* ptr2; if (element->type2 == 9) { - tmp = gUnk_0200AF00.unk_2f; + tmp = gHUD.unk_2f; if (tmp == 0) { switch (gArea.portal_mode) { case 2: @@ -812,13 +815,13 @@ void TextUIElement(UIElement* element) { tmp = 0xa; break; default: - tmp = gUnk_0200AF00.unk_2c; + tmp = gHUD.unk_2c; break; } } - gUnk_0200AF00.unk_32 = tmp; + gHUD.unk_32 = tmp; } - tmp = gUnk_0200AF00.unk_30[element->buttonElementId]; + tmp = gHUD.unk_30[element->buttonElementId]; element->unk_0_1 = 0; if (tmp != 0) { tmp += gUnk_080C9044[((SaveHeader*)0x2000000)->language]; @@ -836,7 +839,7 @@ UIElement* FindUIElement(u32 type) { UIElement* element; u32 index; for (index = 0; index < MAX_UI_ELEMENTS; index++) { - element = &gUnk_0200AF00.elements[index]; + element = &gHUD.elements[index]; if (element->used != 0 && type == element->type) { return element; } @@ -851,8 +854,8 @@ void HeartUIElement(UIElement* element) { u32 health; u32 frameIndex; element->unk_0_1 = 0; - if (((gUnk_0200AF00.unk_1 & 0x10) == 0) && ((gMessage.doTextBox & 0x7f) == 0)) { - health = gUnk_0200AF00.health; + if (((gHUD.hideFlags & HUD_HIDE_HEARTS) == 0) && ((gMessage.doTextBox & 0x7f) == 0)) { + health = gHUD.health; if (health != 0) { element->unk_0_1 = 1; // Calculate the position for this heart. @@ -880,8 +883,8 @@ void EzloNagUIElement(UIElement* element) { } void EzloNagUIElement_Action0(UIElement* element) { - if (gUnk_0200AF00.ezloNagFuncIndex == 1) { - gUnk_0200AF00.ezloNagFuncIndex = 2; + if (gHUD.ezloNagFuncIndex == 1) { + gHUD.ezloNagFuncIndex = 2; element->x = 0x10; element->y = 0x90; element->unk_6 = 0; @@ -898,19 +901,19 @@ void EzloNagUIElement_Action1(UIElement* element) { if (tmp == 0) { element->action = 2; element->type = UI_ELEMENT_EZLONAGACTIVE; - gUnk_0200AF00.ezloNagFuncIndex = 3; + gHUD.ezloNagFuncIndex = 3; SoundReq(SFX_EZLO_UI); } } void EzloNagUIElement_Action2(UIElement* element) { - if (gUnk_0200AF00.ezloNagFuncIndex >= 5 || (gMessage.doTextBox & 0x7f)) { + if (gHUD.ezloNagFuncIndex >= 5 || (gMessage.doTextBox & 0x7f)) { element->action = 0; element->unk_0_1 = 0; return; } sub_0801CAD0(element); if (element->frameSettings == 1) { - gUnk_0200AF00.ezloNagFuncIndex = 4; + gHUD.ezloNagFuncIndex = 4; } } |
