summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Huderle <huderlem@gmail.com>2017-09-17 20:43:34 -0700
committerMarcus Huderle <huderlem@gmail.com>2017-09-17 20:43:34 -0700
commitf2b5416c20ba48a09f590dd727e533177254b5c8 (patch)
treebf3dffb840341bf512e0cd8dd5c4ab01f45a8d84
parentc1c2015f7046676b043641c0d1f9d9e29bc73647 (diff)
Decompile PrintNewStatsInLevelUpWindow()
-rw-r--r--asm/party_menu.s88
-rw-r--r--include/party_menu.h8
-rw-r--r--src/party_menu.c49
3 files changed, 42 insertions, 103 deletions
diff --git a/asm/party_menu.s b/asm/party_menu.s
index ec6754b86..8f575f495 100644
--- a/asm/party_menu.s
+++ b/asm/party_menu.s
@@ -7448,94 +7448,6 @@ PartyMenuGetPopupMenuFunc: @ 806E81C
.section .text_8070968
- thumb_func_start sub_8070968
-sub_8070968: @ 8070968
- push {r4-r7,lr}
- mov r7, r10
- mov r6, r9
- mov r5, r8
- push {r5-r7}
- movs r7, 0
- ldr r0, _08070A10 @ =0x0201c000
- mov r9, r0
- ldr r1, _08070A14 @ =0xfffff264
- add r1, r9
- mov r10, r1
- ldr r0, _08070A18 @ =gStringVar1
- mov r8, r0
-_08070982:
- mov r1, r9
- ldr r0, [r1]
- ldr r1, _08070A1C @ =gUnknown_08376D1C
- adds r1, r7, r1
- ldrb r1, [r1]
- bl GetMonData
- adds r6, r7, 0x6
- lsls r6, 1
- add r6, r10
- strh r0, [r6]
- adds r0, r7, 0
- movs r1, 0x3
- bl __udivsi3
- lsls r0, 24
- lsrs r0, 24
- lsls r4, r0, 3
- adds r4, r0
- adds r4, 0xB
- lsls r4, 24
- lsrs r4, 24
- adds r0, r7, 0
- movs r1, 0x3
- bl __umodsi3
- adds r5, r0, 0
- lsls r5, 1
- adds r5, 0x1
- lsls r5, 24
- lsrs r5, 24
- movs r0, 0xFC
- mov r1, r8
- strb r0, [r1]
- movs r0, 0x14
- strb r0, [r1, 0x1]
- movs r0, 0x6
- strb r0, [r1, 0x2]
- movs r0, 0
- ldrsh r1, [r6, r0]
- mov r0, r8
- adds r0, 0x3
- movs r2, 0x1
- movs r3, 0x3
- bl ConvertIntToDecimalStringN
- adds r4, 0x6
- lsls r4, 3
- adds r4, 0x6
- lsls r4, 24
- lsrs r4, 24
- lsls r5, 3
- mov r0, r8
- adds r1, r4, 0
- adds r2, r5, 0
- movs r3, 0
- bl MenuPrint_PixelCoords
- adds r0, r7, 0x1
- lsls r0, 24
- lsrs r7, r0, 24
- cmp r7, 0x5
- bls _08070982
- pop {r3-r5}
- mov r8, r3
- mov r9, r4
- mov r10, r5
- pop {r4-r7}
- pop {r0}
- bx r0
- .align 2, 0
-_08070A10: .4byte 0x0201c000
-_08070A14: .4byte 0xfffff264
-_08070A18: .4byte gStringVar1
-_08070A1C: .4byte gUnknown_08376D1C
- thumb_func_end sub_8070968
-
thumb_func_start sub_8070A20
sub_8070A20: @ 8070A20
push {r4-r7,lr}
diff --git a/include/party_menu.h b/include/party_menu.h
index 5250486bb..a78e6c979 100644
--- a/include/party_menu.h
+++ b/include/party_menu.h
@@ -18,7 +18,6 @@ struct PartyPopupMenu
// TODO: Unify these two structs
-#define DATA_COUNT (6)
struct Unk201B000
{
//u8 filler0[0x260];
@@ -30,7 +29,8 @@ struct Unk201B000
u8 unk261;
u8 unk262;
u8 unk263;
- s16 unk264[DATA_COUNT * 2]; // This may be a union
+ // Stat growth upon level-up. First 6 bytes = old stats, Second 6 bytes = new stats.
+ s16 statGrowths[NUM_STATS * 2];
u8 filler27C[2];
s16 unk27E;
s16 unk280;
@@ -122,7 +122,6 @@ void sub_806E6F0();
void sub_806E750(u8, const struct PartyPopupMenu *, const struct PartyMenuItem *, int);
void sub_806E7D0(u8, const struct PartyPopupMenu *);
TaskFunc PartyMenuGetPopupMenuFunc(u8, const struct PartyPopupMenu *, const struct PartyMenuItem *, u8);
-void sub_8070968();
void sub_8070A20();
void Task_RareCandy3(u8);
void sub_8070C54();
@@ -167,7 +166,8 @@ void DoPPUpItemEffect(u8, u16, TaskFunc);
void DoRareCandyItemEffect(u8, u16, TaskFunc);
void Task_RareCandy1(u8);
void Task_RareCandy2(u8);
-void sub_8070848(u8 taskId);
+void PrintStatGrowthsInLevelUpWindow(u8 taskId);
+void PrintNewStatsInLevelUpWindow(u8 taskId);
void sub_806CA60(u8 taskId);
void sub_806CD5C(u8 taskId);
void DoTakeMail(u8 taskId, TaskFunc func);
diff --git a/src/party_menu.c b/src/party_menu.c
index 39477e293..d0fe19fc9 100644
--- a/src/party_menu.c
+++ b/src/party_menu.c
@@ -74,10 +74,10 @@ extern s32 gBattleMoveDamage;
//extern const u8 gUnknown_083769A8[][12];
extern void *const gUnknown_08376858[][6];
extern const u8 gUnknown_083769A8[];
-extern const u8 gUnknown_08376D1C[DATA_COUNT];
+extern const u8 gUnknown_08376D1C[NUM_STATS];
extern const u16 gUnknown_08376504[];
extern void (*const gUnknown_08376B54[])(u8);
-extern const u8 *const gUnknown_08376D04[DATA_COUNT];
+extern const u8 *const gUnknown_08376D04[NUM_STATS];
extern const struct UnknownStruct5 gUnknown_08376BB4[][6];
static void sub_806E884(u8 taskId);
@@ -1282,7 +1282,7 @@ void DoRareCandyItemEffect(u8 taskId, u16 b, TaskFunc c)
if (GetMonData(ewram1C000.pokemon, MON_DATA_LEVEL) != 100)
{
for (i = 0; i < 6; i++)
- ewram1B000.unk264[i] = GetMonData(ewram1C000.pokemon, gUnknown_08376D1C[i]);
+ ewram1B000.statGrowths[i] = GetMonData(ewram1C000.pokemon, gUnknown_08376D1C[i]);
r0 = ExecuteTableBasedItemEffect__(ewram1C000.unk5, b, 0);
}
else
@@ -1319,7 +1319,7 @@ void Task_RareCandy1(u8 taskId)
if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON))
{
PlaySE(SE_SELECT);
- sub_8070848(taskId);
+ PrintStatGrowthsInLevelUpWindow(taskId);
gTasks[taskId].func = Task_RareCandy2;
}
}
@@ -1330,19 +1330,19 @@ void Task_RareCandy2(u8 taskId)
if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON))
{
PlaySE(SE_SELECT);
- sub_8070968(taskId);
+ PrintNewStatsInLevelUpWindow(taskId);
gTasks[taskId].func = Task_RareCandy3;
}
}
#if ENGLISH
-void sub_8070848(u8 taskId)
+void PrintStatGrowthsInLevelUpWindow(u8 taskId)
{
u8 i;
MenuDrawTextWindow(11, 0, 29, 7);
- for (i = 0; i < DATA_COUNT; i++)
+ for (i = 0; i < NUM_STATS; i++)
{
u8 x;
u8 y;
@@ -1350,8 +1350,8 @@ void sub_8070848(u8 taskId)
stat = GetMonData(ewram1C000.pokemon, gUnknown_08376D1C[i]);
- ewram1B000.unk264[i + DATA_COUNT] = stat;
- ewram1B000.unk264[i] = stat - ewram1B000.unk264[i];
+ ewram1B000.statGrowths[i + NUM_STATS] = stat;
+ ewram1B000.statGrowths[i] = stat - ewram1B000.statGrowths[i];
x = (i / 3) * 9 + 11;
y = ((i % 3) << 1) + 1;
@@ -1367,14 +1367,14 @@ void sub_8070848(u8 taskId)
gStringVar1[1] = 0x14;
gStringVar1[2] = 0x06;
- ConvertIntToDecimalStringN(gStringVar1 + 3, ewram1B000.unk264[i], 1, 2);
+ ConvertIntToDecimalStringN(gStringVar1 + 3, ewram1B000.statGrowths[i], 1, 2);
MenuPrint_PixelCoords(gStringVar1, (x + 6) * 8 + 12, y * 8, 0);
}
}
#elif GERMAN
__attribute__((naked))
-void sub_8070848(u8 taskId) {
+void PrintStatGrowthsInLevelUpWindow(u8 taskId) {
asm(".syntax unified\n\
push {r4-r7,lr}\n\
mov r7, r10\n\
@@ -1492,3 +1492,30 @@ _08070940: .4byte gOtherText_TallPlusAndRightArrow\n\
.syntax divided\n");
}
#endif
+
+void PrintNewStatsInLevelUpWindow(u8 taskId)
+{
+ u8 i;
+
+ for (i = 0; i < NUM_STATS; i++)
+ {
+ u8 x;
+ u8 y;
+ u32 stat;
+ u32 newStatIndex;
+
+ stat = GetMonData(ewram1C000.pokemon, gUnknown_08376D1C[i]);
+ newStatIndex = i + 6;
+ ewram1B000.statGrowths[newStatIndex] = stat;
+
+ x = ((i / 3) * 9) + 11;
+ y = ((i % 3) << 1) + 1;
+
+ gStringVar1[0] = EXT_CTRL_CODE_BEGIN;
+ gStringVar1[1] = 0x14;
+ gStringVar1[2] = 0x06;
+
+ ConvertIntToDecimalStringN(gStringVar1 + 3, ewram1B000.statGrowths[newStatIndex], 1, 3);
+ MenuPrint_PixelCoords(gStringVar1, (x + 6) * 8 + 6, y * 8, 0);
+ }
+}