From e1e2132a37e188372f3923cdb741897978cb6e2a Mon Sep 17 00:00:00 2001 From: garak Date: Sun, 9 Dec 2018 22:24:54 -0500 Subject: [PATCH] sync fldeff function names with pokeruby --- data/event_scripts.s | 10 +- data/field_effect_scripts.s | 20 +- .../BattleFrontier_OutsideEast/scripts.inc | 2 +- data/party_menu.s | 2 +- data/scripts/berry_tree.inc | 2 +- data/specials.inc | 6 +- include/fldeff_80F9BCC.h | 14 +- src/battle_setup.c | 4 +- src/data/graphics/berry_fix.h | 2 +- src/field_control_avatar.c | 4 +- src/fldeff_80F9BCC.c | 353 +++++++----------- src/secret_base.c | 4 +- 12 files changed, 169 insertions(+), 254 deletions(-) diff --git a/data/event_scripts.s b/data/event_scripts.s index 115c9921a..c7ef6d244 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -535,7 +535,7 @@ EventScript_23B5F0:: @ 823B5F0 goto_eq EventScript_23B5A1 msgbox Text_2767D1, 3 special sub_80E9C2C - special sub_80FA57C + special DoSecretBasePCTurnOffEffect releaseall end @@ -545,13 +545,13 @@ EventScript_23B62F:: @ 823B62F goto_eq EventScript_23B5A1 msgbox Text_2767E9, 3 special sub_80E9C2C - special sub_80FA57C + special DoSecretBasePCTurnOffEffect releaseall end EventScript_23B652:: @ 823B652 msgbox Text_27676F, 3 - special sub_80FA57C + special DoSecretBasePCTurnOffEffect closemessage releaseall end @@ -562,7 +562,7 @@ EventScript_23B660:: @ 823B660 end EventScript_23B66E:: @ 823B66E - special sub_80FA57C + special DoSecretBasePCTurnOffEffect closemessage releaseall end @@ -590,7 +590,7 @@ EventScript_SecretBaseSandOrnament:: @ 823B684 end EventScript_SecretBaseShieldOrToyTV:: @ 823B68C - special sub_80FAC78 + special GetShieldToyTVDecorationInfo compare VAR_RESULT, 0 goto_eq EventScript_23B6BC compare VAR_RESULT, 1 diff --git a/data/field_effect_scripts.s b/data/field_effect_scripts.s index eab655877..81de41aaa 100644 --- a/data/field_effect_scripts.s +++ b/data/field_effect_scripts.s @@ -118,7 +118,7 @@ gFieldEffectScript_GroundImpactDust:: @ 82DBB28 field_eff_end gFieldEffectScript_Unknown11:: @ 82DBB32 - field_eff_callnative oei_sweet_scent + field_eff_callnative FldEff_UseSecretPowerCave field_eff_end gFieldEffectScript_BikeHopTallGrass:: @ 82DBB38 @@ -179,11 +179,11 @@ gFieldEffectScript_Unknown25:: @ 82DBBB6 field_eff_end gFieldEffectScript_Unknown26:: @ 82DBBC5 - field_eff_callnative sub_80FA208 + field_eff_callnative FldEff_UseSecretPowerTree field_eff_end gFieldEffectScript_Unknown27:: @ 82DBBCB - field_eff_callnative sub_80FA36C + field_eff_callnative FldEff_UseSecretPowerShrub field_eff_end gFieldEffectScript_TreeDisguise:: @ 82DBBD1 @@ -264,11 +264,11 @@ gFieldEffectScript_HeartIcon:: @ 82DBC56 field_eff_end gFieldEffectScript_Unknown47:: @ 82DBC60 - field_eff_callnative sub_80FA6FC + field_eff_callnative FldEff_NopA6FC field_eff_end gFieldEffectScript_Unknown48:: @ 82DBC66 - field_eff_callnative sub_80FA700 + field_eff_callnative FldEff_NopA700 field_eff_end gFieldEffectScript_JumpOutOfAsh:: @ 82DBC6C @@ -284,7 +284,7 @@ gFieldEffectScript_Unknown51:: @ 82DBC80 field_eff_end gFieldEffectScript_Unknown52:: @ 82DBC86 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo9, sub_80FAA7C + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo9, FldEff_SandPillar field_eff_end gFieldEffectScript_Bubbles:: @ 82DBC90 @@ -296,15 +296,15 @@ gFieldEffectScript_Unknown54:: @ 82DBC9A field_eff_end gFieldEffectScript_Unknown55:: @ 82DBCA4 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo7, sub_80FA13C + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo7, FldEff_SecretPowerCave field_eff_end gFieldEffectScript_Unknown56:: @ 82DBCAE - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo8, sub_80FA248 + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo8, FldEff_SecretPowerTree field_eff_end gFieldEffectScript_Unknown57:: @ 82DBCB8 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo8, sub_80FA3AC + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo8, FldEff_SecretPowerShrub field_eff_end gFieldEffectScript_Unknown58:: @ 82DBCC2 @@ -320,7 +320,7 @@ gFieldEffectScript_Unknown60:: @ 82DBCD2 field_eff_end gFieldEffectScript_Unknown61:: @ 82DBCD8 - field_eff_callnative sub_80FA458 + field_eff_callnative FldEff_SecretBasePCTurnOn field_eff_end gFieldEffectScript_Unknown62:: @ 82DBCDE diff --git a/data/maps/BattleFrontier_OutsideEast/scripts.inc b/data/maps/BattleFrontier_OutsideEast/scripts.inc index 6ed4d94d6..febcb05c7 100644 --- a/data/maps/BattleFrontier_OutsideEast/scripts.inc +++ b/data/maps/BattleFrontier_OutsideEast/scripts.inc @@ -117,7 +117,7 @@ BattleFrontier_OutsideEast_EventScript_242CEA:: @ 8242CEA BattleFrontier_OutsideEast_EventScript_242CFC:: @ 8242CFC lock faceplayer - special sub_80FAFF8 + special DoWateringBerryTreeAnim waitstate waitse playse 269 diff --git a/data/party_menu.s b/data/party_menu.s index eedcd4377..e271b7804 100644 --- a/data/party_menu.s +++ b/data/party_menu.s @@ -441,7 +441,7 @@ gUnknown_08615D9C:: @ 8615D9C .4byte hm_prepare_waterfall, 0x0000000d .4byte SetUpFieldMove_Teleport, 0x0000000d .4byte SetUpFieldMove_Dig, 0x0000000d - .4byte sub_80FA004, 0x0000000d + .4byte SetUpFieldMove_SecretPower, 0x0000000d .4byte SetUpFieldMove_SoftBoiled, 0x00000010 .4byte SetUpFieldMove_SoftBoiled, 0x00000010 .4byte SetUpFieldMove_SweetScent, 0x0000000d diff --git a/data/scripts/berry_tree.inc b/data/scripts/berry_tree.inc index 1fda1133f..6b9fb14ef 100644 --- a/data/scripts/berry_tree.inc +++ b/data/scripts/berry_tree.inc @@ -174,7 +174,7 @@ Route102_EventScript_2744C4:: @ 82744C4 message Route102_Text_274710 waitmessage special EventObjectInteractionWaterBerryTree - special sub_80FAFF8 + special DoWateringBerryTreeAnim waitstate message Route102_Text_274723 waitmessage diff --git a/data/specials.inc b/data/specials.inc index a1d9734ca..7dd35507d 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -34,7 +34,7 @@ gSpecials:: @ 81DBA64 def_special sub_8129708 def_special sub_80E91F8 def_special sub_80EA30C - def_special sub_80FA57C + def_special DoSecretBasePCTurnOffEffect def_special sub_80E6BE8 def_special sub_80B2DA4 def_special sub_80B2E4C @@ -105,7 +105,7 @@ gSpecials:: @ 81DBA64 def_special GiveMonArtistRibbon def_special sub_80B3000 def_special SaveGame - def_special sub_80FAFF8 + def_special DoWateringBerryTreeAnim def_special easy_chat_input_maybe def_special sub_811EECC def_special ScrSpecial_GetCurrentMauvilleMan @@ -317,7 +317,7 @@ gSpecials:: @ 81DBA64 def_special ScriptCheckFreePokemonStorageSpace def_special DoSealedChamberShakingEffect1 def_special sub_8139B60 - def_special sub_80FAC78 + def_special GetShieldToyTVDecorationInfo def_special IsPokerusInParty def_special SetSootopolisGymCrackedIceMetatiles def_special sub_8139560 diff --git a/include/fldeff_80F9BCC.h b/include/fldeff_80F9BCC.h index 027bb4273..281d048c1 100644 --- a/include/fldeff_80F9BCC.h +++ b/include/fldeff_80F9BCC.h @@ -1,19 +1,13 @@ #ifndef GUARD_FLDEFF_80F9BCC_H #define GUARD_FLDEFF_80F9BCC_H -// Exported type declarations - -// Exported RAM declarations - -// Exported ROM declarations - -void sub_80FA5E4(s16 id, s16 x, s16 y); -void sub_80FA794(s16 x, s16 y); +void PopSecretBaseBalloon(s16 id, s16 x, s16 y); +void ShatterSecretBaseBreakableDoor(s16 x, s16 y); void CreateRecordMixingSprite(void); void DestroyRecordMixingSprite(void); void FldeffPoison_Start(void); -void sub_80FA970(s16); -void sub_80FA9D0(void); +void PlaySecretBaseMusicNoteMatSound(s16 metatileId); +void DoSecretBaseGlitterMatSparkle(void); bool8 sub_80FADE4(u16, u8); #endif //GUARD_FLDEFF_80F9BCC_H diff --git a/src/battle_setup.c b/src/battle_setup.c index ab2a12fb7..d4b25021e 100644 --- a/src/battle_setup.c +++ b/src/battle_setup.c @@ -56,7 +56,7 @@ struct TrainerBattleParameter }; extern bool32 InTrainerHill(void); -extern bool32 FieldPoisonEffectIsRunning(void); +extern bool32 FldeffPoison_IsActive(void); extern void RestartWildEncounterImmunitySteps(void); extern void ClearPoisonStepCounter(void); extern void sub_81BE72C(void); @@ -337,7 +337,7 @@ static void Task_BattleStart(u8 taskId) switch (tState) { case 0: - if (!FieldPoisonEffectIsRunning()) // is poison not active? + if (!FldeffPoison_IsActive()) // is poison not active? { BattleTransition_StartOnField(tTransition); sub_81BE72C(); diff --git a/src/data/graphics/berry_fix.h b/src/data/graphics/berry_fix.h index aede748a4..07e2cbf51 100644 --- a/src/data/graphics/berry_fix.h +++ b/src/data/graphics/berry_fix.h @@ -20,4 +20,4 @@ const u32 gBerryFixGbaTransferError_Tilemap[] = INCBIN_U32("graphics/berry_fix/g const u16 gBerryFixWindow_Pal[] = INCBIN_U16("graphics/berry_fix/window.gbapal"); const u32 gBerryFixWindow_Gfx[] = INCBIN_U32("graphics/berry_fix/window.4bpp.lz"); -const u32 gBerryFixWindow_Tilemap[] = INCBIN_U32("graphics/berry_fix/window.bin.lz"); \ No newline at end of file +const u32 gBerryFixWindow_Tilemap[] = INCBIN_U32("graphics/berry_fix/window.bin.lz"); diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index c52f5190f..ae598045e 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -522,13 +522,13 @@ static bool8 TryStartMiscWalkingScripts(u16 metatileBehavior) } else if (MetatileBehavior_IsSecretBaseGlitterMat(metatileBehavior) == TRUE) { - sub_80FA9D0(); + DoSecretBaseGlitterMatSparkle(); return FALSE; } else if (MetatileBehavior_IsSecretBaseSoundMat(metatileBehavior) == TRUE) { PlayerGetDestCoords(&x, &y); - sub_80FA970(MapGridGetMetatileIdAt(x, y)); + PlaySecretBaseMusicNoteMatSound(MapGridGetMetatileIdAt(x, y)); return FALSE; } return FALSE; diff --git a/src/fldeff_80F9BCC.c b/src/fldeff_80F9BCC.c index c0fd0643e..94e0fd276 100644 --- a/src/fldeff_80F9BCC.c +++ b/src/fldeff_80F9BCC.c @@ -1,25 +1,25 @@ #include "global.h" +#include "gpu_regs.h" +#include "palette.h" +#include "script.h" +#include "sound.h" +#include "task.h" +#include "rom6.h" +#include "strings.h" +#include "party_menu.h" #include "fieldmap.h" #include "field_effect.h" #include "field_camera.h" -#include "constants/field_effects.h" -#include "constants/songs.h" -#include "constants/vars.h" -#include "rom6.h" -#include "strings.h" +#include "field_player_avatar.h" #include "secret_base.h" #include "event_data.h" -#include "field_player_avatar.h" -#include "party_menu.h" -#include "metatile_behavior.h" -#include "constants/metatile_behaviors.h" #include "event_object_movement.h" -#include "task.h" -#include "sound.h" -#include "script.h" -#include "palette.h" -#include "gpu_regs.h" +#include "metatile_behavior.h" #include "string_util.h" +#include "constants/field_effects.h" +#include "constants/metatile_behaviors.h" +#include "constants/songs.h" +#include "constants/vars.h" extern struct MapPosition gPlayerFacingPosition; extern const struct SpriteTemplate *const gFieldEffectObjectTemplatePointers[]; @@ -34,43 +34,43 @@ extern u8 EventScript_275B38[]; extern const struct OamData gEventObjectBaseOam_32x8; -extern const u8 gSpriteImage_858E1D8[]; -extern const u8 gSpriteImage_858E2D8[]; -extern const u8 gSpriteImage_858E3D8[]; extern const u16 gTilesetPalettes_SecretBase[][16]; -// void sub_80F9C90(u8); void sub_80F9DFC(u8); -void sub_80FA4A0(u8); -void sub_80FA62C(u8); -void sub_80FA6AC(s16); -void sub_80FAEF0(u8); -void sub_80FAF64(u8); -void sub_80FAFD4(u8); +void Task_SecretBasePCTurnOn(u8); + +void Task_PopSecretBaseBalloon(u8); +void DoBalloonSoundEffect(s16); + +void Task_WateringBerryTreeAnim_1(u8); +void Task_WateringBerryTreeAnim_2(u8); +void Task_WateringBerryTreeAnim_3(u8); void sub_80F9C44(TaskFunc, u16, u16, u8); -void sub_80FA0DC(void); -void sub_80FA1E8(void); -void sub_80FA34C(void); -void sub_80FA128(void); -void sub_80FA234(void); -void sub_80FA398(void); +void FieldCallback_SecretBaseCave(void); +static void CaveEntranceSpriteCallback1(struct Sprite *); +static void CaveEntranceSpriteCallback2(struct Sprite *); +static void CaveEntranceSpriteCallbackEnd(struct Sprite *); +static void StartSecretBaseCaveFieldEffect(void); -void door_restore_tilemap(struct Sprite *); -void sub_80FA1A8(struct Sprite *); -void sub_80FA1D8(struct Sprite *); -void sub_80FA304(struct Sprite *); -void sub_80FA33C(struct Sprite *); -void sub_80FA418(struct Sprite *); -void sub_80FA448(struct Sprite *); -void sub_80FAC24(struct Sprite *); -void sub_80FAC68(struct Sprite *); -void sub_80FA18C(struct Sprite *); -void sub_80FA2D8(struct Sprite *); -void sub_80FA3FC(struct Sprite *); +void FieldCallback_SecretBaseTree(void); +static void TreeEntranceSpriteCallback1(struct Sprite *); +static void TreeEntranceSpriteCallback2(struct Sprite *); +static void TreeEntranceSpriteCallbackEnd(struct Sprite *); +static void StartSecretBaseTreeFieldEffect(void); + +void FieldCallback_SecretBaseShrub(void); +static void ShrubEntranceSpriteCallback1(struct Sprite *); +static void ShrubEntranceSpriteCallback2(struct Sprite *); +static void ShrubEntranceSpriteCallbackEnd(struct Sprite *); +static void StartSecretBaseShrubFieldEffect(void); + +void SpriteCB_SandPillar_0(struct Sprite *); +void SpriteCB_SandPillar_1(struct Sprite *); +void SpriteCB_SandPillar_2(struct Sprite *); const u8 gSpriteImage_858D978[] = INCBIN_U8("graphics/unknown/858E588/0.4bpp"); const u8 gSpriteImage_858D9F8[] = INCBIN_U8("graphics/unknown/858E588/1.4bpp"); @@ -222,7 +222,7 @@ const struct SpriteTemplate gUnknown_0858E600 = .anims = gSpriteAnimTable_858E570, .images = gUnknown_858E588, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80FA18C, + .callback = CaveEntranceSpriteCallback1, }; const struct SpriteTemplate gUnknown_0858E618 = @@ -233,7 +233,7 @@ const struct SpriteTemplate gUnknown_0858E618 = .anims = gSpriteAnimTable_858E574, .images = gUnknown_858E5B0, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80FA2D8, + .callback = TreeEntranceSpriteCallback1, }; const struct SpriteTemplate gUnknown_0858E630 = @@ -244,7 +244,7 @@ const struct SpriteTemplate gUnknown_0858E630 = .anims = gSpriteAnimTable_858E584, .images = gUnknown_858E5D8, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80FA3FC, + .callback = ShrubEntranceSpriteCallback1, }; const struct SpritePalette gFieldEffectObjectPaletteInfo7 = {gFieldEffectObjectPalette7, 0x1003}; @@ -290,7 +290,7 @@ const struct SpriteTemplate gUnknown_0858E68C = .anims = gSpriteAnimTable_858E670, .images = gUnknown_0858E674, .affineAnims = gDummySpriteAffineAnimTable, - .callback = door_restore_tilemap, + .callback = SpriteCB_SandPillar_0, }; // This uses one of the secret base palettes, so there is no "field_effect_object_palette_09.pal" file. @@ -355,11 +355,11 @@ bool8 sub_80F9C30(void) return FuncIsActiveTask(sub_80F9DFC); } -void sub_80F9C44(void (*a0) (u8), u16 a1, u16 a2, u8 a3) +void sub_80F9C44(void (*taskfunc) (u8), u16 a1, u16 a2, u8 a3) { u16 tempA, tempB; - u8 taskId = CreateTask(a0, a3); + u8 taskId = CreateTask(taskfunc, a3); gTasks[taskId].data[0] = 0; @@ -713,15 +713,13 @@ void sub_80F9DFC(u8 taskId) //============================================================================= // fldeff_secretpower.c -// SetCurrentSecretBase(); -void sub_80F9F5C(void) +void SetCurrentSecretBase(void) { sub_80E9608(&gPlayerFacingPosition, gMapHeader.events); sub_80E8B6C(); } -// AdjustSecretPowerSpritePixelOffsets -void sub_80F9F78(void) +void AdjustSecretPowerSpritePixelOffsets(void) { if (gPlayerAvatar.flags & 0x6) { @@ -769,8 +767,7 @@ void sub_80F9F78(void) } } -// SetUpFieldMove_SecretPower -bool8 sub_80FA004(void) +bool8 SetUpFieldMove_SecretPower(void) { u8 mb; @@ -784,59 +781,56 @@ bool8 sub_80FA004(void) if (MetatileBehavior_IsSecretBaseCave(mb) == TRUE) { - sub_80F9F5C(); + SetCurrentSecretBase(); gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu; - gPostMenuFieldCallback = sub_80FA0DC; + gPostMenuFieldCallback = FieldCallback_SecretBaseCave; return TRUE; } if (MetatileBehavior_IsSecretBaseTree(mb) == TRUE) { - sub_80F9F5C(); + SetCurrentSecretBase(); gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu; - gPostMenuFieldCallback = sub_80FA1E8; + gPostMenuFieldCallback = FieldCallback_SecretBaseTree; return TRUE; } if (MetatileBehavior_IsSecretBaseShrub(mb) == TRUE) { - sub_80F9F5C(); + SetCurrentSecretBase(); gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu; - gPostMenuFieldCallback = sub_80FA34C; + gPostMenuFieldCallback = FieldCallback_SecretBaseShrub; return TRUE; } return FALSE; } -// FieldCallback_SecretBaseCave -void sub_80FA0DC(void) +void FieldCallback_SecretBaseCave(void) { gFieldEffectArguments[0] = GetCursorSelectionMonId(); ScriptContext1_SetupScript(EventScript_275A86); } -bool8 oei_sweet_scent(void) +bool8 FldEff_UseSecretPowerCave(void) { u8 taskId = oei_task_add(); - gTasks[taskId].data[8] = (u32)sub_80FA128 >> 16; - gTasks[taskId].data[9] = (u32)sub_80FA128; + gTasks[taskId].data[8] = (u32)StartSecretBaseCaveFieldEffect >> 16; + gTasks[taskId].data[9] = (u32)StartSecretBaseCaveFieldEffect; return FALSE; } -// StartSecretBaseCaveFieldEffect -void sub_80FA128(void) +static void StartSecretBaseCaveFieldEffect(void) { FieldEffectActiveListRemove(FLDEFF_USE_SECRET_POWER_CAVE); FieldEffectStart(FLDEFF_SECRET_POWER_CAVE); } -// FldEff_SecretPowerCave -bool8 sub_80FA13C(void) +bool8 FldEff_SecretPowerCave(void) { - sub_80F9F78(); + AdjustSecretPowerSpritePixelOffsets(); CreateSprite(&gUnknown_0858E600, gSprites[gPlayerAvatar.spriteId].oam.x + gFieldEffectArguments[5], @@ -846,17 +840,15 @@ bool8 sub_80FA13C(void) return FALSE; } -// CaveEntranceSpriteCallback1 -void sub_80FA18C(struct Sprite *sprite) +static void CaveEntranceSpriteCallback1(struct Sprite *sprite) { PlaySE(SE_W088); sprite->data[0] = 0; - sprite->callback = sub_80FA1A8; + sprite->callback = CaveEntranceSpriteCallback2; } -// CaveEntranceSpriteCallback2 -void sub_80FA1A8(struct Sprite *sprite) +static void CaveEntranceSpriteCallback2(struct Sprite *sprite) { if (sprite->data[0] < 40) { @@ -868,45 +860,39 @@ void sub_80FA1A8(struct Sprite *sprite) else { sprite->data[0] = 0; - sprite->callback = sub_80FA1D8; + sprite->callback = CaveEntranceSpriteCallbackEnd; } } -// CaveEntranceSpriteCallbackEnd -void sub_80FA1D8(struct Sprite *sprite) +static void CaveEntranceSpriteCallbackEnd(struct Sprite *sprite) { - // FieldEffectStop(sprite, FLDEFF_SECRET_POWER_CAVE); EnableBothScriptContexts(); } -// FieldCallback_SecretBaseTree -void sub_80FA1E8(void) +void FieldCallback_SecretBaseTree(void) { gFieldEffectArguments[0] = GetCursorSelectionMonId(); ScriptContext1_SetupScript(EventScript_275ADF); } -// FldEff_UseSecretPowerTree -bool8 sub_80FA208(void) +bool8 FldEff_UseSecretPowerTree(void) { u8 taskId = oei_task_add(); - gTasks[taskId].data[8] = (u32)sub_80FA234 >> 16; - gTasks[taskId].data[9] = (u32)sub_80FA234; + gTasks[taskId].data[8] = (u32)StartSecretBaseTreeFieldEffect >> 16; + gTasks[taskId].data[9] = (u32)StartSecretBaseTreeFieldEffect; return FALSE; } -// StartSecretBaseTreeFieldEffect -void sub_80FA234(void) +static void StartSecretBaseTreeFieldEffect(void) { FieldEffectActiveListRemove(FLDEFF_USE_SECRET_POWER_TREE); FieldEffectStart(FLDEFF_SECRET_POWER_TREE); } -// FldEff_SecretPowerTree -bool8 sub_80FA248(void) +bool8 FldEff_SecretPowerTree(void) { s16 mb = MapGridGetMetatileBehaviorAt(gPlayerFacingPosition.x, gPlayerFacingPosition.y) & 0xFFF; @@ -916,7 +902,7 @@ bool8 sub_80FA248(void) if (mb == MB_SECRET_BASE_SPOT_TREE_RIGHT) gFieldEffectArguments[7] = 2; - sub_80F9F78(); + AdjustSecretPowerSpritePixelOffsets(); CreateSprite(&gUnknown_0858E618, gSprites[gPlayerAvatar.spriteId].oam.x + gFieldEffectArguments[5], @@ -929,18 +915,16 @@ bool8 sub_80FA248(void) return FALSE; } -// TreeEntranceSpriteCallback1 -void sub_80FA2D8(struct Sprite *sprite) +static void TreeEntranceSpriteCallback1(struct Sprite *sprite) { PlaySE(SE_W010); sprite->animNum = gFieldEffectArguments[7]; sprite->data[0] = 0; - sprite->callback = sub_80FA304; + sprite->callback = TreeEntranceSpriteCallback2; } -// TreeEntranceSpriteCallback2 -void sub_80FA304(struct Sprite *sprite) +static void TreeEntranceSpriteCallback2(struct Sprite *sprite) { sprite->data[0]++; @@ -950,46 +934,41 @@ void sub_80FA304(struct Sprite *sprite) sub_80E8D4C(); sprite->data[0] = 0; - sprite->callback = sub_80FA33C; + sprite->callback = TreeEntranceSpriteCallbackEnd; } } -// TreeEntranceSpriteCallbackEnd -void sub_80FA33C(struct Sprite *sprite) +static void TreeEntranceSpriteCallbackEnd(struct Sprite *sprite) { FieldEffectStop(sprite, FLDEFF_SECRET_POWER_TREE); EnableBothScriptContexts(); } -// FieldCallback_SecretBaseShrub -void sub_80FA34C(void) +void FieldCallback_SecretBaseShrub(void) { gFieldEffectArguments[0] = GetCursorSelectionMonId(); ScriptContext1_SetupScript(EventScript_275B38); } -// FldEff_UseSecretPowerShrub -bool8 sub_80FA36C(void) +bool8 FldEff_UseSecretPowerShrub(void) { u8 taskId = oei_task_add(); - gTasks[taskId].data[8] = (u32)sub_80FA398 >> 16; - gTasks[taskId].data[9] = (u32)sub_80FA398; + gTasks[taskId].data[8] = (u32)StartSecretBaseShrubFieldEffect >> 16; + gTasks[taskId].data[9] = (u32)StartSecretBaseShrubFieldEffect; return FALSE; } -// StartSecretBaseShrubFieldEffect -void sub_80FA398(void) +static void StartSecretBaseShrubFieldEffect(void) { FieldEffectActiveListRemove(FLDEFF_USE_SECRET_POWER_SHRUB); FieldEffectStart(FLDEFF_SECRET_POWER_SHRUB); } -// FldEff_SecretPowerShrub -bool8 sub_80FA3AC(void) +bool8 FldEff_SecretPowerShrub(void) { - sub_80F9F78(); + AdjustSecretPowerSpritePixelOffsets(); CreateSprite(&gUnknown_0858E630, gSprites[gPlayerAvatar.spriteId].oam.x + gFieldEffectArguments[5], @@ -999,17 +978,15 @@ bool8 sub_80FA3AC(void) return FALSE; } -// ShrubEntranceSpriteCallback1 -void sub_80FA3FC(struct Sprite *sprite) +static void ShrubEntranceSpriteCallback1(struct Sprite *sprite) { PlaySE(SE_W077); sprite->data[0] = 0; - sprite->callback = sub_80FA418; + sprite->callback = ShrubEntranceSpriteCallback2; } -// ShrubEntranceSpriteCallback2 -void sub_80FA418(struct Sprite *sprite) +static void ShrubEntranceSpriteCallback2(struct Sprite *sprite) { if (sprite->data[0] < 40) { @@ -1021,29 +998,24 @@ void sub_80FA418(struct Sprite *sprite) else { sprite->data[0] = 0; - sprite->callback = sub_80FA448; + sprite->callback = ShrubEntranceSpriteCallbackEnd; } } -// ShrubEntranceSpriteCallbackEnd -void sub_80FA448(struct Sprite *sprite) +static void ShrubEntranceSpriteCallbackEnd(struct Sprite *sprite) { FieldEffectStop(sprite, FLDEFF_SECRET_POWER_SHRUB); EnableBothScriptContexts(); } -//============================================================================= -// fldeff_secretbase_pc.c - -// FldEff_SecretBasePCTurnOn -u32 sub_80FA458(void) +u32 FldEff_SecretBasePCTurnOn(void) { s16 x, y; u8 taskId; GetXYCoordsOneStepInFrontOfPlayer(&x, &y); - taskId = CreateTask(sub_80FA4A0, 0); + taskId = CreateTask(Task_SecretBasePCTurnOn, 0); gTasks[taskId].data[0] = x; gTasks[taskId].data[1] = y; gTasks[taskId].data[2] = 0; @@ -1051,8 +1023,7 @@ u32 sub_80FA458(void) return 0; } -// Task_SecretBasePCTurnOn -void sub_80FA4A0(u8 taskId) +void Task_SecretBasePCTurnOn(u8 taskId) { s16 *data = gTasks[taskId].data; @@ -1080,8 +1051,7 @@ void sub_80FA4A0(u8 taskId) data[2]++; } -// DoSecretBasePCTurnOffEffect -void sub_80FA57C(void) +void DoSecretBasePCTurnOffEffect(void) { s16 x, y; @@ -1099,10 +1069,9 @@ void sub_80FA57C(void) //============================================================================= // fldeff_decoration.c -// PopSecretBaseBalloon -void sub_80FA5E4(s16 metatileId, s16 x, s16 y) +void PopSecretBaseBalloon(s16 metatileId, s16 x, s16 y) { - u8 taskId = CreateTask(sub_80FA62C, 0); + u8 taskId = CreateTask(Task_PopSecretBaseBalloon, 0); gTasks[taskId].data[0] = metatileId; gTasks[taskId].data[1] = x; @@ -1111,8 +1080,7 @@ void sub_80FA5E4(s16 metatileId, s16 x, s16 y) gTasks[taskId].data[4] = 1; } -// -void sub_80FA62C(u8 taskId) +void Task_PopSecretBaseBalloon(u8 taskId) { s16 *data = gTasks[taskId].data; @@ -1124,7 +1092,7 @@ void sub_80FA62C(u8 taskId) if (data[3] == 0) { if (data[4] == 2) - sub_80FA6AC(data[0]); + DoBalloonSoundEffect(data[0]); MapGridSetMetatileIdAt(data[1], data[2], data[0] + data[4]); CurrentMapDrawMetatileAt(data[1], data[2]); @@ -1136,8 +1104,7 @@ void sub_80FA62C(u8 taskId) } } -// DoBalloonSoundEffect -void sub_80FA6AC(s16 metatileId) +void DoBalloonSoundEffect(s16 metatileId) { switch (metatileId) { @@ -1156,20 +1123,17 @@ void sub_80FA6AC(s16 metatileId) } } -// FldEff_Nop47 -bool8 sub_80FA6FC(void) +bool8 FldEff_NopA6FC(void) { return FALSE; } -// FldEff_Nop48 -bool8 sub_80FA700(void) +bool8 FldEff_NopA700(void) { return FALSE; } -// -void sub_80FA704(s16 x, s16 y) +void DoSecretBaseBreakableDoorEffect(s16 x, s16 y) { PlaySE(SE_TOY_KABE); MapGridSetMetatileIdAt(x, y, 630); @@ -1178,12 +1142,11 @@ void sub_80FA704(s16 x, s16 y) CurrentMapDrawMetatileAt(x, y - 1); } -// -void sub_80FA754(u8 taskId) +void Task_ShatterSecretBaseBreakableDoor(u8 taskId) { if (gTasks[taskId].data[0] == 7) { - sub_80FA704(gTasks[taskId].data[1], gTasks[taskId].data[2]); + DoSecretBaseBreakableDoorEffect(gTasks[taskId].data[1], gTasks[taskId].data[2]); DestroyTask(taskId); } else @@ -1192,18 +1155,17 @@ void sub_80FA754(u8 taskId) } } -// ShatterSecretBaseBreakableDoor -void sub_80FA794(s16 x, s16 y) +void ShatterSecretBaseBreakableDoor(s16 x, s16 y) { u8 dir = GetPlayerFacingDirection(); if (dir == DIR_SOUTH) { - sub_80FA704(x, y); + DoSecretBaseBreakableDoorEffect(x, y); } else if (dir == DIR_NORTH) { - u8 taskId = CreateTask(sub_80FA754, 5); + u8 taskId = CreateTask(Task_ShatterSecretBaseBreakableDoor, 5); gTasks[taskId].data[0] = 0; gTasks[taskId].data[1] = x; gTasks[taskId].data[2] = y; @@ -1211,12 +1173,11 @@ void sub_80FA794(s16 x, s16 y) } #define tMetatileID data[0] -// Task_SecretBaseMusicNoteMatSound -void sub_80FA7EC(u8 taskId) +void Task_SecretBaseMusicNoteMatSound(u8 taskId) { if (gTasks[taskId].data[1] == 7) { - switch (gTasks[taskId].tMetatileID) // metatileId + switch (gTasks[taskId].tMetatileID) { case 632: PlaySE(SE_TOY_C); @@ -1252,18 +1213,16 @@ void sub_80FA7EC(u8 taskId) } } -// PlaySecretBaseMusicNoteMatSound -void sub_80FA970(s16 metatileId) +void PlaySecretBaseMusicNoteMatSound(s16 metatileId) { - u8 taskId = CreateTask(sub_80FA7EC, 5); + u8 taskId = CreateTask(Task_SecretBaseMusicNoteMatSound, 5); gTasks[taskId].tMetatileID = metatileId; gTasks[taskId].data[1] = 0; } #undef tMetatileID -// SpriteCB_GlitterMatSparkle -void sub_80FA9A4(struct Sprite *sprite) +void SpriteCB_GlitterMatSparkle(struct Sprite *sprite) { sprite->data[0]++; @@ -1274,8 +1233,7 @@ void sub_80FA9A4(struct Sprite *sprite) DestroySprite(sprite); } -// DoSecretBaseGlitterMatSparkle -void sub_80FA9D0(void) +void DoSecretBaseGlitterMatSparkle(void) { s16 x = gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.x; s16 y = gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.y; @@ -1289,13 +1247,12 @@ void sub_80FA9D0(void) gSprites[spriteId].coordOffsetEnabled = TRUE; gSprites[spriteId].oam.priority = 1; gSprites[spriteId].oam.paletteNum = 5; - gSprites[spriteId].callback = sub_80FA9A4; + gSprites[spriteId].callback = SpriteCB_GlitterMatSparkle; gSprites[spriteId].data[0] = 0; } } -// FldEff_SandPillar -bool8 sub_80FAA7C(void) +bool8 FldEff_SandPillar(void) { s16 x, y; @@ -1343,8 +1300,7 @@ bool8 sub_80FAA7C(void) return FALSE; } -// SpriteCB_SandPillar_0 -void door_restore_tilemap(struct Sprite *sprite) +void SpriteCB_SandPillar_0(struct Sprite *sprite) { PlaySE(SE_W088); @@ -1358,11 +1314,10 @@ void door_restore_tilemap(struct Sprite *sprite) CurrentMapDrawMetatileAt(gFieldEffectArguments[5], gFieldEffectArguments[6]); sprite->data[0] = 0; - sprite->callback = sub_80FAC24; + sprite->callback = SpriteCB_SandPillar_1; } -// SpriteCB_SandPillar_1 -void sub_80FAC24(struct Sprite *sprite) +void SpriteCB_SandPillar_1(struct Sprite *sprite) { if (sprite->data[0] < 18) { @@ -1373,19 +1328,17 @@ void sub_80FAC24(struct Sprite *sprite) MapGridSetMetatileIdAt(gFieldEffectArguments[5], gFieldEffectArguments[6], 3724); CurrentMapDrawMetatileAt(gFieldEffectArguments[5], gFieldEffectArguments[6]); sprite->data[0] = 0; - sprite->callback = sub_80FAC68; + sprite->callback = SpriteCB_SandPillar_2; } } -// SpriteCB_SandPillar_2 -void sub_80FAC68(struct Sprite *sprite) +void SpriteCB_SandPillar_2(struct Sprite *sprite) { FieldEffectStop(sprite, FLDEFF_SAND_PILLAR); EnableBothScriptContexts(); } -// GetShieldToyTVDecorationInfo -void sub_80FAC78(void) +void GetShieldToyTVDecorationInfo(void) { s16 x, y; s32 metatileId; @@ -1458,7 +1411,6 @@ void sub_80FAC78(void) // bool8 sub_80FADE4(u16 arg0, u8 arg1) { - /* // if (CurrentMapIsSecretBase()) { @@ -1480,28 +1432,6 @@ bool8 sub_80FADE4(u16 arg0, u8 arg1) } } return FALSE; - */ - if (!CurrentMapIsSecretBase()) return FALSE; - else - { - // return TRUE; - if (arg1 == 0) - { - // - if ((u16)(arg0 + 0xfffffd7b) <= 1 || (arg0 == 0x237)) - return TRUE; - //if (arg0 == 0x237) - //else return FALSE; - } - else - { - // - if (arg0 == 0x28d || arg0 == 0x23f) - return TRUE; - //return FALSE; - } - } - return FALSE; } #else NAKED @@ -1549,8 +1479,7 @@ bool8 sub_80FADE4(u16 arg0, u8 arg1) } #endif -// Task_FieldPoisonEffect -void task50_overworld_poison_effect(u8 taskId) +void Task_FieldPoisonEffect(u8 taskId) { s16 *data = gTasks[taskId].data; @@ -1577,27 +1506,23 @@ void task50_overworld_poison_effect(u8 taskId) SetGpuReg(REG_OFFSET_MOSAIC, (data[1] << 4) | data[1]); } -// FldeffPoison_Start void FldeffPoison_Start(void) { PlaySE(SE_DOKU); - CreateTask(task50_overworld_poison_effect, 80); + CreateTask(Task_FieldPoisonEffect, 80); } -// FldeffPoison_IsActive -bool32 FieldPoisonEffectIsRunning(void) +bool32 FldeffPoison_IsActive(void) { - return FuncIsActiveTask(task50_overworld_poison_effect); + return FuncIsActiveTask(Task_FieldPoisonEffect); } -// Task_WateringBerryTreeAnim_0 -void sub_80FAED4(u8 taskId) +void Task_WateringBerryTreeAnim_0(u8 taskId) { - gTasks[taskId].func = sub_80FAEF0; + gTasks[taskId].func = Task_WateringBerryTreeAnim_1; } -// Task_WateringBerryTreeAnim_1 -void sub_80FAEF0(u8 taskId) +void Task_WateringBerryTreeAnim_1(u8 taskId) { struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId]; @@ -1606,12 +1531,11 @@ void sub_80FAEF0(u8 taskId) { sub_808C228(GetPlayerFacingDirection()); EventObjectSetHeldMovement(playerEventObj, GetWalkInPlaceNormalMovementAction(GetPlayerFacingDirection())); - gTasks[taskId].func = sub_80FAF64; + gTasks[taskId].func = Task_WateringBerryTreeAnim_2; } } -// Task_WateringBerryTreeAnim_2 -void sub_80FAF64(u8 taskId) +void Task_WateringBerryTreeAnim_2(u8 taskId) { struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId]; @@ -1623,25 +1547,22 @@ void sub_80FAF64(u8 taskId) EventObjectSetHeldMovement(playerEventObj, GetWalkInPlaceNormalMovementAction(GetPlayerFacingDirection())); else - gTasks[taskId].func = sub_80FAFD4; + gTasks[taskId].func = Task_WateringBerryTreeAnim_3; } } -// Task_WateringBerryTreeAnim_3 -void sub_80FAFD4(u8 taskId) +void Task_WateringBerryTreeAnim_3(u8 taskId) { SetPlayerAvatarTransitionFlags(sub_808BCD0()); DestroyTask(taskId); EnableBothScriptContexts(); } -// DoWateringBerryTreeAnim -void sub_80FAFF8(void) +void DoWateringBerryTreeAnim(void) { - CreateTask(sub_80FAED4, 80); + CreateTask(Task_WateringBerryTreeAnim_0, 80); } -// u8 CreateRecordMixingSprite(void) { u8 spriteId; diff --git a/src/secret_base.c b/src/secret_base.c index 578db1902..d50ad94bb 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -1256,7 +1256,7 @@ void sub_80EA3E4(u8 taskId) } else if (MetatileBehavior_IsSecretBaseBalloon(behavior) == TRUE) { - sub_80FA5E4(MapGridGetMetatileIdAt(x, y), x, y); + PopSecretBaseBalloon(MapGridGetMetatileIdAt(x, y), x, y); if (gUnknown_0203A01D == TRUE) { switch ((int)MapGridGetMetatileIdAt(x, y)) @@ -1278,7 +1278,7 @@ void sub_80EA3E4(u8 taskId) { VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x400); } - sub_80FA794(x, y); + ShatterSecretBaseBreakableDoor(x, y); } else if (MetatileBehavior_IsSecretBaseSoundMat(behavior) == TRUE){ if (gUnknown_0203A01D == TRUE) {