From 301664db2f7459e6f819a5f6eceeefccc78f0414 Mon Sep 17 00:00:00 2001 From: KDSKardabox Date: Thu, 15 Feb 2018 17:12:02 +0530 Subject: [PATCH] Matching the unmatched and another function --- asm/fldeff_softboiled.s | 72 ++++++++++++++++++------------------- include/fldeff_softboiled.h | 1 + include/party_menu.h | 10 +++--- include/strings.h | 4 +++ src/fldeff_softboiled.c | 51 +++++--------------------- 5 files changed, 56 insertions(+), 82 deletions(-) diff --git a/asm/fldeff_softboiled.s b/asm/fldeff_softboiled.s index 4af5a2592..9f5f6a26e 100644 --- a/asm/fldeff_softboiled.s +++ b/asm/fldeff_softboiled.s @@ -205,42 +205,42 @@ // .pool // thumb_func_end sub_816166C - thumb_func_start sub_81616C0 -sub_81616C0: @ 81616C0 - push {r4,r5,lr} - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldr r0, =gUnknown_0203CEC8 - movs r1, 0xA - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gStringVar1 - bl GetMonNickname - ldr r4, =gStringVar4 - ldr r1, =gText_PkmnHPRestoredByVar2 - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0 - bl sub_81B1B5C - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_8161724 - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81616C0 +// thumb_func_start sub_81616C0 +//sub_81616C0: @ 81616C0 +// push {r4,r5,lr} +// adds r5, r0, 0 +// lsls r5, 24 +// lsrs r5, 24 +// ldr r0, =gUnknown_0203CEC8 +// movs r1, 0xA +// ldrsb r1, [r0, r1] +// movs r0, 0x64 +// muls r0, r1 +// ldr r1, =gPlayerParty +// adds r0, r1 +// ldr r1, =gStringVar1 +// bl GetMonNickname +// ldr r4, =gStringVar4 +// ldr r1, =gText_PkmnHPRestoredByVar2 +// adds r0, r4, 0 +// bl StringExpandPlaceholders +// adds r0, r4, 0 +// movs r1, 0 +// bl sub_81B1B5C +// movs r0, 0x2 +// bl schedule_bg_copy_tilemap_to_vram +// ldr r1, =gTasks +// lsls r0, r5, 2 +// adds r0, r5 +// lsls r0, 3 +// adds r0, r1 +// ldr r1, =sub_8161724 +// str r1, [r0] +// pop {r4,r5} +// pop {r0} +// bx r0 +// .pool +// thumb_func_end sub_81616C0 thumb_func_start sub_8161724 sub_8161724: @ 8161724 diff --git a/include/fldeff_softboiled.h b/include/fldeff_softboiled.h index 065dcbf02..0e3b98a46 100644 --- a/include/fldeff_softboiled.h +++ b/include/fldeff_softboiled.h @@ -4,4 +4,5 @@ bool8 SetUpFieldMove_SoftBoiled(void); void sub_8161560(u8 taskid); + #endif // GUARD_FLDEFF_SOFTBOILED_H diff --git a/include/party_menu.h b/include/party_menu.h index 8f361663b..25c389493 100644 --- a/include/party_menu.h +++ b/include/party_menu.h @@ -1,6 +1,6 @@ #ifndef GUARD_PARTY_MENU_H #define GUARD_PARTY_MENU_H - +#include "task.h" enum { AILMENT_NONE, @@ -14,8 +14,8 @@ enum struct Struct203CEC8 { u8 filler[0x9]; - u8 unk9; - u8 unkA; + s8 unk9; + s8 unkA; u8 unkB; u8 filler2[0x2]; }; @@ -31,8 +31,10 @@ u8 GetCursorSelectionMonId(void); bool8 FieldCallback_Teleport(void); void sub_81B7F60(void); -void sub_81B0FCC(u8 partyMonId, u8 a); +void sub_81B0FCC(u8 partyIdx, u8 a); void sub_81B1370(u8 taskId); void display_pokemon_menu_message(u8 windowBorderId); +void sub_81B1F18(u8 taskId, u8 pokemonIdx, s8 a, s16 hp, TaskFunc func); +void sub_81B1B5C(void *a, u8 b); #endif // GUARD_PARTY_MENU_H diff --git a/include/strings.h b/include/strings.h index c9ebc175f..4632938da 100644 --- a/include/strings.h +++ b/include/strings.h @@ -348,6 +348,10 @@ extern const u8 gText_DepositedVar2Var1s[]; extern const u8 gText_NoRoomForItems[]; extern const u8 gText_ThreeDashes[]; +//party menu text +extern const u8 gText_PkmnHPRestoredByVar2[]; + +//birch dex rating text extern const u8 gBirchDexRatingText_LessThan10[]; extern const u8 gBirchDexRatingText_LessThan20[]; extern const u8 gBirchDexRatingText_LessThan30[]; diff --git a/src/fldeff_softboiled.c b/src/fldeff_softboiled.c index d4193b917..3420faed7 100644 --- a/src/fldeff_softboiled.c +++ b/src/fldeff_softboiled.c @@ -7,13 +7,14 @@ #include "constants/songs.h" #include "sound.h" #include "sprite.h" +#include "string_util.h" #include "strings.h" #include "task.h" void sub_816166C(u8 taskId); void sub_81617B8(u8 taskId); void sub_81616C0(u8 taskId); -void sub_81B1F18(u8 taskId, u8 pokemonIdx, s8 a, s16 hp, TaskFunc func); +void sub_8161724(u8 taskId); bool8 SetUpFieldMove_SoftBoiled(void) { @@ -66,52 +67,18 @@ void sub_81615A8(u8 taskId) sub_81B1F18(taskId, unk9, -1, GetMonData(&gPlayerParty[unk9], MON_DATA_MAX_HP)/5, sub_816166C); } -#ifdef NONMATCHING void sub_816166C(u8 taskId) { PlaySE(SE_KAIFUKU); sub_81B1F18(taskId, gUnknown_0203CEC8.unkA, 1, GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_MAX_HP)/5, sub_81616C0); } -#else -__attribute__((naked)) -void sub_816166C(u8 taskId) + +void sub_81616C0(u8 taskId) { - asm(".syntax unified\n\ - push {r4,r5,lr}\n\ - sub sp, 0x4\n\ - adds r4, r0, 0\n\ - lsls r4, 24\n\ - lsrs r4, 24\n\ - movs r0, 0x1\n\ - bl PlaySE\n\ - ldr r5, =gUnknown_0203CEC8\n\ - movs r1, 0x9\n\ - ldrsb r1, [r5, r1]\n\ - movs r0, 0x64\n\ - muls r0, r1\n\ - ldr r1, =gPlayerParty\n\ - adds r0, r1\n\ - movs r1, 0x3A\n\ - bl GetMonData\n\ - movs r1, 0x5\n\ - bl __udivsi3\n\ - adds r3, r0, 0\n\ - lsls r3, 16\n\ - asrs r3, 16\n\ - ldrb r1, [r5, 0xA]\n\ - ldr r0, =sub_81616C0\n\ - str r0, [sp]\n\ - adds r0, r4, 0\n\ - movs r2, 0x1\n\ - bl sub_81B1F18\n\ - add sp, 0x4\n\ - pop {r4,r5}\n\ - pop {r0}\n\ - bx r0\n\ - .pool\n\ - .syntax divided\n"); - + GetMonNickname(&gPlayerParty[gUnknown_0203CEC8.unkA], gStringVar1); + StringExpandPlaceholders(gStringVar4, gText_PkmnHPRestoredByVar2); + sub_81B1B5C(gStringVar4, 0); + schedule_bg_copy_tilemap_to_vram(2); + gTasks[taskId].func = sub_8161724; } -#endif -