diff --git a/asm/include/overlay_01_021E7FDC.inc b/asm/include/overlay_01_021E7FDC.inc index 4c666f412..8b9bba374 100644 --- a/asm/include/overlay_01_021E7FDC.inc +++ b/asm/include/overlay_01_021E7FDC.inc @@ -27,7 +27,7 @@ .public sub_0200B00C .public sub_0200B050 .public sub_0200B0CC -.public sub_0200B12C +.public GF_PlttResObj_GetVramSlotNum .public AllocFromHeap .public FreeToHeap .public SpriteList_Delete diff --git a/asm/include/overlay_02.inc b/asm/include/overlay_02.inc index 2a864d9ad..b5898722c 100644 --- a/asm/include/overlay_02.inc +++ b/asm/include/overlay_02.inc @@ -41,7 +41,7 @@ .public sub_0200AF00 .public sub_0200B00C .public sub_0200B0A8 -.public sub_0200B0F8 +.public GF_PlttResObj_GetPlttProxy .public NewMsgDataFromNarc .public DestroyMsgData .public NewString_ReadMsgData diff --git a/asm/include/overlay_05.inc b/asm/include/overlay_05.inc index 0611908d4..461002ca3 100644 --- a/asm/include/overlay_05.inc +++ b/asm/include/overlay_05.inc @@ -48,7 +48,7 @@ .public SpriteRenderer_LoadCellResObjFromOpenNarc .public SpriteRenderer_LoadAnimResObjFromOpenNarc .public SpriteRenderer_LoadResourcesAndCreateSprite -.public sub_0200D934 +.public GfGfxHandler_GetPlttProxy .public SpriteRenderer_UnloadResourcesAndRemoveGfxHandler .public UnkImageStruct_Delete .public UnkImageStruct_SetSpriteAnimSeqNo diff --git a/asm/include/overlay_100.inc b/asm/include/overlay_100.inc index 57c0c21f0..7c22628be 100644 --- a/asm/include/overlay_100.inc +++ b/asm/include/overlay_100.inc @@ -41,7 +41,7 @@ .public sub_0200B00C .public sub_0200B084 .public sub_0200B0CC -.public sub_0200B12C +.public GF_PlttResObj_GetVramSlotNum .public sub_0200B2E0 .public sub_0200B2E8 .public SpriteRenderer_Create diff --git a/asm/include/overlay_101.inc b/asm/include/overlay_101.inc index 4c81f6299..e234e4ddc 100644 --- a/asm/include/overlay_101.inc +++ b/asm/include/overlay_101.inc @@ -58,7 +58,7 @@ .public SpriteRenderer_GetG2dRendererPtr .public thunk_Sprite_Delete .public SpriteRenderer_CreateSprite -.public sub_0200D934 +.public GfGfxHandler_GetPlttProxy .public thunk_Sprite_SetPriority .public thunk_Sprite_SetDrawPriority .public Sprite_SetPositionXY diff --git a/asm/include/overlay_108.inc b/asm/include/overlay_108.inc index c1741c1d8..186d56b0e 100644 --- a/asm/include/overlay_108.inc +++ b/asm/include/overlay_108.inc @@ -58,7 +58,7 @@ .public SpriteRenderer_Delete .public sub_0200D2A4 .public SpriteRenderer_CreateSprite -.public sub_0200D934 +.public GfGfxHandler_GetPlttProxy .public UnkImageStruct_Delete .public thunk_Set2dSpriteVisibleFlag .public thunk_Sprite_SetPriority diff --git a/asm/include/overlay_112.inc b/asm/include/overlay_112.inc index fe8014391..4c48a8a72 100644 --- a/asm/include/overlay_112.inc +++ b/asm/include/overlay_112.inc @@ -51,7 +51,7 @@ .public sub_0200AF00 .public sub_0200AF94 .public sub_0200B0A8 -.public sub_0200B0F8 +.public GF_PlttResObj_GetPlttProxy .public OamManager_Create .public OamManager_Free .public NewMsgDataFromNarc diff --git a/asm/include/overlay_12_02264824.inc b/asm/include/overlay_12_02264824.inc index d34431c53..ed5e66655 100644 --- a/asm/include/overlay_12_02264824.inc +++ b/asm/include/overlay_12_02264824.inc @@ -13,7 +13,7 @@ .public SpriteRenderer_LoadCellResObjFromOpenNarc .public SpriteRenderer_LoadAnimResObjFromOpenNarc .public SpriteRenderer_LoadResourcesAndCreateSprite -.public sub_0200D944 +.public GfGfxHandler_GetPlttNumById .public SpriteGfxHandler_UnloadCharObjById .public SpriteGfxHandler_UnloadCellObjById .public SpriteGfxHandler_UnloadAnimObjById @@ -40,7 +40,7 @@ .public String_New .public String_Delete .public Mon_GetBoxMon -.public sub_02088080 +.public HpBar_GetColorIdx .public MIi_CpuCopy16 .public MI_CpuFill8 .public abs @@ -70,7 +70,7 @@ .public ov12_02264EE0 .public BattleHpBar_SetEnabled .public ov12_02264FB0 -.public ov12_02265B64 -.public ov12_02265C54 +.public BattleHpBar_Util_GetBarTypeFromBattlerSide +.public BattleHpBar_BeginExpBarFullFlashEffect .public ov12_02265D70 .public ov12_02265D74 diff --git a/asm/include/overlay_12_02266024.inc b/asm/include/overlay_12_02266024.inc index ee91c0766..d1213968b 100644 --- a/asm/include/overlay_12_02266024.inc +++ b/asm/include/overlay_12_02266024.inc @@ -34,7 +34,7 @@ .public SpriteRenderer_LoadAnimResObjFromNarcId .public SpriteRenderer_LoadAnimResObjFromOpenNarc .public SpriteRenderer_LoadResourcesAndCreateSprite -.public sub_0200D934 +.public GfGfxHandler_GetPlttProxy .public SpriteGfxHandler_UnloadCharObjById .public SpriteGfxHandler_UnloadPlttObjById .public SpriteGfxHandler_UnloadCellObjById diff --git a/asm/include/overlay_12_battle_command.inc b/asm/include/overlay_12_battle_command.inc index 8b482f9d0..0233c6baf 100644 --- a/asm/include/overlay_12_battle_command.inc +++ b/asm/include/overlay_12_battle_command.inc @@ -26,7 +26,7 @@ .public SpriteRenderer_LoadCellResObjFromNarcId .public SpriteRenderer_LoadAnimResObjFromNarcId .public SpriteRenderer_LoadResourcesAndCreateSprite -.public sub_0200D934 +.public GfGfxHandler_GetPlttProxy .public SpriteGfxHandler_UnloadCharObjById .public SpriteGfxHandler_UnloadPlttObjById .public SpriteGfxHandler_UnloadCellObjById diff --git a/asm/include/overlay_12_battle_controller_opponent.inc b/asm/include/overlay_12_battle_controller_opponent.inc index ccd6106d4..3346d7252 100644 --- a/asm/include/overlay_12_battle_controller_opponent.inc +++ b/asm/include/overlay_12_battle_controller_opponent.inc @@ -272,8 +272,8 @@ .public ov12_02264EB4 .public BattleHpBar_SetEnabled .public ov12_02264FB0 -.public ov12_02265B64 -.public ov12_02265C54 +.public BattleHpBar_Util_GetBarTypeFromBattlerSide +.public BattleHpBar_BeginExpBarFullFlashEffect .public ov12_02265D70 .public ov12_02265D74 .public ov12_02266508 diff --git a/asm/include/overlay_14.inc b/asm/include/overlay_14.inc index 05a09aa8d..9680178eb 100644 --- a/asm/include/overlay_14.inc +++ b/asm/include/overlay_14.inc @@ -65,7 +65,7 @@ .public SpriteRenderer_LoadAnimResObjFromNarcId .public SpriteRenderer_LoadResourcesAndCreateSprite .public SpriteRenderer_LoadResourcesAndCreateSprite_CustomBottomScreenOffset -.public sub_0200D934 +.public GfGfxHandler_GetPlttProxy .public SpriteRenderer_UnloadResourcesAndRemoveGfxHandler .public UnkImageStruct_Delete .public UnkImageStruct_TickSpriteAnimation1Frame diff --git a/asm/include/overlay_18.inc b/asm/include/overlay_18.inc index e0434cbf7..c683960e2 100644 --- a/asm/include/overlay_18.inc +++ b/asm/include/overlay_18.inc @@ -57,7 +57,7 @@ .public sub_0200AEB0 .public sub_0200B00C .public sub_0200B0A8 -.public sub_0200B12C +.public GF_PlttResObj_GetVramSlotNum .public NewMsgDataFromNarc .public DestroyMsgData .public ReadMsgDataIntoString @@ -91,7 +91,7 @@ .public SpriteRenderer_LoadAnimResObjFromOpenNarc .public SpriteRenderer_LoadResourcesAndCreateSprite .public SpriteRenderer_LoadResourcesAndCreateSprite_CustomBottomScreenOffset -.public sub_0200D944 +.public GfGfxHandler_GetPlttNumById .public SpriteGfxHandler_UnloadCharObjById .public SpriteGfxHandler_UnloadPlttObjById .public SpriteGfxHandler_UnloadCellObjById diff --git a/asm/include/overlay_40.inc b/asm/include/overlay_40.inc index d0a29c50e..4f06028dd 100644 --- a/asm/include/overlay_40.inc +++ b/asm/include/overlay_40.inc @@ -67,7 +67,7 @@ .public SpriteRenderer_LoadAnimResObjFromNarcId .public SpriteRenderer_LoadAnimResObjFromOpenNarc .public SpriteRenderer_LoadResourcesAndCreateSprite -.public sub_0200D934 +.public GfGfxHandler_GetPlttProxy .public SpriteGfxHandler_UnloadCharObjById .public SpriteGfxHandler_UnloadPlttObjById .public SpriteGfxHandler_UnloadCellObjById diff --git a/asm/include/overlay_41.inc b/asm/include/overlay_41.inc index 46a42e84b..c283dde16 100644 --- a/asm/include/overlay_41.inc +++ b/asm/include/overlay_41.inc @@ -55,7 +55,7 @@ .public sub_0200AEB0 .public sub_0200B00C .public sub_0200B0A8 -.public sub_0200B0F8 +.public GF_PlttResObj_GetPlttProxy .public OamManager_Create .public OamManager_ApplyAndResetBuffers .public OamManager_Free diff --git a/asm/include/overlay_42.inc b/asm/include/overlay_42.inc index b35793663..ad61f7311 100644 --- a/asm/include/overlay_42.inc +++ b/asm/include/overlay_42.inc @@ -20,7 +20,7 @@ .public sub_0200AEB0 .public sub_0200B00C .public sub_0200B0A8 -.public sub_0200B12C +.public GF_PlttResObj_GetVramSlotNum .public AllocFromHeap .public FreeToHeap .public InitBgFromTemplate diff --git a/asm/include/overlay_44.inc b/asm/include/overlay_44.inc index 802999e01..81709f103 100644 --- a/asm/include/overlay_44.inc +++ b/asm/include/overlay_44.inc @@ -57,7 +57,7 @@ .public sub_0200AEB0 .public sub_0200B00C .public sub_0200B0A8 -.public sub_0200B0F8 +.public GF_PlttResObj_GetPlttProxy .public OamManager_Create .public OamManager_ApplyAndResetBuffers .public OamManager_Free diff --git a/asm/include/overlay_57.inc b/asm/include/overlay_57.inc index 578842336..e8d03d0d1 100644 --- a/asm/include/overlay_57.inc +++ b/asm/include/overlay_57.inc @@ -57,7 +57,7 @@ .public SpriteRenderer_LoadAnimResObjFromNarcId .public SpriteRenderer_LoadAnimResObjFromOpenNarc .public SpriteRenderer_LoadResourcesAndCreateSprite -.public sub_0200D934 +.public GfGfxHandler_GetPlttProxy .public SpriteGfxHandler_UnloadCharObjById .public SpriteRenderer_UnloadResourcesAndRemoveGfxHandler .public UnkImageStruct_Delete diff --git a/asm/include/overlay_80_0223A00C.inc b/asm/include/overlay_80_0223A00C.inc index 4862ec076..8ad6b3c33 100644 --- a/asm/include/overlay_80_0223A00C.inc +++ b/asm/include/overlay_80_0223A00C.inc @@ -21,7 +21,7 @@ .public SpriteRenderer_LoadCellResObjFromOpenNarc .public SpriteRenderer_LoadAnimResObjFromOpenNarc .public SpriteRenderer_LoadResourcesAndCreateSprite -.public sub_0200D934 +.public GfGfxHandler_GetPlttProxy .public UnkImageStruct_Delete .public TickSpriteAnimation1Frame .public UnkImageStruct_SetSpriteVisibleFlag diff --git a/asm/include/overlay_89.inc b/asm/include/overlay_89.inc index b11c614bb..60581763a 100644 --- a/asm/include/overlay_89.inc +++ b/asm/include/overlay_89.inc @@ -57,7 +57,7 @@ .public SpriteRenderer_LoadCellResObjFromOpenNarc .public SpriteRenderer_LoadAnimResObjFromOpenNarc .public SpriteRenderer_LoadResourcesAndCreateSprite -.public sub_0200D934 +.public GfGfxHandler_GetPlttProxy .public SpriteRenderer_UnloadResourcesAndRemoveGfxHandler .public UnkImageStruct_Delete .public TickSpriteAnimation1Frame diff --git a/asm/include/overlay_90.inc b/asm/include/overlay_90.inc index 6772801ef..3df6b02c8 100644 --- a/asm/include/overlay_90.inc +++ b/asm/include/overlay_90.inc @@ -34,7 +34,7 @@ .public sub_0200AEB0 .public sub_0200B00C .public sub_0200B0A8 -.public sub_0200B12C +.public GF_PlttResObj_GetVramSlotNum .public OamManager_Create .public OamManager_ApplyAndResetBuffers .public OamManager_Free diff --git a/asm/include/overlay_91.inc b/asm/include/overlay_91.inc index 30abdf82a..ed2b7bbe5 100644 --- a/asm/include/overlay_91.inc +++ b/asm/include/overlay_91.inc @@ -31,7 +31,7 @@ .public sub_0200AEB0 .public sub_0200B00C .public sub_0200B0A8 -.public sub_0200B0F8 +.public GF_PlttResObj_GetPlttProxy .public OamManager_Create .public OamManager_ApplyAndResetBuffers .public OamManager_Free diff --git a/asm/include/overlay_93_thumb_2.inc b/asm/include/overlay_93_thumb_2.inc index afa220f53..c13f53009 100644 --- a/asm/include/overlay_93_thumb_2.inc +++ b/asm/include/overlay_93_thumb_2.inc @@ -15,8 +15,8 @@ .public GfGfxLoader_LoadScrnDataFromOpenNarc .public NewString_ReadMsgData .public SpriteRenderer_LoadResourcesAndCreateSprite -.public sub_0200D934 -.public sub_0200D944 +.public GfGfxHandler_GetPlttProxy +.public GfGfxHandler_GetPlttNumById .public UnkImageStruct_Delete .public TickSpriteAnimation1Frame .public UnkImageStruct_TickSpriteAnimationNFrames diff --git a/asm/include/overlay_96.inc b/asm/include/overlay_96.inc index 14f1b1bac..f7c04e4da 100644 --- a/asm/include/overlay_96.inc +++ b/asm/include/overlay_96.inc @@ -72,7 +72,7 @@ .public sub_0200AF00 .public sub_0200AF94 .public sub_0200B0A8 -.public sub_0200B0F8 +.public GF_PlttResObj_GetPlttProxy .public OamManager_Create .public OamManager_ApplyAndResetBuffers .public OamManager_Free diff --git a/asm/include/overlay_97.inc b/asm/include/overlay_97.inc index 8a8a7e460..905348d4c 100644 --- a/asm/include/overlay_97.inc +++ b/asm/include/overlay_97.inc @@ -24,7 +24,7 @@ .public sub_0200AF00 .public sub_0200AF94 .public sub_0200B0A8 -.public sub_0200B0F8 +.public GF_PlttResObj_GetPlttProxy .public OamManager_Create .public OamManager_Free .public NewMsgDataFromNarc diff --git a/asm/include/render_window.inc b/asm/include/render_window.inc index 8b7511a0f..8af19708a 100644 --- a/asm/include/render_window.inc +++ b/asm/include/render_window.inc @@ -11,7 +11,7 @@ .public PokepicManager_Delete .public Get2DGfxResObjById .public sub_0200AF00 -.public sub_0200B0F8 +.public GF_PlttResObj_GetPlttProxy .public UnkImageStruct_Delete .public SysTask_CreateOnVBlankQueue .public SysTask_CreateOnVWaitQueue diff --git a/asm/include/unk_020863F4.inc b/asm/include/unk_020863F4.inc index 978979e8d..44937cd68 100644 --- a/asm/include/unk_020863F4.inc +++ b/asm/include/unk_020863F4.inc @@ -20,7 +20,7 @@ .public SpriteRenderer_LoadCellResObjFromOpenNarc .public SpriteRenderer_LoadAnimResObjFromOpenNarc .public SpriteRenderer_LoadResourcesAndCreateSprite -.public sub_0200D934 +.public GfGfxHandler_GetPlttProxy .public UnkImageStruct_Delete .public UnkImageStruct_TickSpriteAnimation1Frame .public UnkImageStruct_SetSpriteAnimSeqNo diff --git a/asm/overlay_01_021E7FDC.s b/asm/overlay_01_021E7FDC.s index 40582fa0c..51b959e89 100644 --- a/asm/overlay_01_021E7FDC.s +++ b/asm/overlay_01_021E7FDC.s @@ -525,7 +525,7 @@ _021E83CC: bl ov01_021E847C ldr r1, [sp, #0x2c] add r0, r4, #0 - bl sub_0200B12C + bl GF_PlttResObj_GetVramSlotNum add sp, #0x10 pop {r3, r4, r5, r6, r7, pc} _021E83E4: diff --git a/asm/overlay_02_02245B80.s b/asm/overlay_02_02245B80.s index dee67e621..2230dfeb0 100644 --- a/asm/overlay_02_02245B80.s +++ b/asm/overlay_02_02245B80.s @@ -10239,7 +10239,7 @@ ov02_0224A88C: ; 0x0224A88C mov r1, #3 bl Get2DGfxResObjById add r1, r6, #0 - bl sub_0200B0F8 + bl GF_PlttResObj_GetPlttProxy mov r1, #1 bl NNS_G2dGetImagePaletteLocation add r5, r0, #0 diff --git a/asm/overlay_05.s b/asm/overlay_05.s index 908263048..d0fbe8c18 100644 --- a/asm/overlay_05.s +++ b/asm/overlay_05.s @@ -3418,7 +3418,7 @@ ov05_0221D530: ; 0x0221D530 lsl r0, r0, #2 ldr r0, [r4, r0] ldr r1, _0221D5D4 ; =0x0000B807 - bl sub_0200D934 + bl GfGfxHandler_GetPlttProxy mov r1, #0x3e lsl r2, r6, #4 lsl r1, r1, #4 diff --git a/asm/overlay_100.s b/asm/overlay_100.s index 7fc7683a7..ee0d825ec 100644 --- a/asm/overlay_100.s +++ b/asm/overlay_100.s @@ -2500,7 +2500,7 @@ _021E6BE0: bl Sprite_SetAnimCtrlSeq add r0, r7, #0 add r1, r6, #0 - bl sub_0200B12C + bl GF_PlttResObj_GetVramSlotNum ldr r1, _021E6C40 ; =ov100_021E770C add r2, r0, #0 ldrb r1, [r1, r5] diff --git a/asm/overlay_101.s b/asm/overlay_101.s index 077ff3f26..70d4ac8ea 100644 --- a/asm/overlay_101.s +++ b/asm/overlay_101.s @@ -2558,7 +2558,7 @@ ov101_021E8AE4: ; 0x021E8AE4 mov r1, #0 add r0, #0x90 ldr r0, [r0] - bl sub_0200D934 + bl GfGfxHandler_GetPlttProxy str r0, [sp, #0x24] mov r0, #0 str r0, [sp, #0x10] diff --git a/asm/overlay_108.s b/asm/overlay_108.s index b0d04a48f..10f1ea71e 100644 --- a/asm/overlay_108.s +++ b/asm/overlay_108.s @@ -3607,7 +3607,7 @@ ov108_021E756C: ; 0x021E756C lsl r0, r0, #4 ldr r0, [r5, r0] mov r1, #0 - bl sub_0200D934 + bl GfGfxHandler_GetPlttProxy str r0, [sp, #0x1c] mov r0, #3 str r0, [sp, #0x30] diff --git a/asm/overlay_112.s b/asm/overlay_112.s index 38257b287..471242634 100644 --- a/asm/overlay_112.s +++ b/asm/overlay_112.s @@ -22288,7 +22288,7 @@ ov112_021F0C50: ; 0x021F0C50 add r6, r0, #0 add r0, r4, #0 add r1, r6, #0 - bl sub_0200B0F8 + bl GF_PlttResObj_GetPlttProxy add r4, r0, #0 add r0, r6, #0 mov r1, #2 diff --git a/asm/overlay_12_02266024.s b/asm/overlay_12_02266024.s index 33c6d251c..dd53c7dda 100644 --- a/asm/overlay_12_02266024.s +++ b/asm/overlay_12_02266024.s @@ -4534,7 +4534,7 @@ _02268602: str r0, [sp, #0x54] ldr r0, [sp, #0x20] ldr r1, [sp, #0x98] - bl sub_0200D934 + bl GfGfxHandler_GetPlttProxy str r0, [sp, #0x58] mov r0, #0 ldr r1, [sp, #0x34] diff --git a/asm/overlay_12_battle_command.s b/asm/overlay_12_battle_command.s index 158c1d96e..b5cd76414 100644 --- a/asm/overlay_12_battle_command.s +++ b/asm/overlay_12_battle_command.s @@ -4025,7 +4025,7 @@ _022483C6: str r0, [sp, #0x34] ldr r1, _022484AC ; =0x00004E30 add r0, r4, #0 - bl sub_0200D934 + bl GfGfxHandler_GetPlttProxy mov r1, #0 str r0, [sp, #0x38] ldr r0, [sp, #0x60] diff --git a/asm/overlay_12_battle_controller_opponent.s b/asm/overlay_12_battle_controller_opponent.s index 1cfd578e4..5d7d4c313 100644 --- a/asm/overlay_12_battle_controller_opponent.s +++ b/asm/overlay_12_battle_controller_opponent.s @@ -3678,7 +3678,7 @@ ov12_0225A414: ; 0x0225A414 add r1, r0, #0 ldr r0, _0225A4D4 ; =0x00000195 ldrb r0, [r6, r0] - bl ov12_02265B64 + bl BattleHpBar_Util_GetBarTypeFromBattlerSide add r1, r4, #0 add r1, #0x25 strb r0, [r1] @@ -4445,7 +4445,7 @@ _0225A9F2: add r1, r0, #0 ldr r0, _0225AA60 ; =0x00000195 ldrb r0, [r6, r0] - bl ov12_02265B64 + bl BattleHpBar_Util_GetBarTypeFromBattlerSide add r1, r4, #0 add r1, #0x25 strb r0, [r1] @@ -5147,7 +5147,7 @@ ov12_0225AF74: ; 0x0225AF74 add r1, r0, #0 ldr r0, _0225B024 ; =0x00000195 ldrb r0, [r6, r0] - bl ov12_02265B64 + bl BattleHpBar_Util_GetBarTypeFromBattlerSide add r1, r4, #0 add r1, #0x25 strb r0, [r1] @@ -13192,7 +13192,7 @@ _0225F070: bl BattleSystem_GetBattleType add r1, r0, #0 ldr r0, [sp, #0x18] - bl ov12_02265B64 + bl BattleHpBar_Util_GetBarTypeFromBattlerSide add r1, r5, #0 add r1, #0x25 strb r0, [r1] @@ -15802,7 +15802,7 @@ ov12_02260584: ; 0x02260584 _02260596: ldr r0, [r4, #4] add r1, #0xb - bl ov12_02265C54 + bl BattleHpBar_BeginExpBarFullFlashEffect ldr r0, _022605CC ; =0x0000070C bl PlaySE ldrb r0, [r4, #0xa] diff --git a/asm/overlay_14.s b/asm/overlay_14.s index 18c28783b..db7de131d 100644 --- a/asm/overlay_14.s +++ b/asm/overlay_14.s @@ -30846,7 +30846,7 @@ ov14_021F4D10: ; 0x021F4D10 lsl r0, r0, #2 ldr r0, [r4, r0] ldr r1, _021F4E5C ; =0x0000C101 - bl sub_0200D934 + bl GfGfxHandler_GetPlttProxy str r0, [sp, #0x14] mov r0, #0xc6 lsl r0, r0, #2 @@ -30914,7 +30914,7 @@ ov14_021F4D10: ; 0x021F4D10 lsl r0, r0, #2 ldr r0, [r4, r0] ldr r1, _021F4E5C ; =0x0000C101 - bl sub_0200D934 + bl GfGfxHandler_GetPlttProxy str r0, [sp, #0x14] mov r0, #0xc6 lsl r0, r0, #2 diff --git a/asm/overlay_18.s b/asm/overlay_18.s index 5fd583f88..f03ef028b 100644 --- a/asm/overlay_18.s +++ b/asm/overlay_18.s @@ -23188,7 +23188,7 @@ ov18_021F14B4: ; 0x021F14B4 ldr r1, _021F14F8 ; =0x0000C550 mov r2, #1 add r6, r3, #0 - bl sub_0200D944 + bl GfGfxHandler_GetPlttNumById mov r3, #1 add r7, r0, #0 str r3, [sp] @@ -23262,7 +23262,7 @@ ov18_021F1534: ; 0x021F1534 ldr r1, _021F1594 ; =0x0000C551 ldr r0, [r5, r0] mov r2, #2 - bl sub_0200D944 + bl GfGfxHandler_GetPlttNumById add r6, r0, #0 ldr r1, [sp, #4] add r0, r7, #0 @@ -24290,7 +24290,7 @@ ov18_021F1D98: ; 0x021F1D98 ldr r1, _021F1DE0 ; =0x0000C55B ldr r0, [r6, r0] mov r2, #2 - bl sub_0200D944 + bl GfGfxHandler_GetPlttNumById add r1, r0, #0 ldr r0, [r5, r4] bl UnkImageStruct_SetSpritePalIndex @@ -24819,7 +24819,7 @@ ov18_021F21FC: ; 0x021F21FC ldr r1, _021F226C ; =0x0000C558 ldr r0, [r5, r0] mov r2, #2 - bl sub_0200D944 + bl GfGfxHandler_GetPlttNumById add r6, r0, #0 ldr r0, [sp, #4] bl ov18_021F9688 @@ -25113,7 +25113,7 @@ _021F248A: ldr r1, _021F24D8 ; =0x0000C55A ldr r0, [r7, r0] mov r2, #2 - bl sub_0200D944 + bl GfGfxHandler_GetPlttNumById add r1, r0, #0 mov r0, #0x67 lsl r0, r0, #4 @@ -26783,7 +26783,7 @@ _021F3214: ldr r1, _021F3290 ; =0x0000C55A ldr r0, [r5, r0] mov r2, #2 - bl sub_0200D944 + bl GfGfxHandler_GetPlttNumById add r1, r0, #0 mov r0, #0x67 lsl r0, r0, #4 @@ -38793,7 +38793,7 @@ ov18_021F8FF8: ; 0x021F8FF8 lsl r0, r0, #2 ldr r0, [r4, r0] mov r1, #1 - bl sub_0200B12C + bl GF_PlttResObj_GetVramSlotNum add r2, r0, #0 lsl r2, r2, #0x14 ldr r0, [r4, #4] @@ -38883,7 +38883,7 @@ ov18_021F9068: ; 0x021F9068 lsl r0, r0, #2 ldr r0, [r4, r0] mov r1, #1 - bl sub_0200B12C + bl GF_PlttResObj_GetVramSlotNum add r2, r0, #0 lsl r2, r2, #0x14 ldr r0, [r4, #4] @@ -38982,7 +38982,7 @@ ov18_021F9150: ; 0x021F9150 str r0, [r5, r1] ldr r0, [r5, r1] mov r1, #1 - bl sub_0200B12C + bl GF_PlttResObj_GetVramSlotNum add r2, r0, #0 lsl r2, r2, #0x14 ldr r0, [r5, #4] diff --git a/asm/overlay_40.s b/asm/overlay_40.s index e206600f8..720483023 100644 --- a/asm/overlay_40.s +++ b/asm/overlay_40.s @@ -3511,7 +3511,7 @@ _0222D2E6: ldr r1, [sp, #0xc] ldr r0, [r6, #0x1c] ldr r1, [r1] - bl sub_0200D934 + bl GfGfxHandler_GetPlttProxy str r0, [sp, #0x58] ldr r0, [r4] add r1, sp, #0x20 @@ -3845,7 +3845,7 @@ _0222D5BE: str r0, [sp, #0x24] ldr r0, [r4, #8] add r1, r6, #0 - bl sub_0200D934 + bl GfGfxHandler_GetPlttProxy str r0, [sp, #0x28] ldr r0, [r5, #4] add r1, sp, #8 diff --git a/asm/overlay_41.s b/asm/overlay_41.s index 56ab2c009..8ea2275cb 100644 --- a/asm/overlay_41.s +++ b/asm/overlay_41.s @@ -9928,7 +9928,7 @@ ov41_0224A734: ; 0x0224A734 ldr r0, [r4, #0x4c] bl Get2DGfxResObjById mov r1, #0 - bl sub_0200B0F8 + bl GF_PlttResObj_GetPlttProxy str r0, [sp, #0x98] ldr r0, [sp, #0xb8] mov r1, #1 diff --git a/asm/overlay_42.s b/asm/overlay_42.s index 21930cec0..2d53d1fff 100644 --- a/asm/overlay_42.s +++ b/asm/overlay_42.s @@ -1975,11 +1975,11 @@ ov42_02227E78: ; 0x02227E78 str r0, [sp, #4] add r0, r6, #0 mov r1, #1 - bl sub_0200B12C + bl GF_PlttResObj_GetVramSlotNum add r7, r0, #0 add r0, r6, #0 mov r1, #2 - bl sub_0200B12C + bl GF_PlttResObj_GetVramSlotNum add r6, r0, #0 mov r0, #0 mvn r0, r0 diff --git a/asm/overlay_44.s b/asm/overlay_44.s index 71d88b9fc..94e89f6ae 100644 --- a/asm/overlay_44.s +++ b/asm/overlay_44.s @@ -14918,7 +14918,7 @@ _02231604: str r0, [sp, #0x40] ldr r0, _0223168C ; =0x00000D2C ldr r0, [r5, r0] - bl sub_0200B0F8 + bl GF_PlttResObj_GetPlttProxy str r0, [sp, #0x44] ldr r0, _022316A4 ; =0x00000D3C ldr r1, [r5, r0] diff --git a/asm/overlay_57.s b/asm/overlay_57.s index 7ec117cb3..b4801bd1d 100644 --- a/asm/overlay_57.s +++ b/asm/overlay_57.s @@ -2004,7 +2004,7 @@ ov57_022387E0: ; 0x022387E0 add r0, #0xe0 ldr r0, [r0] ldr r1, _022388E0 ; =0x00007530 - bl sub_0200D934 + bl GfGfxHandler_GetPlttProxy str r0, [sp, #0x38] mov r2, #0 mov r0, #0x9b diff --git a/asm/overlay_80_0223A00C.s b/asm/overlay_80_0223A00C.s index 8d0b83f6b..fcb6a09e5 100644 --- a/asm/overlay_80_0223A00C.s +++ b/asm/overlay_80_0223A00C.s @@ -849,7 +849,7 @@ _0223A6D6: str r0, [sp, #0x54] ldr r0, [sp, #0x20] ldr r1, [sp, #0x98] - bl sub_0200D934 + bl GfGfxHandler_GetPlttProxy mov r1, #0 str r0, [sp, #0x58] ldr r0, [sp, #0x34] diff --git a/asm/overlay_89.s b/asm/overlay_89.s index fb6e1f5d6..47350cdd7 100644 --- a/asm/overlay_89.s +++ b/asm/overlay_89.s @@ -3232,7 +3232,7 @@ _0225A2E6: str r0, [sp, #0x50] ldr r1, [sp, #0x98] add r0, r7, #0 - bl sub_0200D934 + bl GfGfxHandler_GetPlttProxy mov r1, #0 str r0, [sp, #0x54] ldr r0, [sp, #0x30] diff --git a/asm/overlay_90.s b/asm/overlay_90.s index cad3caced..835ef4923 100644 --- a/asm/overlay_90.s +++ b/asm/overlay_90.s @@ -658,7 +658,7 @@ ov90_02258C74: ; 0x02258C74 ldr r1, _02258C88 ; =0x00001388 bl Get2DGfxResObjById mov r1, #1 - bl sub_0200B12C + bl GF_PlttResObj_GetVramSlotNum pop {r3, pc} nop _02258C88: .word 0x00001388 diff --git a/asm/overlay_91.s b/asm/overlay_91.s index 80a52ac29..dde14c220 100644 --- a/asm/overlay_91.s +++ b/asm/overlay_91.s @@ -10689,7 +10689,7 @@ _022616FA: ldr r0, [r4, #0x1c] str r0, [sp, #0x34] ldr r0, [r5, #0x60] - bl sub_0200B0F8 + bl GF_PlttResObj_GetPlttProxy str r0, [sp, #0x38] ldr r0, [r5, #0x34] str r0, [sp, #0x3c] diff --git a/asm/overlay_93_thumb_2.s b/asm/overlay_93_thumb_2.s index 9641d9740..0267a5e94 100644 --- a/asm/overlay_93_thumb_2.s +++ b/asm/overlay_93_thumb_2.s @@ -2222,7 +2222,7 @@ ov93_02260CF8: ; 0x02260CF8 ldr r0, [r7, #0x28] ldr r1, _02260E10 ; =0x00002716 mov r2, #2 - bl sub_0200D944 + bl GfGfxHandler_GetPlttNumById str r0, [sp, #0xc] mov r0, #0 str r0, [sp, #0x18] @@ -2372,7 +2372,7 @@ ov93_02260E1C: ; 0x02260E1C ldr r0, [r5, #0x28] ldr r1, _02260F08 ; =0x00002716 mov r2, #2 - bl sub_0200D944 + bl GfGfxHandler_GetPlttNumById str r0, [sp, #4] mov r0, #0 str r0, [sp, #0x10] @@ -4569,7 +4569,7 @@ _02261F42: str r0, [sp, #0x48] ldr r0, [sp, #0x1c] ldr r1, [sp, #0x98] - bl sub_0200D934 + bl GfGfxHandler_GetPlttProxy str r0, [sp, #0x4c] mov r0, #0 str r0, [sp, #0x50] diff --git a/asm/overlay_96.s b/asm/overlay_96.s index 5ff63859b..07ee41024 100644 --- a/asm/overlay_96.s +++ b/asm/overlay_96.s @@ -6930,7 +6930,7 @@ _021E8C14: ldr r0, [r6, r0] add r0, r0, r5 ldr r0, [r0, #4] - bl sub_0200B0F8 + bl GF_PlttResObj_GetPlttProxy add r5, r0, #0 add r0, r7, #0 mov r1, #0x20 @@ -7071,7 +7071,7 @@ _021E8CC2: str r0, [sp, #0x24] ldr r0, [r4, #4] ldr r1, [sp, #0x24] - bl sub_0200B0F8 + bl GF_PlttResObj_GetPlttProxy str r0, [sp, #0x28] ldr r0, [r4] bl GF2DGfxResObj_GetCharDataPtr @@ -30732,7 +30732,7 @@ _021F4420: add r7, r0, #0 ldr r0, [sp, #4] add r1, r7, #0 - bl sub_0200B0F8 + bl GF_PlttResObj_GetPlttProxy str r0, [sp, #0xc] add r0, r7, #0 mov r1, #2 @@ -40043,7 +40043,7 @@ ov96_021F8DF4: ; 0x021F8DF4 mov r0, #0xb1 lsl r0, r0, #2 ldr r0, [r5, r0] - bl sub_0200B0F8 + bl GF_PlttResObj_GetPlttProxy str r0, [sp, #0x34] ldr r0, [sp, #0x78] str r0, [sp, #0x38] @@ -55972,7 +55972,7 @@ _02200D90: add r6, r0, #0 add r0, r5, #0 add r1, r6, #0 - bl sub_0200B0F8 + bl GF_PlttResObj_GetPlttProxy str r0, [sp, #8] ldr r1, [sp] ldr r0, [sp, #4] @@ -62143,7 +62143,7 @@ ov96_02203F50: ; 0x02203F50 add r7, r0, #0 add r0, r5, #0 add r1, r7, #0 - bl sub_0200B0F8 + bl GF_PlttResObj_GetPlttProxy str r0, [sp] mov r4, #0 _02203F80: @@ -71471,7 +71471,7 @@ _022089E4: add r6, r0, #0 add r0, r5, #0 add r1, r6, #0 - bl sub_0200B0F8 + bl GF_PlttResObj_GetPlttProxy str r0, [sp, #8] ldr r1, [sp] ldr r0, [sp, #4] diff --git a/asm/overlay_97.s b/asm/overlay_97.s index 9ef90202e..6164fd896 100644 --- a/asm/overlay_97.s +++ b/asm/overlay_97.s @@ -2710,7 +2710,7 @@ ov97_0221FBA0: ; 0x0221FBA0 add r6, r0, #0 add r0, r4, #0 add r1, r6, #0 - bl sub_0200B0F8 + bl GF_PlttResObj_GetPlttProxy add r4, r0, #0 add r0, r6, #0 mov r1, #2 diff --git a/asm/render_window.s b/asm/render_window.s index e1e9dd8ab..724407698 100644 --- a/asm/render_window.s +++ b/asm/render_window.s @@ -2572,7 +2572,7 @@ sub_0200F748: ; 0x0200F748 ldr r1, _0200F828 ; =0x00015CD5 bl Get2DGfxResObjById ldr r1, [sp, #4] - bl sub_0200B0F8 + bl GF_PlttResObj_GetPlttProxy mov r1, #1 bl NNS_G2dGetImagePaletteLocation add r5, r0, #0 diff --git a/asm/unk_020863F4.s b/asm/unk_020863F4.s index ecae15b5f..8565a3707 100644 --- a/asm/unk_020863F4.s +++ b/asm/unk_020863F4.s @@ -1738,7 +1738,7 @@ sub_02087090: ; 0x02087090 str r0, [sp, #0x34] ldr r0, [r5, r1] add r1, #0xf7 - bl sub_0200D934 + bl GfGfxHandler_GetPlttProxy str r0, [sp, #0x38] mov r1, #0 mov r0, #0xe2 diff --git a/include/battle/battle.h b/include/battle/battle.h index ba03abd70..b4d7280b6 100644 --- a/include/battle/battle.h +++ b/include/battle/battle.h @@ -459,7 +459,7 @@ typedef struct BattleHpBar { s32 maxExp; s32 gainedExp; s32 expCalc; - u8 unk48; + u8 level; u8 unk49; u8 unk_4A; u8 unk4B; diff --git a/include/battle/battle_hp_bar.h b/include/battle/battle_hp_bar.h index 8e03f69b5..40c68ce7b 100644 --- a/include/battle/battle_hp_bar.h +++ b/include/battle/battle_hp_bar.h @@ -16,8 +16,8 @@ void ov12_02264EB4(BattleHpBar *hpBar); void ov12_02264EE0(BattleHpBar *hpBar, int prio); void BattleHpBar_SetEnabled(BattleHpBar *hpBar, BOOL a1); void ov12_02264FB0(BattleHpBar *hpBar, BOOL a1); -u8 ov12_02265B64(u8 a0, u32 battleType); -SysTask *ov12_02265C54(BattleHpBar *hpBar, u8 *a1); +u8 BattleHpBar_Util_GetBarTypeFromBattlerSide(u8 a0, u32 battleType); +SysTask *BattleHpBar_BeginExpBarFullFlashEffect(BattleHpBar *hpBar, u8 *a1); void ov12_02265D70(BattleHpBar *hpBar); void ov12_02265D74(BattleHpBar *hpBar); diff --git a/include/unk_0200ACF0.h b/include/unk_0200ACF0.h index a3807699f..3a087cca1 100644 --- a/include/unk_0200ACF0.h +++ b/include/unk_0200ACF0.h @@ -23,7 +23,7 @@ void sub_0200B050(GF_2DGfxResObjList *plttResObjList); void sub_0200B084(GF_2DGfxResObj *plttResObj); void sub_0200B0A8(GF_2DGfxResObj *plttResObj); void sub_0200B0CC(GF_2DGfxResObjList *plttResObjList); -NNSG2dImagePaletteProxy *sub_0200B0F8(GF_2DGfxResObj *plttResObj, NNSG2dImageProxy *imageProxy); -int sub_0200B12C(GF_2DGfxResObj *plttResObj, NNS_G2D_VRAM_TYPE vram); +NNSG2dImagePaletteProxy *GF_PlttResObj_GetPlttProxy(GF_2DGfxResObj *plttResObj, NNSG2dImageProxy *imageProxy); +int GF_PlttResObj_GetVramSlotNum(GF_2DGfxResObj *plttResObj, NNS_G2D_VRAM_TYPE vram); #endif // POKEHEARTGOLD_UNK_0200ACF0_H diff --git a/include/unk_0200CF18.h b/include/unk_0200CF18.h index a9dbd93eb..0e9a0188b 100644 --- a/include/unk_0200CF18.h +++ b/include/unk_0200CF18.h @@ -111,8 +111,8 @@ BOOL SpriteRenderer_LoadAnimResObjFromNarcId(SpriteRenderer *renderer, SpriteGfx BOOL SpriteRenderer_LoadAnimResObjFromOpenNarc(SpriteRenderer *renderer, SpriteGfxHandler *gfxHandler, NARC *narc, int fileId, BOOL compressed, int resId); UnkImageStruct *SpriteRenderer_LoadResourcesAndCreateSprite(SpriteRenderer *renderer, SpriteGfxHandler *gfxHandler, const UnkTemplate_0200D748 *unkTemplate); UnkImageStruct *SpriteRenderer_LoadResourcesAndCreateSprite_CustomBottomScreenOffset(SpriteRenderer *renderer, SpriteGfxHandler *gfxHandler, const UnkTemplate_0200D748 *unkTemplate, fx32 yOffset); -NNSG2dImagePaletteProxy *sub_0200D934(SpriteGfxHandler *gfxHandler, int id); -int sub_0200D944(SpriteGfxHandler *gfxHandler, int id, NNS_G2D_VRAM_TYPE vram); +NNSG2dImagePaletteProxy *GfGfxHandler_GetPlttProxy(SpriteGfxHandler *gfxHandler, int id); +int GfGfxHandler_GetPlttNumById(SpriteGfxHandler *gfxHandler, int id, NNS_G2D_VRAM_TYPE vram); BOOL SpriteGfxHandler_UnloadCharObjById(SpriteGfxHandler *gfxHandler, u32 character); BOOL SpriteGfxHandler_UnloadPlttObjById(SpriteGfxHandler *gfxHandler, u32 pal); BOOL SpriteGfxHandler_UnloadCellObjById(SpriteGfxHandler *gfxHandler, u32 cell); diff --git a/include/unk_0208805C.h b/include/unk_0208805C.h index c5e06f7d1..e812ff462 100644 --- a/include/unk_0208805C.h +++ b/include/unk_0208805C.h @@ -7,7 +7,7 @@ u16 sub_0208805C(int a0); u8 CalculateHpBarPixelsLength(u32 hp, u32 maxHp, u8 pixelsWide); -u8 sub_02088080(u32 hp, u32 pixelsWide); +u8 HpBar_GetColorIdx(u32 pixelsCur, u32 pixelsWide); u8 CalculateHpBarColor(u16 hp, u16 maxHp, u32 pixelsWide); void sub_020880CC(u8 a0, HeapID heapId); int sub_020881C0(s16 *a0, u16 a1); diff --git a/src/battle/battle_hp_bar.c b/src/battle/battle_hp_bar.c index a071e70f0..c800ff6c6 100644 --- a/src/battle/battle_hp_bar.c +++ b/src/battle/battle_hp_bar.c @@ -19,6 +19,12 @@ typedef enum HPBarType { HP_BAR_TYPE_PALPARK, } HPBarType; +#ifdef FAST_HP_BARS +#define USE_SUBPIXELS_TEST (TRUE) +#else +#define USE_SUBPIXELS_TEST (maxHp < pixelsWide) +#endif // FAST_HP_BARS + ALIGN(4) static const s8 ov12_0226D368[] = { 72, @@ -36,176 +42,176 @@ typedef struct UnkStruct_ov12_0226D408 { static const UnkStruct_ov12_0226D408 ov12_0226D680[][4] = { { - { 0x0260, 0x00A0 }, - { 0x0360, 0x00A0 }, - { 0x0A00, 0x0060 }, - { 0x0B00, 0x0060 }, + { 0x260, 0xA0 }, + { 0x360, 0xA0 }, + { 0xA00, 0x60 }, + { 0xB00, 0x60 }, }, { - { 0x0220, 0x00E0 }, - { 0x0320, 0x00E0 }, - { 0x0A00, 0x0020 }, - { 0x0B00, 0x0020 }, + { 0x220, 0xE0 }, + { 0x320, 0xE0 }, + { 0xA00, 0x20 }, + { 0xB00, 0x20 }, }, { - { 0x0240, 0x00C0 }, - { 0x0340, 0x00C0 }, - { 0x0A00, 0x0040 }, - { 0x0B00, 0x0040 }, + { 0x240, 0xC0 }, + { 0x340, 0xC0 }, + { 0xA00, 0x40 }, + { 0xB00, 0x40 }, }, { - { 0x0220, 0x00E0 }, - { 0x0320, 0x00E0 }, - { 0x0A00, 0x0020 }, - { 0x0B00, 0x0020 }, + { 0x220, 0xE0 }, + { 0x320, 0xE0 }, + { 0xA00, 0x20 }, + { 0xB00, 0x20 }, }, { - { 0x0240, 0x00C0 }, - { 0x0340, 0x00C0 }, - { 0x0A00, 0x0040 }, - { 0x0B00, 0x0040 }, + { 0x240, 0xC0 }, + { 0x340, 0xC0 }, + { 0xA00, 0x40 }, + { 0xB00, 0x40 }, }, { - { 0x0220, 0x00E0 }, - { 0x0320, 0x00E0 }, - { 0x0A00, 0x0020 }, - { 0x0B00, 0x0020 }, + { 0x220, 0xE0 }, + { 0x320, 0xE0 }, + { 0xA00, 0x20 }, + { 0xB00, 0x20 }, }, }; static const UnkStruct_ov12_0226D408 ov12_0226D4B0[][2] = { { - { 0x0A60, 0x0040 }, - { 0x0B60, 0x0040 }, + { 0xA60, 0x40 }, + { 0xB60, 0x40 }, }, { - { 0x0A20, 0x0040 }, - { 0x0B20, 0x0040 }, + { 0xA20, 0x40 }, + { 0xB20, 0x40 }, }, { - { 0x0A40, 0x0040 }, - { 0x0B40, 0x0040 }, + { 0xA40, 0x40 }, + { 0xB40, 0x40 }, }, { - { 0x0A20, 0x0040 }, - { 0x0B20, 0x0040 }, + { 0xA20, 0x40 }, + { 0xB20, 0x40 }, }, { - { 0x0A40, 0x0040 }, - { 0x0B40, 0x0040 }, + { 0xA40, 0x40 }, + { 0xB40, 0x40 }, }, { - { 0x0A20, 0x0040 }, - { 0x0B20, 0x0040 }, + { 0xA20, 0x40 }, + { 0xB20, 0x40 }, }, }; static const UnkStruct_ov12_0226D408 ov12_0226D420[][2] = { { - { 0x0AA0, 0x0060 }, - { 0x0BA0, 0x0060 }, + { 0xAA0, 0x60 }, + { 0xBA0, 0x60 }, }, { - { 0x0A60, 0x0060 }, - { 0x0B60, 0x0060 }, + { 0xA60, 0x60 }, + { 0xB60, 0x60 }, }, { - { 0x0A80, 0x0060 }, - { 0x0B80, 0x0060 }, + { 0xA80, 0x60 }, + { 0xB80, 0x60 }, }, { - { 0x0A60, 0x0060 }, - { 0x0B60, 0x0060 }, + { 0xA60, 0x60 }, + { 0xB60, 0x60 }, }, { - { 0x0A80, 0x0060 }, - { 0x0B80, 0x0060 }, + { 0xA80, 0x60 }, + { 0xB80, 0x60 }, }, { - { 0x0A60, 0x0060 }, - { 0x0B60, 0x0060 }, + { 0xA60, 0x60 }, + { 0xB60, 0x60 }, }, }; static const UnkStruct_ov12_0226D408 ov12_0226D450[][2] = { { - { 0x0000, 0x0000 }, - { 0x0D00, 0x0060 }, + { 0, 0 }, + { 0xD00, 0x60 }, }, { - { 0x0620, 0x0060 }, - { 0x0000, 0x0000 }, + { 0x620, 0x60 }, + { 0, 0 }, }, { - { 0x0000, 0x0000 }, - { 0x0C00, 0x0060 }, + { 0, 0 }, + { 0xC00, 0x60 }, }, { - { 0x0620, 0x0060 }, - { 0x0000, 0x0000 }, + { 0x620, 0x60 }, + { 0, 0 }, }, { - { 0x0000, 0x0000 }, - { 0x0C00, 0x0060 }, + { 0, 0 }, + { 0xC00, 0x60 }, }, { - { 0x0620, 0x0060 }, - { 0x0000, 0x0000 }, + { 0x620, 0x60 }, + { 0, 0 }, }, }; static const UnkStruct_ov12_0226D408 ov12_0226D3F0[] = { - { 0x0D80, 0x0060 }, - { 0x06A0, 0x0060 }, - { 0x0C80, 0x0060 }, - { 0x06A0, 0x0060 }, - { 0x0C80, 0x0060 }, - { 0x06A0, 0x0060 }, + { 0xD80, 0x60 }, + { 0x6A0, 0x60 }, + { 0xC80, 0x60 }, + { 0x6A0, 0x60 }, + { 0xC80, 0x60 }, + { 0x6A0, 0x60 }, }; static const UnkStruct_ov12_0226D408 ov12_0226D480[][2] = { { - { 0x04E0, 0x0000 }, - { 0x0C20, 0x00C0 }, + { 0x4E0, 0 }, + { 0xC20, 0xC0 }, }, { - { 0x04E0, 0x0020 }, - { 0x0C00, 0x00A0 }, + { 0x4E0, 0x20 }, + { 0xC00, 0xA0 }, }, { - { 0x04E0, 0x0000 }, - { 0x0C00, 0x00C0 }, + { 0x4E0, 0 }, + { 0xC00, 0xC0 }, }, { - { 0x04E0, 0x0020 }, - { 0x0C00, 0x00A0 }, + { 0x4E0, 0x20 }, + { 0xC00, 0xA0 }, }, { - { 0x04E0, 0x0000 }, - { 0x0C00, 0x00C0 }, + { 0x4E0, 0 }, + { 0xC00, 0xC0 }, }, { - { 0x04E0, 0x0020 }, - { 0x0C00, 0x00A0 }, + { 0x4E0, 0x20 }, + { 0xC00, 0xA0 }, }, }; static const UnkStruct_ov12_0226D408 ov12_0226D3C0[] = { - { 0x0460, 0x0020 }, - { 0x0420, 0x0020 }, - { 0x0440, 0x0020 }, - { 0x0420, 0x0020 }, - { 0x0440, 0x0020 }, - { 0x0420, 0x0020 }, + { 0x460, 0x20 }, + { 0x420, 0x20 }, + { 0x440, 0x20 }, + { 0x420, 0x20 }, + { 0x440, 0x20 }, + { 0x420, 0x20 }, }; static const UnkStruct_ov12_0226D408 ov12_0226D390[] = { - { 0x0480, 0x0060 }, - { 0x0440, 0x0060 }, - { 0x0460, 0x0060 }, - { 0x0440, 0x0060 }, - { 0x0460, 0x0060 }, - { 0x0440, 0x0060 }, + { 0x480, 0x60 }, + { 0x440, 0x60 }, + { 0x460, 0x60 }, + { 0x440, 0x60 }, + { 0x460, 0x60 }, + { 0x440, 0x60 }, }; static const UnkStruct_ov12_0226D408 ov12_0226D370[] = { @@ -223,30 +229,30 @@ static const UnkStruct_ov12_0226D408 ov12_0226D380[] = { }; static const UnkStruct_ov12_0226D408 ov12_0226D3A8[] = { - { 0x0000, 0x0000 }, - { 0x0000, 0x0000 }, - { 0x04C0, 0x0040 }, - { 0x0000, 0x0000 }, - { 0x04C0, 0x0040 }, - { 0x0000, 0x0000 }, + { 0, 0 }, + { 0, 0 }, + { 0x4C0, 0x40 }, + { 0, 0 }, + { 0x4C0, 0x40 }, + { 0, 0 }, }; static const UnkStruct_ov12_0226D408 ov12_0226D3D8[] = { - { 0x0000, 0x0000 }, - { 0x0000, 0x0000 }, - { 0x0CC0, 0x0020 }, - { 0x0000, 0x0000 }, - { 0x0CC0, 0x0020 }, - { 0x0000, 0x0000 }, + { 0, 0 }, + { 0, 0 }, + { 0xCC0, 0x20 }, + { 0, 0 }, + { 0xCC0, 0x20 }, + { 0, 0 }, }; static const UnkStruct_ov12_0226D408 ov12_0226D408[] = { - { 0x0000, 0x0000 }, - { 0x0000, 0x0000 }, - { 0x0C60, 0x0020 }, - { 0x0000, 0x0000 }, - { 0x0C60, 0x0020 }, - { 0x0000, 0x0000 }, + { 0, 0 }, + { 0, 0 }, + { 0xC60, 0x20 }, + { 0, 0 }, + { 0xC60, 0x20 }, + { 0, 0 }, }; static void ov12_02264824(SpriteRenderer *renderer, SpriteGfxHandler *gfxHandler, NARC *narc, PaletteData *plttData, int barType); @@ -266,185 +272,185 @@ static void ov12_02265474(BattleHpBar *hpBar, u32 num); static void ov12_02265500(BattleHpBar *hpBar); static void ov12_02265560(BattleHpBar *hpBar); static void ov12_022655B0(BattleHpBar *hpBar, int a1); -static void ov12_022655F0(BattleHpBar *hpBar, u32 flag); -static void ov12_022656CC(BattleHpBar *hpBar, u32 flag); -static int ov12_022657E4(BattleHpBar *hpBar, BOOL a1); -static void ov12_02265878(BattleHpBar *hpBar, u8 a1); -static int ov12_022659E0(s32 maxHp, s32 hp, s32 deltaHP, s32 *pHpCalc, u8 a4, u16 a5); -static u8 ov12_02265A9C(s32 maxHp, s32 hp, s32 deltaHp, s32 *pHpCalc, u8 *a4, u8 a5); -static u32 ov12_02265B18(s32 exp, s32 gainedExp, s32 maxExp, u8 a3); -static const u8 *ov12_02265B58(int a0); -static const UnkTemplate_0200D748 *ov12_02265BB8(u8 barType); -static const UnkTemplate_0200D748 *ov12_02265C1C(u8 barType); -static void ov12_02265C88(SysTask *task, void *data); +static void BattleHpBar_PrintSafariOrParkBallsString(BattleHpBar *hpBar, u32 flag); +static void BattleHpBar_PrintNumRemainingSafariOrParkBalls(BattleHpBar *hpBar, u32 flag); +static int ov12_022657E4(BattleHpBar *hpBar, BOOL isExp); +static void ov12_02265878(BattleHpBar *hpBar, u8 isExp); +static int BattleHpBar_CalculatePixelsChangeFrame(s32 maxHp, s32 curHp, s32 deltaHp, s32 *pHpCalc, u8 tilesWide, u16 hpChange); +static u8 BattleHpBar_Util_MakeHpBarPixelBuffer(s32 maxHp, s32 hp, s32 deltaHp, s32 *pHpCalc, u8 *pixelBuf, u8 tilesWide); +static u32 BattleHpBar_Util_GetPixelsToGain(s32 exp, s32 gainedExp, s32 maxExp, u8 tilesWide); +static const u8 *BattleHpBar_Util_GetComponentRawGraphic(int componentId); +static const UnkTemplate_0200D748 *BattleHpBar_Util_GetHpBoxSpriteTemplate(u8 barType); +static const UnkTemplate_0200D748 *BattleHpBar_Util_GetArrowSpriteTemplate(u8 barType); +static void Task_ExpBarFullFlash(SysTask *task, void *data); static void ov12_02265D78(BattleHpBar *hpBar); static void ov12_02265DA0(BattleHpBar *hpBar); static void ov12_02265DC4(SysTask *task, void *data); -static const UnkTemplate_0200D748 ov12_0226D5E4 = { - .x = 0x00C0, - .y = 0x0074, - .z = 0x0000, - .animation = 0x0000, - .spritePriority = 0x00000017, - .pal = 0x00000000, +static const UnkTemplate_0200D748 sSpriteTemplate_HpBarSinglePlayer = { + .x = 0xC0, + .y = 0x74, + .z = 0, + .animation = 0, + .spritePriority = 0x17, + .pal = 0, .vram = NNS_G2D_VRAM_TYPE_2DMAIN, .resIdList = { - 0x000000BF, - 0x00004E26, - 0x000000BE, - 0x000000BD, - 0xFFFFFFFF, - 0xFFFFFFFF, + 0xBF, + 20006, + 0xBE, + 0xBD, + -1, + -1, }, - .bgPriority = 0x00000000, - .vramTransfer = 0x00000000 + .bgPriority = 0, + .vramTransfer = 0 }; -static const UnkTemplate_0200D748 ov12_0226D618 = { - .x = 0x003A, - .y = 0x0024, - .z = 0x0000, - .animation = 0x0000, - .spritePriority = 0x00000018, - .pal = 0x00000000, +static const UnkTemplate_0200D748 sSpriteTemplate_HpBarSingleEnemy = { + .x = 0x3A, + .y = 0x24, + .z = 0, + .animation = 0, + .spritePriority = 0x18, + .pal = 0, .vram = NNS_G2D_VRAM_TYPE_2DMAIN, .resIdList = { - 0x000000BC, - 0x00004E26, - 0x000000BB, - 0x000000BA, - 0xFFFFFFFF, - 0xFFFFFFFF, + 0xBC, + 20006, + 0xBB, + 0xBA, + -1, + -1, }, - .bgPriority = 0x00000000, - .vramTransfer = 0x00000000 + .bgPriority = 0, + .vramTransfer = 0 }; -static const UnkTemplate_0200D748 ov12_0226D4E0 = { - .x = 0x00C0, - .y = 0x0067, - .z = 0x0000, - .animation = 0x0000, - .spritePriority = 0x0000001C, - .pal = 0x00000000, +static const UnkTemplate_0200D748 sSpriteTemplate_HpBarDoublePlayerLHS = { + .x = 0xC0, + .y = 0x67, + .z = 0, + .animation = 0, + .spritePriority = 0x1C, + .pal = 0, .vram = NNS_G2D_VRAM_TYPE_2DMAIN, .resIdList = { - 0x000000C8, - 0x00004E26, - 0x000000C7, - 0x000000C6, - 0xFFFFFFFF, - 0xFFFFFFFF, + 0xC8, + 20006, + 0xC7, + 0xC6, + -1, + -1, }, - .bgPriority = 0x00000000, - .vramTransfer = 0x00000000 + .bgPriority = 0, + .vramTransfer = 0 }; -static const UnkTemplate_0200D748 ov12_0226D514 = { - .x = 0x0040, - .y = 0x0010, - .z = 0x0000, - .animation = 0x0000, - .spritePriority = 0x00000019, - .pal = 0x00000000, +static const UnkTemplate_0200D748 sSpriteTemplate_HpBarDoubleEnemyLHS = { + .x = 0x40, + .y = 0x10, + .z = 0, + .animation = 0, + .spritePriority = 0x19, + .pal = 0, .vram = NNS_G2D_VRAM_TYPE_2DMAIN, .resIdList = { - 0x000000C2, - 0x00004E26, - 0x000000C1, - 0x000000C0, - 0xFFFFFFFF, - 0xFFFFFFFF, + 0xC2, + 20006, + 0xC1, + 0xC0, + -1, + -1, }, - .bgPriority = 0x00000000, - .vramTransfer = 0x00000000 + .bgPriority = 0, + .vramTransfer = 0 }; -static const UnkTemplate_0200D748 ov12_0226D57C = { - .x = 0x00C6, - .y = 0x0084, - .z = 0x0000, - .animation = 0x0000, - .spritePriority = 0x0000001A, - .pal = 0x00000000, +static const UnkTemplate_0200D748 sSpriteTemplate_HpBarDoublePlayerRHS = { + .x = 0xC6, + .y = 0x84, + .z = 0, + .animation = 0, + .spritePriority = 0x1A, + .pal = 0, .vram = NNS_G2D_VRAM_TYPE_2DMAIN, .resIdList = { - 0x000000CB, - 0x00004E26, - 0x000000CA, - 0x000000C9, - 0xFFFFFFFF, - 0xFFFFFFFF, + 0xCB, + 20006, + 0xCA, + 0xC9, + -1, + -1, }, - .bgPriority = 0x00000000, - .vramTransfer = 0x00000000 + .bgPriority = 0, + .vramTransfer = 0 }; -static const UnkTemplate_0200D748 ov12_0226D64C = { - .x = 0x003A, - .y = 0x002D, - .z = 0x0000, - .animation = 0x0000, - .spritePriority = 0x0000001B, - .pal = 0x00000000, +static const UnkTemplate_0200D748 sSpriteTemplate_HpBarDoubleEnemyRHS = { + .x = 0x3A, + .y = 0x2D, + .z = 0, + .animation = 0, + .spritePriority = 0x1B, + .pal = 0, .vram = NNS_G2D_VRAM_TYPE_2DMAIN, .resIdList = { - 0x000000C5, - 0x00004E26, - 0x000000C4, - 0x000000C3, - 0xFFFFFFFF, - 0xFFFFFFFF, + 0xC5, + 20006, + 0xC4, + 0xC3, + -1, + -1, }, - .bgPriority = 0x00000000, - .vramTransfer = 0x00000000 + .bgPriority = 0, + .vramTransfer = 0 }; -static const UnkTemplate_0200D748 ov12_0226D548 = { - .x = 0x0000, - .y = 0x0000, - .z = 0x0000, - .animation = 0x0000, - .spritePriority = 0x00000011, - .pal = 0x00000000, +static const UnkTemplate_0200D748 sSpriteTemplate_Arrow = { + .x = 0, + .y = 0, + .z = 0, + .animation = 0, + .spritePriority = 0x11, + .pal = 0, .vram = NNS_G2D_VRAM_TYPE_2DMAIN, .resIdList = { - 0x000000B9, - 0x00004E26, - 0x000000B8, - 0x000000B7, - 0xFFFFFFFF, - 0xFFFFFFFF, + 0xB9, + 20006, + 0xB8, + 0xB7, + -1, + -1, }, - .bgPriority = 0x00000000, - .vramTransfer = 0x00000000 + .bgPriority = 0, + .vramTransfer = 0 }; -static const UnkTemplate_0200D748 ov12_0226D5B0 = { - .x = 0x00C0, - .y = 0x0074, - .z = 0x0000, - .animation = 0x0000, - .spritePriority = 0x00000017, - .pal = 0x00000000, +static const UnkTemplate_0200D748 sSpriteTemplate_HpBarSafariOrPark = { + .x = 0xC0, + .y = 0x74, + .z = 0, + .animation = 0, + .spritePriority = 0x17, + .pal = 0, .vram = NNS_G2D_VRAM_TYPE_2DMAIN, .resIdList = { - 0x000000FD, - 0x00004E28, - 0x000000FE, - 0x000000FF, - 0xFFFFFFFF, - 0xFFFFFFFF, + 0xFD, + 20008, + 0xFE, + 0xFF, + -1, + -1, }, - .bgPriority = 0x00000000, - .vramTransfer = 0x00000000 + .bgPriority = 0, + .vramTransfer = 0 }; #include "battle/battle_hp_bar_data.h" static void ov12_02264824(SpriteRenderer *renderer, SpriteGfxHandler *gfxHandler, NARC *narc, PaletteData *plttData, int barType) { - const UnkTemplate_0200D748 *pRes = ov12_02265BB8(barType); + const UnkTemplate_0200D748 *pRes = BattleHpBar_Util_GetHpBoxSpriteTemplate(barType); SpriteRenderer_LoadCharResObjFromOpenNarc(renderer, gfxHandler, narc, pRes->resIdList[GF_GFX_RES_TYPE_CHAR], TRUE, NNS_G2D_VRAM_TYPE_2DMAIN, pRes->resIdList[GF_GFX_RES_TYPE_CHAR]); sub_0200D68C(plttData, PLTTBUF_MAIN_OBJ, renderer, gfxHandler, narc, 71, FALSE, 1, NNS_G2D_VRAM_TYPE_2DMAIN, 20006); @@ -457,7 +463,7 @@ static void ov12_02264824(SpriteRenderer *renderer, SpriteGfxHandler *gfxHandler } static void ov12_022648EC(SpriteRenderer *renderer, SpriteGfxHandler *gfxHandler, NARC *narc, PaletteData *plttData, int barType) { - const UnkTemplate_0200D748 *pRes = ov12_02265C1C(barType); + const UnkTemplate_0200D748 *pRes = BattleHpBar_Util_GetArrowSpriteTemplate(barType); if (pRes != NULL) { SpriteRenderer_LoadCharResObjFromOpenNarc(renderer, gfxHandler, narc, pRes->resIdList[GF_GFX_RES_TYPE_CHAR], TRUE, NNS_G2D_VRAM_TYPE_2DMAIN, pRes->resIdList[GF_GFX_RES_TYPE_CHAR]); @@ -468,7 +474,7 @@ static void ov12_022648EC(SpriteRenderer *renderer, SpriteGfxHandler *gfxHandler } static UnkImageStruct *ov12_02264968(SpriteRenderer *renderer, SpriteGfxHandler *gfxHandler, int barType) { - const UnkTemplate_0200D748 *pRes = ov12_02265BB8(barType); + const UnkTemplate_0200D748 *pRes = BattleHpBar_Util_GetHpBoxSpriteTemplate(barType); UnkImageStruct *ret = SpriteRenderer_LoadResourcesAndCreateSprite(renderer, gfxHandler, pRes); TickSpriteAnimation1Frame(ret->sprite); @@ -569,11 +575,11 @@ void ov12_0226498C(BattleHpBar *hpBar, u32 num, u32 flag) { } if (flag & 0x1400) { - ov12_022655F0(hpBar, flag); + BattleHpBar_PrintSafariOrParkBallsString(hpBar, flag); } if (flag & 0x2800) { - ov12_022656CC(hpBar, flag); + BattleHpBar_PrintNumRemainingSafariOrParkBalls(hpBar, flag); } } @@ -596,7 +602,7 @@ static void ov12_02264B4C(BattleHpBar *hpBar) { } static void ov12_02264B60(BattleHpBar *hpBar) { - const UnkTemplate_0200D748 *tmplate = ov12_02265BB8(hpBar->type); + const UnkTemplate_0200D748 *tmplate = BattleHpBar_Util_GetHpBoxSpriteTemplate(hpBar->type); SpriteRenderer *renderer = ov12_0223A8E4(hpBar->bsys); SpriteGfxHandler *gfxHandler = ov12_0223A8EC(hpBar->bsys); SpriteGfxHandler_UnloadCharObjById(gfxHandler, tmplate->resIdList[GF_GFX_RES_TYPE_CHAR]); @@ -605,7 +611,7 @@ static void ov12_02264B60(BattleHpBar *hpBar) { } static void ov12_02264B94(BattleHpBar *hpBar) { - const UnkTemplate_0200D748 *tmplate = ov12_02265C1C(hpBar->type); + const UnkTemplate_0200D748 *tmplate = BattleHpBar_Util_GetArrowSpriteTemplate(hpBar->type); if (tmplate != NULL) { SpriteRenderer *renderer = ov12_0223A8E4(hpBar->bsys); SpriteGfxHandler *gfxHandler = ov12_0223A8EC(hpBar->bsys); @@ -629,7 +635,7 @@ void BattleHpBar_LoadResources(BattleHpBar *hpBar) { gfxHandler = ov12_0223A8EC(hpBar->bsys); plttData = BattleSystem_GetPaletteData(hpBar->bsys); - tmplate = ov12_02265BB8(hpBar->type); + tmplate = BattleHpBar_Util_GetHpBoxSpriteTemplate(hpBar->type); ov12_02264824(renderer, gfxHandler, narc, plttData, hpBar->type); hpBar->unk4 = ov12_02264968(renderer, gfxHandler, hpBar->type); @@ -662,7 +668,7 @@ asm void BattleHpBar_LoadResources(BattleHpBar *hpBar) { add r0, r5, #0 add r0, #0x25 ldrb r0, [r0, #0] - bl ov12_02265BB8 + bl BattleHpBar_Util_GetHpBoxSpriteTemplate add r4, r0, #0 add r0, r5, #0 add r0, #0x25 @@ -733,19 +739,19 @@ void ov12_02264C84(BattleHpBar *hpBar) { vramBaseAddr = G2_GetOBJCharPtr(); imgProxy = Sprite_GetImageProxy(hpBar->unk4->sprite); if (hpBar->unk_4F_3 == 1) { - src = ov12_02265B58(70); + src = BattleHpBar_Util_GetComponentRawGraphic(70); MI_CpuCopy16(src, (void *)((u32)vramBaseAddr + ov12_0226D3A8[hpBar->type].offset + 0x20 + imgProxy->vramLocation.baseAddrOfVram[NNS_G2D_VRAM_TYPE_2DMAIN]), 0x20); - src = ov12_02265B58(71); + src = BattleHpBar_Util_GetComponentRawGraphic(71); MI_CpuCopy16(src, (void *)((u32)vramBaseAddr + ov12_0226D3D8[hpBar->type].offset + 0x20 + imgProxy->vramLocation.baseAddrOfVram[NNS_G2D_VRAM_TYPE_2DMAIN]), 0x20); - src = ov12_02265B58(69); + src = BattleHpBar_Util_GetComponentRawGraphic(69); MI_CpuCopy16(src, (void *)((u32)vramBaseAddr + ov12_0226D408[hpBar->type].offset + imgProxy->vramLocation.baseAddrOfVram[NNS_G2D_VRAM_TYPE_2DMAIN]), ov12_0226D408[hpBar->type].size); ov12_0226498C(hpBar, hpBar->hp, 6); } else { - src = ov12_02265B58(66); + src = BattleHpBar_Util_GetComponentRawGraphic(66); MI_CpuCopy16(src, (void *)((u32)vramBaseAddr + ov12_0226D3A8[hpBar->type].offset + imgProxy->vramLocation.baseAddrOfVram[NNS_G2D_VRAM_TYPE_2DMAIN]), ov12_0226D3A8[hpBar->type].size); - src = ov12_02265B58(68); + src = BattleHpBar_Util_GetComponentRawGraphic(68); MI_CpuCopy16(src, (void *)((u32)vramBaseAddr + ov12_0226D3D8[hpBar->type].offset + imgProxy->vramLocation.baseAddrOfVram[NNS_G2D_VRAM_TYPE_2DMAIN]), ov12_0226D3D8[hpBar->type].size); - src = ov12_02265B58(38); + src = BattleHpBar_Util_GetComponentRawGraphic(38); MI_CpuCopy16(src, (void *)((u32)vramBaseAddr + ov12_0226D3D8[hpBar->type].offset + 0x20 + imgProxy->vramLocation.baseAddrOfVram[NNS_G2D_VRAM_TYPE_2DMAIN]), 0x20); ov12_0226498C(hpBar, hpBar->hp, 1); } @@ -854,7 +860,7 @@ static void ov12_02264F44(BattleHpBar *hpBar, int x, int y) { GF_ASSERT(hpBar->unk4 != NULL); - r4 = ov12_02265BB8(hpBar->type); + r4 = BattleHpBar_Util_GetHpBoxSpriteTemplate(hpBar->type); Sprite_SetPositionXY(hpBar->unk4->sprite, r4->x + x, r4->y + y); if (hpBar->unk8 != NULL) { @@ -878,7 +884,7 @@ _02264F56: add r0, r5, #0 add r0, #0x25 ldrb r0, [r0, #0] - bl ov12_02265BB8 + bl BattleHpBar_Util_GetHpBoxSpriteTemplate add r4, r0, #0 mov r1, #0 mov r2, #2 @@ -951,7 +957,7 @@ static void ov12_02265054(SysTask *task, void *data) { int r4; r4 = 0; - r6 = ov12_02265BB8(hpBar->type); + r6 = BattleHpBar_Util_GetHpBoxSpriteTemplate(hpBar->type); UnkImageStruct_GetSpritePositionXY(hpBar->unk4, &x, &y); switch (hpBar->type) { @@ -1011,7 +1017,7 @@ asm static void ov12_02265054(SysTask *task, void *data) { add r0, #0x25 ldrb r0, [r0, #0] mov r4, #0 - bl ov12_02265BB8 + bl BattleHpBar_Util_GetHpBoxSpriteTemplate add r6, r0, #0 add r1, sp, #0 ldr r0, [r5, #4] @@ -1208,8 +1214,8 @@ static void ov12_022652D0(BattleHpBar *hpBar) { r0 = 76; r4 = 64; } - const u8 *sp0 = ov12_02265B58(r0); - const u8 *r7 = ov12_02265B58(r4); + const u8 *sp0 = BattleHpBar_Util_GetComponentRawGraphic(r0); + const u8 *r7 = BattleHpBar_Util_GetComponentRawGraphic(r4); NNSG2dImageProxy *imgProxy = Sprite_GetImageProxy(hpBar->unk4->sprite); void *vramAddr = G2_GetOBJCharPtr(); MI_CpuCopy16(r7, (void *)((u32)vramAddr + ov12_0226D4B0[hpBar->type][0].offset + imgProxy->vramLocation.baseAddrOfVram[NNS_G2D_VRAM_TYPE_2DMAIN]), ov12_0226D4B0[hpBar->type][0].size); @@ -1221,7 +1227,7 @@ static void ov12_02265354(BattleHpBar *hpBar) { u8 *r4 = AllocFromHeap(HEAP_ID_BATTLE, 0x60); u8 *r7 = AllocFromHeap(HEAP_ID_BATTLE, 0xC0); MI_CpuFill8(r4, 0xFF, 0x60); - sub_0200CEB0(BattleSystem_GetLevelNumPrinter(hpBar->bsys), hpBar->unk48, 3, PRINTING_MODE_LEFT_ALIGN, (void *)r4); + sub_0200CEB0(BattleSystem_GetLevelNumPrinter(hpBar->bsys), hpBar->level, 3, PRINTING_MODE_LEFT_ALIGN, (void *)r4); NNSG2dImageProxy *imgProxy = Sprite_GetImageProxy(hpBar->unk4->sprite); void *vramAddr = G2_GetOBJCharPtr(); MI_CpuCopy16((void *)((u32)vramAddr + ov12_0226D420[hpBar->type][0].offset + imgProxy->vramLocation.baseAddrOfVram[NNS_G2D_VRAM_TYPE_2DMAIN]), r7, ov12_0226D420[hpBar->type][0].size); @@ -1269,9 +1275,9 @@ static void ov12_02265500(BattleHpBar *hpBar) { static void ov12_02265560(BattleHpBar *hpBar) { const u8 *r4; if (hpBar->unk4B == 1) { - r4 = ov12_02265B58(59); + r4 = BattleHpBar_Util_GetComponentRawGraphic(59); } else { - r4 = ov12_02265B58(38); + r4 = BattleHpBar_Util_GetComponentRawGraphic(38); } NNSG2dImageProxy *imgProxy = Sprite_GetImageProxy(hpBar->unk4->sprite); void *vramAddr = G2_GetOBJCharPtr(); @@ -1280,14 +1286,14 @@ static void ov12_02265560(BattleHpBar *hpBar) { } static void ov12_022655B0(BattleHpBar *hpBar, int a1) { - const u8 *r4 = ov12_02265B58(a1); + const u8 *r4 = BattleHpBar_Util_GetComponentRawGraphic(a1); NNSG2dImageProxy *imgProxy = Sprite_GetImageProxy(hpBar->unk4->sprite); void *vramAddr = G2_GetOBJCharPtr(); MI_CpuCopy16(r4, (void *)((u32)vramAddr + ov12_0226D390[hpBar->type].offset + imgProxy->vramLocation.baseAddrOfVram[NNS_G2D_VRAM_TYPE_2DMAIN]), ov12_0226D390[hpBar->type].size); } -static void ov12_022655F0(BattleHpBar *hpBar, u32 flag) { +static void BattleHpBar_PrintSafariOrParkBallsString(BattleHpBar *hpBar, u32 flag) { BgConfig *bgConfig; u8 *windowBuf; NNSG2dImageProxy *imgProxy; @@ -1326,7 +1332,7 @@ static void ov12_022655F0(BattleHpBar *hpBar, u32 flag) { String_Delete(string); } -static void ov12_022656CC(BattleHpBar *hpBar, u32 flag) { +static void BattleHpBar_PrintNumRemainingSafariOrParkBalls(BattleHpBar *hpBar, u32 flag) { BgConfig *bgConfig; u8 *windowBuf; NNSG2dImageProxy *imgProxy; @@ -1372,22 +1378,24 @@ static void ov12_022656CC(BattleHpBar *hpBar, u32 flag) { String_Delete(string2); } -static int ov12_022657E4(BattleHpBar *hpBar, BOOL a1) { +static int ov12_022657E4(BattleHpBar *hpBar, BOOL isExp) { int ret; - if (!a1) { - ret = ov12_022659E0(hpBar->maxHp, hpBar->hp, hpBar->gainedHp, &hpBar->hpCalc, 6, 1); + if (isExp == FALSE) { + ret = BattleHpBar_CalculatePixelsChangeFrame(hpBar->maxHp, hpBar->hp, hpBar->gainedHp, &hpBar->hpCalc, 6, 1); } else { - int denom = ov12_02265B18(hpBar->exp, hpBar->gainedExp, hpBar->maxExp, 12); + // Supposedly this will make the exp bar move at a consistent speed regardless of the gauge size. + int denom = BattleHpBar_Util_GetPixelsToGain(hpBar->exp, hpBar->gainedExp, hpBar->maxExp, 12); if (denom == 0) { denom = 1; } - ret = ov12_022659E0(hpBar->maxExp, hpBar->exp, hpBar->gainedExp, &hpBar->expCalc, 12, abs(hpBar->gainedExp / denom)); + ret = BattleHpBar_CalculatePixelsChangeFrame(hpBar->maxExp, hpBar->exp, hpBar->gainedExp, &hpBar->expCalc, 12, abs(hpBar->gainedExp / denom)); } - if (a1 || hpBar->unk_4F_3 != TRUE) { - ov12_02265878(hpBar, a1); + if (isExp != FALSE || hpBar->unk_4F_3 != TRUE) { + ov12_02265878(hpBar, isExp); } if (ret == -1) { - if (!a1) { + // we done + if (isExp == FALSE) { hpBar->hpCalc = 0; } else { hpBar->expCalc = 0; @@ -1396,119 +1404,125 @@ static int ov12_022657E4(BattleHpBar *hpBar, BOOL a1) { return ret; } -static void ov12_02265878(BattleHpBar *hpBar, u8 a1) { +static void ov12_02265878(BattleHpBar *hpBar, u8 isExp) { u8 i; - u8 sp10[12]; + u8 pixelBuffer[12]; u8 tmp; - const u8 *spC; + const u8 *src; void *vramAddr; NNSG2dImageProxy *imgProxy; - int r7; + int sizeTop; vramAddr = G2_GetOBJCharPtr(); imgProxy = Sprite_GetImageProxy(hpBar->unk4->sprite); - switch (a1) { - case 0: - switch (sub_02088080(ov12_02265A9C(hpBar->maxHp, hpBar->hp, hpBar->gainedHp, &hpBar->hpCalc, sp10, 6), 0x30)) { - case 3: + switch (isExp) { + case FALSE: + // hp + switch (HpBar_GetColorIdx(BattleHpBar_Util_MakeHpBarPixelBuffer(hpBar->maxHp, hpBar->hp, hpBar->gainedHp, &hpBar->hpCalc, pixelBuffer, 6), 0x30)) { + case 3: // Green tmp = 2; break; - case 2: + case 2: // Yellow tmp = 11; break; - case 1: + case 1: // Red default: tmp = 20; break; } - spC = ov12_02265B58(tmp); - r7 = ov12_0226D480[hpBar->type][0].size / 32; + src = BattleHpBar_Util_GetComponentRawGraphic(tmp); + sizeTop = ov12_0226D480[hpBar->type][0].size / 32; for (i = 0; i < 6; ++i) { - if (i < r7) { - MI_CpuCopy16(spC + sp10[i] * 32, (void *)((u32)vramAddr + ov12_0226D480[hpBar->type][0].offset + i * 32 + imgProxy->vramLocation.baseAddrOfVram[NNS_G2D_VRAM_TYPE_2DMAIN]), 0x20); + if (i < sizeTop) { + MI_CpuCopy16(src + pixelBuffer[i] * 32, (void *)((u32)vramAddr + ov12_0226D480[hpBar->type][0].offset + i * 32 + imgProxy->vramLocation.baseAddrOfVram[NNS_G2D_VRAM_TYPE_2DMAIN]), 0x20); } else { - MI_CpuCopy16(spC + sp10[i] * 32, (void *)((u32)vramAddr + ov12_0226D480[hpBar->type][1].offset + (i - r7) * 32 + imgProxy->vramLocation.baseAddrOfVram[NNS_G2D_VRAM_TYPE_2DMAIN]), 0x20); + MI_CpuCopy16(src + pixelBuffer[i] * 32, (void *)((u32)vramAddr + ov12_0226D480[hpBar->type][1].offset + (i - sizeTop) * 32 + imgProxy->vramLocation.baseAddrOfVram[NNS_G2D_VRAM_TYPE_2DMAIN]), 0x20); } } break; - case 1: - ov12_02265A9C(hpBar->maxExp, hpBar->exp, hpBar->gainedExp, &hpBar->expCalc, sp10, 12); - if (hpBar->unk48 == 100) { + case TRUE: + // exp + BattleHpBar_Util_MakeHpBarPixelBuffer(hpBar->maxExp, hpBar->exp, hpBar->gainedExp, &hpBar->expCalc, pixelBuffer, 12); + if (hpBar->level == 100) { + // Don't fill an exp bar for a level 100 mon for (i = 0; i < 12; ++i) { - sp10[i] = 0; + pixelBuffer[i] = 0; } } - spC = ov12_02265B58(29); + src = BattleHpBar_Util_GetComponentRawGraphic(29); for (i = 0; i < 12; ++i) { if (i < 5) { - MI_CpuCopy16(spC + sp10[i] * 32, (void *)((u32)vramAddr + 0x660 + i * 32 + imgProxy->vramLocation.baseAddrOfVram[NNS_G2D_VRAM_TYPE_2DMAIN]), 0x20); + MI_CpuCopy16(src + pixelBuffer[i] * 32, (void *)((u32)vramAddr + 0x660 + i * 32 + imgProxy->vramLocation.baseAddrOfVram[NNS_G2D_VRAM_TYPE_2DMAIN]), 0x20); } else { - MI_CpuCopy16(spC + sp10[i] * 32, (void *)((u32)vramAddr + 0xE00 + (i - 5) * 32 + imgProxy->vramLocation.baseAddrOfVram[NNS_G2D_VRAM_TYPE_2DMAIN]), 0x20); + MI_CpuCopy16(src + pixelBuffer[i] * 32, (void *)((u32)vramAddr + 0xE00 + (i - 5) * 32 + imgProxy->vramLocation.baseAddrOfVram[NNS_G2D_VRAM_TYPE_2DMAIN]), 0x20); } } break; } } -static int ov12_022659E0(s32 maxHp, s32 curHp, s32 deltaHp, s32 *pHpCalc, u8 a4, u16 a5) { - s32 r4; +static int BattleHpBar_CalculatePixelsChangeFrame(s32 maxHp, s32 curHp, s32 deltaHp, s32 *pHpCalc, u8 tilesWide, u16 hpChange) { + s32 nowHp; s32 ret; - u8 r2; - s32 r0; + u8 pixelsWide; + s32 hpPerPixel; - r2 = a4 * 8; + pixelsWide = tilesWide * 8; if (*pHpCalc == 0x80000000) { - if (maxHp < r2) { + // Initialize + if (USE_SUBPIXELS_TEST) { *pHpCalc = curHp << 8; } else { *pHpCalc = curHp; } } - r4 = curHp - deltaHp; - if (r4 < 0) { - r4 = 0; - } else if (r4 > maxHp) { - r4 = maxHp; + nowHp = curHp - deltaHp; + if (nowHp < 0) { + nowHp = 0; + } else if (nowHp > maxHp) { + nowHp = maxHp; } - if (maxHp < r2) { - if (r4 == (*pHpCalc >> 8) && (*pHpCalc & 0xFF) == 0) { + if (USE_SUBPIXELS_TEST) { + // Use subpixel mode + if (nowHp == (*pHpCalc >> 8) && (*pHpCalc & 0xFF) == 0) { return -1; } } else { - if (r4 == *pHpCalc) { + // Use integer pixel mode + if (nowHp == *pHpCalc) { return -1; } } - if (maxHp < r2) { - r0 = (maxHp << 8) / r2; + if (USE_SUBPIXELS_TEST) { + hpPerPixel = (maxHp << 8) / pixelsWide; if (deltaHp < 0) { - *pHpCalc += r0; + *pHpCalc += hpPerPixel; ret = *pHpCalc >> 8; - if (ret >= r4) { - *pHpCalc = r4 << 8; - ret = r4; + if (ret >= nowHp) { + *pHpCalc = nowHp << 8; + ret = nowHp; } } else { - *pHpCalc -= r0; + *pHpCalc -= hpPerPixel; ret = *pHpCalc >> 8; if ((*pHpCalc & 0xFF) > 0) { ++ret; } - if (ret <= r4) { - *pHpCalc = r4 << 8; - ret = r4; + if (ret <= nowHp) { + *pHpCalc = nowHp << 8; + ret = nowHp; } } } else { if (deltaHp < 0) { - *pHpCalc += a5; - if (*pHpCalc > r4) { - *pHpCalc = r4; + *pHpCalc += hpChange; + if (*pHpCalc > nowHp) { + *pHpCalc = nowHp; } } else { - *pHpCalc -= a5; - if (*pHpCalc < r4) { - *pHpCalc = r4; + *pHpCalc -= hpChange; + if (*pHpCalc < nowHp) { + *pHpCalc = nowHp; } } ret = *pHpCalc; @@ -1516,39 +1530,39 @@ static int ov12_022659E0(s32 maxHp, s32 curHp, s32 deltaHp, s32 *pHpCalc, u8 a4, return ret; } -static u8 ov12_02265A9C(s32 maxHp, s32 hp, s32 deltaHp, s32 *pHpCalc, u8 *a4, u8 a5) { +static u8 BattleHpBar_Util_MakeHpBarPixelBuffer(s32 maxHp, s32 hp, s32 deltaHp, s32 *pHpCalc, u8 *pixelBuf, u8 tilesWide) { int i; - int r7; - u32 r2; - u32 r0; + int targetHp; + u32 pixelsWide; + u32 curPixels; u32 ret; - r7 = hp - deltaHp; - if (r7 < 0) { - r7 = 0; - } else if (r7 > maxHp) { - r7 = maxHp; + targetHp = hp - deltaHp; + if (targetHp < 0) { + targetHp = 0; + } else if (targetHp > maxHp) { + targetHp = maxHp; } - r2 = a5 * 8; - for (i = 0; i < a5; ++i) { - a4[i] = 0; + pixelsWide = tilesWide * 8; + for (i = 0; i < tilesWide; ++i) { + pixelBuf[i] = 0; } - if (maxHp < r2) { - r0 = (*pHpCalc * r2 / maxHp) >> 8; + if (USE_SUBPIXELS_TEST) { + curPixels = (*pHpCalc * pixelsWide / maxHp) >> 8; } else { - r0 = *pHpCalc * r2 / maxHp; + curPixels = *pHpCalc * pixelsWide / maxHp; } - ret = r0; - if (r0 == 0 && r7 > 0) { - a4[0] = 1; - ret = 1; + ret = curPixels; + if (curPixels == 0 && targetHp > 0) { + pixelBuf[0] = 1; + ret = 1; } else { - for (i = 0; i < a5; ++i) { - if (r0 >= 8) { - a4[i] = 8; - r0 -= 8; + for (i = 0; i < tilesWide; ++i) { + if (curPixels >= 8) { + pixelBuf[i] = 8; + curPixels -= 8; } else { - a4[i] = r0; + pixelBuf[i] = curPixels; break; } } @@ -1556,78 +1570,78 @@ static u8 ov12_02265A9C(s32 maxHp, s32 hp, s32 deltaHp, s32 *pHpCalc, u8 *a4, u8 return ret; } -static u32 ov12_02265B18(s32 exp, s32 gainedExp, s32 maxExp, u8 a3) { - s8 r7, r0; - u8 r6; - s32 r4; +static u32 BattleHpBar_Util_GetPixelsToGain(s32 exp, s32 gainedExp, s32 maxExp, u8 tilesWide) { + s8 curPixels, targetPixels; + u8 pixelsWide; + s32 targetExp; - r6 = a3 * 8; + pixelsWide = tilesWide * 8; - r4 = exp - gainedExp; - if (r4 < 0) { - r4 = 0; - } else if (r4 > maxExp) { - r4 = maxExp; + targetExp = exp - gainedExp; + if (targetExp < 0) { + targetExp = 0; + } else if (targetExp > maxExp) { + targetExp = maxExp; } - r7 = exp * r6 / maxExp; - r0 = r4 * r6 / maxExp; - return abs(r7 - r0); + curPixels = exp * pixelsWide / maxExp; + targetPixels = targetExp * pixelsWide / maxExp; + return abs(curPixels - targetPixels); } -static const u8 *ov12_02265B58(int a0) { - return ov12_0226D6E0 + a0 * 32; +static const u8 *BattleHpBar_Util_GetComponentRawGraphic(int componentId) { + return gBattleHpBar_RawGraphicComponents + componentId * 32; } -u8 ov12_02265B64(u8 a0, u32 battleType) { - switch (a0) { +u8 BattleHpBar_Util_GetBarTypeFromBattlerSide(u8 bside, u32 battleType) { + switch (bside) { case 0: if (battleType & BATTLE_TYPE_PAL_PARK) { - return 7; + return HP_BAR_TYPE_PALPARK; } if (battleType & BATTLE_TYPE_SAFARI) { - return 6; + return HP_BAR_TYPE_SAFARI; } - return 0; + return HP_BAR_TYPE_SINGLE_PLAYER; case 1: - return 1; + return HP_BAR_TYPE_SINGLE_ENEMY; case 2: - return 2; + return HP_BAR_TYPE_DOUBLE_PLAYER_LHS; case 3: - return 3; + return HP_BAR_TYPE_DOUBLE_ENEMY_LHS; case 4: - return 4; + return HP_BAR_TYPE_DOUBLE_PLAYER_RHS; case 5: - return 5; + return HP_BAR_TYPE_DOUBLE_ENEMY_RHS; default: GF_ASSERT(FALSE); - return 0; + return HP_BAR_TYPE_SINGLE_PLAYER; } } -static const UnkTemplate_0200D748 *ov12_02265BB8(u8 barType) { +static const UnkTemplate_0200D748 *BattleHpBar_Util_GetHpBoxSpriteTemplate(u8 barType) { const UnkTemplate_0200D748 *ret; switch (barType) { - case 0: - ret = &ov12_0226D5E4; + case HP_BAR_TYPE_SINGLE_PLAYER: + ret = &sSpriteTemplate_HpBarSinglePlayer; break; - case 1: - ret = &ov12_0226D618; + case HP_BAR_TYPE_SINGLE_ENEMY: + ret = &sSpriteTemplate_HpBarSingleEnemy; break; - case 2: - ret = &ov12_0226D4E0; + case HP_BAR_TYPE_DOUBLE_PLAYER_LHS: + ret = &sSpriteTemplate_HpBarDoublePlayerLHS; break; - case 3: - ret = &ov12_0226D514; + case HP_BAR_TYPE_DOUBLE_ENEMY_LHS: + ret = &sSpriteTemplate_HpBarDoubleEnemyLHS; break; - case 4: - ret = &ov12_0226D57C; + case HP_BAR_TYPE_DOUBLE_PLAYER_RHS: + ret = &sSpriteTemplate_HpBarDoublePlayerRHS; break; - case 5: - ret = &ov12_0226D64C; + case HP_BAR_TYPE_DOUBLE_ENEMY_RHS: + ret = &sSpriteTemplate_HpBarDoubleEnemyRHS; break; - case 6: - case 7: - ret = &ov12_0226D5B0; + case HP_BAR_TYPE_SAFARI: + case HP_BAR_TYPE_PALPARK: + ret = &sSpriteTemplate_HpBarSafariOrPark; break; default: GF_ASSERT(FALSE); @@ -1636,17 +1650,17 @@ static const UnkTemplate_0200D748 *ov12_02265BB8(u8 barType) { return ret; } -static const UnkTemplate_0200D748 *ov12_02265C1C(u8 barType) { +static const UnkTemplate_0200D748 *BattleHpBar_Util_GetArrowSpriteTemplate(u8 barType) { switch (barType) { - case 0: - case 2: - case 4: - case 6: - case 7: - return &ov12_0226D548; - case 1: - case 3: - case 5: + case HP_BAR_TYPE_SINGLE_PLAYER: + case HP_BAR_TYPE_DOUBLE_PLAYER_LHS: + case HP_BAR_TYPE_DOUBLE_PLAYER_RHS: + case HP_BAR_TYPE_SAFARI: + case HP_BAR_TYPE_PALPARK: + return &sSpriteTemplate_Arrow; + case HP_BAR_TYPE_SINGLE_ENEMY: + case HP_BAR_TYPE_DOUBLE_ENEMY_LHS: + case HP_BAR_TYPE_DOUBLE_ENEMY_RHS: return NULL; default: GF_ASSERT(FALSE); @@ -1654,56 +1668,56 @@ static const UnkTemplate_0200D748 *ov12_02265C1C(u8 barType) { } } -typedef struct UnkStruct_ov12_02265C54 { +typedef struct BattleHpBarExpBarFullFlashEffectTaskData { BattleHpBar *hpBar; - u8 *unk_4; - u8 unk_8; - u8 unk_9; - s8 unk_A; -} UnkStruct_ov12_02265C54; + u8 *pDoneFlag; + u8 state; + u8 plttNum; + s8 ev; +} BattleHpBarExpBarFullFlashEffectTaskData; -SysTask *ov12_02265C54(BattleHpBar *hpBar, u8 *a1) { - *a1 = 0; - UnkStruct_ov12_02265C54 *taskData = AllocFromHeap(HEAP_ID_BATTLE, sizeof(UnkStruct_ov12_02265C54)); - MI_CpuFill8(taskData, 0, sizeof(UnkStruct_ov12_02265C54)); - taskData->hpBar = hpBar; - taskData->unk_4 = a1; - return SysTask_CreateOnMainQueue(ov12_02265C88, taskData, 1000); +SysTask *BattleHpBar_BeginExpBarFullFlashEffect(BattleHpBar *hpBar, u8 *a1) { + *a1 = 0; + BattleHpBarExpBarFullFlashEffectTaskData *taskData = AllocFromHeap(HEAP_ID_BATTLE, sizeof(BattleHpBarExpBarFullFlashEffectTaskData)); + MI_CpuFill8(taskData, 0, sizeof(BattleHpBarExpBarFullFlashEffectTaskData)); + taskData->hpBar = hpBar; + taskData->pDoneFlag = a1; + return SysTask_CreateOnMainQueue(Task_ExpBarFullFlash, taskData, 1000); } -static void ov12_02265C88(SysTask *task, void *data) { - UnkStruct_ov12_02265C54 *taskData = data; - SpriteGfxHandler *gfxHandler = ov12_0223A8EC(taskData->hpBar->bsys); +static void Task_ExpBarFullFlash(SysTask *task, void *data) { + BattleHpBarExpBarFullFlashEffectTaskData *taskData = data; + SpriteGfxHandler *gfxHandler = ov12_0223A8EC(taskData->hpBar->bsys); int plttNum; PaletteData *plttData = BattleSystem_GetPaletteData(taskData->hpBar->bsys); - switch (taskData->unk_8) { + switch (taskData->state) { case 0: - plttNum = sub_0200D944(gfxHandler, 20007, NNS_G2D_VRAM_TYPE_2DMAIN); + plttNum = GfGfxHandler_GetPlttNumById(gfxHandler, 20007, NNS_G2D_VRAM_TYPE_2DMAIN); UnkImageStruct_SetSpritePalIndex(taskData->hpBar->unk4, plttNum); - taskData->unk_9 = plttNum; - ++taskData->unk_8; + taskData->plttNum = plttNum; + ++taskData->state; // break; case 1: - taskData->unk_A += 2; - if (taskData->unk_A >= 10) { - taskData->unk_A = 10; - ++taskData->unk_8; + taskData->ev += 2; + if (taskData->ev >= 10) { + taskData->ev = 10; + ++taskData->state; } - PaletteData_BlendPalette(plttData, PLTTBUF_MAIN_OBJ, 16 * taskData->unk_9, 0x10, taskData->unk_A, RGB(5, 29, 28)); + PaletteData_BlendPalette(plttData, PLTTBUF_MAIN_OBJ, 16 * taskData->plttNum, 0x10, taskData->ev, RGB(5, 29, 28)); break; case 2: - taskData->unk_A -= 2; - if (taskData->unk_A <= 0) { - taskData->unk_A = 0; - ++taskData->unk_8; + taskData->ev -= 2; + if (taskData->ev <= 0) { + taskData->ev = 0; + ++taskData->state; } - PaletteData_BlendPalette(plttData, PLTTBUF_MAIN_OBJ, 16 * taskData->unk_9, 0x10, taskData->unk_A, RGB(5, 29, 28)); + PaletteData_BlendPalette(plttData, PLTTBUF_MAIN_OBJ, 16 * taskData->plttNum, 0x10, taskData->ev, RGB(5, 29, 28)); break; default: - plttNum = sub_0200D944(gfxHandler, 20006, NNS_G2D_VRAM_TYPE_2DMAIN); + plttNum = GfGfxHandler_GetPlttNumById(gfxHandler, 20006, NNS_G2D_VRAM_TYPE_2DMAIN); UnkImageStruct_SetSpritePalIndex(taskData->hpBar->unk4, plttNum); - *taskData->unk_4 = 1; + *taskData->pDoneFlag = 1; FreeToHeap(taskData); SysTask_Destroy(task); break; diff --git a/src/battle/battle_hp_bar_data.h b/src/battle/battle_hp_bar_data.h index fab868731..b707d3b52 100644 --- a/src/battle/battle_hp_bar_data.h +++ b/src/battle/battle_hp_bar_data.h @@ -2,7 +2,7 @@ // clang-format off -ALIGN(4) const u8 ov12_0226D6E0[] = { +ALIGN(4) const u8 gBattleHpBar_RawGraphicComponents[] = { // 0x00 0xE3, 0xEE, 0xEE, 0xEE, 0xEE, 0x88, 0x8E, 0xE8, 0xEE, 0x88, 0x8E, 0xE8, 0xEE, 0x88, 0x88, 0xE8, 0xEE, 0x88, 0x8E, 0xE8, 0xEE, 0x88, 0x8E, 0xE8, 0xE3, 0xEE, 0xEE, 0xEE, 0x32, 0x33, 0x33, 0x33, // 0x01 diff --git a/src/battle/battle_system.c b/src/battle/battle_system.c index 822c89d1c..5c9276a5b 100644 --- a/src/battle/battle_system.c +++ b/src/battle/battle_system.c @@ -1042,7 +1042,7 @@ void BattleSystem_HpBar_Init(BattleSystem *bsys) { for (i = 0; i < bsys->maxBattlers; i++) { hpBar = OpponentData_GetHpBar(bsys->opponentData[i]); hpBar->bsys = bsys; - hpBar->type = ov12_02265B64(ov12_02261258(bsys->opponentData[i]), BattleSystem_GetBattleType(bsys)); + hpBar->type = BattleHpBar_Util_GetBarTypeFromBattlerSide(ov12_02261258(bsys->opponentData[i]), BattleSystem_GetBattleType(bsys)); BattleHpBar_LoadResources(hpBar); BattleHpBar_SetEnabled(hpBar, FALSE); } diff --git a/src/choose_starter_app.c b/src/choose_starter_app.c index a470d4dcc..7c05dd211 100644 --- a/src/choose_starter_app.c +++ b/src/choose_starter_app.c @@ -1201,7 +1201,7 @@ static void loadOneMonObj(GF_2DGfxResMan *charResMan, GF_2DGfxResMan *plttResMan sub_0200ADA4(charResObj); sub_0200B00C(plttResObj); charProxy = sub_0200AF00(charResObj); - plttProxy = sub_0200B0F8(plttResObj, charProxy); + plttProxy = GF_PlttResObj_GetPlttProxy(plttResObj, charProxy); imageloc = NNS_G2dGetImageLocation(charProxy, NNS_G2D_VRAM_TYPE_2DSUB); plttloc = NNS_G2dGetImagePaletteLocation(plttProxy, NNS_G2D_VRAM_TYPE_2DSUB); DC_FlushRange(charData, 0xC80); diff --git a/src/credits/credits.c b/src/credits/credits.c index e253d0edc..4dbe2b42c 100644 --- a/src/credits/credits.c +++ b/src/credits/credits.c @@ -930,7 +930,7 @@ static void LoadCutsceneSpriteResources(CreditsAppWork *work) { GF_2DGfxResObj *charResObj = work->cutsceneRsrs[i].charResObj; GF_2DGfxResObj *plttResObj = work->cutsceneRsrs[i].plttResObj; NNSG2dImageProxy *imageProxy = sub_0200AF00(charResObj); - NNSG2dImagePaletteProxy *plttProxy = sub_0200B0F8(plttResObj, imageProxy); + NNSG2dImagePaletteProxy *plttProxy = GF_PlttResObj_GetPlttProxy(plttResObj, imageProxy); cutsceneWork->spriteGfx[i].imageProxy = imageProxy; cutsceneWork->spriteGfx[i].plttProxy = plttProxy; diff --git a/src/unk_02009D48.c b/src/unk_02009D48.c index 670f5e059..769b8134f 100644 --- a/src/unk_02009D48.c +++ b/src/unk_02009D48.c @@ -54,7 +54,7 @@ void CreateSpriteResourcesHeader(struct SpriteResourcesHeader *hdr, int charId, GF_ASSERT(proxy != NULL); hdr->charData = NULL; } - hdr->plttProxy = sub_0200B0F8(plttObj, proxy); + hdr->plttProxy = GF_PlttResObj_GetPlttProxy(plttObj, proxy); hdr->imageProxy = proxy; hdr->cellData = GF2DGfxResObj_GetCellDataPtr(cellObj); if (cellAnmObj != NULL) { diff --git a/src/unk_0200ACF0.c b/src/unk_0200ACF0.c index eaf255c2f..a1da95c7d 100644 --- a/src/unk_0200ACF0.c +++ b/src/unk_0200ACF0.c @@ -198,7 +198,7 @@ void sub_0200B0CC(GF_2DGfxResObjList *plttResObjList) { } } -NNSG2dImagePaletteProxy *sub_0200B0F8(GF_2DGfxResObj *plttResObj, NNSG2dImageProxy *imageProxy) { +NNSG2dImagePaletteProxy *GF_PlttResObj_GetPlttProxy(GF_2DGfxResObj *plttResObj, NNSG2dImageProxy *imageProxy) { GF_ASSERT(plttResObj != NULL); GF_ASSERT(GF2DGfxResObj_GetResType(plttResObj) == GF_GFX_RES_TYPE_PLTT); @@ -210,8 +210,8 @@ NNSG2dImagePaletteProxy *sub_0200B0F8(GF_2DGfxResObj *plttResObj, NNSG2dImagePro } } -int sub_0200B12C(GF_2DGfxResObj *plttResObj, NNS_G2D_VRAM_TYPE vram) { - NNSG2dImagePaletteProxy *plttProxy = sub_0200B0F8(plttResObj, NULL); +int GF_PlttResObj_GetVramSlotNum(GF_2DGfxResObj *plttResObj, NNS_G2D_VRAM_TYPE vram) { + NNSG2dImagePaletteProxy *plttProxy = GF_PlttResObj_GetPlttProxy(plttResObj, NULL); int location = NNS_G2dGetImagePaletteLocation(plttProxy, vram); if (location != -1) { location /= 32; diff --git a/src/unk_0200CF18.c b/src/unk_0200CF18.c index 4e9cbf452..006ee7c57 100644 --- a/src/unk_0200CF18.c +++ b/src/unk_0200CF18.c @@ -345,7 +345,7 @@ s8 SpriteRenderer_LoadPlttResObjFromNarcId(SpriteRenderer *renderer, SpriteGfxHa if (obj != NULL) { GF_ASSERT(sub_0200B00C(obj) == TRUE); MyInsertResObjIntoList(gfxHandler->_2dGfxResObjList[GF_GFX_RES_TYPE_PLTT], obj); - return sub_0200B12C(obj, vram); + return GF_PlttResObj_GetVramSlotNum(obj, vram); } GF_ASSERT(0); return -1; @@ -359,7 +359,7 @@ s8 SpriteRenderer_LoadPlttResObjFromOpenNarc(SpriteRenderer *renderer, SpriteGfx if (obj != NULL) { GF_ASSERT(sub_0200B00C(obj) == TRUE); MyInsertResObjIntoList(gfxHandler->_2dGfxResObjList[GF_GFX_RES_TYPE_PLTT], obj); - return sub_0200B12C(obj, vram); + return GF_PlttResObj_GetVramSlotNum(obj, vram); } GF_ASSERT(0); return -1; @@ -487,12 +487,12 @@ static UnkImageStruct *MyLoadResourcesAndCreateSprite(SpriteRenderer *renderer, return ret; } -NNSG2dImagePaletteProxy *sub_0200D934(SpriteGfxHandler *gfxHandler, int id) { - return sub_0200B0F8(Get2DGfxResObjById(gfxHandler->_2dGfxResMan[GF_GFX_RES_TYPE_PLTT], id), NULL); +NNSG2dImagePaletteProxy *GfGfxHandler_GetPlttProxy(SpriteGfxHandler *gfxHandler, int id) { + return GF_PlttResObj_GetPlttProxy(Get2DGfxResObjById(gfxHandler->_2dGfxResMan[GF_GFX_RES_TYPE_PLTT], id), NULL); } -int sub_0200D944(SpriteGfxHandler *gfxHandler, int id, NNS_G2D_VRAM_TYPE vram) { - return sub_0200B12C(Get2DGfxResObjById(gfxHandler->_2dGfxResMan[GF_GFX_RES_TYPE_PLTT], id), vram); +int GfGfxHandler_GetPlttNumById(SpriteGfxHandler *gfxHandler, int id, NNS_G2D_VRAM_TYPE vram) { + return GF_PlttResObj_GetVramSlotNum(Get2DGfxResObjById(gfxHandler->_2dGfxResMan[GF_GFX_RES_TYPE_PLTT], id), vram); } BOOL SpriteGfxHandler_UnloadCharObjById(SpriteGfxHandler *gfxHandler, u32 character) { diff --git a/src/unk_0208805C.c b/src/unk_0208805C.c index c4d4a52d8..d7e95894f 100644 --- a/src/unk_0208805C.c +++ b/src/unk_0208805C.c @@ -35,15 +35,15 @@ u8 CalculateHpBarPixelsLength(u32 hp, u32 maxHp, u8 pixelsWide) { return ret; } -u8 sub_02088080(u32 hp, u32 pixelsWide) { - hp <<= 8; +u8 HpBar_GetColorIdx(u32 pixelsCur, u32 pixelsWide) { + pixelsCur <<= 8; pixelsWide <<= 8; - if (hp > pixelsWide / 2) { + if (pixelsCur > pixelsWide / 2) { return 3; // green - } else if (hp > pixelsWide / 5) { + } else if (pixelsCur > pixelsWide / 5) { return 2; // yellow - } else if (hp > 0) { + } else if (pixelsCur > 0) { return 1; // red } @@ -54,7 +54,7 @@ u8 CalculateHpBarColor(u16 hp, u16 maxHp, u32 pixelsWide) { if (hp == maxHp) { return 4; } - return sub_02088080(CalculateHpBarPixelsLength(hp, maxHp, pixelsWide), pixelsWide); + return HpBar_GetColorIdx(CalculateHpBarPixelsLength(hp, maxHp, pixelsWide), pixelsWide); } void sub_020880CC(u8 a0, HeapID heapId) {