From c03e7be9af2a908833a868436f0f9f12519a81ee Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Tue, 3 Jan 2017 19:54:37 +0100 Subject: Attempt to decompile trainer memo printing --- src/pokemon_summary_screen.c | 318 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 318 insertions(+) create mode 100644 src/pokemon_summary_screen.c (limited to 'src/pokemon_summary_screen.c') diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c new file mode 100644 index 000000000..323f2be80 --- /dev/null +++ b/src/pokemon_summary_screen.c @@ -0,0 +1,318 @@ +#include "global.h" +#include "asm.h" +#include "menu.h" +#include "pokemon.h" +#include "string_util.h" + +extern u8 gStringVar1[]; +extern u8 gStringVar4[]; + +extern u8 *(gNatureNames[]); +extern const u8 gOtherText_Terminator4[]; +extern const u8 gOtherText_Nature[]; + +extern const u8 gOtherText_Met[]; +extern const u8 gOtherText_Egg2[]; +extern const u8 gOtherText_ObtainedInTrade[]; +extern const u8 gOtherText_FatefulEncounter[]; +extern const u8 gOtherText_Met2[]; + +u8 *sub_80A1E9C(u8 *dest, u8 *src, u8); +u8 sub_80A0664(struct Pokemon *pokemon); +u8 *PokemonSummaryScreen_CopyPokemonLevel(u8 *dest, u8 level); + +#define CHAR_NEWLINE (0xFE) + +#ifdef NONMATCHING +void PokemonSummaryScreen_PrintTrainerMemo(struct Pokemon *pokemon, u8 left, u8 top) { + u8 nature; + u8 *ptr = gStringVar4; + + nature = GetNature(pokemon); + ptr = sub_80A1E9C(ptr, gNatureNames[nature], 14); + + if (nature != NATURE_BOLD && nature != NATURE_GENTLE) { + ptr = StringCopy(ptr, gOtherText_Terminator4); + } + + ptr = StringCopy(ptr, gOtherText_Nature); + + if (sub_80A0664(pokemon) == TRUE) { + u8 locationMet; + + locationMet = GetMonData(pokemon, MON_DATA_MET_LOCATION); + + if (GetMonData(pokemon, MON_DATA_MET_LEVEL) == 0) { + ptr = PokemonSummaryScreen_CopyPokemonLevel(ptr, 5); + ptr[0] = CHAR_NEWLINE; + ptr++; + + CopyLocationName(gStringVar1, locationMet); + ptr = sub_80A1E9C(ptr, gStringVar1, 14); + StringCopy(ptr, gOtherText_Egg2); + } else if (locationMet < 88) { + u8 levelMet; + + levelMet = GetMonData(pokemon, MON_DATA_MET_LEVEL); + + ptr = PokemonSummaryScreen_CopyPokemonLevel(ptr, levelMet); + ptr[0] = CHAR_NEWLINE; + ptr++; + + CopyLocationName(gStringVar1, locationMet); + ptr = sub_80A1E9C(ptr, gStringVar1, 14); + StringCopy(ptr, gOtherText_Met); + } else { + ptr[0] = CHAR_NEWLINE; + ptr++; + + StringCopy(ptr, gOtherText_ObtainedInTrade); + } + } else { + u8 gameMet; + + gameMet = GetMonData(pokemon, MON_DATA_MET_GAME); + if (gameMet == VERSION_RUBY || gameMet == VERSION_SAPPHIRE || gameMet == 3) { + u8 locationMet; + + locationMet = GetMonData(pokemon, MON_DATA_MET_LOCATION); + if (locationMet == 0xFF) { + u8 levelMet; + + levelMet = GetMonData(pokemon, MON_DATA_MET_LEVEL); + + ptr = PokemonSummaryScreen_CopyPokemonLevel(ptr, levelMet); + ptr[0] = CHAR_NEWLINE; + ptr++; + + StringCopy(ptr, gOtherText_FatefulEncounter); + } else if (locationMet <= 88) { + u8 levelMet; + + levelMet = GetMonData(pokemon, MON_DATA_MET_LEVEL); + + ptr = PokemonSummaryScreen_CopyPokemonLevel(ptr, levelMet); + ptr[0] = CHAR_NEWLINE; + ptr++; + + CopyLocationName(gStringVar1, locationMet); + ptr = sub_80A1E9C(ptr, gStringVar1, 14); + StringCopy(ptr, gOtherText_Met2); + } else { + ptr[0] = CHAR_NEWLINE; + ptr++; + + StringCopy(ptr, gOtherText_ObtainedInTrade); + } + } else { + ptr[0] = CHAR_NEWLINE; + ptr++; + + StringCopy(ptr, gOtherText_ObtainedInTrade); + } + + } + + MenuPrint(gStringVar4, left, top); +} +#else +__attribute__((naked)) +void PokemonSummaryScreen_PrintTrainerMemo(void) { + asm(".syntax unified\n\ + push {r4-r7,lr}\n\ + mov r7, r9\n\ + mov r6, r8\n\ + push {r6,r7}\n\ + adds r7, r0, 0\n\ + lsls r1, 24\n\ + lsrs r1, 24\n\ + mov r9, r1\n\ + lsls r2, 24\n\ + lsrs r2, 24\n\ + mov r8, r2\n\ + ldr r5, _080A0838 @ =gStringVar4\n\ + bl GetNature\n\ + lsls r0, 24\n\ + lsrs r4, r0, 24\n\ + ldr r1, _080A083C @ =gNatureNames\n\ + lsls r0, r4, 2\n\ + adds r0, r1\n\ + ldr r1, [r0]\n\ + adds r0, r5, 0\n\ + movs r2, 0xE\n\ + bl sub_80A1E9C\n\ + adds r5, r0, 0\n\ + cmp r4, 0x5\n\ + beq _080A07DA\n\ + cmp r4, 0x15\n\ + beq _080A07DA\n\ + ldr r1, _080A0840 @ =gOtherText_Terminator4\n\ + bl StringCopy\n\ + adds r5, r0, 0\n\ +_080A07DA:\n\ + ldr r1, _080A0844 @ =gOtherText_Nature\n\ + adds r0, r5, 0\n\ + bl StringCopy\n\ + adds r5, r0, 0\n\ + adds r0, r7, 0\n\ + bl sub_80A0664\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + cmp r0, 0x1\n\ + bne _080A0898\n\ + adds r0, r7, 0\n\ + movs r1, 0x23\n\ + bl GetMonData\n\ + lsls r0, 24\n\ + lsrs r6, r0, 24\n\ + adds r0, r7, 0\n\ + movs r1, 0x24\n\ + bl GetMonData\n\ + cmp r0, 0\n\ + bne _080A0850\n\ + adds r0, r5, 0\n\ + movs r1, 0x5\n\ + bl PokemonSummaryScreen_CopyPokemonLevel\n\ + adds r5, r0, 0\n\ + movs r0, 0xFE\n\ + strb r0, [r5]\n\ + adds r5, 0x1\n\ + ldr r4, _080A0848 @ =gStringVar1\n\ + adds r0, r4, 0\n\ + adds r1, r6, 0\n\ + bl CopyLocationName\n\ + adds r0, r5, 0\n\ + adds r1, r4, 0\n\ + movs r2, 0xE\n\ + bl sub_80A1E9C\n\ + adds r5, r0, 0\n\ + ldr r1, _080A084C @ =gOtherText_Egg2\n\ + bl StringCopy\n\ + b _080A0934\n\ + .align 2, 0\n\ +_080A0838: .4byte gStringVar4\n\ +_080A083C: .4byte gNatureNames\n\ +_080A0840: .4byte gOtherText_Terminator4\n\ +_080A0844: .4byte gOtherText_Nature\n\ +_080A0848: .4byte gStringVar1\n\ +_080A084C: .4byte gOtherText_Egg2\n\ +_080A0850:\n\ + cmp r6, 0x57\n\ + bhi _080A08E8\n\ + adds r0, r7, 0\n\ + movs r1, 0x24\n\ + bl GetMonData\n\ + adds r1, r0, 0\n\ + lsls r1, 24\n\ + lsrs r1, 24\n\ + adds r0, r5, 0\n\ + bl PokemonSummaryScreen_CopyPokemonLevel\n\ + adds r5, r0, 0\n\ + movs r0, 0xFE\n\ + strb r0, [r5]\n\ + adds r5, 0x1\n\ + ldr r4, _080A0890 @ =gStringVar1\n\ + adds r0, r4, 0\n\ + adds r1, r6, 0\n\ + bl CopyLocationName\n\ + adds r0, r5, 0\n\ + adds r1, r4, 0\n\ + movs r2, 0xE\n\ + bl sub_80A1E9C\n\ + adds r5, r0, 0\n\ + ldr r1, _080A0894 @ =gOtherText_Met\n\ + bl StringCopy\n\ + b _080A0934\n\ + .align 2, 0\n\ +_080A0890: .4byte gStringVar1\n\ +_080A0894: .4byte gOtherText_Met\n\ +_080A0898:\n\ + adds r0, r7, 0\n\ + movs r1, 0x25\n\ + bl GetMonData\n\ + lsls r0, 24\n\ + movs r1, 0xFF\n\ + lsls r1, 24\n\ + adds r0, r1\n\ + lsrs r0, 24\n\ + cmp r0, 0x2\n\ + bhi _080A08E8\n\ + adds r0, r7, 0\n\ + movs r1, 0x23\n\ + bl GetMonData\n\ + lsls r0, 24\n\ + lsrs r6, r0, 24\n\ + cmp r6, 0xFF\n\ + bne _080A08E4\n\ + adds r0, r7, 0\n\ + movs r1, 0x24\n\ + bl GetMonData\n\ + adds r1, r0, 0\n\ + lsls r1, 24\n\ + lsrs r1, 24\n\ + adds r0, r5, 0\n\ + bl PokemonSummaryScreen_CopyPokemonLevel\n\ + adds r5, r0, 0\n\ + movs r0, 0xFE\n\ + strb r0, [r5]\n\ + adds r5, 0x1\n\ + ldr r1, _080A08E0 @ =gOtherText_FatefulEncounter\n\ + b _080A08F0\n\ + .align 2, 0\n\ +_080A08E0: .4byte gOtherText_FatefulEncounter\n\ +_080A08E4:\n\ + cmp r6, 0x57\n\ + bls _080A08FC\n\ +_080A08E8:\n\ + movs r0, 0xFE\n\ + strb r0, [r5]\n\ + adds r5, 0x1\n\ + ldr r1, _080A08F8 @ =gOtherText_ObtainedInTrade\n\ +_080A08F0:\n\ + adds r0, r5, 0\n\ + bl StringCopy\n\ + b _080A0934\n\ + .align 2, 0\n\ +_080A08F8: .4byte gOtherText_ObtainedInTrade\n\ +_080A08FC:\n\ + adds r0, r7, 0\n\ + movs r1, 0x24\n\ + bl GetMonData\n\ + adds r1, r0, 0\n\ + lsls r1, 24\n\ + lsrs r1, 24\n\ + adds r0, r5, 0\n\ + bl PokemonSummaryScreen_CopyPokemonLevel\n\ + adds r5, r0, 0\n\ + movs r0, 0xFE\n\ + strb r0, [r5]\n\ + adds r5, 0x1\n\ + ldr r4, _080A094C @ =gStringVar1\n\ + adds r0, r4, 0\n\ + adds r1, r6, 0\n\ + bl CopyLocationName\n\ + adds r0, r5, 0\n\ + adds r1, r4, 0\n\ + movs r2, 0xE\n\ + bl sub_80A1E9C\n\ + adds r5, r0, 0\n\ + ldr r1, _080A0950 @ =gOtherText_Met2\n\ + bl StringCopy\n\ +_080A0934:\n\ + ldr r0, _080A0954 @ =gStringVar4\n\ + mov r1, r9\n\ + mov r2, r8\n\ + bl MenuPrint\n\ + pop {r3,r4}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .align 2, 0\n\ +_080A094C: .4byte gStringVar1\n\ +_080A0950: .4byte gOtherText_Met2\n\ +_080A0954: .4byte gStringVar4\n\ + .syntax divided\n"); +} +#endif -- cgit v1.2.3 From 19f0d5a5cfc018932fac50eb7cf430297bd3f2da Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Tue, 3 Jan 2017 21:07:08 -0800 Subject: make PokemonSummaryScreen_PrintTrainerMemo match --- src/pokemon_summary_screen.c | 261 ++++--------------------------------------- 1 file changed, 23 insertions(+), 238 deletions(-) (limited to 'src/pokemon_summary_screen.c') diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 323f2be80..406b374f5 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -21,14 +21,12 @@ u8 *sub_80A1E9C(u8 *dest, u8 *src, u8); u8 sub_80A0664(struct Pokemon *pokemon); u8 *PokemonSummaryScreen_CopyPokemonLevel(u8 *dest, u8 level); -#define CHAR_NEWLINE (0xFE) - -#ifdef NONMATCHING void PokemonSummaryScreen_PrintTrainerMemo(struct Pokemon *pokemon, u8 left, u8 top) { - u8 nature; + u8 locationMet; + u8 gameMet; u8 *ptr = gStringVar4; + u8 nature = GetNature(pokemon); - nature = GetNature(pokemon); ptr = sub_80A1E9C(ptr, gNatureNames[nature], 14); if (nature != NATURE_BOLD && nature != NATURE_GENTLE) { @@ -38,8 +36,6 @@ void PokemonSummaryScreen_PrintTrainerMemo(struct Pokemon *pokemon, u8 left, u8 ptr = StringCopy(ptr, gOtherText_Nature); if (sub_80A0664(pokemon) == TRUE) { - u8 locationMet; - locationMet = GetMonData(pokemon, MON_DATA_MET_LOCATION); if (GetMonData(pokemon, MON_DATA_MET_LEVEL) == 0) { @@ -50,10 +46,13 @@ void PokemonSummaryScreen_PrintTrainerMemo(struct Pokemon *pokemon, u8 left, u8 CopyLocationName(gStringVar1, locationMet); ptr = sub_80A1E9C(ptr, gStringVar1, 14); StringCopy(ptr, gOtherText_Egg2); - } else if (locationMet < 88) { - u8 levelMet; + } else if (locationMet >= 88) { + ptr[0] = CHAR_NEWLINE; + ptr++; - levelMet = GetMonData(pokemon, MON_DATA_MET_LEVEL); + StringCopy(ptr, gOtherText_ObtainedInTrade); + } else { + u8 levelMet = GetMonData(pokemon, MON_DATA_MET_LEVEL); ptr = PokemonSummaryScreen_CopyPokemonLevel(ptr, levelMet); ptr[0] = CHAR_NEWLINE; @@ -62,34 +61,32 @@ void PokemonSummaryScreen_PrintTrainerMemo(struct Pokemon *pokemon, u8 left, u8 CopyLocationName(gStringVar1, locationMet); ptr = sub_80A1E9C(ptr, gStringVar1, 14); StringCopy(ptr, gOtherText_Met); - } else { - ptr[0] = CHAR_NEWLINE; - ptr++; - - StringCopy(ptr, gOtherText_ObtainedInTrade); } } else { - u8 gameMet; - gameMet = GetMonData(pokemon, MON_DATA_MET_GAME); - if (gameMet == VERSION_RUBY || gameMet == VERSION_SAPPHIRE || gameMet == 3) { - u8 locationMet; + if (!(gameMet == VERSION_RUBY || gameMet == VERSION_SAPPHIRE || gameMet == 3)) { + ptr[0] = CHAR_NEWLINE; + ptr++; + + StringCopy(ptr, gOtherText_ObtainedInTrade); + } else { locationMet = GetMonData(pokemon, MON_DATA_MET_LOCATION); if (locationMet == 0xFF) { - u8 levelMet; - - levelMet = GetMonData(pokemon, MON_DATA_MET_LEVEL); + u8 levelMet = GetMonData(pokemon, MON_DATA_MET_LEVEL); ptr = PokemonSummaryScreen_CopyPokemonLevel(ptr, levelMet); ptr[0] = CHAR_NEWLINE; ptr++; StringCopy(ptr, gOtherText_FatefulEncounter); - } else if (locationMet <= 88) { - u8 levelMet; + } else if (locationMet >= 88) { + ptr[0] = CHAR_NEWLINE; + ptr++; - levelMet = GetMonData(pokemon, MON_DATA_MET_LEVEL); + StringCopy(ptr, gOtherText_ObtainedInTrade); + } else { + u8 levelMet = GetMonData(pokemon, MON_DATA_MET_LEVEL); ptr = PokemonSummaryScreen_CopyPokemonLevel(ptr, levelMet); ptr[0] = CHAR_NEWLINE; @@ -98,221 +95,9 @@ void PokemonSummaryScreen_PrintTrainerMemo(struct Pokemon *pokemon, u8 left, u8 CopyLocationName(gStringVar1, locationMet); ptr = sub_80A1E9C(ptr, gStringVar1, 14); StringCopy(ptr, gOtherText_Met2); - } else { - ptr[0] = CHAR_NEWLINE; - ptr++; - - StringCopy(ptr, gOtherText_ObtainedInTrade); } - } else { - ptr[0] = CHAR_NEWLINE; - ptr++; - - StringCopy(ptr, gOtherText_ObtainedInTrade); } - } - MenuPrint(gStringVar4, left, top); -} -#else -__attribute__((naked)) -void PokemonSummaryScreen_PrintTrainerMemo(void) { - asm(".syntax unified\n\ - push {r4-r7,lr}\n\ - mov r7, r9\n\ - mov r6, r8\n\ - push {r6,r7}\n\ - adds r7, r0, 0\n\ - lsls r1, 24\n\ - lsrs r1, 24\n\ - mov r9, r1\n\ - lsls r2, 24\n\ - lsrs r2, 24\n\ - mov r8, r2\n\ - ldr r5, _080A0838 @ =gStringVar4\n\ - bl GetNature\n\ - lsls r0, 24\n\ - lsrs r4, r0, 24\n\ - ldr r1, _080A083C @ =gNatureNames\n\ - lsls r0, r4, 2\n\ - adds r0, r1\n\ - ldr r1, [r0]\n\ - adds r0, r5, 0\n\ - movs r2, 0xE\n\ - bl sub_80A1E9C\n\ - adds r5, r0, 0\n\ - cmp r4, 0x5\n\ - beq _080A07DA\n\ - cmp r4, 0x15\n\ - beq _080A07DA\n\ - ldr r1, _080A0840 @ =gOtherText_Terminator4\n\ - bl StringCopy\n\ - adds r5, r0, 0\n\ -_080A07DA:\n\ - ldr r1, _080A0844 @ =gOtherText_Nature\n\ - adds r0, r5, 0\n\ - bl StringCopy\n\ - adds r5, r0, 0\n\ - adds r0, r7, 0\n\ - bl sub_80A0664\n\ - lsls r0, 24\n\ - lsrs r0, 24\n\ - cmp r0, 0x1\n\ - bne _080A0898\n\ - adds r0, r7, 0\n\ - movs r1, 0x23\n\ - bl GetMonData\n\ - lsls r0, 24\n\ - lsrs r6, r0, 24\n\ - adds r0, r7, 0\n\ - movs r1, 0x24\n\ - bl GetMonData\n\ - cmp r0, 0\n\ - bne _080A0850\n\ - adds r0, r5, 0\n\ - movs r1, 0x5\n\ - bl PokemonSummaryScreen_CopyPokemonLevel\n\ - adds r5, r0, 0\n\ - movs r0, 0xFE\n\ - strb r0, [r5]\n\ - adds r5, 0x1\n\ - ldr r4, _080A0848 @ =gStringVar1\n\ - adds r0, r4, 0\n\ - adds r1, r6, 0\n\ - bl CopyLocationName\n\ - adds r0, r5, 0\n\ - adds r1, r4, 0\n\ - movs r2, 0xE\n\ - bl sub_80A1E9C\n\ - adds r5, r0, 0\n\ - ldr r1, _080A084C @ =gOtherText_Egg2\n\ - bl StringCopy\n\ - b _080A0934\n\ - .align 2, 0\n\ -_080A0838: .4byte gStringVar4\n\ -_080A083C: .4byte gNatureNames\n\ -_080A0840: .4byte gOtherText_Terminator4\n\ -_080A0844: .4byte gOtherText_Nature\n\ -_080A0848: .4byte gStringVar1\n\ -_080A084C: .4byte gOtherText_Egg2\n\ -_080A0850:\n\ - cmp r6, 0x57\n\ - bhi _080A08E8\n\ - adds r0, r7, 0\n\ - movs r1, 0x24\n\ - bl GetMonData\n\ - adds r1, r0, 0\n\ - lsls r1, 24\n\ - lsrs r1, 24\n\ - adds r0, r5, 0\n\ - bl PokemonSummaryScreen_CopyPokemonLevel\n\ - adds r5, r0, 0\n\ - movs r0, 0xFE\n\ - strb r0, [r5]\n\ - adds r5, 0x1\n\ - ldr r4, _080A0890 @ =gStringVar1\n\ - adds r0, r4, 0\n\ - adds r1, r6, 0\n\ - bl CopyLocationName\n\ - adds r0, r5, 0\n\ - adds r1, r4, 0\n\ - movs r2, 0xE\n\ - bl sub_80A1E9C\n\ - adds r5, r0, 0\n\ - ldr r1, _080A0894 @ =gOtherText_Met\n\ - bl StringCopy\n\ - b _080A0934\n\ - .align 2, 0\n\ -_080A0890: .4byte gStringVar1\n\ -_080A0894: .4byte gOtherText_Met\n\ -_080A0898:\n\ - adds r0, r7, 0\n\ - movs r1, 0x25\n\ - bl GetMonData\n\ - lsls r0, 24\n\ - movs r1, 0xFF\n\ - lsls r1, 24\n\ - adds r0, r1\n\ - lsrs r0, 24\n\ - cmp r0, 0x2\n\ - bhi _080A08E8\n\ - adds r0, r7, 0\n\ - movs r1, 0x23\n\ - bl GetMonData\n\ - lsls r0, 24\n\ - lsrs r6, r0, 24\n\ - cmp r6, 0xFF\n\ - bne _080A08E4\n\ - adds r0, r7, 0\n\ - movs r1, 0x24\n\ - bl GetMonData\n\ - adds r1, r0, 0\n\ - lsls r1, 24\n\ - lsrs r1, 24\n\ - adds r0, r5, 0\n\ - bl PokemonSummaryScreen_CopyPokemonLevel\n\ - adds r5, r0, 0\n\ - movs r0, 0xFE\n\ - strb r0, [r5]\n\ - adds r5, 0x1\n\ - ldr r1, _080A08E0 @ =gOtherText_FatefulEncounter\n\ - b _080A08F0\n\ - .align 2, 0\n\ -_080A08E0: .4byte gOtherText_FatefulEncounter\n\ -_080A08E4:\n\ - cmp r6, 0x57\n\ - bls _080A08FC\n\ -_080A08E8:\n\ - movs r0, 0xFE\n\ - strb r0, [r5]\n\ - adds r5, 0x1\n\ - ldr r1, _080A08F8 @ =gOtherText_ObtainedInTrade\n\ -_080A08F0:\n\ - adds r0, r5, 0\n\ - bl StringCopy\n\ - b _080A0934\n\ - .align 2, 0\n\ -_080A08F8: .4byte gOtherText_ObtainedInTrade\n\ -_080A08FC:\n\ - adds r0, r7, 0\n\ - movs r1, 0x24\n\ - bl GetMonData\n\ - adds r1, r0, 0\n\ - lsls r1, 24\n\ - lsrs r1, 24\n\ - adds r0, r5, 0\n\ - bl PokemonSummaryScreen_CopyPokemonLevel\n\ - adds r5, r0, 0\n\ - movs r0, 0xFE\n\ - strb r0, [r5]\n\ - adds r5, 0x1\n\ - ldr r4, _080A094C @ =gStringVar1\n\ - adds r0, r4, 0\n\ - adds r1, r6, 0\n\ - bl CopyLocationName\n\ - adds r0, r5, 0\n\ - adds r1, r4, 0\n\ - movs r2, 0xE\n\ - bl sub_80A1E9C\n\ - adds r5, r0, 0\n\ - ldr r1, _080A0950 @ =gOtherText_Met2\n\ - bl StringCopy\n\ -_080A0934:\n\ - ldr r0, _080A0954 @ =gStringVar4\n\ - mov r1, r9\n\ - mov r2, r8\n\ - bl MenuPrint\n\ - pop {r3,r4}\n\ - mov r8, r3\n\ - mov r9, r4\n\ - pop {r4-r7}\n\ - pop {r0}\n\ - bx r0\n\ - .align 2, 0\n\ -_080A094C: .4byte gStringVar1\n\ -_080A0950: .4byte gOtherText_Met2\n\ -_080A0954: .4byte gStringVar4\n\ - .syntax divided\n"); + MenuPrint(gStringVar4, left++, top++); } -#endif -- cgit v1.2.3 From b6b8d053ecfc73c9ff0d4b5715404e3583501b84 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Wed, 4 Jan 2017 04:29:25 -0800 Subject: Emerald version enum --- src/pokemon_summary_screen.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/pokemon_summary_screen.c') diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 406b374f5..5095ec3d0 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -40,14 +40,14 @@ void PokemonSummaryScreen_PrintTrainerMemo(struct Pokemon *pokemon, u8 left, u8 if (GetMonData(pokemon, MON_DATA_MET_LEVEL) == 0) { ptr = PokemonSummaryScreen_CopyPokemonLevel(ptr, 5); - ptr[0] = CHAR_NEWLINE; + *ptr = CHAR_NEWLINE; ptr++; CopyLocationName(gStringVar1, locationMet); ptr = sub_80A1E9C(ptr, gStringVar1, 14); StringCopy(ptr, gOtherText_Egg2); } else if (locationMet >= 88) { - ptr[0] = CHAR_NEWLINE; + *ptr = CHAR_NEWLINE; ptr++; StringCopy(ptr, gOtherText_ObtainedInTrade); @@ -55,7 +55,7 @@ void PokemonSummaryScreen_PrintTrainerMemo(struct Pokemon *pokemon, u8 left, u8 u8 levelMet = GetMonData(pokemon, MON_DATA_MET_LEVEL); ptr = PokemonSummaryScreen_CopyPokemonLevel(ptr, levelMet); - ptr[0] = CHAR_NEWLINE; + *ptr = CHAR_NEWLINE; ptr++; CopyLocationName(gStringVar1, locationMet); @@ -65,8 +65,8 @@ void PokemonSummaryScreen_PrintTrainerMemo(struct Pokemon *pokemon, u8 left, u8 } else { gameMet = GetMonData(pokemon, MON_DATA_MET_GAME); - if (!(gameMet == VERSION_RUBY || gameMet == VERSION_SAPPHIRE || gameMet == 3)) { - ptr[0] = CHAR_NEWLINE; + if (!(gameMet == VERSION_RUBY || gameMet == VERSION_SAPPHIRE || gameMet == VERSION_EMERALD)) { + *ptr = CHAR_NEWLINE; ptr++; StringCopy(ptr, gOtherText_ObtainedInTrade); @@ -76,12 +76,12 @@ void PokemonSummaryScreen_PrintTrainerMemo(struct Pokemon *pokemon, u8 left, u8 u8 levelMet = GetMonData(pokemon, MON_DATA_MET_LEVEL); ptr = PokemonSummaryScreen_CopyPokemonLevel(ptr, levelMet); - ptr[0] = CHAR_NEWLINE; + *ptr = CHAR_NEWLINE; ptr++; StringCopy(ptr, gOtherText_FatefulEncounter); } else if (locationMet >= 88) { - ptr[0] = CHAR_NEWLINE; + *ptr = CHAR_NEWLINE; ptr++; StringCopy(ptr, gOtherText_ObtainedInTrade); @@ -89,7 +89,7 @@ void PokemonSummaryScreen_PrintTrainerMemo(struct Pokemon *pokemon, u8 left, u8 u8 levelMet = GetMonData(pokemon, MON_DATA_MET_LEVEL); ptr = PokemonSummaryScreen_CopyPokemonLevel(ptr, levelMet); - ptr[0] = CHAR_NEWLINE; + *ptr = CHAR_NEWLINE; ptr++; CopyLocationName(gStringVar1, locationMet); -- cgit v1.2.3 From 355428ee31698073a93c335a6d9db47936c5ffbb Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Wed, 4 Jan 2017 04:45:33 -0800 Subject: name some functions --- src/pokemon_summary_screen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/pokemon_summary_screen.c') diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 5095ec3d0..58573e97e 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -18,7 +18,7 @@ extern const u8 gOtherText_FatefulEncounter[]; extern const u8 gOtherText_Met2[]; u8 *sub_80A1E9C(u8 *dest, u8 *src, u8); -u8 sub_80A0664(struct Pokemon *pokemon); +u8 PokemonSummaryScreen_CheckOT(struct Pokemon *pokemon); u8 *PokemonSummaryScreen_CopyPokemonLevel(u8 *dest, u8 level); void PokemonSummaryScreen_PrintTrainerMemo(struct Pokemon *pokemon, u8 left, u8 top) { @@ -35,7 +35,7 @@ void PokemonSummaryScreen_PrintTrainerMemo(struct Pokemon *pokemon, u8 left, u8 ptr = StringCopy(ptr, gOtherText_Nature); - if (sub_80A0664(pokemon) == TRUE) { + if (PokemonSummaryScreen_CheckOT(pokemon) == TRUE) { locationMet = GetMonData(pokemon, MON_DATA_MET_LOCATION); if (GetMonData(pokemon, MON_DATA_MET_LEVEL) == 0) { -- cgit v1.2.3 From ef6bf02e7039a8e6f3b249ca3491987c42ca2d46 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Wed, 4 Jan 2017 19:24:48 -0800 Subject: decompile more summary screen functions --- src/pokemon_summary_screen.c | 72 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) (limited to 'src/pokemon_summary_screen.c') diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 58573e97e..7ac26fc72 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -3,10 +3,13 @@ #include "menu.h" #include "pokemon.h" #include "string_util.h" +#include "link.h" extern u8 gStringVar1[]; extern u8 gStringVar4[]; +extern struct Pokemon *unk_2018000; + extern u8 *(gNatureNames[]); extern const u8 gOtherText_Terminator4[]; extern const u8 gOtherText_Nature[]; @@ -16,10 +19,79 @@ extern const u8 gOtherText_Egg2[]; extern const u8 gOtherText_ObtainedInTrade[]; extern const u8 gOtherText_FatefulEncounter[]; extern const u8 gOtherText_Met2[]; +extern const u8 gOtherText_EggDayCare[]; +extern const u8 gOtherText_EggNicePlace[]; +extern const u8 gOtherText_EggObtainedInTrade[]; +extern const u8 gOtherText_EggHotSprings[]; u8 *sub_80A1E9C(u8 *dest, u8 *src, u8); u8 PokemonSummaryScreen_CheckOT(struct Pokemon *pokemon); u8 *PokemonSummaryScreen_CopyPokemonLevel(u8 *dest, u8 level); +u32 GetPlayerTrainerId(void); + +bool8 PokemonSummaryScreen_CheckOT(struct Pokemon *mon) +{ + u32 trainerId; + + if (unk_2018000 == gEnemyParty) + { + u8 enemyId = GetMultiplayerId() ^ 1; + trainerId = gLinkPlayers[enemyId].trainerId & 0xFFFF; + StringCopy(gStringVar1, gLinkPlayers[enemyId].name); + StripExtCtrlCodes(gStringVar1); + } + else + { + trainerId = GetPlayerTrainerId() & 0xFFFF; + StringCopy(gStringVar1, gSaveBlock2.playerName); + } + + if (trainerId != (GetMonData(mon, MON_DATA_OT_ID) & 0xFFFF)) + return FALSE; + + GetMonData(mon, MON_DATA_OT_NAME, gStringVar2); + + if (!StringCompareWithoutExtCtrlCodes(gStringVar1, gStringVar2)) + return TRUE; + + return FALSE; +} + +void sub_80A0708(struct Pokemon *mon, u8 left, u8 top) +{ + u8 locationMet; + u8 gameMet = GetMonData(mon, MON_DATA_MET_GAME); + + if (!(gameMet == VERSION_RUBY || gameMet == VERSION_SAPPHIRE || gameMet == VERSION_EMERALD)) + { + MenuPrint(gOtherText_EggObtainedInTrade, left, top); + return; + } + + locationMet = GetMonData(mon, MON_DATA_MET_LOCATION); + + if (locationMet == 255) + { + MenuPrint(gOtherText_EggNicePlace, left, top); + return; + } + + if (!PokemonSummaryScreen_CheckOT(mon)) + { + MenuPrint(gOtherText_EggObtainedInTrade, left, top); + return; + } + + asm(""); // needed to match for some reason + + if (locationMet == 253) + { + MenuPrint(gOtherText_EggHotSprings, left, top); + return; + } + + MenuPrint(gOtherText_EggDayCare, left, top); +} void PokemonSummaryScreen_PrintTrainerMemo(struct Pokemon *pokemon, u8 left, u8 top) { u8 locationMet; -- cgit v1.2.3 From f3595e9022cce039ce0861e0b976e2c724c4a2ef Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Wed, 4 Jan 2017 19:41:30 -0800 Subject: name function --- src/pokemon_summary_screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/pokemon_summary_screen.c') diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 7ac26fc72..b6b24b9d7 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -57,7 +57,7 @@ bool8 PokemonSummaryScreen_CheckOT(struct Pokemon *mon) return FALSE; } -void sub_80A0708(struct Pokemon *mon, u8 left, u8 top) +void PokemonSummaryScreen_PrintEggTrainerMemo(struct Pokemon *mon, u8 left, u8 top) { u8 locationMet; u8 gameMet = GetMonData(mon, MON_DATA_MET_GAME); -- cgit v1.2.3 From 648c6c7093f5173694562929f615380f297ad306 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Tue, 17 Jan 2017 13:41:12 +0100 Subject: Move `gStringVar` declarations to text.h --- src/pokemon_summary_screen.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/pokemon_summary_screen.c') diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index b6b24b9d7..6e051f449 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -5,9 +5,6 @@ #include "string_util.h" #include "link.h" -extern u8 gStringVar1[]; -extern u8 gStringVar4[]; - extern struct Pokemon *unk_2018000; extern u8 *(gNatureNames[]); -- cgit v1.2.3 From c9722602cb47eb5b6ecbccddf13df5f286a8ef7b Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Tue, 17 Jan 2017 14:13:04 +0100 Subject: Sort includes --- src/pokemon_summary_screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/pokemon_summary_screen.c') diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 6e051f449..7bf9ef078 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -1,9 +1,9 @@ #include "global.h" #include "asm.h" +#include "link.h" #include "menu.h" #include "pokemon.h" #include "string_util.h" -#include "link.h" extern struct Pokemon *unk_2018000; -- cgit v1.2.3 From bcaab977727ded65c9eeaef9dbef9e9441d26fb7 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Sat, 21 Jan 2017 16:48:06 -0800 Subject: formatting --- src/pokemon_summary_screen.c | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) (limited to 'src/pokemon_summary_screen.c') diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 7bf9ef078..5f96512f0 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -90,7 +90,8 @@ void PokemonSummaryScreen_PrintEggTrainerMemo(struct Pokemon *mon, u8 left, u8 t MenuPrint(gOtherText_EggDayCare, left, top); } -void PokemonSummaryScreen_PrintTrainerMemo(struct Pokemon *pokemon, u8 left, u8 top) { +void PokemonSummaryScreen_PrintTrainerMemo(struct Pokemon *pokemon, u8 left, u8 top) +{ u8 locationMet; u8 gameMet; u8 *ptr = gStringVar4; @@ -98,16 +99,19 @@ void PokemonSummaryScreen_PrintTrainerMemo(struct Pokemon *pokemon, u8 left, u8 ptr = sub_80A1E9C(ptr, gNatureNames[nature], 14); - if (nature != NATURE_BOLD && nature != NATURE_GENTLE) { + if (nature != NATURE_BOLD && nature != NATURE_GENTLE) + { ptr = StringCopy(ptr, gOtherText_Terminator4); } ptr = StringCopy(ptr, gOtherText_Nature); - if (PokemonSummaryScreen_CheckOT(pokemon) == TRUE) { + if (PokemonSummaryScreen_CheckOT(pokemon) == TRUE) + { locationMet = GetMonData(pokemon, MON_DATA_MET_LOCATION); - if (GetMonData(pokemon, MON_DATA_MET_LEVEL) == 0) { + if (GetMonData(pokemon, MON_DATA_MET_LEVEL) == 0) + { ptr = PokemonSummaryScreen_CopyPokemonLevel(ptr, 5); *ptr = CHAR_NEWLINE; ptr++; @@ -115,12 +119,16 @@ void PokemonSummaryScreen_PrintTrainerMemo(struct Pokemon *pokemon, u8 left, u8 CopyLocationName(gStringVar1, locationMet); ptr = sub_80A1E9C(ptr, gStringVar1, 14); StringCopy(ptr, gOtherText_Egg2); - } else if (locationMet >= 88) { + } + else if (locationMet >= 88) + { *ptr = CHAR_NEWLINE; ptr++; StringCopy(ptr, gOtherText_ObtainedInTrade); - } else { + } + else + { u8 levelMet = GetMonData(pokemon, MON_DATA_MET_LEVEL); ptr = PokemonSummaryScreen_CopyPokemonLevel(ptr, levelMet); @@ -131,17 +139,23 @@ void PokemonSummaryScreen_PrintTrainerMemo(struct Pokemon *pokemon, u8 left, u8 ptr = sub_80A1E9C(ptr, gStringVar1, 14); StringCopy(ptr, gOtherText_Met); } - } else { + } + else + { gameMet = GetMonData(pokemon, MON_DATA_MET_GAME); - if (!(gameMet == VERSION_RUBY || gameMet == VERSION_SAPPHIRE || gameMet == VERSION_EMERALD)) { + if (!(gameMet == VERSION_RUBY || gameMet == VERSION_SAPPHIRE || gameMet == VERSION_EMERALD)) + { *ptr = CHAR_NEWLINE; ptr++; StringCopy(ptr, gOtherText_ObtainedInTrade); - } else { + } + else + { locationMet = GetMonData(pokemon, MON_DATA_MET_LOCATION); - if (locationMet == 0xFF) { + if (locationMet == 0xFF) + { u8 levelMet = GetMonData(pokemon, MON_DATA_MET_LEVEL); ptr = PokemonSummaryScreen_CopyPokemonLevel(ptr, levelMet); @@ -149,12 +163,16 @@ void PokemonSummaryScreen_PrintTrainerMemo(struct Pokemon *pokemon, u8 left, u8 ptr++; StringCopy(ptr, gOtherText_FatefulEncounter); - } else if (locationMet >= 88) { + } + else if (locationMet >= 88) + { *ptr = CHAR_NEWLINE; ptr++; StringCopy(ptr, gOtherText_ObtainedInTrade); - } else { + } + else + { u8 levelMet = GetMonData(pokemon, MON_DATA_MET_LEVEL); ptr = PokemonSummaryScreen_CopyPokemonLevel(ptr, levelMet); -- cgit v1.2.3 From d35dc5bd698b8e359669ac0e5bc74b2df0e58bd8 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Sun, 21 May 2017 12:46:28 +0200 Subject: Add strings2.h --- src/pokemon_summary_screen.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'src/pokemon_summary_screen.c') diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 5f96512f0..56a56e455 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -4,22 +4,11 @@ #include "menu.h" #include "pokemon.h" #include "string_util.h" +#include "strings2.h" extern struct Pokemon *unk_2018000; extern u8 *(gNatureNames[]); -extern const u8 gOtherText_Terminator4[]; -extern const u8 gOtherText_Nature[]; - -extern const u8 gOtherText_Met[]; -extern const u8 gOtherText_Egg2[]; -extern const u8 gOtherText_ObtainedInTrade[]; -extern const u8 gOtherText_FatefulEncounter[]; -extern const u8 gOtherText_Met2[]; -extern const u8 gOtherText_EggDayCare[]; -extern const u8 gOtherText_EggNicePlace[]; -extern const u8 gOtherText_EggObtainedInTrade[]; -extern const u8 gOtherText_EggHotSprings[]; u8 *sub_80A1E9C(u8 *dest, u8 *src, u8); u8 PokemonSummaryScreen_CheckOT(struct Pokemon *pokemon); -- cgit v1.2.3 From 4d2b22a899c11dfcacfec6889968ab01655a3fe3 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Fri, 26 May 2017 14:53:51 +0200 Subject: Add headers --- src/pokemon_summary_screen.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/pokemon_summary_screen.c') diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 56a56e455..47af6c6f9 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -1,5 +1,7 @@ +#include "region_map.h" +#include "tv.h" #include "global.h" -#include "asm.h" +#include "pokemon_summary_screen.h" #include "link.h" #include "menu.h" #include "pokemon.h" @@ -8,13 +10,6 @@ extern struct Pokemon *unk_2018000; -extern u8 *(gNatureNames[]); - -u8 *sub_80A1E9C(u8 *dest, u8 *src, u8); -u8 PokemonSummaryScreen_CheckOT(struct Pokemon *pokemon); -u8 *PokemonSummaryScreen_CopyPokemonLevel(u8 *dest, u8 level); -u32 GetPlayerTrainerId(void); - bool8 PokemonSummaryScreen_CheckOT(struct Pokemon *mon) { u32 trainerId; -- cgit v1.2.3 From f26daa3d6954d2db3a7c44b79d319a7a084462c2 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Fri, 26 May 2017 15:01:42 +0200 Subject: Sort includes --- src/pokemon_summary_screen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/pokemon_summary_screen.c') diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 47af6c6f9..61ae11438 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -1,12 +1,12 @@ -#include "region_map.h" -#include "tv.h" #include "global.h" #include "pokemon_summary_screen.h" #include "link.h" #include "menu.h" #include "pokemon.h" +#include "region_map.h" #include "string_util.h" #include "strings2.h" +#include "tv.h" extern struct Pokemon *unk_2018000; -- cgit v1.2.3 From f7528a440daa93ed0916834dcaf84ea26ba0e22d Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Sat, 24 Jun 2017 18:23:41 +0200 Subject: wip src --- src/pokemon_summary_screen.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/pokemon_summary_screen.c') diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 61ae11438..00a0bea29 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -81,6 +81,7 @@ void PokemonSummaryScreen_PrintTrainerMemo(struct Pokemon *pokemon, u8 left, u8 u8 *ptr = gStringVar4; u8 nature = GetNature(pokemon); +#if ENGLISH ptr = sub_80A1E9C(ptr, gNatureNames[nature], 14); if (nature != NATURE_BOLD && nature != NATURE_GENTLE) @@ -89,6 +90,11 @@ void PokemonSummaryScreen_PrintTrainerMemo(struct Pokemon *pokemon, u8 left, u8 } ptr = StringCopy(ptr, gOtherText_Nature); +#elif GERMAN + ptr = StringCopy(gStringVar4, gOtherText_Nature); + ptr = sub_80A1E9C(ptr, gNatureNames[nature], 14); + ptr = StringCopy(ptr, gOtherText_Terminator4); +#endif if (PokemonSummaryScreen_CheckOT(pokemon) == TRUE) { -- cgit v1.2.3