diff --git a/asm/fldeff_softboiled.s b/asm/fldeff_softboiled.s index c3aa4f1ed..8d06c9c8f 100644 --- a/asm/fldeff_softboiled.s +++ b/asm/fldeff_softboiled.s @@ -5,169 +5,169 @@ .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 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_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_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 diff --git a/data/party_menu.s b/data/party_menu.s index 9eae24ab9..b60a1f927 100644 --- a/data/party_menu.s +++ b/data/party_menu.s @@ -442,8 +442,8 @@ gUnknown_08615D9C:: @ 8615D9C .4byte SetUpFieldMove_Teleport, 0x0000000d .4byte sub_813572C, 0x0000000d .4byte sub_80FA004, 0x0000000d - .4byte hm_prepare_dive_probably, 0x00000010 - .4byte hm_prepare_dive_probably, 0x00000010 + .4byte SetUpFieldMove_SoftBoiled, 0x00000010 + .4byte SetUpFieldMove_SoftBoiled, 0x00000010 .4byte SetUpFieldMove_SweetScent, 0x0000000d .align 2 diff --git a/include/fldeff_softboiled.h b/include/fldeff_softboiled.h new file mode 100644 index 000000000..065dcbf02 --- /dev/null +++ b/include/fldeff_softboiled.h @@ -0,0 +1,7 @@ +#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 14aacce88..8f361663b 100644 --- a/include/party_menu.h +++ b/include/party_menu.h @@ -11,6 +11,17 @@ enum AILMENT_BRN }; +struct Struct203CEC8 +{ + u8 filler[0x9]; + u8 unk9; + u8 unkA; + u8 unkB; + u8 filler2[0x2]; +}; + +extern struct Struct203CEC8 gUnknown_0203CEC8; + bool8 pokemon_has_move(struct Pokemon *, u16); void sub_81B58A8(void); void DoWallyTutorialBagMenu(void); @@ -20,4 +31,8 @@ u8 GetCursorSelectionMonId(void); bool8 FieldCallback_Teleport(void); void sub_81B7F60(void); +void sub_81B0FCC(u8 partyMonId, u8 a); +void sub_81B1370(u8 taskId); +void display_pokemon_menu_message(u8 windowBorderId); + #endif // GUARD_PARTY_MENU_H diff --git a/ld_script.txt b/ld_script.txt index b084d866e..ae782a00b 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -210,6 +210,7 @@ SECTIONS { src/fldeff_sweetscent.o(.text); 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); diff --git a/src/fldeff_softboiled.c b/src/fldeff_softboiled.c new file mode 100644 index 000000000..8211cc77d --- /dev/null +++ b/src/fldeff_softboiled.c @@ -0,0 +1,191 @@ +#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" +#include "strings.h" +#include "task.h" +//#include "ewram.h" + +/* +struct Struct2001000 { + u8 unk0; + u8 unk1; + u8 unk2; + u8 filler3[9]; + void *unkC; +}; + +struct Struct201C000 { + struct Pokemon *unk0; + u8 filler4[1]; + u8 unk5; + u16 unk6; + u8 filler8[4]; + s32 unkC; + void* unk10; + u8 filler14[26]; + s16 unk2E; +}; + +#if ENGLISH +#define WINDOW_LEFT 3 +#define WINDOW_RIGHT 26 +#elif GERMAN +#define WINDOW_LEFT 0 +#define WINDOW_RIGHT 29 +#endif +*/ +/* +// extern +extern u8 gUnknown_0202E8F6; +extern u8 gLastFieldPokeMenuOpened; +extern u8 gUnknown_0202E8F4; + +// Static +static void sub_8133D50(u8 taskId); +static void sub_8133E74(u8 taskId); +static void sub_8133EB8(u8 taskId); +static void sub_8133EF8(void); +*/ + +void sub_816166C(u8 taskId); +void sub_81617B8(u8 taskId); +void sub_81B1F18(u8 taskId, u8 pokemonIdx, s8 a, s16 hp, TaskFunc func); + +bool8 SetUpFieldMove_SoftBoiled(void) +{ + u16 maxHp; + u16 hp; + u16 minHp; + + maxHp = GetMonData(&gPlayerParty[GetCursorSelectionMonId()], MON_DATA_MAX_HP); + hp = GetMonData(&gPlayerParty[GetCursorSelectionMonId()], MON_DATA_HP); + + minHp = (maxHp / 5); + if (hp > minHp) + { + return TRUE; + } + return FALSE; +} + +void sub_8161560(u8 taskId) +{ + gUnknown_0203CEC8.unkB = 0xA; + gUnknown_0203CEC8.unkA = gUnknown_0203CEC8.unk9; + sub_81B0FCC(GetCursorSelectionMonId(), 0x1); + display_pokemon_menu_message(0x5); + gTasks[taskId].func = sub_81B1370; +} + +void sub_81615A8(u8 taskId) +{ + u16 hp; + + u8 unk9 = gUnknown_0203CEC8.unk9; + u8 pokemonIndex = gUnknown_0203CEC8.unkA; + if(pokemonIndex > 6) + { + gUnknown_0203CEC8.unkB = 0; + display_pokemon_menu_message(0x0); + gTasks[taskId].func = sub_81B1370; + return; + } + + hp = GetMonData(&gPlayerParty[pokemonIndex], MON_DATA_HP); + if(hp == 0 || unk9 == pokemonIndex || GetMonData(&gPlayerParty[pokemonIndex], MON_DATA_MAX_HP) == hp) + { + sub_81617B8(taskId); + return; + } + + PlaySE(SE_KAIFUKU); + sub_81B1F18(taskId, unk9, -1, GetMonData(&gPlayerParty[unk9], MON_DATA_MAX_HP)/5, sub_816166C); +} + +/* +void sub_8133D28(u8 taskid) { + EWRAM_1000.unkC = sub_8133D50; + EWRAM_1B000_2.unk272 = 3; + DoPokemonMenu_Switch(taskid); +} + +static void sub_8133D50(u8 taskId) { + u8 unk1, unk2; + u16 hp; + struct Pokemon *pokemon; + //struct Task *task; + + struct Sprite *sprites = gSprites; + + + unk1 = sprites[EWRAM_1000.unk1].data[0]; + unk2 = sprites[EWRAM_1000.unk2].data[0]; + + if (unk1 > 5 || unk2 > 5) + { + sub_806CD44(taskId); + return; + } + + EWRAM_1C000.unk0 = &gPlayerParty[sprites[EWRAM_1000.unk2].data[0]]; + hp = GetMonData(EWRAM_1C000.unk0, MON_DATA_HP); + + if (hp == 0 || unk1 == unk2 || GetMonData(EWRAM_1C000.unk0, MON_DATA_MAX_HP) == hp) + { + sub_8133EB8(taskId); + return; + } + + PlaySE(SE_KAIFUKU); + + EWRAM_1C000.unk5 = gSprites[EWRAM_1000.unk1].data[0]; + + pokemon = &gPlayerParty[EWRAM_1C000.unk5]; + EWRAM_1C000.unk0 = pokemon; + EWRAM_1C000.unk6 = 0; + EWRAM_1C000.unkC = -0x8000; + EWRAM_1C000.unk10 = sub_8133EF8; + + + gTasks[taskId].data[10] = GetMonData(EWRAM_1C000.unk0, MON_DATA_MAX_HP); + gTasks[taskId].data[11] = GetMonData(EWRAM_1C000.unk0, MON_DATA_HP); + gTasks[taskId].data[12] = gTasks[taskId].data[10] / 5; + + sub_806D5A4(); + gTasks[taskId].func = sub_806FA18; + EWRAM_1B000_2.unk282 = gTasks[taskId].data[11]; +} + +static void sub_8133E74(u8 taskId) { + if (gUnknown_0202E8F6) + { + return; + } + + MenuZeroFillWindowRect(WINDOW_LEFT, 14, WINDOW_RIGHT, 19); + PrintPartyMenuPromptText(3, 0); + gTasks[taskId].func = HandlePartyMenuSwitchPokemonInput; +} + +static void sub_8133EB8(u8 taskId) { + gUnknown_0202E8F4 = 0; + sub_806D5A4(); + sub_806E834(gOtherText_CantUseOnPoke, 1); + gTasks[taskId].func = sub_8133E74; +} + +static void sub_8133EF8(void) { + sub_806CCE4(); + EWRAM_1B000_2.unk261 = 2; + DestroySprite(&gSprites[EWRAM_1000.unk1]); + MenuZeroFillWindowRect(WINDOW_LEFT, 14, WINDOW_RIGHT, 19); + PrintPartyMenuPromptText(0, 0); + SwitchTaskToFollowupFunc(EWRAM_1000.unk0); +} +*/