From a200d9406b15f722b34775050f6fe73894d23629 Mon Sep 17 00:00:00 2001 From: KDSKardabox Date: Thu, 15 Feb 2018 22:32:28 +0530 Subject: [PATCH] Finish fldeff_softboiled.c --- asm/fldeff_softboiled.s | 339 ------------------------------------ include/fldeff_softboiled.h | 8 - include/party_menu.h | 3 +- include/strings.h | 1 + ld_script.txt | 1 - src/fldeff_softboiled.c | 33 +++- 6 files changed, 32 insertions(+), 353 deletions(-) delete mode 100644 asm/fldeff_softboiled.s delete mode 100644 include/fldeff_softboiled.h diff --git a/asm/fldeff_softboiled.s b/asm/fldeff_softboiled.s deleted file mode 100644 index 9f5f6a26e..000000000 --- a/asm/fldeff_softboiled.s +++ /dev/null @@ -1,339 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - -// thumb_func_start hm_prepare_dive_probably -//hm_prepare_dive_probably: @ 8161508 -// push {r4-r6,lr} -// bl GetCursorSelectionMonId -// lsls r0, 24 -// lsrs r0, 24 -// movs r6, 0x64 -// muls r0, r6 -// ldr r4, =gPlayerParty -// adds r0, r4 -// movs r1, 0x3A -// bl GetMonData -// adds r5, r0, 0 -// lsls r5, 16 -// lsrs r5, 16 -// bl GetCursorSelectionMonId -// lsls r0, 24 -// lsrs r0, 24 -// muls r0, r6 -// adds r0, r4 -// movs r1, 0x39 -// bl GetMonData -// adds r4, r0, 0 -// lsls r4, 16 -// lsrs r4, 16 -// adds r0, r5, 0 -// movs r1, 0x5 -// bl __udivsi3 -// lsls r0, 16 -// lsrs r0, 16 -// cmp r4, r0 -// bhi _08161558 -// movs r0, 0 -// b _0816155A -// .pool -//_08161558: -// movs r0, 0x1 -//_0816155A: -// pop {r4-r6} -// pop {r1} -// bx r1 -// thumb_func_end hm_prepare_dive_probably - -// thumb_func_start sub_8161560 -//sub_8161560: @ 8161560 -// push {r4,lr} -// adds r4, r0, 0 -// lsls r4, 24 -// lsrs r4, 24 -// ldr r0, =gUnknown_0203CEC8 -// movs r1, 0xA -// strb r1, [r0, 0xB] -// ldrb r1, [r0, 0x9] -// strb r1, [r0, 0xA] -// bl GetCursorSelectionMonId -// lsls r0, 24 -// lsrs r0, 24 -// movs r1, 0x1 -// bl sub_81B0FCC -// movs r0, 0x5 -// bl display_pokemon_menu_message -// ldr r1, =gTasks -// lsls r0, r4, 2 -// adds r0, r4 -// lsls r0, 3 -// adds r0, r1 -// ldr r1, =sub_81B1370 -// str r1, [r0] -// pop {r4} -// pop {r0} -// bx r0 -// .pool -// thumb_func_end sub_8161560 - -// thumb_func_start sub_81615A8 -//sub_81615A8: @ 81615A8 -// push {r4-r7,lr} -// mov r7, r10 -// mov r6, r9 -// mov r5, r8 -// push {r5-r7} -// sub sp, 0x8 -// lsls r0, 24 -// lsrs r4, r0, 24 -// str r4, [sp, 0x4] -// ldr r1, =gUnknown_0203CEC8 -// ldrb r7, [r1, 0x9] -// mov r8, r7 -// ldrb r0, [r1, 0xA] -// adds r5, r0, 0 -// cmp r5, 0x6 -// bls _081615EC -// movs r0, 0 -// strb r0, [r1, 0xB] -// bl display_pokemon_menu_message -// ldr r1, =gTasks -// lsls r0, r4, 2 -// adds r0, r4 -// lsls r0, 3 -// adds r0, r1 -// ldr r1, =sub_81B1370 -// str r1, [r0] -// b _08161658 -// .pool -//_081615EC: -// movs r0, 0x64 -// mov r10, r0 -// mov r0, r10 -// muls r0, r5 -// ldr r1, =gPlayerParty -// mov r9, r1 -// adds r6, r0, r1 -// adds r0, r6, 0 -// movs r1, 0x39 -// bl GetMonData -// lsls r0, 16 -// lsrs r4, r0, 16 -// cmp r4, 0 -// beq _0816161A -// cmp r7, r5 -// beq _0816161A -// adds r0, r6, 0 -// movs r1, 0x3A -// bl GetMonData -// cmp r0, r4 -// bne _08161628 -//_0816161A: -// ldr r0, [sp, 0x4] -// bl sub_81617B8 -// b _08161658 -// .pool -//_08161628: -// movs r0, 0x1 -// bl PlaySE -// mov r1, r10 -// mov r0, r8 -// muls r0, r1 -// add r0, r9 -// movs r1, 0x3A -// bl GetMonData -// movs r1, 0x5 -// bl __udivsi3 -// adds r3, r0, 0 -// lsls r3, 16 -// asrs r3, 16 -// movs r2, 0x1 -// negs r2, r2 -// ldr r0, =sub_816166C -// str r0, [sp] -// ldr r0, [sp, 0x4] -// mov r1, r8 -// bl sub_81B1F18 -//_08161658: -// add sp, 0x8 -// pop {r3-r5} -// mov r8, r3 -// mov r9, r4 -// mov r10, r5 -// pop {r4-r7} -// pop {r0} -// bx r0 -// .pool -// thumb_func_end sub_81615A8 - -// thumb_func_start sub_816166C -//sub_816166C: @ 816166C -// push {r4,r5,lr} -// sub sp, 0x4 -// adds r4, r0, 0 -// lsls r4, 24 -// lsrs r4, 24 -// movs r0, 0x1 -// bl PlaySE -// ldr r5, =gUnknown_0203CEC8 -// movs r1, 0x9 -// ldrsb r1, [r5, r1] -// movs r0, 0x64 -// muls r0, r1 -// ldr r1, =gPlayerParty -// adds r0, r1 -// movs r1, 0x3A -// bl GetMonData -// movs r1, 0x5 -// bl __udivsi3 -// adds r3, r0, 0 -// lsls r3, 16 -// asrs r3, 16 -// ldrb r1, [r5, 0xA] -// ldr r0, =sub_81616C0 -// str r0, [sp] -// adds r0, r4, 0 -// movs r2, 0x1 -// bl sub_81B1F18 -// add sp, 0x4 -// pop {r4,r5} -// pop {r0} -// bx r0 -// .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_8161724 -sub_8161724: @ 8161724 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _08161772 - ldr r4, =gUnknown_0203CEC8 - movs r0, 0 - strb r0, [r4, 0xB] - ldrb r0, [r4, 0x9] - movs r1, 0 - bl sub_81B0FCC - ldrb r0, [r4, 0xA] - strb r0, [r4, 0x9] - ldrb r0, [r4, 0xA] - movs r1, 0x1 - bl sub_81B0FCC - movs r0, 0x6 - movs r1, 0 - bl sub_8198070 - movs r0, 0x6 - bl ClearWindowTilemap - movs r0, 0 - bl display_pokemon_menu_message - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B1370 - str r1, [r0] -_08161772: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8161724 - - thumb_func_start sub_8161784 -sub_8161784: @ 8161784 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081617AA - movs r0, 0x5 - bl display_pokemon_menu_message - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B1370 - str r0, [r1] -_081617AA: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8161784 - - thumb_func_start sub_81617B8 -sub_81617B8: @ 81617B8 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x5 - bl PlaySE - ldr r0, =gText_CantBeUsedOnPkmn - movs r1, 0 - bl sub_81B1B5C - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_8161784 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81617B8 - - .align 2, 0 @ Don't pad with nop. diff --git a/include/fldeff_softboiled.h b/include/fldeff_softboiled.h deleted file mode 100644 index 0e3b98a46..000000000 --- a/include/fldeff_softboiled.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef GUARD_FLDEFF_SOFTBOILED_H -#define GUARD_FLDEFF_SOFTBOILED_H - -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 25c389493..1ce12d98f 100644 --- a/include/party_menu.h +++ b/include/party_menu.h @@ -33,8 +33,9 @@ void sub_81B7F60(void); void sub_81B0FCC(u8 partyIdx, u8 a); void sub_81B1370(u8 taskId); -void display_pokemon_menu_message(u8 windowBorderId); +void display_pokemon_menu_message(u8 windowId); void sub_81B1F18(u8 taskId, u8 pokemonIdx, s8 a, s16 hp, TaskFunc func); void sub_81B1B5C(void *a, u8 b); +u8 sub_81B1BD4(); #endif // GUARD_PARTY_MENU_H diff --git a/include/strings.h b/include/strings.h index 4632938da..70b2777e1 100644 --- a/include/strings.h +++ b/include/strings.h @@ -350,6 +350,7 @@ extern const u8 gText_ThreeDashes[]; //party menu text extern const u8 gText_PkmnHPRestoredByVar2[]; +extern const u8 gText_CantBeUsedOnPkmn[]; //birch dex rating text extern const u8 gBirchDexRatingText_LessThan10[]; diff --git a/ld_script.txt b/ld_script.txt index ae782a00b..a6971b8d1 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -211,7 +211,6 @@ SECTIONS { asm/battle_anim_815A0D4.o(.text); asm/learn_move.o(.text); src/fldeff_softboiled.o(.text); - asm/fldeff_softboiled.o(.text); src/decoration_inventory.o(.text); src/roamer.o(.text); asm/battle_tower.o(.text); diff --git a/src/fldeff_softboiled.c b/src/fldeff_softboiled.c index 3420faed7..b61cf9f32 100644 --- a/src/fldeff_softboiled.c +++ b/src/fldeff_softboiled.c @@ -1,9 +1,7 @@ #include "global.h" -#include "fldeff_softboiled.h" #include "menu.h" #include "party_menu.h" #include "pokemon.h" -//#include "pokemon_menu.h" #include "constants/songs.h" #include "sound.h" #include "sprite.h" @@ -27,9 +25,7 @@ bool8 SetUpFieldMove_SoftBoiled(void) minHp = (maxHp / 5); if (hp > minHp) - { return TRUE; - } return FALSE; } @@ -82,3 +78,32 @@ void sub_81616C0(u8 taskId) gTasks[taskId].func = sub_8161724; } +void sub_8161724(u8 taskId) +{ + if(sub_81B1BD4() == 1) + return; + gUnknown_0203CEC8.unkB = 0x0; + sub_81B0FCC(gUnknown_0203CEC8.unk9, 0); + gUnknown_0203CEC8.unk9 = gUnknown_0203CEC8.unkA; + sub_81B0FCC(gUnknown_0203CEC8.unkA, 1); + sub_8198070(0x6, FALSE); + ClearWindowTilemap(0x6); + display_pokemon_menu_message(0); + gTasks[taskId].func = sub_81B1370; +} + +void sub_8161784(u8 taskId) +{ + if(sub_81B1BD4() == 1) + return; + display_pokemon_menu_message(0x5); + gTasks[taskId].func = sub_81B1370; +} + +void sub_81617B8(u8 taskId) +{ + PlaySE(SE_SELECT); + sub_81B1B5C(&gText_CantBeUsedOnPkmn, 0); + schedule_bg_copy_tilemap_to_vram(2); + gTasks[taskId].func = sub_8161784; +}