summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Huderle <huderlem@gmail.com>2017-09-19 16:37:35 -0700
committerMarcus Huderle <huderlem@gmail.com>2017-09-19 16:37:35 -0700
commit38f06a72f86940d46abf3aa304f4b8d72398ea15 (patch)
treecf90af5c71591289956647202976cb29c80ca553
parent5d5f91e71b5dad8245415e3bc255b2567d56f3a7 (diff)
Decompile PartyMenuTryDrawHPBar
-rw-r--r--asm/party_menu.s41
-rw-r--r--include/party_menu.h2
-rw-r--r--src/choose_party.c1
-rw-r--r--src/party_menu.c30
4 files changed, 24 insertions, 50 deletions
diff --git a/asm/party_menu.s b/asm/party_menu.s
index 305111b2c..1fa1dd726 100644
--- a/asm/party_menu.s
+++ b/asm/party_menu.s
@@ -7212,45 +7212,4 @@ PartyMenuDrawHPBar: @ 806E630
bx r0
thumb_func_end PartyMenuDrawHPBar
- thumb_func_start PartyMenuTryDrawHPBar
-PartyMenuTryDrawHPBar: @ 806E674
- push {r4-r6,lr}
- adds r4, r1, 0
- lsls r0, 24
- lsrs r5, r0, 24
- adds r6, r5, 0
- adds r0, r4, 0
- movs r1, 0xB
- bl GetMonData
- cmp r0, 0
- beq _0806E6C0
- adds r0, r4, 0
- movs r1, 0x2D
- bl GetMonData
- cmp r0, 0
- bne _0806E6C0
- bl IsLinkDoubleBattle
- lsls r0, 24
- lsrs r0, 24
- cmp r0, 0x1
- bne _0806E6AE
- adds r0, r5, 0
- movs r1, 0x2
- adds r2, r4, 0
- bl PartyMenuDrawHPBar
- b _0806E6C0
-_0806E6AE:
- bl IsDoubleBattle
- adds r1, r0, 0
- lsls r1, 24
- lsrs r1, 24
- adds r0, r6, 0
- adds r2, r4, 0
- bl PartyMenuDrawHPBar
-_0806E6C0:
- pop {r4-r6}
- pop {r0}
- bx r0
- thumb_func_end PartyMenuTryDrawHPBar
-
.align 2, 0 @ Don't pad with nop.
diff --git a/include/party_menu.h b/include/party_menu.h
index 46063831a..dfd231081 100644
--- a/include/party_menu.h
+++ b/include/party_menu.h
@@ -112,6 +112,8 @@ void PartyMenuPrintMonsLevelOrStatus(void);
void PartyMenuDoPrintHP(u8, int, u16, u16);
void PartyMenuTryPrintMonsHP(void);
void nullsub_13(void);
+void PartyMenuDrawHPBar(u8 monIndex, u8 b, struct Pokemon *pokemon);
+void PartyMenuTryDrawHPBar(u8 monIndex, struct Pokemon *pokemon);
void PartyMenuDrawHPBars(void);
void SwapPokemon(struct Pokemon *a, struct Pokemon *b);
void SetPartyPopupMenuOffsets(u8 menuIndex, u8 *left, u8 *top, const struct PartyPopupMenu *menu);
diff --git a/src/choose_party.c b/src/choose_party.c
index 38533ba02..28d6a8c9d 100644
--- a/src/choose_party.c
+++ b/src/choose_party.c
@@ -72,7 +72,6 @@ extern void PartyMenuPutStatusTilemap(u8, int, u8);
extern void PartyMenuPrintLevel();
extern void PartyMenuPutNicknameTilemap();
extern void PrintPartyMenuMonNickname();
-extern void PartyMenuDrawHPBar();
extern bool8 sub_80F9344(void);
extern void sub_806D4AC();
extern void sub_806D3B4();
diff --git a/src/party_menu.c b/src/party_menu.c
index 294a1f2ed..5baa0f8f3 100644
--- a/src/party_menu.c
+++ b/src/party_menu.c
@@ -33,7 +33,6 @@
#include "main.h"
#include "battle_interface.h"
#include "species.h"
-#include "party_menu.h"
struct Unk201C000
{
@@ -85,7 +84,6 @@ extern const struct UnknownStruct5 gUnknown_08376BB4[][6];
static void sub_806E884(u8 taskId);
static void sub_8070D90(u8 taskId);
-void PartyMenuTryDrawHPBar(u8, struct Pokemon *);
/*
void sub_806AEDC(void)
@@ -112,6 +110,22 @@ void sub_806AEDC(void)
#endif
+void PartyMenuTryDrawHPBar(u8 monIndex, struct Pokemon *pokemon)
+{
+ if (GetMonData(pokemon, MON_DATA_SPECIES) && !GetMonData(pokemon, MON_DATA_IS_EGG))
+ {
+ u8 isDoubleBattle = IsLinkDoubleBattle();
+ if (isDoubleBattle == TRUE)
+ {
+ PartyMenuDrawHPBar(monIndex, 2, pokemon);
+ }
+ else
+ {
+ PartyMenuDrawHPBar(monIndex, IsDoubleBattle(), pokemon);
+ }
+ }
+}
+
void PartyMenuDrawHPBars(void)
{
u8 i;
@@ -1580,7 +1594,7 @@ void PrintNewStatsInLevelUpWindow(u8 taskId)
}
}
-void RedrawPokemonInfoInMenu(u8 a, struct Pokemon *pokemon)
+void RedrawPokemonInfoInMenu(u8 monIndex, struct Pokemon *pokemon)
{
u8 statusAndPkrs;
bool8 isDoubleBattle;
@@ -1591,7 +1605,7 @@ void RedrawPokemonInfoInMenu(u8 a, struct Pokemon *pokemon)
statusAndPkrs = GetMonStatusAndPokerus(pokemon);
if (statusAndPkrs == 0 || statusAndPkrs == 6)
{
- PartyMenuUpdateLevelOrStatus(pokemon, a);
+ PartyMenuUpdateLevelOrStatus(pokemon, monIndex);
}
isDoubleBattle = IsDoubleBattle();
@@ -1599,13 +1613,13 @@ void RedrawPokemonInfoInMenu(u8 a, struct Pokemon *pokemon)
currentHP = GetMonData(pokemon, MON_DATA_HP);
maxHP = GetMonData(pokemon, MON_DATA_MAX_HP);
- PartyMenuDoPrintHP(a, isDoubleBattle, currentHP, maxHP);
- PartyMenuTryDrawHPBar(a, pokemon);
+ PartyMenuDoPrintHP(monIndex, isDoubleBattle, currentHP, maxHP);
+ PartyMenuTryDrawHPBar(monIndex, pokemon);
- icon = GetMonIconSpriteId_maybe(ewram1C000.unk4, a);
+ icon = GetMonIconSpriteId_maybe(ewram1C000.unk4, monIndex);
SetMonIconAnim(icon, pokemon);
- task_pc_turn_off(&gUnknown_083769A8[IsDoubleBattle() * 12 + a * 2], 7);
+ task_pc_turn_off(&gUnknown_083769A8[IsDoubleBattle() * 12 + monIndex * 2], 7);
ewram1B000.unk261 = 2;
}