diff --git a/asm/fldeff_strength.s b/asm/fldeff_strength.s index fdadd2aacb..a0a3f932d6 100644 --- a/asm/fldeff_strength.s +++ b/asm/fldeff_strength.s @@ -5,51 +5,51 @@ .text - thumb_func_start hm_prepare_rocksmash -hm_prepare_rocksmash: @ 8145DC4 - push {r4,lr} - movs r0, 0x57 - bl npc_before_player_of_type - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _08145DD8 - movs r0, 0 - b _08145DF2 -_08145DD8: - ldr r4, =gSpecialVar_Result - bl GetCursorSelectionMonId - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4] - ldr r1, =gUnknown_03005DB0 - ldr r0, =FieldCallback_Teleport - str r0, [r1] - ldr r1, =gUnknown_0203CEEC - ldr r0, =sub_8145E0C - str r0, [r1] - movs r0, 0x1 -_08145DF2: - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end hm_prepare_rocksmash +// thumb_func_start hm_prepare_rocksmash +//hm_prepare_rocksmash: @ 8145DC4 +// push {r4,lr} +// movs r0, 0x57 +// bl npc_before_player_of_type +// lsls r0, 24 +// lsrs r0, 24 +// cmp r0, 0x1 +// beq _08145DD8 +// movs r0, 0 +// b _08145DF2 +//_08145DD8: +// ldr r4, =gSpecialVar_Result +// bl GetCursorSelectionMonId +// lsls r0, 24 +// lsrs r0, 24 +// strh r0, [r4] +// ldr r1, =gUnknown_03005DB0 +// ldr r0, =FieldCallback_Teleport +// str r0, [r1] +// ldr r1, =gUnknown_0203CEEC +// ldr r0, =sub_8145E0C +// str r0, [r1] +// movs r0, 0x1 +//_08145DF2: +// pop {r4} +// pop {r1} +// bx r1 +// .pool +// thumb_func_end hm_prepare_rocksmash - thumb_func_start sub_8145E0C -sub_8145E0C: @ 8145E0C - push {lr} - bl GetCursorSelectionMonId - ldr r1, =gFieldEffectArguments - lsls r0, 24 - lsrs r0, 24 - str r0, [r1] - ldr r0, =FieryPath_EventScript_2908FD - bl ScriptContext1_SetupScript - pop {r0} - bx r0 - .pool - thumb_func_end sub_8145E0C +// thumb_func_start sub_8145E0C +//sub_8145E0C: @ 8145E0C +// push {lr} +// bl GetCursorSelectionMonId +// ldr r1, =gFieldEffectArguments +// lsls r0, 24 +// lsrs r0, 24 +// str r0, [r1] +// ldr r0, =FieryPath_EventScript_2908FD +// bl ScriptContext1_SetupScript +// pop {r0} +// bx r0 +// .pool +// thumb_func_end sub_8145E0C thumb_func_start sub_8145E2C sub_8145E2C: @ 8145E2C diff --git a/include/rom6.h b/include/rom6.h index f91b34b4a7..058504fe24 100644 --- a/include/rom6.h +++ b/include/rom6.h @@ -11,6 +11,8 @@ void UpdateBirchState(u16 days); void UpdateFrontierManiac(u16 days); void UpdateFrontierGambler(u16 days); void SetShoalItemFlag(u16 days); + +bool8 npc_before_player_of_type(u8); u8 oei_task_add(void); #endif //GUARD_ROM6_H diff --git a/ld_script.txt b/ld_script.txt index 838c468adb..fcecdd4beb 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -193,6 +193,7 @@ SECTIONS { asm/pokedex_cry_screen.o(.text); src/coins.o(.text); src/landmark.o(.text); + src/fldeff_strength.o(.text); asm/fldeff_strength.o(.text); src/battle_transition.o(.text); src/battle_controller_link_partner.o(.text); diff --git a/src/fldeff_strength.c b/src/fldeff_strength.c new file mode 100644 index 0000000000..77fa0db359 --- /dev/null +++ b/src/fldeff_strength.c @@ -0,0 +1,109 @@ +#include "global.h" +#include "field_effect.h" +#include "rom6.h" +#include "party_menu.h" + +#include "script.h" + +extern u16 gSpecialVar_Result; +extern void (*gUnknown_0203CEEC)(void); +extern bool8 (*gUnknown_03005DB0)(void); +static void sub_8145E0C(void); + +extern u8 FieryPath_EventScript_2908FD[]; + +bool8 hm_prepare_rocksmash(void) +{ + if (npc_before_player_of_type(87) == TRUE) + { + gSpecialVar_Result = GetCursorSelectionMonId(); + gUnknown_03005DB0 = FieldCallback_Teleport; + gUnknown_0203CEEC = sub_8145E0C; + return TRUE; + } + return FALSE; +} + +static void sub_8145E0C(void) +{ + gFieldEffectArguments[0] = GetCursorSelectionMonId(); + ScriptContext1_SetupScript(FieryPath_EventScript_2908FD); +} + +/* +#include "braille_puzzles.h" +#include "field_effect.h" +#include "party_menu.h" +#include "pokemon.h" +#include "pokemon_menu.h" + +#include "script.h" +#include "task.h" +#include "text.h" + +static void sub_811AA18(void); +static void sub_811AA38(void); +static void sub_811AA9C(void); + +extern u8 gLastFieldPokeMenuOpened; +extern u16 gSpecialVar_Result; +extern void (*gFieldCallback)(void); +extern void (*gUnknown_03005CE4)(void); + +extern u8 S_UseStrength[]; + +bool8 SetUpFieldMove_Strength(void) +{ + if (ShouldDoBrailleStrengthEffect()) + { + gSpecialVar_Result = gLastFieldPokeMenuOpened; + gFieldCallback = FieldCallback_Teleport; + gUnknown_03005CE4 = sub_811AA38; + } + else + { + if (npc_before_player_of_type(87) != TRUE) + return 0; + gSpecialVar_Result = gLastFieldPokeMenuOpened; + gFieldCallback = FieldCallback_Teleport; + gUnknown_03005CE4 = sub_811AA18; + } + + return TRUE; +} + +static void sub_811AA18(void) +{ + gFieldEffectArguments[0] = gLastFieldPokeMenuOpened; + ScriptContext1_SetupScript(S_UseStrength); +} + +static void sub_811AA38(void) +{ + gFieldEffectArguments[0] = gLastFieldPokeMenuOpened; + FieldEffectStart(FLDEFF_USE_STRENGTH); +} + +bool8 FldEff_UseStrength(void) +{ + u8 taskId = oei_task_add(); + + gTasks[taskId].data[8] = (u32)sub_811AA9C >> 16; + gTasks[taskId].data[9] = (u32)sub_811AA9C; + GetMonNickname(&gPlayerParty[gFieldEffectArguments[0]], gStringVar1); + return FALSE; +} + +static void sub_811AA9C(void) +{ + if (ShouldDoBrailleStrengthEffect()) + { + DoBrailleStrengthEffect(); + } + else + { + FieldEffectActiveListRemove(40); + EnableBothScriptContexts(); + } +} +*/