summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2018-04-02 10:07:40 -0400
committerPikalaxALT <pikalaxalt@gmail.com>2018-04-02 10:07:40 -0400
commite83a8d3454a451eb57a6c6d5e41cd64d3517ba40 (patch)
treeea74112dad16b1bb5d5c35dcfed1f6e7042f02a8
parenta61e8646af82098604ffc0afbc195607f0733ff3 (diff)
through debug_sub_8160308
-rw-r--r--asm/nakamura_debug_menu.s436
-rw-r--r--include/pokemon.h4
-rw-r--r--src/debug/nakamura_debug_menu.c109
3 files changed, 111 insertions, 438 deletions
diff --git a/asm/nakamura_debug_menu.s b/asm/nakamura_debug_menu.s
index 7a95bc953..76684feef 100644
--- a/asm/nakamura_debug_menu.s
+++ b/asm/nakamura_debug_menu.s
@@ -5,442 +5,6 @@
.text
- thumb_func_start debug_sub_816009C
-debug_sub_816009C:
- push {lr}
- add r2, r0, #0
- lsl r2, r2, #0x18
- lsr r2, r2, #0x18
- ldr r1, ._219 @ _nakamuraStatic0
- lsl r0, r2, #0x2
- add r0, r0, r1
- mov r3, #0x0
- ldsh r1, [r0, r3]
- mov r0, #0xb
- mul r0, r0, r1
- ldr r1, ._219 + 4 @ gSpeciesNames
- add r0, r0, r1
- lsl r2, r2, #0x1
- add r2, r2, #0x1
- lsl r2, r2, #0x18
- lsr r2, r2, #0x18
- mov r1, #0x10
- bl Menu_PrintText
- pop {r0}
- bx r0
-._220:
- .align 2, 0
-._219:
- .word _nakamuraStatic0
- .word gSpeciesNames
-
- thumb_func_end debug_sub_816009C
-
- thumb_func_start debug_sub_81600D0
-debug_sub_81600D0:
- push {r4, r5, lr}
- add sp, sp, #0xfffffffc
- lsl r0, r0, #0x18
- lsr r4, r0, #0x18
- add r5, r4, #0
- ldr r1, ._223 @ Str_843E5F0
- mov r0, sp
- mov r2, #0x2
- bl memcpy
- mov r0, #0x64
- mul r0, r0, r4
- ldr r1, ._223 + 4 @ gPlayerParty
- add r0, r0, r1
- bl GetMonGender
- lsl r0, r0, #0x18
- lsr r0, r0, #0x18
- cmp r0, #0
- bne ._221 @cond_branch
- ldr r0, ._223 + 8 @ gOtherText_MaleSymbol2
- b ._222
-._224:
- .align 2, 0
-._223:
- .word Str_843E5F0
- .word gPlayerParty
- .word gOtherText_MaleSymbol2
-._221:
- cmp r0, #0xfe
- bne ._225 @cond_branch
- ldr r0, ._227 @ gOtherText_FemaleSymbolAndLv
-._222:
- lsl r2, r4, #0x1
- add r2, r2, #0x1
- lsl r2, r2, #0x18
- lsr r2, r2, #0x18
- mov r1, #0x17
- bl Menu_PrintText
- b ._226
-._228:
- .align 2, 0
-._227:
- .word gOtherText_FemaleSymbolAndLv
-._225:
- lsl r2, r5, #0x1
- add r2, r2, #0x1
- lsl r2, r2, #0x18
- lsr r2, r2, #0x18
- mov r0, sp
- mov r1, #0x17
- bl Menu_PrintText
-._226:
- add sp, sp, #0x4
- pop {r4, r5}
- pop {r0}
- bx r0
-
- thumb_func_end debug_sub_81600D0
-
- thumb_func_start debug_sub_816013C
-debug_sub_816013C:
- push {r4, r5, lr}
- add r4, r0, #0
- lsl r4, r4, #0x18
- lsr r4, r4, #0x18
- ldr r5, ._229 @ gStringVar1
- ldr r1, ._229 + 4 @ _nakamuraStatic0
- lsl r0, r4, #0x2
- add r0, r0, r1
- mov r1, #0x2
- ldrsb r1, [r0, r1]
- add r0, r5, #0
- mov r2, #0x1
- mov r3, #0x3
- bl ConvertIntToDecimalStringN
- lsl r4, r4, #0x1
- add r4, r4, #0x1
- lsl r4, r4, #0x18
- lsr r4, r4, #0x18
- add r0, r5, #0
- mov r1, #0x1a
- add r2, r4, #0
- bl Menu_PrintText
- pop {r4, r5}
- pop {r0}
- bx r0
-._230:
- .align 2, 0
-._229:
- .word gStringVar1
- .word _nakamuraStatic0
-
- thumb_func_end debug_sub_816013C
-
- thumb_func_start debug_sub_816017C
-debug_sub_816017C:
- push {r4, lr}
- lsl r0, r0, #0x18
- lsr r4, r0, #0x18
- lsl r3, r4, #0x1
- add r1, r3, #1
- lsl r1, r1, #0x18
- lsr r1, r1, #0x18
- add r3, r3, #0x2
- lsl r3, r3, #0x18
- lsr r3, r3, #0x18
- mov r0, #0x10
- mov r2, #0x1c
- bl Menu_BlankWindowRect
- ldr r1, ._232 @ _nakamuraStatic0
- lsl r0, r4, #0x2
- add r0, r0, r1
- mov r1, #0x0
- ldsh r0, [r0, r1]
- cmp r0, #0
- beq ._231 @cond_branch
- add r0, r4, #0
- bl debug_sub_816009C
- add r0, r4, #0
- bl debug_sub_81600D0
- add r0, r4, #0
- bl debug_sub_816013C
-._231:
- mov r0, #0x5
- bl debug_sub_81603B8
- pop {r4}
- pop {r0}
- bx r0
-._233:
- .align 2, 0
-._232:
- .word _nakamuraStatic0
-
- thumb_func_end debug_sub_816017C
-
- thumb_func_start debug_sub_81601C8
-debug_sub_81601C8:
- push {r4, r5, lr}
- add sp, sp, #0xfffffff0
- lsl r0, r0, #0x18
- lsr r5, r0, #0x18
- lsl r1, r1, #0x18
- lsr r3, r1, #0x18
- ldr r1, ._239 @ _nakamuraStatic0
- lsl r0, r5, #0x2
- add r2, r0, r1
- mov r4, #0x0
- ldsh r0, [r2, r4]
- cmp r0, #0
- bne ._236 @cond_branch
- ldrb r0, [r2, #0x3]
- cmp r0, #0
- bne ._236 @cond_branch
- cmp r3, #0x1
- bne ._236 @cond_branch
- mov r0, #0x8a
- lsl r0, r0, #0x1
- strh r0, [r2]
-._236:
- lsl r0, r5, #0x2
- add r4, r0, r1
- lsl r0, r3, #0x18
- asr r0, r0, #0x18
- ldrh r1, [r4]
- add r2, r0, r1
- mov r3, #0x0
- strh r2, [r4]
- lsl r1, r2, #0x10
- mov r0, #0xcd
- lsl r0, r0, #0x11
- cmp r1, r0
- ble ._237 @cond_branch
- ldr r1, ._239 + 4 @ 0xfffffe65
- add r0, r2, r1
- strh r0, [r4]
-._237:
- ldrh r1, [r4]
- mov r2, #0x0
- ldsh r0, [r4, r2]
- cmp r0, #0
- bge ._238 @cond_branch
- ldr r2, ._239 + 8 @ 0x19b
- add r0, r1, r2
- strh r0, [r4]
-._238:
- mov r0, #0x64
- mul r0, r0, r5
- ldr r1, ._239 + 12 @ gPlayerParty
- add r0, r0, r1
- ldrh r1, [r4]
- ldrb r2, [r4, #0x2]
- str r3, [sp]
- str r3, [sp, #0x4]
- str r3, [sp, #0x8]
- str r3, [sp, #0xc]
- mov r3, #0x20
- bl CreateMon
- mov r0, #0x1
- strb r0, [r4, #0x3]
- add sp, sp, #0x10
- pop {r4, r5}
- pop {r0}
- bx r0
-._240:
- .align 2, 0
-._239:
- .word _nakamuraStatic0
- .word 0xfffffe65
- .word 0x19b
- .word gPlayerParty
-
- thumb_func_end debug_sub_81601C8
-
- thumb_func_start debug_sub_8160258
-debug_sub_8160258:
- push {lr}
- lsl r0, r0, #0x18
- lsr r2, r0, #0x18
- ldr r1, ._242 @ _nakamuraStatic0
- lsl r0, r2, #0x2
- add r0, r0, r1
- mov r1, #0x0
- ldsh r0, [r0, r1]
- cmp r0, #0
- beq ._241 @cond_branch
- add r0, r2, #0
- bl debug_sub_816062C
-._241:
- pop {r0}
- bx r0
-._243:
- .align 2, 0
-._242:
- .word _nakamuraStatic0
-
- thumb_func_end debug_sub_8160258
-
- thumb_func_start debug_sub_816027C
-debug_sub_816027C:
- push {r4, lr}
- lsl r0, r0, #0x18
- lsr r0, r0, #0x18
- add r4, r0, #0
- lsl r1, r1, #0x18
- lsr r2, r1, #0x18
- ldr r1, ._247 @ _nakamuraStatic0
- lsl r0, r4, #0x2
- add r3, r0, r1
- mov r1, #0x0
- ldsh r0, [r3, r1]
- cmp r0, #0
- beq ._244 @cond_branch
- lsl r0, r2, #0x18
- asr r0, r0, #0x18
- ldrb r1, [r3, #0x2]
- add r0, r0, r1
- strb r0, [r3, #0x2]
- lsl r0, r0, #0x18
- asr r0, r0, #0x18
- cmp r0, #0x64
- ble ._245 @cond_branch
- mov r0, #0x1
- strb r0, [r3, #0x2]
-._245:
- mov r0, #0x2
- ldrsb r0, [r3, r0]
- cmp r0, #0
- bgt ._246 @cond_branch
- mov r0, #0x64
- strb r0, [r3, #0x2]
-._246:
- mov r0, #0x64
- mul r4, r4, r0
- ldr r0, ._247 + 4 @ gPlayerParty
- add r4, r4, r0
- ldr r2, ._247 + 8 @ gBaseStats
- mov r0, #0x0
- ldsh r1, [r3, r0]
- lsl r0, r1, #0x3
- sub r0, r0, r1
- lsl r0, r0, #0x2
- add r0, r0, r2
- ldrb r1, [r0, #0x13]
- mov r0, #0xca
- lsl r0, r0, #0x1
- add r2, r1, #0
- mul r2, r2, r0
- mov r0, #0x2
- ldrsb r0, [r3, r0]
- lsl r0, r0, #0x2
- ldr r1, ._247 + 12 @ gExperienceTables
- add r0, r0, r1
- add r2, r2, r0
- add r0, r4, #0
- mov r1, #0x19
- bl SetMonData
- add r0, r4, #0
- bl debug_sub_803F55C
-._244:
- pop {r4}
- pop {r0}
- bx r0
-._248:
- .align 2, 0
-._247:
- .word _nakamuraStatic0
- .word gPlayerParty
- .word gBaseStats
- .word gExperienceTables
-
- thumb_func_end debug_sub_816027C
-
- thumb_func_start debug_sub_8160308
-debug_sub_8160308:
- push {r4, r5, r6, r7, lr}
- mov r7, r9
- mov r6, r8
- push {r6, r7}
- add sp, sp, #0xffffff8c
- mov r0, #0x0
- mov r1, #0x0
- mov r2, #0x1d
- mov r3, #0x13
- bl Menu_EraseWindowRect
- mov r2, #0x0
-._252:
- add r1, r2, #1
- lsl r0, r1, #0x18
- lsr r5, r0, #0x18
- mov r8, r1
- cmp r5, #0x5
- bhi ._249 @cond_branch
- mov r0, #0x64
- mov r9, r0
- mov r0, r9
- mul r0, r0, r2
- ldr r7, ._254 @ gPlayerParty
- add r6, r0, r7
-._251:
- add r0, r6, #0
- mov r1, #0xb
- mov r2, #0x0
- bl GetMonData
- cmp r0, #0
- bne ._250 @cond_branch
- add r0, sp, #0x10
- add r1, r6, #0
- mov r2, #0x64
- bl memcpy
- mov r4, r9
- mul r4, r4, r5
- add r4, r4, r7
- add r0, r6, #0
- add r1, r4, #0
- mov r2, #0x64
- bl memcpy
- add r0, r4, #0
- add r1, sp, #0x10
- mov r2, #0x64
- bl memcpy
-._250:
- add r0, r5, #1
- lsl r0, r0, #0x18
- lsr r5, r0, #0x18
- cmp r5, #0x5
- bls ._251 @cond_branch
-._249:
- mov r1, r8
- lsl r0, r1, #0x18
- lsr r2, r0, #0x18
- cmp r2, #0x4
- bls ._252 @cond_branch
- bl CalculatePlayerPartyCount
- ldr r4, ._254 + 4 @ gPlayerPartyCount
- ldrb r1, [r4]
- cmp r1, #0
- bne ._253 @cond_branch
- ldr r0, ._254 @ gPlayerParty
- str r1, [sp]
- str r1, [sp, #0x4]
- str r1, [sp, #0x8]
- str r1, [sp, #0xc]
- mov r1, #0x1
- mov r2, #0xa
- mov r3, #0x20
- bl CreateMon
- mov r0, #0x1
- strb r0, [r4]
-._253:
- add sp, sp, #0x74
- pop {r3, r4}
- mov r8, r3
- mov r9, r4
- pop {r4, r5, r6, r7}
- pop {r0}
- bx r0
-._255:
- .align 2, 0
-._254:
- .word gPlayerParty
- .word gPlayerPartyCount
-
- thumb_func_end debug_sub_8160308
-
thumb_func_start debug_sub_81603B8
debug_sub_81603B8:
push {r4, r5, r6, r7, lr}
diff --git a/include/pokemon.h b/include/pokemon.h
index 169045c0c..c827e3cd5 100644
--- a/include/pokemon.h
+++ b/include/pokemon.h
@@ -631,4 +631,8 @@ void BoxMonRestorePP(struct BoxPokemon *);
bool8 HealStatusConditions(struct Pokemon *mon, u32 unused, u32 healMask, u8 battleId);
+#if DEBUG
+void debug_sub_803F55C(struct Pokemon *);
+#endif // DEBUG
+
#endif // GUARD_POKEMON_H
diff --git a/src/debug/nakamura_debug_menu.c b/src/debug/nakamura_debug_menu.c
index 5ceb0896f..5840a5ebf 100644
--- a/src/debug/nakamura_debug_menu.c
+++ b/src/debug/nakamura_debug_menu.c
@@ -2,6 +2,8 @@
#include "global.h"
#include "constants/items.h"
#include "constants/species.h"
+#include "data2.h"
+#include "strings.h"
#include "random.h"
#include "palette.h"
#include "main.h"
@@ -34,8 +36,8 @@ EWRAM_DATA u16 _nakamuraDataA = 0;
EWRAM_DATA u16 _nakamuraDataC = 0;
__attribute__((unused)) static struct {
- u16 species;
- u8 level;
+ s16 species;
+ s8 level;
u8 unk3;
} _nakamuraStatic0[PARTY_SIZE];
__attribute__((unused)) static u8 _nakamuraStatic18;
@@ -57,7 +59,9 @@ bool8 debug_sub_815FE1C(void);
void debug_sub_816009C(u8);
void debug_sub_81600D0(u8);
void debug_sub_816013C(u8);
+void debug_sub_81603B8(u8);
bool8 debug_sub_8160498(void);
+void debug_sub_816062C(u8);
bool8 debug_sub_8160D98(void);
const u8 Str_843E36C[] = _("Berries");
@@ -201,6 +205,8 @@ const u8 Str_843E5D4[] = _(
"Aボタン {ESCAPE}\p"
"  Bボタン ー\n"
"START けってい");
+
+// The following may be defined in the functions in which they are invoked
const u8 Str_843E5F0[] = _("?");
const u8 Str_843E5F2[] = _("HP どりょくち");
const u8 Str_843E5FB[] = _("こうげき どりょくち");
@@ -886,4 +892,103 @@ void debug_sub_815FFDC(void)
gMenuCallback = debug_sub_8160498;
}
+void debug_sub_816009C(u8 i)
+{
+ Menu_PrintText(gSpeciesNames[_nakamuraStatic0[i].species], 16, 2 * i + 1);
+}
+
+void debug_sub_81600D0(u8 i)
+{
+ // u8 sp0[] = _("?");
+
+ u8 sp0[2];
+ u8 gender;
+
+ memcpy(sp0, Str_843E5F0, sizeof Str_843E5F0);
+ gender = GetMonGender(gPlayerParty + i);
+ if (gender == MON_MALE)
+ Menu_PrintText(gOtherText_MaleSymbol2, 23, 2 * i + 1);
+ else if (gender == MON_FEMALE)
+ Menu_PrintText(gOtherText_FemaleSymbolAndLv, 23, 2 * i + 1);
+ else
+ Menu_PrintText(sp0, 23, 2 * i + 1);
+}
+
+void debug_sub_816013C(u8 i)
+{
+ ConvertIntToDecimalStringN(gStringVar1, _nakamuraStatic0[i].level, STR_CONV_MODE_RIGHT_ALIGN, 3);
+ Menu_PrintText(gStringVar1, 26, 2 * i + 1);
+}
+
+void debug_sub_816017C(u8 i)
+{
+ Menu_BlankWindowRect(16, 2 * i + 1, 28, 2 * i + 2);
+ if (_nakamuraStatic0[i].species != SPECIES_NONE)
+ {
+ debug_sub_816009C(i);
+ debug_sub_81600D0(i);
+ debug_sub_816013C(i);
+ }
+ debug_sub_81603B8(5);
+}
+
+void debug_sub_81601C8(u8 i, s8 dirn)
+{
+ if (_nakamuraStatic0[i].species == SPECIES_NONE && _nakamuraStatic0[i].unk3 == 0 && dirn == 1)
+ _nakamuraStatic0[i].species = SPECIES_TREECKO - 1;
+ _nakamuraStatic0[i].species += dirn;
+ if (_nakamuraStatic0[i].species >= SPECIES_CHIMECHO)
+ _nakamuraStatic0[i].species -= SPECIES_CHIMECHO;
+ if (_nakamuraStatic0[i].species < 0)
+ _nakamuraStatic0[i].species += SPECIES_CHIMECHO;
+ CreateMon(gPlayerParty + i, _nakamuraStatic0[i].species, _nakamuraStatic0[i].level, 0x20, 0, 0, 0, 0);
+ _nakamuraStatic0[i].unk3 = 1;
+}
+
+void debug_sub_8160258(u8 i)
+{
+ if (_nakamuraStatic0[i].species != SPECIES_NONE)
+ debug_sub_816062C(i);
+}
+
+void debug_sub_816027C(u8 i, s8 dirn)
+{
+ if (_nakamuraStatic0[i].species != SPECIES_NONE)
+ {
+ _nakamuraStatic0[i].level += dirn;
+ if (_nakamuraStatic0[i].level > 100)
+ _nakamuraStatic0[i].level = 1;
+ if (_nakamuraStatic0[i].level < 1)
+ _nakamuraStatic0[i].level = 100;
+ SetMonData(gPlayerParty + i, MON_DATA_EXP, gExperienceTables[gBaseStats[_nakamuraStatic0[i].species].growthRate] + _nakamuraStatic0[i].level);
+ debug_sub_803F55C(gPlayerParty + i);
+ }
+}
+
+void debug_sub_8160308(void)
+{
+ u8 i;
+ u8 j;
+
+ Menu_EraseWindowRect(0, 0, 29, 19);
+ for (i = 0; i < 5; i++)
+ {
+ for (j = i + 1; j < 6; j++)
+ {
+ if (GetMonData(gPlayerParty + i, MON_DATA_SPECIES, NULL) == SPECIES_NONE)
+ {
+ struct Pokemon tmp = gPlayerParty[i];
+ gPlayerParty[i] = gPlayerParty[j];
+ gPlayerParty[j] = tmp;
+ }
+ }
+ }
+ CalculatePlayerPartyCount();
+ if (gPlayerPartyCount == 0)
+ {
+ CreateMon(gPlayerParty + 0, SPECIES_BULBASAUR, 10, 0x20, 0, 0, 0, 0);
+ gPlayerPartyCount = 1;
+ }
+}
+
#endif // DEBUG