From 18d57a38021a7fee9d8f2131f776946d81c83fbe Mon Sep 17 00:00:00 2001 From: GriffinR Date: Fri, 19 Jun 2020 19:58:56 -0400 Subject: [PATCH 1/9] Document some overworld and field effects --- data/field_effect_scripts.s | 420 ++++----- data/io_reg.s | 37 - data/maps/BirthIsland_Exterior/scripts.inc | 4 +- gflib/io_reg.c | 36 + gflib/io_reg.h | 7 + .../pics/{unknown_29.png => sand_pile.png} | Bin .../{unknown_35.png => small_sparkle.png} | Bin ...ry_tree_growth_sparkle.png => sparkle.png} | Bin graphics/field_effects/pics/unknown_18.png | Bin 344 -> 0 bytes graphics/field_effects/pics/unused_grass.png | Bin 389 -> 344 bytes .../field_effects/pics/unused_grass_2.png | Bin 0 -> 389 bytes include/constants/field_effects.h | 44 +- include/event_scripts.h | 22 + include/field_camera.h | 2 +- include/field_control_avatar.h | 2 +- include/field_effect.h | 6 +- include/field_player_avatar.h | 4 +- include/field_screen_effect.h | 2 + include/fieldmap.h | 12 +- include/fldeff.h | 8 +- include/global.fieldmap.h | 16 +- include/menu.h | 6 +- include/overworld.h | 9 +- ld_script.txt | 2 +- spritesheet_rules.mk | 10 +- src/battle_pyramid_bag.c | 4 +- src/berry_crush.c | 2 +- src/berry_tag_screen.c | 4 +- src/bike.c | 8 +- src/braille_puzzles.c | 4 +- .../field_effect_object_template_pointers.h | 92 +- src/data/field_effects/field_effect_objects.h | 118 +-- .../object_events/object_event_graphics.h | 18 +- src/dodrio_berry_picking.c | 2 +- src/event_object_movement.c | 4 +- src/faraway_island.c | 3 +- src/field_camera.c | 40 +- src/field_control_avatar.c | 4 +- src/field_effect.c | 869 +++++++++--------- src/field_effect_helpers.c | 78 +- src/field_player_avatar.c | 42 +- src/field_region_map.c | 4 +- src/field_screen_effect.c | 29 +- src/fieldmap.c | 38 +- src/fldeff_cut.c | 4 +- src/fldeff_dig.c | 2 +- src/fldeff_escalator.c | 217 +++-- src/fldeff_flash.c | 2 +- src/fldeff_misc.c | 12 +- src/fldeff_rocksmash.c | 49 +- src/fldeff_strength.c | 2 +- src/fldeff_sweetscent.c | 2 +- src/fldeff_teleport.c | 4 +- src/hall_of_fame.c | 2 +- src/item_menu.c | 4 +- src/menu.c | 50 +- src/move_relearner.c | 6 +- src/naming_screen.c | 2 +- src/overworld.c | 265 +++--- src/party_menu.c | 4 +- src/pokeblock.c | 4 +- src/pokeblock_feed.c | 4 +- src/pokemon_storage_system.c | 4 +- src/pokemon_summary_screen.c | 4 +- src/rayquaza_scene.c | 4 +- src/region_map.c | 4 +- src/reset_rtc_screen.c | 4 +- src/roulette.c | 2 +- src/shop.c | 4 +- src/starter_choose.c | 4 +- src/wallclock.c | 4 +- 71 files changed, 1379 insertions(+), 1302 deletions(-) delete mode 100644 data/io_reg.s create mode 100644 gflib/io_reg.c create mode 100644 gflib/io_reg.h rename graphics/field_effects/pics/{unknown_29.png => sand_pile.png} (100%) rename graphics/field_effects/pics/{unknown_35.png => small_sparkle.png} (100%) rename graphics/field_effects/pics/{berry_tree_growth_sparkle.png => sparkle.png} (100%) delete mode 100644 graphics/field_effects/pics/unknown_18.png create mode 100644 graphics/field_effects/pics/unused_grass_2.png diff --git a/data/field_effect_scripts.s b/data/field_effect_scripts.s index 4aef859d8..2eddf3126 100644 --- a/data/field_effect_scripts.s +++ b/data/field_effect_scripts.s @@ -1,345 +1,345 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" + .include "asm/macros.inc" + .include "constants/constants.inc" - .section script_data, "aw", %progbits + .section script_data, "aw", %progbits - .align 2 + .align 2 gFieldEffectScriptPointers:: @ 82DB9D4 - .4byte gFieldEffectScript_ExclamationMarkIcon1 - .4byte gFieldEffectScript_UseCutOnTallGrass - .4byte gFieldEffectScript_UseCutOnTree - .4byte gFieldEffectScript_Shadow - .4byte gFieldEffectScript_TallGrass - .4byte gFieldEffectScript_Ripple - .4byte gFieldEffectScript_FieldMoveShowMon - .4byte gFieldEffectScript_Ash - .4byte gFieldEffectScript_SurfBlob - .4byte gFieldEffectScript_UseSurf - .4byte gFieldEffectScript_GroundImpactDust - .4byte gFieldEffectScript_UseSecretPowerCave - .4byte gFieldEffectScript_BikeHopTallGrass - .4byte gFieldEffectScript_SandFootprints - .4byte gFieldEffectScript_BikeHopBigSplash - .4byte gFieldEffectScript_Splash - .4byte gFieldEffectScript_BikeHopSmallSplash - .4byte gFieldEffectScript_LongGrass - .4byte gFieldEffectScript_JumpLongGrass - .4byte gFieldEffectScript_Unknown19 - .4byte gFieldEffectScript_Unknown20 - .4byte gFieldEffectScript_Unknown21 - .4byte gFieldEffectScript_Unknown22 - .4byte gFieldEffectScript_BerryTreeGrowthSparkle - .4byte gFieldEffectScript_DeepSandFootprints - .4byte gFieldEffectScript_PokeCenterHeal - .4byte gFieldEffectScript_UseSecretPowerTree - .4byte gFieldEffectScript_UseSecretPowerShrub - .4byte gFieldEffectScript_TreeDisguise - .4byte gFieldEffectScript_MountainDisguise - .4byte gFieldEffectScript_NPCUseFly - .4byte gFieldEffectScript_UseFly - .4byte gFieldEffectScript_FlyIn - .4byte gFieldEffectScript_QuestionMarkIcon - .4byte gFieldEffectScript_FeetInFlowingWater - .4byte gFieldEffectScript_BikeTireTracks - .4byte gFieldEffectScript_SandDisguisePlaceholder - .4byte gFieldEffectScript_UseRockSmash - .4byte gFieldEffectScript_UseDig - .4byte gFieldEffectScript_SandPile - .4byte gFieldEffectScript_UseStrength - .4byte gFieldEffectScript_ShortGrass - .4byte gFieldEffectScript_HotSpringsWater - .4byte gFieldEffectScript_UseWaterfall - .4byte gFieldEffectScript_UseDive - .4byte gFieldEffectScript_Pokeball - .4byte gFieldEffectScript_HeartIcon - .4byte gFieldEffectScript_Unknown47 - .4byte gFieldEffectScript_Unknown48 - .4byte gFieldEffectScript_JumpOutOfAsh - .4byte gFieldEffectScript_LavaridgeGymWarp - .4byte gFieldEffectScript_SweetScent - .4byte gFieldEffectScript_SandPillar - .4byte gFieldEffectScript_Bubbles - .4byte gFieldEffectScript_Sparkle - .4byte gFieldEffectScript_ShowSecretPowerCave - .4byte gFieldEffectScript_ShowSecretPowerTree - .4byte gFieldEffectScript_ShowSecretPowerShrub - .4byte gFieldEffectScript_ShowCutGrass - .4byte gFieldEffectScript_FieldMoveShowMonInit - .4byte gFieldEffectScript_UsePuzzleEffect - .4byte gFieldEffectScript_SecretBaseBootPC - .4byte gFieldEffectScript_HallOfFameRecord - .4byte gFieldEffectScript_UseTeleport - .4byte gFieldEffectScript_Rayquaza - .4byte gFieldEffectScript_Unknown65 - .4byte gFieldEffectScript_MoveDeoxysRock + .4byte gFieldEffectScript_ExclamationMarkIcon1 @ FLDEFF_EXCLAMATION_MARK_ICON + .4byte gFieldEffectScript_UseCutOnTallGrass @ FLDEFF_USE_CUT_ON_GRASS + .4byte gFieldEffectScript_UseCutOnTree @ FLDEFF_USE_CUT_ON_TREE + .4byte gFieldEffectScript_Shadow @ FLDEFF_SHADOW + .4byte gFieldEffectScript_TallGrass @ FLDEFF_TALL_GRASS + .4byte gFieldEffectScript_Ripple @ FLDEFF_RIPPLE + .4byte gFieldEffectScript_FieldMoveShowMon @ FLDEFF_FIELD_MOVE_SHOW_MON + .4byte gFieldEffectScript_Ash @ FLDEFF_ASH + .4byte gFieldEffectScript_SurfBlob @ FLDEFF_SURF_BLOB + .4byte gFieldEffectScript_UseSurf @ FLDEFF_USE_SURF + .4byte gFieldEffectScript_GroundImpactDust @ FLDEFF_DUST + .4byte gFieldEffectScript_UseSecretPowerCave @ FLDEFF_USE_SECRET_POWER_CAVE + .4byte gFieldEffectScript_BikeHopTallGrass @ FLDEFF_JUMP_TALL_GRASS + .4byte gFieldEffectScript_SandFootprints @ FLDEFF_SAND_FOOTPRINTS + .4byte gFieldEffectScript_BikeHopBigSplash @ FLDEFF_JUMP_BIG_SPLASH + .4byte gFieldEffectScript_Splash @ FLDEFF_SPLASH + .4byte gFieldEffectScript_BikeHopSmallSplash @ FLDEFF_JUMP_SMALL_SPLASH + .4byte gFieldEffectScript_LongGrass @ FLDEFF_LONG_GRASS + .4byte gFieldEffectScript_JumpLongGrass @ FLDEFF_JUMP_LONG_GRASS + .4byte gFieldEffectScript_Unknown19 @ FLDEFF_UNKNOWN_19 + .4byte gFieldEffectScript_UnusedGrass @ FLDEFF_UNUSED_GRASS + .4byte gFieldEffectScript_Unknown21 @ FLDEFF_UNKNOWN_21 + .4byte gFieldEffectScript_Unknown22 @ FLDEFF_UNKNOWN_22 + .4byte gFieldEffectScript_BerryTreeGrowthSparkle @ FLDEFF_BERRY_TREE_GROWTH_SPARKLE + .4byte gFieldEffectScript_DeepSandFootprints @ FLDEFF_DEEP_SAND_FOOTPRINTS + .4byte gFieldEffectScript_PokeCenterHeal @ FLDEFF_POKECENTER_HEAL + .4byte gFieldEffectScript_UseSecretPowerTree @ FLDEFF_USE_SECRET_POWER_TREE + .4byte gFieldEffectScript_UseSecretPowerShrub @ FLDEFF_USE_SECRET_POWER_SHRUB + .4byte gFieldEffectScript_TreeDisguise @ FLDEFF_TREE_DISGUISE + .4byte gFieldEffectScript_MountainDisguise @ FLDEFF_MOUNTAIN_DISGUISE + .4byte gFieldEffectScript_NPCUseFly @ FLDEFF_NPCFLY_OUT + .4byte gFieldEffectScript_UseFly @ FLDEFF_USE_FLY + .4byte gFieldEffectScript_FlyIn @ FLDEFF_FLY_IN + .4byte gFieldEffectScript_QuestionMarkIcon @ FLDEFF_QUESTION_MARK_ICON + .4byte gFieldEffectScript_FeetInFlowingWater @ FLDEFF_FEET_IN_FLOWING_WATER + .4byte gFieldEffectScript_BikeTireTracks @ FLDEFF_BIKE_TIRE_TRACKS + .4byte gFieldEffectScript_SandDisguisePlaceholder @ FLDEFF_SAND_DISGUISE + .4byte gFieldEffectScript_UseRockSmash @ FLDEFF_USE_ROCK_SMASH + .4byte gFieldEffectScript_UseDig @ FLDEFF_USE_DIG + .4byte gFieldEffectScript_SandPile @ FLDEFF_SAND_PILE + .4byte gFieldEffectScript_UseStrength @ FLDEFF_USE_STRENGTH + .4byte gFieldEffectScript_ShortGrass @ FLDEFF_SHORT_GRASS + .4byte gFieldEffectScript_HotSpringsWater @ FLDEFF_HOT_SPRINGS_WATER + .4byte gFieldEffectScript_UseWaterfall @ FLDEFF_USE_WATERFALL + .4byte gFieldEffectScript_UseDive @ FLDEFF_USE_DIVE + .4byte gFieldEffectScript_Pokeball @ FLDEFF_POKEBALL + .4byte gFieldEffectScript_HeartIcon @ FLDEFF_HEART_ICON + .4byte gFieldEffectScript_Unknown47 @ FLDEFF_NOP_47 + .4byte gFieldEffectScript_Unknown48 @ FLDEFF_NOP_48 + .4byte gFieldEffectScript_JumpOutOfAsh @ FLDEFF_POP_OUT_OF_ASH + .4byte gFieldEffectScript_LavaridgeGymWarp @ FLDEFF_LAVARIDGE_GYM_WARP + .4byte gFieldEffectScript_SweetScent @ FLDEFF_SWEET_SCENT + .4byte gFieldEffectScript_SandPillar @ FLDEFF_SAND_PILLAR + .4byte gFieldEffectScript_Bubbles @ FLDEFF_BUBBLES + .4byte gFieldEffectScript_Sparkle @ FLDEFF_SPARKLE + .4byte gFieldEffectScript_ShowSecretPowerCave @ FLDEFF_SECRET_POWER_CAVE + .4byte gFieldEffectScript_ShowSecretPowerTree @ FLDEFF_SECRET_POWER_TREE + .4byte gFieldEffectScript_ShowSecretPowerShrub @ FLDEFF_SECRET_POWER_SHRUB + .4byte gFieldEffectScript_ShowCutGrass @ FLDEFF_CUT_GRASS + .4byte gFieldEffectScript_FieldMoveShowMonInit @ FLDEFF_FIELD_MOVE_SHOW_MON_INIT + .4byte gFieldEffectScript_UsePuzzleEffect @ FLDEFF_USE_TOMB_PUZZLE_EFFECT + .4byte gFieldEffectScript_SecretBaseBootPC @ FLDEFF_PCTURN_ON + .4byte gFieldEffectScript_HallOfFameRecord @ FLDEFF_HALL_OF_FAME_RECORD + .4byte gFieldEffectScript_UseTeleport @ FLDEFF_USE_TELEPORT + .4byte gFieldEffectScript_Rayquaza @ FLDEFF_RAYQUAZA + .4byte gFieldEffectScript_DestroyDeoxysRock @ FLDEFF_DESTROY_DEOXYS_ROCK + .4byte gFieldEffectScript_MoveDeoxysRock @ FLDEFF_MOVE_DEOXYS_ROCK gFieldEffectScript_ExclamationMarkIcon1:: @ 82DBAE0 - field_eff_callnative FldEff_ExclamationMarkIcon - field_eff_end + field_eff_callnative FldEff_ExclamationMarkIcon + field_eff_end gFieldEffectScript_UseCutOnTallGrass:: @ 82DBAE6 - field_eff_callnative FldEff_UseCutOnGrass - field_eff_end + field_eff_callnative FldEff_UseCutOnGrass + field_eff_end gFieldEffectScript_UseCutOnTree:: @ 82DBAEC - field_eff_callnative FldEff_UseCutOnTree - field_eff_end + field_eff_callnative FldEff_UseCutOnTree + field_eff_end gFieldEffectScript_Shadow:: @ 82DBAF2 - field_eff_callnative FldEff_Shadow - field_eff_end + field_eff_callnative FldEff_Shadow + field_eff_end gFieldEffectScript_TallGrass:: @ 82DBAF8 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo1, FldEff_TallGrass - field_eff_end + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo1, FldEff_TallGrass + field_eff_end gFieldEffectScript_Ripple:: @ 82DBB02 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo1, FldEff_Ripple - field_eff_end + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo1, FldEff_Ripple + field_eff_end gFieldEffectScript_FieldMoveShowMon:: @ 82DBB0C - field_eff_callnative FldEff_FieldMoveShowMon - field_eff_end + field_eff_callnative FldEff_FieldMoveShowMon + field_eff_end gFieldEffectScript_Ash:: @ 82DBB12 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo1, FldEff_Ash - field_eff_end + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo1, FldEff_Ash + field_eff_end gFieldEffectScript_SurfBlob:: @ 82DBB1C - field_eff_callnative FldEff_SurfBlob - field_eff_end + field_eff_callnative FldEff_SurfBlob + field_eff_end gFieldEffectScript_UseSurf:: @ 82DBB22 - field_eff_callnative FldEff_UseSurf - field_eff_end + field_eff_callnative FldEff_UseSurf + field_eff_end gFieldEffectScript_GroundImpactDust:: @ 82DBB28 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_Dust - field_eff_end + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_Dust + field_eff_end gFieldEffectScript_UseSecretPowerCave:: @ 82DBB32 - field_eff_callnative FldEff_UseSecretPowerCave - field_eff_end + field_eff_callnative FldEff_UseSecretPowerCave + field_eff_end gFieldEffectScript_BikeHopTallGrass:: @ 82DBB38 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo1, FldEff_JumpTallGrass - field_eff_end + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo1, FldEff_JumpTallGrass + field_eff_end gFieldEffectScript_SandFootprints:: @ 82DBB42 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_SandFootprints - field_eff_end + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_SandFootprints + field_eff_end gFieldEffectScript_BikeHopBigSplash:: @ 82DBB4C - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_JumpBigSplash - field_eff_end + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_JumpBigSplash + field_eff_end gFieldEffectScript_Splash:: @ 82DBB56 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_Splash - field_eff_end + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_Splash + field_eff_end gFieldEffectScript_BikeHopSmallSplash:: @ 82DBB60 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_JumpSmallSplash - field_eff_end + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_JumpSmallSplash + field_eff_end gFieldEffectScript_LongGrass:: @ 82DBB6A - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo1, FldEff_LongGrass - field_eff_end + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo1, FldEff_LongGrass + field_eff_end gFieldEffectScript_JumpLongGrass:: @ 82DBB74 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo1, FldEff_JumpLongGrass - field_eff_end + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo1, FldEff_JumpLongGrass + field_eff_end gFieldEffectScript_Unknown19:: @ 82DBB7E - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo1, FldEff_Unknown19 - field_eff_end + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo1, FldEff_Unknown19 + field_eff_end -gFieldEffectScript_Unknown20:: @ 82DBB88 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo1, FldEff_Unknown20 - field_eff_end +gFieldEffectScript_UnusedGrass:: @ 82DBB88 + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo1, FldEff_UnusedGrass + field_eff_end gFieldEffectScript_Unknown21:: @ 82DBB92 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_Unknown21 - field_eff_end + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_Unknown21 + field_eff_end gFieldEffectScript_Unknown22:: @ 82DBB9C - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_Unknown22 - field_eff_end + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_Unknown22 + field_eff_end gFieldEffectScript_BerryTreeGrowthSparkle:: @ 82DBBA6 - field_eff_callnative FldEff_BerryTreeGrowthSparkle - field_eff_end + field_eff_callnative FldEff_BerryTreeGrowthSparkle + field_eff_end gFieldEffectScript_DeepSandFootprints:: @ 82DBBAC - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_DeepSandFootprints - field_eff_end + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_DeepSandFootprints + field_eff_end gFieldEffectScript_PokeCenterHeal:: @ 82DBBB6 - field_eff_loadfadedpal gFieldEffectObjectPaletteInfo4 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_PokecenterHeal - field_eff_end + field_eff_loadfadedpal gFieldEffectObjectPaletteInfo4 + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_PokecenterHeal + field_eff_end gFieldEffectScript_UseSecretPowerTree:: @ 82DBBC5 - field_eff_callnative FldEff_UseSecretPowerTree - field_eff_end + field_eff_callnative FldEff_UseSecretPowerTree + field_eff_end gFieldEffectScript_UseSecretPowerShrub:: @ 82DBBCB - field_eff_callnative FldEff_UseSecretPowerShrub - field_eff_end + field_eff_callnative FldEff_UseSecretPowerShrub + field_eff_end gFieldEffectScript_TreeDisguise:: @ 82DBBD1 - field_eff_callnative ShowTreeDisguiseFieldEffect - field_eff_end + field_eff_callnative ShowTreeDisguiseFieldEffect + field_eff_end gFieldEffectScript_MountainDisguise:: @ 82DBBD7 - field_eff_callnative ShowMountainDisguiseFieldEffect - field_eff_end + field_eff_callnative ShowMountainDisguiseFieldEffect + field_eff_end gFieldEffectScript_NPCUseFly:: @ 82DBBDD - field_eff_callnative FldEff_NPCFlyOut - field_eff_end + field_eff_callnative FldEff_NPCFlyOut + field_eff_end gFieldEffectScript_UseFly:: @ 82DBBE3 - field_eff_callnative FldEff_UseFly - field_eff_end + field_eff_callnative FldEff_UseFly + field_eff_end gFieldEffectScript_FlyIn:: @ 82DBBE9 - field_eff_callnative FldEff_FlyIn - field_eff_end + field_eff_callnative FldEff_FlyIn + field_eff_end gFieldEffectScript_QuestionMarkIcon:: @ 82DBBEF - field_eff_callnative FldEff_QuestionMarkIcon - field_eff_end + field_eff_callnative FldEff_QuestionMarkIcon + field_eff_end gFieldEffectScript_FeetInFlowingWater:: @ 82DBBF5 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_FeetInFlowingWater - field_eff_end + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_FeetInFlowingWater + field_eff_end gFieldEffectScript_BikeTireTracks:: @ 82DBBFF - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_BikeTireTracks - field_eff_end + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_BikeTireTracks + field_eff_end gFieldEffectScript_SandDisguisePlaceholder:: @ 82DBC09 - field_eff_callnative ShowSandDisguiseFieldEffect - field_eff_end + field_eff_callnative ShowSandDisguiseFieldEffect + field_eff_end gFieldEffectScript_UseRockSmash:: @ 82DBC0F - field_eff_callnative FldEff_UseRockSmash - field_eff_end + field_eff_callnative FldEff_UseRockSmash + field_eff_end gFieldEffectScript_UseStrength:: @ 82DBC15 - field_eff_callnative sub_8145E2C - field_eff_end + field_eff_callnative sub_8145E2C + field_eff_end gFieldEffectScript_UseDig:: @ 82DBC1B - field_eff_callnative FldEff_UseDig - field_eff_end + field_eff_callnative FldEff_UseDig + field_eff_end gFieldEffectScript_SandPile:: @ 82DBC21 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_SandPile - field_eff_end + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_SandPile + field_eff_end gFieldEffectScript_ShortGrass:: @ 82DBC2B - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo1, FldEff_ShortGrass - field_eff_end + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo1, FldEff_ShortGrass + field_eff_end gFieldEffectScript_HotSpringsWater:: @ 82DBC35 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo1, FldEff_HotSpringsWater - field_eff_end + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo1, FldEff_HotSpringsWater + field_eff_end gFieldEffectScript_UseWaterfall:: @ 82DBC3F - field_eff_callnative FldEff_UseWaterfall - field_eff_end + field_eff_callnative FldEff_UseWaterfall + field_eff_end gFieldEffectScript_UseDive:: @ 82DBC45 - field_eff_callnative FldEff_UseDive - field_eff_end + field_eff_callnative FldEff_UseDive + field_eff_end gFieldEffectScript_Pokeball:: @ 82DBC4B - field_eff_loadpal gFieldEffectObjectPaletteInfo10 - field_eff_callnative FldEff_Pokeball - field_eff_end + field_eff_loadpal gFieldEffectObjectPaletteInfo10 + field_eff_callnative FldEff_Pokeball + field_eff_end gFieldEffectScript_HeartIcon:: @ 82DBC56 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_HeartIcon - field_eff_end + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_HeartIcon + field_eff_end gFieldEffectScript_Unknown47:: @ 82DBC60 - field_eff_callnative FldEff_NopA6FC - field_eff_end + field_eff_callnative FldEff_NopA6FC + field_eff_end gFieldEffectScript_Unknown48:: @ 82DBC66 - field_eff_callnative FldEff_NopA700 - field_eff_end + field_eff_callnative FldEff_NopA700 + field_eff_end gFieldEffectScript_JumpOutOfAsh:: @ 82DBC6C - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo2, FldEff_PopOutOfAsh - field_eff_end + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo2, FldEff_PopOutOfAsh + field_eff_end gFieldEffectScript_LavaridgeGymWarp:: @ 82DBC76 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo2, FldEff_LavaridgeGymWarp - field_eff_end + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo2, FldEff_LavaridgeGymWarp + field_eff_end gFieldEffectScript_SweetScent:: @ 82DBC80 - field_eff_callnative FldEff_SweetScent - field_eff_end + field_eff_callnative FldEff_SweetScent + field_eff_end gFieldEffectScript_SandPillar:: @ 82DBC86 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo9, FldEff_SandPillar - field_eff_end + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo9, FldEff_SandPillar + field_eff_end gFieldEffectScript_Bubbles:: @ 82DBC90 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_Bubbles - field_eff_end + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_Bubbles + field_eff_end gFieldEffectScript_Sparkle:: @ 82DBC9A - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo3, FldEff_Sparkle - field_eff_end + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo3, FldEff_Sparkle + field_eff_end gFieldEffectScript_ShowSecretPowerCave:: @ 82DBCA4 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo7, FldEff_SecretPowerCave - field_eff_end + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo7, FldEff_SecretPowerCave + field_eff_end gFieldEffectScript_ShowSecretPowerTree:: @ 82DBCAE - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo8, FldEff_SecretPowerTree - field_eff_end + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo8, FldEff_SecretPowerTree + field_eff_end gFieldEffectScript_ShowSecretPowerShrub:: @ 82DBCB8 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo8, FldEff_SecretPowerShrub - field_eff_end + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo8, FldEff_SecretPowerShrub + field_eff_end gFieldEffectScript_ShowCutGrass:: @ 82DBCC2 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo6, FldEff_CutGrass - field_eff_end + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo6, FldEff_CutGrass + field_eff_end gFieldEffectScript_FieldMoveShowMonInit:: @ 82DBCCC - field_eff_callnative FldEff_FieldMoveShowMonInit - field_eff_end + field_eff_callnative FldEff_FieldMoveShowMonInit + field_eff_end gFieldEffectScript_UsePuzzleEffect:: @ 82DBCD2 - field_eff_callnative FldEff_UsePuzzleEffect - field_eff_end + field_eff_callnative FldEff_UsePuzzleEffect + field_eff_end gFieldEffectScript_SecretBaseBootPC:: @ 82DBCD8 - field_eff_callnative FldEff_SecretBasePCTurnOn - field_eff_end + field_eff_callnative FldEff_SecretBasePCTurnOn + field_eff_end gFieldEffectScript_HallOfFameRecord:: @ 82DBCDE - field_eff_loadfadedpal gFieldEffectObjectPaletteInfo4 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo5, FldEff_HallOfFameRecord - field_eff_end + field_eff_loadfadedpal gFieldEffectObjectPaletteInfo4 + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo5, FldEff_HallOfFameRecord + field_eff_end gFieldEffectScript_UseTeleport:: @ 82DBCED - field_eff_callnative FldEff_UseTeleport - field_eff_end + field_eff_callnative FldEff_UseTeleport + field_eff_end gFieldEffectScript_Rayquaza:: @ 82DBCF3 - field_eff_callnative sub_80B8F98 - field_eff_end + field_eff_callnative sub_80B8F98 + field_eff_end -gFieldEffectScript_Unknown65:: @ 82DBCF9 - field_eff_callnative sub_80B9ADC - field_eff_end +gFieldEffectScript_DestroyDeoxysRock:: @ 82DBCF9 + field_eff_callnative FldEff_DestroyDeoxysRock + field_eff_end gFieldEffectScript_MoveDeoxysRock:: @ 82DBCFF - field_eff_callnative Fldeff_MoveDeoxysRock - field_eff_end + field_eff_callnative FldEff_MoveDeoxysRock + field_eff_end diff --git a/data/io_reg.s b/data/io_reg.s deleted file mode 100644 index 0941b4345..000000000 --- a/data/io_reg.s +++ /dev/null @@ -1,37 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - - -.align 2 -gUnref_82EC784:: @ 82EC784 - .4byte 0x00000000 - .4byte 0x00000000 - .4byte 0x04000008 - .4byte 0x0400000A - .4byte 0x0400000C - .4byte 0x0400000E - .4byte 0x04000010 - .4byte 0x04000014 - .4byte 0x04000018 - .4byte 0x0400001C - .4byte 0x04000012 - .4byte 0x04000016 - .4byte 0x0400001A - .4byte 0x0400001E - .4byte 0x02000100 - .4byte 0x08000400 - -gOverworldBackgroundLayerFlags:: @ 82EC7C4 - .2byte BLDCNT_TGT2_BG0 - .2byte BLDCNT_TGT2_BG1 - .2byte BLDCNT_TGT2_BG2 - .2byte BLDCNT_TGT2_BG3 - -gOrbEffectBackgroundLayerFlags:: @ 82EC7CC - .2byte BLDCNT_TGT1_BG0 - .2byte BLDCNT_TGT1_BG1 - .2byte BLDCNT_TGT1_BG2 - .2byte BLDCNT_TGT1_BG3 diff --git a/data/maps/BirthIsland_Exterior/scripts.inc b/data/maps/BirthIsland_Exterior/scripts.inc index 8cf47bfdb..d3963958b 100644 --- a/data/maps/BirthIsland_Exterior/scripts.inc +++ b/data/maps/BirthIsland_Exterior/scripts.inc @@ -68,9 +68,9 @@ BirthIsland_Exterior_EventScript_Deoxys:: @ 8267FC1 setfieldeffectargument 0, 1 setfieldeffectargument 1, 58 setfieldeffectargument 2, 26 - dofieldeffect FLDEFF_65 + dofieldeffect FLDEFF_DESTROY_DEOXYS_ROCK playbgm MUS_RG_DEOEYE, 0 - waitfieldeffect FLDEFF_65 + waitfieldeffect FLDEFF_DESTROY_DEOXYS_ROCK addobject 2 applymovement 2, BirthIsland_Exterior_Movement_DeoxysApproach waitmovement 0 diff --git a/gflib/io_reg.c b/gflib/io_reg.c new file mode 100644 index 000000000..44364349d --- /dev/null +++ b/gflib/io_reg.c @@ -0,0 +1,36 @@ +#include "global.h" +#include "io_reg.h" +#include "gba/io_reg.h" + +static const u32 sUnused[] = { + 0, + 0, + (1 << 26) | (1 << 3), + (1 << 26) | (1 << 3) | (1 << 1), + (1 << 26) | (1 << 3) | (1 << 2), + (1 << 26) | (1 << 3) | (1 << 2) | (1 << 1), + (1 << 26) | (1 << 4), + (1 << 26) | (1 << 4) | (1 << 2), + (1 << 26) | (1 << 4) | (1 << 3), + (1 << 26) | (1 << 4) | (1 << 3) | (1 << 2), + (1 << 26) | (1 << 4) | (1 << 1), + (1 << 26) | (1 << 4) | (1 << 2) | (1 << 1), + (1 << 26) | (1 << 4) | (1 << 3) | (1 << 1), + (1 << 26) | (1 << 4) | (1 << 3) | (1 << 2) | (1 << 1), + (1 << 25) | (1 << 8), + (1 << 27) | (1 << 10), +}; + +const u16 gOverworldBackgroundLayerFlags[] = { + BLDCNT_TGT2_BG0, + BLDCNT_TGT2_BG1, + BLDCNT_TGT2_BG2, + BLDCNT_TGT2_BG3, +}; + +const u16 gOrbEffectBackgroundLayerFlags[] = { + BLDCNT_TGT1_BG0, + BLDCNT_TGT1_BG1, + BLDCNT_TGT1_BG2, + BLDCNT_TGT1_BG3, +}; diff --git a/gflib/io_reg.h b/gflib/io_reg.h new file mode 100644 index 000000000..82d2fc5ed --- /dev/null +++ b/gflib/io_reg.h @@ -0,0 +1,7 @@ +#ifndef GUARD_IO_REG_H +#define GUARD_IO_REG_H + +extern const u16 gOverworldBackgroundLayerFlags[]; +extern const u16 gOrbEffectBackgroundLayerFlags[]; + +#endif // GUARD_IO_REG_H diff --git a/graphics/field_effects/pics/unknown_29.png b/graphics/field_effects/pics/sand_pile.png similarity index 100% rename from graphics/field_effects/pics/unknown_29.png rename to graphics/field_effects/pics/sand_pile.png diff --git a/graphics/field_effects/pics/unknown_35.png b/graphics/field_effects/pics/small_sparkle.png similarity index 100% rename from graphics/field_effects/pics/unknown_35.png rename to graphics/field_effects/pics/small_sparkle.png diff --git a/graphics/field_effects/pics/berry_tree_growth_sparkle.png b/graphics/field_effects/pics/sparkle.png similarity index 100% rename from graphics/field_effects/pics/berry_tree_growth_sparkle.png rename to graphics/field_effects/pics/sparkle.png diff --git a/graphics/field_effects/pics/unknown_18.png b/graphics/field_effects/pics/unknown_18.png deleted file mode 100644 index 65f4d97e29f9d738995b8e5e67053d3d0d99cd74..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 344 zcmV-e0jK_nP)%W`?qaOPi_P|w=Kqv~VzjK3q}9c9#iT*BgBYZ0)|W4J0002v zNklyiR;lE?ZvEWtaeaEh7>Yp#i3@awkjx2U|P7&dxZ qwRy^&G(+uS(C)MozC?BEcm4v??T4!bpiRC20000yiR;lE?ZvEWtaeaEh7>Yp#iUaJE)9r_=1fWg600000NkvXX Hu0mjfA|iaY delta 303 zcmV+~0nq-~0)+#RUw;7*NklqBOO3N`=9&Yf;Kro zMG`W_3_JU@#voIN(*F@7Zcz~X1N{!|6t+SHP!ezIr1Z(=mC>W+~=Oq;>EPAZgj1ejA@|^((Qi6$6&40)OEW0#zPTg1qEXlYu zFT}uNFm{f?DY^jWi}+(g4|5NmoF1NMh7Mg^qd|-XlT*vJSQS}(3lr0~zu248Ps_>n zJPR`YZ`;?Q-l$x0oNlua4)>eume;|lC;ysU;REh z!Sqx8Cz%W`?qaOPi_P|w=Kqv~VzjK3q}9c9#iT*BgBYZ0)|W4J0003H zNklqBOO3N`=9&Yf;KroMG`W_3_JU@#voIN(*F@7 zZcz~X1N{!|6t+SHP!ezIr1Z(=mC>W+~ z=Oq;>EPAZgj1ejA@|^((Qi6$6&By{QyEJxA-B<-I$+$Ex#K2-Oc8j_+vs3 za}S=J9-e204qaTML5u~HQ_Hnj66Vtc9*qhT&%gOdU3o`w0+t;Dqs9bTJZnF>$ z_nYgM*TJbL|Dc^^2K#XmTtz0QZ~~9heuBr#PfmAV{XROu^i%yOnfC>^`>Po`{Z!xK jB4$eu> 16; gTasks[taskId].data[9] = (u32)UseRegisteelHm_Callback; @@ -411,7 +411,7 @@ bool32 BrailleWait_CheckButtonPress(void) // this used to be FldEff_UseFlyAncientTomb . why did GF merge the 2 functions? bool8 FldEff_UsePuzzleEffect(void) { - u8 taskId = oei_task_add(); + u8 taskId = CreateFieldMoveTask(); if (sBraillePuzzleCallbackFlag == REGISTEEL_PUZZLE) { diff --git a/src/data/field_effects/field_effect_object_template_pointers.h b/src/data/field_effects/field_effect_object_template_pointers.h index de39e6db3..12ed63df3 100755 --- a/src/data/field_effects/field_effect_object_template_pointers.h +++ b/src/data/field_effects/field_effect_object_template_pointers.h @@ -8,70 +8,70 @@ const struct SpriteTemplate gFieldEffectObjectTemplate_Ash; const struct SpriteTemplate gFieldEffectObjectTemplate_SurfBlob; const struct SpriteTemplate gFieldEffectObjectTemplate_Arrow; const struct SpriteTemplate gFieldEffectObjectTemplate_GroundImpactDust; -const struct SpriteTemplate gFieldEffectObjectTemplate_BikeHopTallGrass; +const struct SpriteTemplate gFieldEffectObjectTemplate_JumpTallGrass; const struct SpriteTemplate gFieldEffectObjectTemplate_SandFootprints; -const struct SpriteTemplate gFieldEffectObjectTemplate_BikeHopBigSplash; +const struct SpriteTemplate gFieldEffectObjectTemplate_JumpBigSplash; const struct SpriteTemplate gFieldEffectObjectTemplate_Splash; -const struct SpriteTemplate gFieldEffectObjectTemplate_BikeHopSmallSplash; +const struct SpriteTemplate gFieldEffectObjectTemplate_JumpSmallSplash; const struct SpriteTemplate gFieldEffectObjectTemplate_LongGrass; -const struct SpriteTemplate gFieldEffectObjectTemplate_Unknown16; +const struct SpriteTemplate gFieldEffectObjectTemplate_JumpLongGrass; const struct SpriteTemplate gFieldEffectObjectTemplate_Unknown17; -const struct SpriteTemplate gFieldEffectObjectTemplate_Unknown18; +const struct SpriteTemplate gFieldEffectObjectTemplate_UnusedGrass; const struct SpriteTemplate gFieldEffectObjectTemplate_Unknown19; const struct SpriteTemplate gFieldEffectObjectTemplate_Unknown20; -const struct SpriteTemplate gFieldEffectObjectTemplate_Unknown21; -const struct SpriteTemplate gFieldEffectObjectTemplate_BerryTreeGrowthSparkle; +const struct SpriteTemplate gFieldEffectObjectTemplate_ReflectionDistortion; +const struct SpriteTemplate gFieldEffectObjectTemplate_Sparkle; const struct SpriteTemplate gFieldEffectObjectTemplate_DeepSandFootprints; const struct SpriteTemplate gFieldEffectObjectTemplate_TreeDisguise; const struct SpriteTemplate gFieldEffectObjectTemplate_MountainDisguise; const struct SpriteTemplate gFieldEffectObjectTemplate_Bird; const struct SpriteTemplate gFieldEffectObjectTemplate_BikeTireTracks; const struct SpriteTemplate gFieldEffectObjectTemplate_SandDisguisePlaceholder; -const struct SpriteTemplate gFieldEffectObjectTemplate_Unknown29; +const struct SpriteTemplate gFieldEffectObjectTemplate_SandPile; const struct SpriteTemplate gFieldEffectObjectTemplate_ShortGrass; const struct SpriteTemplate gFieldEffectObjectTemplate_HotSpringsWater; const struct SpriteTemplate gFieldEffectObjectTemplate_JumpOutOfAsh; const struct SpriteTemplate gFieldEffectObjectTemplate_LavaridgeGymWarp; const struct SpriteTemplate gFieldEffectObjectTemplate_Bubbles; -const struct SpriteTemplate gFieldEffectObjectTemplate_Unknown35; +const struct SpriteTemplate gFieldEffectObjectTemplate_SmallSparkle; const struct SpriteTemplate gFieldEffectObjectTemplate_Rayquaza; const struct SpriteTemplate *const gFieldEffectObjectTemplatePointers[] = { - &gFieldEffectObjectTemplate_ShadowSmall, - &gFieldEffectObjectTemplate_ShadowMedium, - &gFieldEffectObjectTemplate_ShadowLarge, - &gFieldEffectObjectTemplate_ShadowExtraLarge, - &gFieldEffectObjectTemplate_TallGrass, - &gFieldEffectObjectTemplate_Ripple, - &gFieldEffectObjectTemplate_Ash, - &gFieldEffectObjectTemplate_SurfBlob, - &gFieldEffectObjectTemplate_Arrow, - &gFieldEffectObjectTemplate_GroundImpactDust, - &gFieldEffectObjectTemplate_BikeHopTallGrass, - &gFieldEffectObjectTemplate_SandFootprints, - &gFieldEffectObjectTemplate_BikeHopBigSplash, - &gFieldEffectObjectTemplate_Splash, - &gFieldEffectObjectTemplate_BikeHopSmallSplash, - &gFieldEffectObjectTemplate_LongGrass, - &gFieldEffectObjectTemplate_Unknown16, - &gFieldEffectObjectTemplate_Unknown17, - &gFieldEffectObjectTemplate_Unknown18, - &gFieldEffectObjectTemplate_Unknown19, - &gFieldEffectObjectTemplate_Unknown20, - &gFieldEffectObjectTemplate_Unknown21, - &gFieldEffectObjectTemplate_BerryTreeGrowthSparkle, - &gFieldEffectObjectTemplate_DeepSandFootprints, - &gFieldEffectObjectTemplate_TreeDisguise, - &gFieldEffectObjectTemplate_MountainDisguise, - &gFieldEffectObjectTemplate_Bird, - &gFieldEffectObjectTemplate_BikeTireTracks, - &gFieldEffectObjectTemplate_SandDisguisePlaceholder, - &gFieldEffectObjectTemplate_Unknown29, - &gFieldEffectObjectTemplate_ShortGrass, - &gFieldEffectObjectTemplate_HotSpringsWater, - &gFieldEffectObjectTemplate_JumpOutOfAsh, - &gFieldEffectObjectTemplate_LavaridgeGymWarp, - &gFieldEffectObjectTemplate_Bubbles, - &gFieldEffectObjectTemplate_Unknown35, - &gFieldEffectObjectTemplate_Rayquaza, + [FLDEFFOBJ_SHADOW_S] = &gFieldEffectObjectTemplate_ShadowSmall, + [FLDEFFOBJ_SHADOW_M] = &gFieldEffectObjectTemplate_ShadowMedium, + [FLDEFFOBJ_SHADOW_L] = &gFieldEffectObjectTemplate_ShadowLarge, + [FLDEFFOBJ_SHADOW_XL] = &gFieldEffectObjectTemplate_ShadowExtraLarge, + [FLDEFFOBJ_TALL_GRASS] = &gFieldEffectObjectTemplate_TallGrass, + [FLDEFFOBJ_RIPPLE] = &gFieldEffectObjectTemplate_Ripple, + [FLDEFFOBJ_ASH] = &gFieldEffectObjectTemplate_Ash, + [FLDEFFOBJ_SURF_BLOB] = &gFieldEffectObjectTemplate_SurfBlob, + [FLDEFFOBJ_ARROW] = &gFieldEffectObjectTemplate_Arrow, + [FLDEFFOBJ_GROUND_IMPACT_DUST] = &gFieldEffectObjectTemplate_GroundImpactDust, + [FLDEFFOBJ_JUMP_TALL_GRASS] = &gFieldEffectObjectTemplate_JumpTallGrass, + [FLDEFFOBJ_SAND_FOOTPRINTS] = &gFieldEffectObjectTemplate_SandFootprints, + [FLDEFFOBJ_JUMP_BIG_SPLASH] = &gFieldEffectObjectTemplate_JumpBigSplash, + [FLDEFFOBJ_SPLASH] = &gFieldEffectObjectTemplate_Splash, + [FLDEFFOBJ_JUMP_SMALL_SPLASH] = &gFieldEffectObjectTemplate_JumpSmallSplash, + [FLDEFFOBJ_LONG_GRASS] = &gFieldEffectObjectTemplate_LongGrass, + [FLDEFFOBJ_JUMP_LONG_GRASS] = &gFieldEffectObjectTemplate_JumpLongGrass, + [FLDEFFOBJ_17] = &gFieldEffectObjectTemplate_Unknown17, + [FLDEFFOBJ_UNUSED_GRASS] = &gFieldEffectObjectTemplate_UnusedGrass, + [FLDEFFOBJ_19] = &gFieldEffectObjectTemplate_Unknown19, + [FLDEFFOBJ_20] = &gFieldEffectObjectTemplate_Unknown20, + [FLDEFFOBJ_REFLECTION_DISTORTION] = &gFieldEffectObjectTemplate_ReflectionDistortion, + [FLDEFFOBJ_SPARKLE] = &gFieldEffectObjectTemplate_Sparkle, + [FLDEFFOBJ_DEEP_SAND_FOOTPRINTS] = &gFieldEffectObjectTemplate_DeepSandFootprints, + [FLDEFFOBJ_TREE_DISGUISE] = &gFieldEffectObjectTemplate_TreeDisguise, + [FLDEFFOBJ_MOUNTAIN_DISGUISE] = &gFieldEffectObjectTemplate_MountainDisguise, + [FLDEFFOBJ_BIRD] = &gFieldEffectObjectTemplate_Bird, + [FLDEFFOBJ_BIKE_TIRE_TRACKS] = &gFieldEffectObjectTemplate_BikeTireTracks, + [FLDEFFOBJ_SAND_DISGUISE] = &gFieldEffectObjectTemplate_SandDisguisePlaceholder, + [FLDEFFOBJ_SAND_PILE] = &gFieldEffectObjectTemplate_SandPile, + [FLDEFFOBJ_SHORT_GRASS] = &gFieldEffectObjectTemplate_ShortGrass, + [FLDEFFOBJ_HOT_SPRINGS_WATER] = &gFieldEffectObjectTemplate_HotSpringsWater, + [FLDEFFOBJ_JUMP_OUT_OF_ASH] = &gFieldEffectObjectTemplate_JumpOutOfAsh, + [FLDEFFOBJ_LAVARIDGE_GYM_WARP] = &gFieldEffectObjectTemplate_LavaridgeGymWarp, + [FLDEFFOBJ_BUBBLES] = &gFieldEffectObjectTemplate_Bubbles, + [FLDEFFOBJ_SMALL_SPARKLE] = &gFieldEffectObjectTemplate_SmallSparkle, + [FLDEFFOBJ_RAYQUAZA] = &gFieldEffectObjectTemplate_Rayquaza, }; diff --git a/src/data/field_effects/field_effect_objects.h b/src/data/field_effects/field_effect_objects.h index 65f35107d..4654a133a 100755 --- a/src/data/field_effects/field_effect_objects.h +++ b/src/data/field_effects/field_effect_objects.h @@ -225,11 +225,11 @@ const union AnimCmd *const gFieldEffectObjectImageAnimTable_GroundImpactDust[] = const struct SpriteTemplate gFieldEffectObjectTemplate_GroundImpactDust = {0xFFFF, 0x1004, &gObjectEventBaseOam_16x8, gFieldEffectObjectImageAnimTable_GroundImpactDust, gFieldEffectObjectPicTable_GroundImpactDust, gDummySpriteAffineAnimTable, sub_8156194}; -const struct SpriteFrameImage gFieldEffectObjectPicTable_BikeHopTallGrass[] = { - overworld_frame(gFieldEffectObjectPic_BikeHopTallGrass, 2, 1, 0), - overworld_frame(gFieldEffectObjectPic_BikeHopTallGrass, 2, 1, 1), - overworld_frame(gFieldEffectObjectPic_BikeHopTallGrass, 2, 1, 2), - overworld_frame(gFieldEffectObjectPic_BikeHopTallGrass, 2, 1, 3), +const struct SpriteFrameImage gFieldEffectObjectPicTable_JumpTallGrass[] = { + overworld_frame(gFieldEffectObjectPic_JumpTallGrass, 2, 1, 0), + overworld_frame(gFieldEffectObjectPic_JumpTallGrass, 2, 1, 1), + overworld_frame(gFieldEffectObjectPic_JumpTallGrass, 2, 1, 2), + overworld_frame(gFieldEffectObjectPic_JumpTallGrass, 2, 1, 3), }; const union AnimCmd gFieldEffectObjectImageAnim_850CCD8[] = @@ -241,12 +241,12 @@ const union AnimCmd gFieldEffectObjectImageAnim_850CCD8[] = ANIMCMD_END, }; -const union AnimCmd *const gFieldEffectObjectImageAnimTable_BikeHopTallGrass[] = +const union AnimCmd *const gFieldEffectObjectImageAnimTable_JumpTallGrass[] = { gFieldEffectObjectImageAnim_850CCD8, }; -const struct SpriteTemplate gFieldEffectObjectTemplate_BikeHopTallGrass = {0xFFFF, 0x1005, &gObjectEventBaseOam_16x8, gFieldEffectObjectImageAnimTable_BikeHopTallGrass, gFieldEffectObjectPicTable_BikeHopTallGrass, gDummySpriteAffineAnimTable, sub_8156194}; +const struct SpriteTemplate gFieldEffectObjectTemplate_JumpTallGrass = {0xFFFF, 0x1005, &gObjectEventBaseOam_16x8, gFieldEffectObjectImageAnimTable_JumpTallGrass, gFieldEffectObjectPicTable_JumpTallGrass, gDummySpriteAffineAnimTable, sub_8156194}; const struct SpriteFrameImage gFieldEffectObjectPicTable_SandFootprints[] = { overworld_frame(gFieldEffectObjectPic_SandFootprints, 2, 2, 0), @@ -398,11 +398,11 @@ const union AnimCmd *const gFieldEffectObjectImageAnimTable_BikeTireTracks[] = const struct SpriteTemplate gFieldEffectObjectTemplate_BikeTireTracks = {0xFFFF, 0x1004, &gObjectEventBaseOam_16x16, gFieldEffectObjectImageAnimTable_BikeTireTracks, gFieldEffectObjectPicTable_BikeTireTracks, gDummySpriteAffineAnimTable, UpdateFootprintsTireTracksFieldEffect}; -const struct SpriteFrameImage gFieldEffectObjectPicTable_BikeHopBigSplash[] = { - overworld_frame(gFieldEffectObjectPic_BikeHopBigSplash, 2, 2, 0), - overworld_frame(gFieldEffectObjectPic_BikeHopBigSplash, 2, 2, 1), - overworld_frame(gFieldEffectObjectPic_BikeHopBigSplash, 2, 2, 2), - overworld_frame(gFieldEffectObjectPic_BikeHopBigSplash, 2, 2, 3), +const struct SpriteFrameImage gFieldEffectObjectPicTable_JumpBigSplash[] = { + overworld_frame(gFieldEffectObjectPic_JumpBigSplash, 2, 2, 0), + overworld_frame(gFieldEffectObjectPic_JumpBigSplash, 2, 2, 1), + overworld_frame(gFieldEffectObjectPic_JumpBigSplash, 2, 2, 2), + overworld_frame(gFieldEffectObjectPic_JumpBigSplash, 2, 2, 3), }; const union AnimCmd gFieldEffectObjectImageAnim_850CE7C[] = @@ -414,12 +414,12 @@ const union AnimCmd gFieldEffectObjectImageAnim_850CE7C[] = ANIMCMD_END, }; -const union AnimCmd *const gFieldEffectObjectImageAnimTable_BikeHopBigSplash[] = +const union AnimCmd *const gFieldEffectObjectImageAnimTable_JumpBigSplash[] = { gFieldEffectObjectImageAnim_850CE7C, }; -const struct SpriteTemplate gFieldEffectObjectTemplate_BikeHopBigSplash = {0xFFFF, 0x1004, &gObjectEventBaseOam_16x16, gFieldEffectObjectImageAnimTable_BikeHopBigSplash, gFieldEffectObjectPicTable_BikeHopBigSplash, gDummySpriteAffineAnimTable, sub_8156194}; +const struct SpriteTemplate gFieldEffectObjectTemplate_JumpBigSplash = {0xFFFF, 0x1004, &gObjectEventBaseOam_16x16, gFieldEffectObjectImageAnimTable_JumpBigSplash, gFieldEffectObjectPicTable_JumpBigSplash, gDummySpriteAffineAnimTable, sub_8156194}; const struct SpriteFrameImage gFieldEffectObjectPicTable_Splash[] = { overworld_frame(gFieldEffectObjectPic_Splash, 2, 1, 0), @@ -454,10 +454,10 @@ const union AnimCmd *const gFieldEffectObjectImageAnimTable_Splash[] = const struct SpriteTemplate gFieldEffectObjectTemplate_Splash = {0xFFFF, 0x1004, &gObjectEventBaseOam_16x8, gFieldEffectObjectImageAnimTable_Splash, gFieldEffectObjectPicTable_Splash, gDummySpriteAffineAnimTable, UpdateSplashFieldEffect}; -const struct SpriteFrameImage gFieldEffectObjectPicTable_BikeHopSmallSplash[] = { - overworld_frame(gFieldEffectObjectPic_BikeHopSmallSplash, 2, 1, 0), - overworld_frame(gFieldEffectObjectPic_BikeHopSmallSplash, 2, 1, 1), - overworld_frame(gFieldEffectObjectPic_BikeHopSmallSplash, 2, 1, 2), +const struct SpriteFrameImage gFieldEffectObjectPicTable_JumpSmallSplash[] = { + overworld_frame(gFieldEffectObjectPic_JumpSmallSplash, 2, 1, 0), + overworld_frame(gFieldEffectObjectPic_JumpSmallSplash, 2, 1, 1), + overworld_frame(gFieldEffectObjectPic_JumpSmallSplash, 2, 1, 2), }; const union AnimCmd gFieldEffectObjectImageAnim_850CF24[] = @@ -468,12 +468,12 @@ const union AnimCmd gFieldEffectObjectImageAnim_850CF24[] = ANIMCMD_END, }; -const union AnimCmd *const gFieldEffectObjectImageAnimTable_BikeHopSmallSplash[] = +const union AnimCmd *const gFieldEffectObjectImageAnimTable_JumpSmallSplash[] = { gFieldEffectObjectImageAnim_850CF24, }; -const struct SpriteTemplate gFieldEffectObjectTemplate_BikeHopSmallSplash = {0xFFFF, 0x1004, &gObjectEventBaseOam_16x8, gFieldEffectObjectImageAnimTable_BikeHopSmallSplash, gFieldEffectObjectPicTable_BikeHopSmallSplash, gDummySpriteAffineAnimTable, sub_8156194}; +const struct SpriteTemplate gFieldEffectObjectTemplate_JumpSmallSplash = {0xFFFF, 0x1004, &gObjectEventBaseOam_16x8, gFieldEffectObjectImageAnimTable_JumpSmallSplash, gFieldEffectObjectPicTable_JumpSmallSplash, gDummySpriteAffineAnimTable, sub_8156194}; const struct SpriteFrameImage gFieldEffectObjectPicTable_LongGrass[] = { overworld_frame(gFieldEffectObjectPic_LongGrass, 2, 2, 0), @@ -501,13 +501,13 @@ const union AnimCmd *const gFieldEffectObjectImageAnimTable_LongGrass[] = const struct SpriteTemplate gFieldEffectObjectTemplate_LongGrass = {0xFFFF, 0x1005, &gObjectEventBaseOam_16x16, gFieldEffectObjectImageAnimTable_LongGrass, gFieldEffectObjectPicTable_LongGrass, gDummySpriteAffineAnimTable, UpdateLongGrassFieldEffect}; -const struct SpriteFrameImage gFieldEffectObjectPicTable_Unknown16[] = { - overworld_frame(gFieldEffectObjectPic_Unknown16, 2, 2, 0), - overworld_frame(gFieldEffectObjectPic_Unknown16, 2, 2, 1), - overworld_frame(gFieldEffectObjectPic_Unknown16, 2, 2, 2), - overworld_frame(gFieldEffectObjectPic_Unknown16, 2, 2, 3), - overworld_frame(gFieldEffectObjectPic_Unknown16, 2, 2, 4), - overworld_frame(gFieldEffectObjectPic_Unknown16, 2, 2, 6), +const struct SpriteFrameImage gFieldEffectObjectPicTable_JumpLongGrass[] = { + overworld_frame(gFieldEffectObjectPic_JumpLongGrass, 2, 2, 0), + overworld_frame(gFieldEffectObjectPic_JumpLongGrass, 2, 2, 1), + overworld_frame(gFieldEffectObjectPic_JumpLongGrass, 2, 2, 2), + overworld_frame(gFieldEffectObjectPic_JumpLongGrass, 2, 2, 3), + overworld_frame(gFieldEffectObjectPic_JumpLongGrass, 2, 2, 4), + overworld_frame(gFieldEffectObjectPic_JumpLongGrass, 2, 2, 6), }; const union AnimCmd gFieldEffectObjectImageAnim_850CFDC[] = @@ -521,15 +521,15 @@ const union AnimCmd gFieldEffectObjectImageAnim_850CFDC[] = ANIMCMD_END, }; -const union AnimCmd *const gFieldEffectObjectImageAnimTable_Unknown16[] = +const union AnimCmd *const gFieldEffectObjectImageAnimTable_JumpLongGrass[] = { gFieldEffectObjectImageAnim_850CFDC, }; -const struct SpriteTemplate gFieldEffectObjectTemplate_Unknown16 = {0xFFFF, 0x1005, &gObjectEventBaseOam_16x16, gFieldEffectObjectImageAnimTable_Unknown16, gFieldEffectObjectPicTable_Unknown16, gDummySpriteAffineAnimTable, sub_8156194}; +const struct SpriteTemplate gFieldEffectObjectTemplate_JumpLongGrass = {0xFFFF, 0x1005, &gObjectEventBaseOam_16x16, gFieldEffectObjectImageAnimTable_JumpLongGrass, gFieldEffectObjectPicTable_JumpLongGrass, gDummySpriteAffineAnimTable, sub_8156194}; const struct SpriteFrameImage gFieldEffectObjectPicTable_Unknown17[] = { - overworld_frame(gFieldEffectObjectPic_Unknown16, 2, 2, 6), + overworld_frame(gFieldEffectObjectPic_JumpLongGrass, 2, 2, 6), overworld_frame(gFieldEffectObjectPic_Unknown17, 2, 2, 0), overworld_frame(gFieldEffectObjectPic_Unknown17, 2, 2, 1), overworld_frame(gFieldEffectObjectPic_Unknown17, 2, 2, 2), @@ -561,11 +561,11 @@ const union AnimCmd *const gFieldEffectObjectImageAnimTable_Unknown17[] = const struct SpriteTemplate gFieldEffectObjectTemplate_Unknown17 = {0xFFFF, 0x1005, &gObjectEventBaseOam_16x16, gFieldEffectObjectImageAnimTable_Unknown17, gFieldEffectObjectPicTable_Unknown17, gDummySpriteAffineAnimTable, WaitFieldEffectSpriteAnim}; -const struct SpriteFrameImage gFieldEffectObjectPicTable_Unknown18[] = { - overworld_frame(gFieldEffectObjectPic_Unknown18, 2, 2, 0), - overworld_frame(gFieldEffectObjectPic_Unknown18, 2, 2, 1), - overworld_frame(gFieldEffectObjectPic_Unknown18, 2, 2, 2), - overworld_frame(gFieldEffectObjectPic_Unknown18, 2, 2, 3), +const struct SpriteFrameImage gFieldEffectObjectPicTable_UnusedGrass[] = { + overworld_frame(gFieldEffectObjectPic_UnusedGrass, 2, 2, 0), + overworld_frame(gFieldEffectObjectPic_UnusedGrass, 2, 2, 1), + overworld_frame(gFieldEffectObjectPic_UnusedGrass, 2, 2, 2), + overworld_frame(gFieldEffectObjectPic_UnusedGrass, 2, 2, 3), }; const union AnimCmd gFieldEffectObjectImageAnim_850D0C0[] = @@ -579,12 +579,12 @@ const union AnimCmd gFieldEffectObjectImageAnim_850D0C0[] = ANIMCMD_JUMP(0), }; -const union AnimCmd *const gFieldEffectObjectImageAnimTable_Unknown18[] = +const union AnimCmd *const gFieldEffectObjectImageAnimTable_UnusedGrass[] = { gFieldEffectObjectImageAnim_850D0C0, }; -const struct SpriteTemplate gFieldEffectObjectTemplate_Unknown18 = {0xFFFF, 0x1005, &gObjectEventBaseOam_16x16, gFieldEffectObjectImageAnimTable_Unknown18, gFieldEffectObjectPicTable_Unknown18, gDummySpriteAffineAnimTable, WaitFieldEffectSpriteAnim}; +const struct SpriteTemplate gFieldEffectObjectTemplate_UnusedGrass = {0xFFFF, 0x1005, &gObjectEventBaseOam_16x16, gFieldEffectObjectImageAnimTable_UnusedGrass, gFieldEffectObjectPicTable_UnusedGrass, gDummySpriteAffineAnimTable, WaitFieldEffectSpriteAnim}; const struct SpriteFrameImage gFieldEffectObjectPicTable_Unknown19[] = { overworld_frame(gFieldEffectObjectPic_Unknown19, 2, 2, 0), @@ -609,10 +609,10 @@ const union AnimCmd *const gFieldEffectObjectImageAnimTable_Unknown19[] = const struct SpriteTemplate gFieldEffectObjectTemplate_Unknown19 = {0xFFFF, 0x1004, &gObjectEventBaseOam_16x16, gFieldEffectObjectImageAnimTable_Unknown19, gFieldEffectObjectPicTable_Unknown19, gDummySpriteAffineAnimTable, WaitFieldEffectSpriteAnim}; -const struct SpriteFrameImage gFieldEffectObjectPicTable_Unknown29[] = { - overworld_frame(gFieldEffectObjectPic_Unknown29, 2, 1, 0), - overworld_frame(gFieldEffectObjectPic_Unknown29, 2, 1, 1), - overworld_frame(gFieldEffectObjectPic_Unknown29, 2, 1, 2), +const struct SpriteFrameImage gFieldEffectObjectPicTable_SandPile[] = { + overworld_frame(gFieldEffectObjectPic_SandPile, 2, 1, 0), + overworld_frame(gFieldEffectObjectPic_SandPile, 2, 1, 1), + overworld_frame(gFieldEffectObjectPic_SandPile, 2, 1, 2), }; const union AnimCmd gFieldEffectObjectImageAnim_850D160[] = @@ -623,12 +623,12 @@ const union AnimCmd gFieldEffectObjectImageAnim_850D160[] = ANIMCMD_END, }; -const union AnimCmd *const gFieldEffectObjectImageAnimTable_Unknown29[] = +const union AnimCmd *const gFieldEffectObjectImageAnimTable_SandPile[] = { gFieldEffectObjectImageAnim_850D160, }; -const struct SpriteTemplate gFieldEffectObjectTemplate_Unknown29 = {0xFFFF, 0x1004, &gObjectEventBaseOam_16x8, gFieldEffectObjectImageAnimTable_Unknown29, gFieldEffectObjectPicTable_Unknown29, gDummySpriteAffineAnimTable, UpdateSandPileFieldEffect}; +const struct SpriteTemplate gFieldEffectObjectTemplate_SandPile = {0xFFFF, 0x1004, &gObjectEventBaseOam_16x8, gFieldEffectObjectImageAnimTable_SandPile, gFieldEffectObjectPicTable_SandPile, gDummySpriteAffineAnimTable, UpdateSandPileFieldEffect}; const struct SpriteFrameImage gFieldEffectObjectPicTable_Unknown20[] = { overworld_frame(gFieldEffectObjectPic_Unknown20, 2, 2, 0), @@ -683,21 +683,21 @@ const union AffineAnimCmd gFieldEffectObjectRotScalAnim_850D234[] = AFFINEANIMCMD_JUMP(1), }; -const union AffineAnimCmd *const gFieldEffectObjectRotScalAnimTable_Unknown21[] = +const union AffineAnimCmd *const gFieldEffectObjectRotScalAnimTable_ReflectionDistortion[] = { gFieldEffectObjectRotScalAnim_850D1E4, gFieldEffectObjectRotScalAnim_850D234, }; -const struct SpriteTemplate gFieldEffectObjectTemplate_Unknown21 = {0x0, 0xFFFF, &gDummyOamData, gDummySpriteAnimTable, NULL, gFieldEffectObjectRotScalAnimTable_Unknown21, SpriteCallbackDummy}; +const struct SpriteTemplate gFieldEffectObjectTemplate_ReflectionDistortion = {0x0, 0xFFFF, &gDummyOamData, gDummySpriteAnimTable, NULL, gFieldEffectObjectRotScalAnimTable_ReflectionDistortion, SpriteCallbackDummy}; -const struct SpriteFrameImage gFieldEffectObjectPicTable_BerryTreeGrowthSparkle[] = { - overworld_frame(gFieldEffectObjectPic_BerryTreeGrowthSparkle, 2, 2, 0), - overworld_frame(gFieldEffectObjectPic_BerryTreeGrowthSparkle, 2, 2, 1), - overworld_frame(gFieldEffectObjectPic_BerryTreeGrowthSparkle, 2, 2, 2), - overworld_frame(gFieldEffectObjectPic_BerryTreeGrowthSparkle, 2, 2, 3), - overworld_frame(gFieldEffectObjectPic_BerryTreeGrowthSparkle, 2, 2, 4), - overworld_frame(gFieldEffectObjectPic_BerryTreeGrowthSparkle, 2, 2, 5), +const struct SpriteFrameImage gFieldEffectObjectPicTable_Sparkle[] = { + overworld_frame(gFieldEffectObjectPic_Sparkle, 2, 2, 0), + overworld_frame(gFieldEffectObjectPic_Sparkle, 2, 2, 1), + overworld_frame(gFieldEffectObjectPic_Sparkle, 2, 2, 2), + overworld_frame(gFieldEffectObjectPic_Sparkle, 2, 2, 3), + overworld_frame(gFieldEffectObjectPic_Sparkle, 2, 2, 4), + overworld_frame(gFieldEffectObjectPic_Sparkle, 2, 2, 5), }; const union AnimCmd gFieldEffectObjectImageAnim_850D2D4[] = @@ -725,12 +725,12 @@ const union AnimCmd gFieldEffectObjectImageAnim_850D2D4[] = ANIMCMD_END, }; -const union AnimCmd *const gFieldEffectObjectImageAnimTable_BerryTreeGrowthSparkle[] = +const union AnimCmd *const gFieldEffectObjectImageAnimTable_Sparkle[] = { gFieldEffectObjectImageAnim_850D2D4, }; -const struct SpriteTemplate gFieldEffectObjectTemplate_BerryTreeGrowthSparkle = {0xFFFF, 0xFFFF, &gObjectEventBaseOam_16x16, gFieldEffectObjectImageAnimTable_BerryTreeGrowthSparkle, gFieldEffectObjectPicTable_BerryTreeGrowthSparkle, gDummySpriteAffineAnimTable, WaitFieldEffectSpriteAnim}; +const struct SpriteTemplate gFieldEffectObjectTemplate_Sparkle = {0xFFFF, 0xFFFF, &gObjectEventBaseOam_16x16, gFieldEffectObjectImageAnimTable_Sparkle, gFieldEffectObjectPicTable_Sparkle, gDummySpriteAffineAnimTable, WaitFieldEffectSpriteAnim}; const struct SpriteFrameImage gFieldEffectObjectPicTable_TreeDisguise[] = { overworld_frame(gFieldEffectObjectPic_TreeDisguise, 2, 4, 0), @@ -970,9 +970,9 @@ const union AnimCmd *const gFieldEffectObjectImageAnimTable_Bubbles[] = const struct SpriteTemplate gFieldEffectObjectTemplate_Bubbles = {0xFFFF, 0x1004, &gObjectEventBaseOam_16x32, gFieldEffectObjectImageAnimTable_Bubbles, gFieldEffectObjectPicTable_Bubbles, gDummySpriteAffineAnimTable, UpdateBubblesFieldEffect}; -const struct SpriteFrameImage gFieldEffectObjectPicTable_Unknown35[] = { - overworld_frame(gFieldEffectObjectPic_Unknown35, 2, 2, 0), - overworld_frame(gFieldEffectObjectPic_Unknown35, 2, 2, 1), +const struct SpriteFrameImage gFieldEffectObjectPicTable_SmallSparkle[] = { + overworld_frame(gFieldEffectObjectPic_SmallSparkle, 2, 2, 0), + overworld_frame(gFieldEffectObjectPic_SmallSparkle, 2, 2, 1), }; const union AnimCmd gFieldEffectObjectImageAnim_850D674[] = @@ -983,12 +983,12 @@ const union AnimCmd gFieldEffectObjectImageAnim_850D674[] = ANIMCMD_END, }; -const union AnimCmd *const gFieldEffectObjectImageAnimTable_Unknown35[] = +const union AnimCmd *const gFieldEffectObjectImageAnimTable_SmallSparkle[] = { gFieldEffectObjectImageAnim_850D674, }; -const struct SpriteTemplate gFieldEffectObjectTemplate_Unknown35 = {0xFFFF, 0x100F, &gObjectEventBaseOam_16x16, gFieldEffectObjectImageAnimTable_Unknown35, gFieldEffectObjectPicTable_Unknown35, gDummySpriteAffineAnimTable, UpdateSparkleFieldEffect}; +const struct SpriteTemplate gFieldEffectObjectTemplate_SmallSparkle = {0xFFFF, 0x100F, &gObjectEventBaseOam_16x16, gFieldEffectObjectImageAnimTable_SmallSparkle, gFieldEffectObjectPicTable_SmallSparkle, gDummySpriteAffineAnimTable, UpdateSparkleFieldEffect}; const struct SpritePalette gFieldEffectObjectPaletteInfo3 = {gFieldEffectObjectPalette3, 0x100F}; diff --git a/src/data/object_events/object_event_graphics.h b/src/data/object_events/object_event_graphics.h index 769a6bb0a..371ff3815 100755 --- a/src/data/object_events/object_event_graphics.h +++ b/src/data/object_events/object_event_graphics.h @@ -252,7 +252,7 @@ const u32 gObjectEventPic_CableCar[] = INCBIN_U32("graphics/object_events/pics/m const u16 gObjectEventPalette20[] = INCBIN_U16("graphics/object_events/palettes/20.gbapal"); const u32 gObjectEventPic_SSTidal[] = INCBIN_U32("graphics/object_events/pics/misc/ss_tidal.4bpp"); const u16 gObjectEventPalette21[] = INCBIN_U16("graphics/object_events/palettes/21.gbapal"); -const u32 gFieldEffectObjectPic_BerryTreeGrowthSparkle[] = INCBIN_U32("graphics/field_effects/pics/berry_tree_growth_sparkle.4bpp"); +const u32 gFieldEffectObjectPic_Sparkle[] = INCBIN_U32("graphics/field_effects/pics/sparkle.4bpp"); const u32 gObjectEventPic_BerryTreeDirtPile[] = INCBIN_U32("graphics/object_events/pics/berry_trees/dirt_pile.4bpp"); const u32 gObjectEventPic_BerryTreeSprout[] = INCBIN_U32("graphics/object_events/pics/berry_trees/sprout.4bpp"); const u32 gObjectEventPic_PechaBerryTree[] = INCBIN_U32("graphics/object_events/pics/berry_trees/pecha.4bpp"); @@ -303,11 +303,11 @@ const u32 gFieldEffectObjectPic_Arrow[] = INCBIN_U32("graphics/field_effects/pic const u16 gFieldEffectObjectPalette0[] = INCBIN_U16("graphics/field_effects/palettes/00.gbapal"); const u16 gFieldEffectObjectPalette1[] = INCBIN_U16("graphics/field_effects/palettes/01.gbapal"); const u32 gFieldEffectObjectPic_GroundImpactDust[] = INCBIN_U32("graphics/field_effects/pics/ground_impact_dust.4bpp"); -const u32 gFieldEffectObjectPic_BikeHopTallGrass[] = INCBIN_U32("graphics/field_effects/pics/bike_hop_tall_grass.4bpp"); -const u32 gUnusedGrass[] = INCBIN_U32("graphics/field_effects/pics/unused_grass.4bpp"); -const u32 gFieldEffectObjectPic_Unknown16[] = INCBIN_U32("graphics/field_effects/pics/unknown_16.4bpp"); +const u32 gFieldEffectObjectPic_JumpTallGrass[] = INCBIN_U32("graphics/field_effects/pics/bike_hop_tall_grass.4bpp"); +const u32 gUnusedGrass[] = INCBIN_U32("graphics/field_effects/pics/unused_grass_2.4bpp"); +const u32 gFieldEffectObjectPic_JumpLongGrass[] = INCBIN_U32("graphics/field_effects/pics/unknown_16.4bpp"); const u32 gFieldEffectObjectPic_Unknown17[] = INCBIN_U32("graphics/field_effects/pics/unknown_17.4bpp"); -const u32 gFieldEffectObjectPic_Unknown18[] = INCBIN_U32("graphics/field_effects/pics/unknown_18.4bpp"); +const u32 gFieldEffectObjectPic_UnusedGrass[] = INCBIN_U32("graphics/field_effects/pics/unused_grass.4bpp"); const u32 gFieldEffectObjectPic_LongGrass[] = INCBIN_U32("graphics/field_effects/pics/long_grass.4bpp"); const u32 gFieldEffectObjectPic_TallGrass[] = INCBIN_U32("graphics/field_effects/pics/tall_grass.4bpp"); const u32 gFieldEffectObjectPic_ShortGrass[] = INCBIN_U32("graphics/field_effects/pics/short_grass.4bpp"); @@ -315,10 +315,10 @@ const u32 gFieldEffectObjectPic_SandFootprints[] = INCBIN_U32("graphics/field_ef const u32 gFieldEffectObjectPic_DeepSandFootprints[] = INCBIN_U32("graphics/field_effects/pics/deep_sand_footprints.4bpp"); const u32 gFieldEffectObjectPic_BikeTireTracks[] = INCBIN_U32("graphics/field_effects/pics/bike_tire_tracks.4bpp"); const u32 gFieldEffectObjectPic_Unknown19[] = INCBIN_U32("graphics/field_effects/pics/unknown_19.4bpp"); -const u32 gFieldEffectObjectPic_Unknown29[] = INCBIN_U32("graphics/field_effects/pics/unknown_29.4bpp"); -const u32 gFieldEffectObjectPic_BikeHopBigSplash[] = INCBIN_U32("graphics/field_effects/pics/bike_hop_big_splash.4bpp"); +const u32 gFieldEffectObjectPic_SandPile[] = INCBIN_U32("graphics/field_effects/pics/sand_pile.4bpp"); +const u32 gFieldEffectObjectPic_JumpBigSplash[] = INCBIN_U32("graphics/field_effects/pics/bike_hop_big_splash.4bpp"); const u32 gFieldEffectObjectPic_Splash[] = INCBIN_U32("graphics/field_effects/pics/splash.4bpp"); -const u32 gFieldEffectObjectPic_BikeHopSmallSplash[] = INCBIN_U32("graphics/field_effects/pics/bike_hop_small_splash.4bpp"); +const u32 gFieldEffectObjectPic_JumpSmallSplash[] = INCBIN_U32("graphics/field_effects/pics/bike_hop_small_splash.4bpp"); const u32 gFieldEffectObjectPic_Unknown20[] = INCBIN_U32("graphics/field_effects/pics/unknown_20.4bpp"); const u32 gFieldEffectObjectPic_TreeDisguise[] = INCBIN_U32("graphics/field_effects/pics/tree_disguise.4bpp"); const u32 gFieldEffectObjectPic_MountainDisguise[] = INCBIN_U32("graphics/field_effects/pics/mountain_disguise.4bpp"); @@ -328,7 +328,7 @@ const u16 gFieldEffectObjectPalette2[] = INCBIN_U16("graphics/field_effects/pale const u32 gFieldEffectObjectPic_JumpOutOfAsh[] = INCBIN_U32("graphics/field_effects/pics/jump_out_of_ash.4bpp"); const u32 gFieldEffectObjectPic_LavaridgeGymWarp[] = INCBIN_U32("graphics/field_effects/pics/lavaridge_gym_warp.4bpp"); const u32 gFieldEffectObjectPic_Bubbles[] = INCBIN_U32("graphics/field_effects/pics/bubbles.4bpp"); -const u32 gFieldEffectObjectPic_Unknown35[] = INCBIN_U32("graphics/field_effects/pics/unknown_35.4bpp"); +const u32 gFieldEffectObjectPic_SmallSparkle[] = INCBIN_U32("graphics/field_effects/pics/small_sparkle.4bpp"); const u16 gFieldEffectObjectPalette3[] = INCBIN_U16("graphics/field_effects/palettes/03.gbapal"); const u32 gFieldEffectObjectPic_Bird[] = INCBIN_U32("graphics/field_effects/pics/bird.4bpp"); const u32 gObjectEventPic_Juan[] = INCBIN_U32("graphics/object_events/pics/people/gym_leaders/juan.4bpp"); diff --git a/src/dodrio_berry_picking.c b/src/dodrio_berry_picking.c index 262b7d111..7101c0d81 100644 --- a/src/dodrio_berry_picking.c +++ b/src/dodrio_berry_picking.c @@ -4629,7 +4629,7 @@ static void sub_802A7A8(void) ChangeBgX(3, 0, 0); ChangeBgY(3, 0, 0); InitStandardTextBoxWindows(); - sub_8197200(); + InitTextBoxGfxAndPrinters(); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); SetBgTilemapBuffer(3, gUnknown_02022CF8->tilemapBuffers[0]); SetBgTilemapBuffer(1, gUnknown_02022CF8->tilemapBuffers[1]); diff --git a/src/event_object_movement.c b/src/event_object_movement.c index d6a2fe2ec..724d95a29 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -1121,13 +1121,13 @@ void ResetObjectEvents(void) static void CreateReflectionEffectSprites(void) { - u8 spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[21], 0, 0, 31); + u8 spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_REFLECTION_DISTORTION], 0, 0, 31); gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL; InitSpriteAffineAnim(&gSprites[spriteId]); StartSpriteAffineAnim(&gSprites[spriteId], 0); gSprites[spriteId].invisible = TRUE; - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[21], 0, 0, 31); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_REFLECTION_DISTORTION], 0, 0, 31); gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL; InitSpriteAffineAnim(&gSprites[spriteId]); StartSpriteAffineAnim(&gSprites[spriteId], 1); diff --git a/src/faraway_island.c b/src/faraway_island.c index f8e3eac14..4233c43d8 100755 --- a/src/faraway_island.c +++ b/src/faraway_island.c @@ -6,6 +6,7 @@ #include "metatile_behavior.h" #include "sprite.h" #include "constants/event_objects.h" +#include "constants/field_effects.h" #include "constants/flags.h" #include "constants/maps.h" #include "constants/metatile_behaviors.h" @@ -379,7 +380,7 @@ void sub_81D4A90(void) x = mew->currentCoords.x; y = mew->currentCoords.y; sub_80930E0(&x, &y, 8, 8); - sUnknown_0203CF50 = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[15], x, y, gSprites[mew->spriteId].subpriority - 1); + sUnknown_0203CF50 = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_LONG_GRASS], x, y, gSprites[mew->spriteId].subpriority - 1); if (sUnknown_0203CF50 != MAX_SPRITES) { struct Sprite *sprite = &gSprites[sUnknown_0203CF50]; diff --git a/src/field_camera.c b/src/field_camera.c index 038b6932e..57be52221 100644 --- a/src/field_camera.c +++ b/src/field_camera.c @@ -39,7 +39,7 @@ static void CameraPanningCB_PanAhead(void); static struct FieldCameraOffset sFieldCameraOffset; static s16 sHorizontalCameraPan; static s16 sVerticalCameraPan; -static u8 gUnknown_03000E2C; +static bool8 gUnknown_03000E2C; static void (*sFieldCameraPanningCallback)(void); struct CameraObject gFieldCamera; @@ -47,7 +47,7 @@ u16 gTotalCameraPixelOffsetY; u16 gTotalCameraPixelOffsetX; // text -static void move_tilemap_camera_to_upper_left_corner_(struct FieldCameraOffset *cameraOffset) +static void ResetCameraOffset(struct FieldCameraOffset *cameraOffset) { cameraOffset->xTileOffset = 0; cameraOffset->yTileOffset = 0; @@ -56,23 +56,23 @@ static void move_tilemap_camera_to_upper_left_corner_(struct FieldCameraOffset * cameraOffset->copyBGToVRAM = TRUE; } -static void tilemap_move_something(struct FieldCameraOffset *cameraOffset, u32 b, u32 c) +static void AddCameraTileOffset(struct FieldCameraOffset *cameraOffset, u32 xOffset, u32 yOffset) { - cameraOffset->xTileOffset += b; + cameraOffset->xTileOffset += xOffset; cameraOffset->xTileOffset %= 32; - cameraOffset->yTileOffset += c; + cameraOffset->yTileOffset += yOffset; cameraOffset->yTileOffset %= 32; } -static void coords8_add(struct FieldCameraOffset *cameraOffset, u32 b, u32 c) +static void AddCameraPixelOffset(struct FieldCameraOffset *cameraOffset, u32 xOffset, u32 yOffset) { - cameraOffset->xPixelOffset += b; - cameraOffset->yPixelOffset += c; + cameraOffset->xPixelOffset += xOffset; + cameraOffset->yPixelOffset += yOffset; } -void move_tilemap_camera_to_upper_left_corner(void) +void ResetFieldCamera(void) { - move_tilemap_camera_to_upper_left_corner_(&sFieldCameraOffset); + ResetCameraOffset(&sFieldCameraOffset); } void FieldUpdateBgTilemapScroll(void) @@ -89,10 +89,10 @@ void FieldUpdateBgTilemapScroll(void) SetGpuReg(REG_OFFSET_BG3VOFS, r4); } -void sub_8089C08(s16 *a, s16 *b) +void sub_8089C08(s16 *x, s16 *y) { - *a = sFieldCameraOffset.xPixelOffset + sHorizontalCameraPan; - *b = sFieldCameraOffset.yPixelOffset + sVerticalCameraPan + 8; + *x = sFieldCameraOffset.xPixelOffset + sHorizontalCameraPan; + *y = sFieldCameraOffset.yPixelOffset + sVerticalCameraPan + 8; } void DrawWholeMapView(void) @@ -418,11 +418,11 @@ void CameraUpdate(void) UpdateObjectEventsForCameraUpdate(deltaX, deltaY); RotatingGatePuzzleCameraUpdate(deltaX, deltaY); ResetBerryTreeSparkleFlags(); - tilemap_move_something(&sFieldCameraOffset, deltaX * 2, deltaY * 2); + AddCameraTileOffset(&sFieldCameraOffset, deltaX * 2, deltaY * 2); RedrawMapSlicesForCameraUpdate(&sFieldCameraOffset, deltaX * 2, deltaY * 2); } - coords8_add(&sFieldCameraOffset, movementSpeedX, movementSpeedY); + AddCameraPixelOffset(&sFieldCameraOffset, movementSpeedX, movementSpeedY); gTotalCameraPixelOffsetX -= movementSpeedX; gTotalCameraPixelOffsetY -= movementSpeedY; } @@ -436,9 +436,9 @@ void MoveCameraAndRedrawMap(int deltaX, int deltaY) //unused gTotalCameraPixelOffsetY -= deltaY * 16; } -void SetCameraPanningCallback(void (*a)(void)) +void SetCameraPanningCallback(void (*callback)(void)) { - sFieldCameraPanningCallback = a; + sFieldCameraPanningCallback = callback; } void SetCameraPanning(s16 a, s16 b) @@ -450,7 +450,7 @@ void SetCameraPanning(s16 a, s16 b) void InstallCameraPanAheadCallback(void) { sFieldCameraPanningCallback = CameraPanningCB_PanAhead; - gUnknown_03000E2C = 0; + gUnknown_03000E2C = FALSE; sHorizontalCameraPan = 0; sVerticalCameraPan = 32; } @@ -478,12 +478,12 @@ static void CameraPanningCB_PanAhead(void) if (gPlayerAvatar.tileTransitionState == T_TILE_TRANSITION) { gUnknown_03000E2C ^= 1; - if (gUnknown_03000E2C == 0) + if (gUnknown_03000E2C == FALSE) return; } else { - gUnknown_03000E2C = 0; + gUnknown_03000E2C = FALSE; } var = GetPlayerMovementDirection(); diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index e41b5a69a..5a47f1354 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -545,7 +545,7 @@ static bool8 TryStartStepCountScript(u16 metatileBehavior) UpdateHappinessStepCounter(); UpdateFarawayIslandStepCounter(); - if (!(gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_6) && !MetatileBehavior_IsForcedMovementTile(metatileBehavior)) + if (!(gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_FORCED_MOVE) && !MetatileBehavior_IsForcedMovementTile(metatileBehavior)) { if (UpdatePoisonStepCounter() == TRUE) { @@ -938,7 +938,7 @@ static struct BgEvent *GetBackgroundEventAtPosition(struct MapHeader *mapHeader, return NULL; } -bool8 dive_warp(struct MapPosition *position, u16 metatileBehavior) +bool8 TryDoDiveWarp(struct MapPosition *position, u16 metatileBehavior) { if (gMapHeader.mapType == MAP_TYPE_UNDERWATER && !MetatileBehavior_IsUnableToEmerge(metatileBehavior)) { diff --git a/src/field_effect.c b/src/field_effect.c index c4e9fc40a..284d9b0e7 100644 --- a/src/field_effect.c +++ b/src/field_effect.c @@ -64,122 +64,120 @@ static void PokeballGlowEffect_7(struct Sprite *); static u8 PokecenterHealEffectHelper(s16, s16); static void HallOfFameRecordEffectHelper(s16, s16, s16, u8); -static void FieldCallback_Fly(void); -static void task00_8084310(u8); -static void mapldr_08084390(void); -static void c3_080843F8(u8); +static void FieldCallback_UseFly(void); +static void Task_UseFly(u8); +static void FieldCallback_FlyIntoMap(void); +static void Task_FlyIntoMap(u8); static void Task_FallWarpFieldEffect(u8); +static bool8 FallWarpEffect_0(struct Task *); static bool8 FallWarpEffect_1(struct Task *); static bool8 FallWarpEffect_2(struct Task *); static bool8 FallWarpEffect_3(struct Task *); static bool8 FallWarpEffect_4(struct Task *); static bool8 FallWarpEffect_5(struct Task *); static bool8 FallWarpEffect_6(struct Task *); -static bool8 FallWarpEffect_7(struct Task *); -static void Task_EscalatorWarpFieldEffect(u8); -static bool8 EscalatorWarpEffect_1(struct Task *); -static bool8 EscalatorWarpEffect_2(struct Task *); -static bool8 EscalatorWarpEffect_3(struct Task *); -static bool8 EscalatorWarpEffect_4(struct Task *); -static bool8 EscalatorWarpEffect_5(struct Task *); -static bool8 EscalatorWarpEffect_6(struct Task *); +static void Task_EscalatorWarpOut(u8); +static bool8 EscalatorWarpOutEffect_0(struct Task *); +static bool8 EscalatorWarpOutEffect_1(struct Task *); +static bool8 EscalatorWarpOutEffect_2(struct Task *); +static bool8 EscalatorWarpOutEffect_3(struct Task *); +static bool8 EscalatorWarpOutEffect_4(struct Task *); +static bool8 EscalatorWarpOutEffect_5(struct Task *); static void sub_80B6FB8(struct Task *); static void sub_80B7004(struct Task *); static void sub_80B7050(void); static void sub_80B7060(void); -static void sub_80B70B4(void); -static void sub_80B70DC(u8); -static bool8 sub_80B7114(struct Task *); -static bool8 sub_80B7190(struct Task *); -static bool8 sub_80B71D0(struct Task *); -static bool8 sub_80B7230(struct Task *); -static bool8 sub_80B7270(struct Task *); -static bool8 sub_80B72D0(struct Task *); -static bool8 sub_80B72F4(struct Task *); +static void FieldCallback_EscalatorWarpIn(void); +static void Task_EscalatorWarpIn(u8); +static bool8 EscalatorWarpInEffect_0(struct Task *); +static bool8 EscalatorWarpInEffect_1(struct Task *); +static bool8 EscalatorWarpInEffect_2(struct Task *); +static bool8 EscalatorWarpInEffect_3(struct Task *); +static bool8 EscalatorWarpInEffect_4(struct Task *); +static bool8 EscalatorWarpInEffect_5(struct Task *); +static bool8 EscalatorWarpInEffect_6(struct Task *); -static void sub_80B7384(u8); -static bool8 sub_80B73D0(struct Task *, struct ObjectEvent *); -static bool8 waterfall_1_do_anim_probably(struct Task *, struct ObjectEvent *); -static bool8 waterfall_2_wait_anim_finish_probably(struct Task *, struct ObjectEvent *); -static bool8 sub_80B7450(struct Task *, struct ObjectEvent *); -static bool8 sub_80B7478(struct Task *, struct ObjectEvent *); +static void Task_UseWaterfall(u8); +static bool8 WaterfallFieldEffect_0(struct Task *, struct ObjectEvent *); +static bool8 WaterfallFieldEffect_1(struct Task *, struct ObjectEvent *); +static bool8 WaterfallFieldEffect_2(struct Task *, struct ObjectEvent *); +static bool8 WaterfallFieldEffect_3(struct Task *, struct ObjectEvent *); +static bool8 WaterfallFieldEffect_4(struct Task *, struct ObjectEvent *); -static void Task_Dive(u8); -static bool8 dive_1_lock(struct Task *); -static bool8 dive_2_unknown(struct Task *); -static bool8 dive_3_unknown(struct Task *); +static void Task_UseDive(u8); +static bool8 DiveFieldEffect_0(struct Task *); +static bool8 DiveFieldEffect_1(struct Task *); +static bool8 DiveFieldEffect_2(struct Task *); static void Task_LavaridgeGymB1FWarp(u8); +static bool8 LavaridgeGymB1FWarpEffect_0(struct Task *, struct ObjectEvent *, struct Sprite *); static bool8 LavaridgeGymB1FWarpEffect_1(struct Task *, struct ObjectEvent *, struct Sprite *); static bool8 LavaridgeGymB1FWarpEffect_2(struct Task *, struct ObjectEvent *, struct Sprite *); static bool8 LavaridgeGymB1FWarpEffect_3(struct Task *, struct ObjectEvent *, struct Sprite *); static bool8 LavaridgeGymB1FWarpEffect_4(struct Task *, struct ObjectEvent *, struct Sprite *); static bool8 LavaridgeGymB1FWarpEffect_5(struct Task *, struct ObjectEvent *, struct Sprite *); -static bool8 LavaridgeGymB1FWarpEffect_6(struct Task *, struct ObjectEvent *, struct Sprite *); static void FieldCB_LavaridgeGymB1FWarpExit(void); static void Task_LavaridgeGymB1FWarpExit(u8); +static bool8 LavaridgeGymB1FWarpExitEffect_0(struct Task *, struct ObjectEvent *, struct Sprite *); static bool8 LavaridgeGymB1FWarpExitEffect_1(struct Task *, struct ObjectEvent *, struct Sprite *); static bool8 LavaridgeGymB1FWarpExitEffect_2(struct Task *, struct ObjectEvent *, struct Sprite *); static bool8 LavaridgeGymB1FWarpExitEffect_3(struct Task *, struct ObjectEvent *, struct Sprite *); -static bool8 LavaridgeGymB1FWarpExitEffect_4(struct Task *, struct ObjectEvent *, struct Sprite *); static void Task_LavaridgeGym1FWarp(u8); +static bool8 LavaridgeGym1FWarpEffect_0(struct Task *, struct ObjectEvent *, struct Sprite *); static bool8 LavaridgeGym1FWarpEffect_1(struct Task *, struct ObjectEvent *, struct Sprite *); static bool8 LavaridgeGym1FWarpEffect_2(struct Task *, struct ObjectEvent *, struct Sprite *); static bool8 LavaridgeGym1FWarpEffect_3(struct Task *, struct ObjectEvent *, struct Sprite *); static bool8 LavaridgeGym1FWarpEffect_4(struct Task *, struct ObjectEvent *, struct Sprite *); -static bool8 LavaridgeGym1FWarpEffect_5(struct Task *, struct ObjectEvent *, struct Sprite *); -static void DoEscapeRopeFieldEffect(u8); -static void EscapeRopeFieldEffect_Step0(struct Task *); -static void EscapeRopeFieldEffect_Step1(struct Task *); +static void Task_EscapeRopeWarpOut(u8); +static void EscapeRopeWarpOutFieldEffect_0(struct Task *); +static void EscapeRopeWarpOutFieldEffect_1(struct Task *); -static void mapldr_080859D4(void); -static void sub_80B7E94(u8); +static void FieldCallback_EscapeRopeWarpIn(void); +static void Task_EscapeRopeWarpIn(u8); +static void EscapeRopeWarpInFieldEffect_0(struct Task *); +static void EscapeRopeWarpInFieldEffect_1(struct Task *); -static void sub_80B7EC4(struct Task *); -static void sub_80B7EE8(struct Task *); +static void Task_TeleportWarpOut(u8); +static void TeleportWarpOutFieldEffect_0(struct Task*); +static void TeleportWarpOutFieldEffect_1(struct Task*); +static void TeleportWarpOutFieldEffect_2(struct Task*); +static void TeleportWarpOutFieldEffect_3(struct Task*); -static void ExecuteTeleportFieldEffectTask(u8); -static void TeleportFieldEffectTask1(struct Task*); -static void TeleportFieldEffectTask2(struct Task*); -static void TeleportFieldEffectTask3(struct Task*); -static void TeleportFieldEffectTask4(struct Task*); +static void FieldCallback_TeleportWarpIn(void); +static void Task_TeleportWarpIn(u8); +static void TeleportWarpInFieldEffect_0(struct Task *); +static void TeleportWarpInFieldEffect_1(struct Task *); +static void TeleportWarpInFieldEffect_2(struct Task *); -static void mapldr_08085D88(void); -static void sub_80B8250(u8); +static void Task_FieldMoveShowMonOutdoors(u8); +static void FieldMoveShowMonOutdoorsEffect_0(struct Task *); +static void FieldMoveShowMonOutdoorsEffect_1(struct Task *); +static void FieldMoveShowMonOutdoorsEffect_2(struct Task *); +static void FieldMoveShowMonOutdoorsEffect_3(struct Task *); +static void FieldMoveShowMonOutdoorsEffect_4(struct Task *); +static void FieldMoveShowMonOutdoorsEffect_5(struct Task *); +static void FieldMoveShowMonOutdoorsEffect_6(struct Task *); -static void sub_80B8280(struct Task *); -static void sub_80B830C(struct Task *); -static void sub_80B8410(struct Task *); - -static void sub_80B8554(u8); -static void sub_80B8584(struct Task *); -static void sub_80B85F8(struct Task *); -static void sub_80B8660(struct Task *); -static void sub_80B86EC(struct Task *); -static void sub_80B871C(struct Task *); -static void sub_80B8770(struct Task *); -static void overworld_bg_setup_2(struct Task *); - -static void sub_80B880C(void); +static void VBlankCB_FieldMoveShowMonOutdoors(void); static void sub_80B8874(u16); -static void sub_80B88B4(u8); -static void sub_80B88E4(struct Task *); -static void sub_80B8920(struct Task *); -static void sub_80B898C(struct Task *); -static void sub_80B89DC(struct Task *); -static void sub_80B8A0C(struct Task *); -static void sub_80B8A44(struct Task *); -static void sub_80B8A64(struct Task *); +static void Task_FieldMoveShowMonIndoors(u8); +static void FieldMoveShowMonIndoorsEffect_0(struct Task *); +static void FieldMoveShowMonIndoorsEffect_1(struct Task *); +static void FieldMoveShowMonIndoorsEffect_2(struct Task *); +static void FieldMoveShowMonIndoorsEffect_3(struct Task *); +static void FieldMoveShowMonIndoorsEffect_4(struct Task *); +static void FieldMoveShowMonIndoorsEffect_5(struct Task *); +static void FieldMoveShowMonIndoorsEffect_6(struct Task *); -static void sub_80B8AE0(void); +static void VBlankCB_FieldMoveShowMonIndoors(void); static void sub_80B8B28(struct Task *); static bool8 sub_80B8B38(struct Task *); static bool8 sub_80B8BF0(struct Task *); @@ -189,25 +187,25 @@ static void sub_80B8CC0(struct Sprite *); static void sub_80B8D04(struct Sprite *); static void sub_80B8D20(struct Sprite *); -static void sub_80B8D84(u8); -static void sub_80B8DB4(struct Task *); -static void sub_80B8E14(struct Task *); -static void sub_80B8E60(struct Task *); -static void sub_80B8EA8(struct Task *); -static void sub_80B8F24(struct Task *); +static void Task_SurfFieldEffect(u8); +static void SurfFieldEffect_1(struct Task *); +static void SurfFieldEffect_2(struct Task *); +static void SurfFieldEffect_3(struct Task *); +static void SurfFieldEffect_4(struct Task *); +static void SurfFieldEffect_5(struct Task *); -static void sub_80B9128(struct Sprite *); +static void SpriteCB_NPCFlyOut(struct Sprite *); -static void sub_80B91D4(u8); -static void sub_80B9204(struct Task *); -static void sub_80B925C(struct Task *); -static void sub_80B92A0(struct Task *); -static void sub_80B92F8(struct Task *); -static void sub_80B933C(struct Task *); -static void sub_80B9390(struct Task *); -static void sub_80B9418(struct Task *); -static void sub_80B9474(struct Task *); -static void sub_80B9494(struct Task *); +static void Task_FlyOut(u8); +static void FlyOutFieldEffect_0(struct Task *); +static void FlyOutFieldEffect_1(struct Task *); +static void FlyOutFieldEffect_2(struct Task *); +static void FlyOutFieldEffect_3(struct Task *); +static void FlyOutFieldEffect_4(struct Task *); +static void FlyOutFieldEffect_5(struct Task *); +static void FlyOutFieldEffect_6(struct Task *); +static void FlyOutFieldEffect_7(struct Task *); +static void FlyOutFieldEffect_8(struct Task *); static u8 sub_80B94C4(void); static u8 sub_80B9508(u8); @@ -216,18 +214,24 @@ static void sub_80B9560(u8, u8); static void sub_80B957C(struct Sprite *); static void sub_80B963C(struct Sprite *); -static void sub_80B97D4(u8); -static void sub_80B9804(struct Task *); -static void sub_80B98B8(struct Task *); -static void sub_80B9924(struct Task *); -static void sub_80B9978(struct Task *); -static void sub_80B99F0(struct Task *); -static void sub_80B9A28(struct Task *); -static void sub_80B9A60(struct Task *); +static void Task_FlyIn(u8); +static void FlyInFieldEffect_0(struct Task *); +static void FlyInFieldEffect_1(struct Task *); +static void FlyInFieldEffect_2(struct Task *); +static void FlyInFieldEffect_3(struct Task *); +static void FlyInFieldEffect_4(struct Task *); +static void FlyInFieldEffect_5(struct Task *); +static void FlyInFieldEffect_6(struct Task *); + +static void Task_DestroyDeoxysRock(u8 taskId); +static void DestroyDeoxysRockFieldEffect_0(s16*, u8); +static void DestroyDeoxysRockFieldEffect_1(s16*, u8); +static void DestroyDeoxysRockFieldEffect_2(s16*, u8); -static void sub_80B9BE8(u8 taskId); static void sub_80B9DB8(struct Sprite* sprite); -static void Fldeff_MoveDeoxysRock_Step(u8 taskId); +static void Task_MoveDeoxysRock(u8 taskId); + +static void sub_80B9D24(struct Sprite*); // Static RAM declarations @@ -553,7 +557,7 @@ const struct SpriteTemplate gSpriteTemplate_855C34C = .callback = SpriteCB_HallOfFameMonitor }; -void (*const gUnknown_0855C364[])(struct Task *) = +void (*const sPokecenterHealEffectFuncs[])(struct Task *) = { PokecenterHealEffect_0, PokecenterHealEffect_1, @@ -561,7 +565,7 @@ void (*const gUnknown_0855C364[])(struct Task *) = PokecenterHealEffect_3 }; -void (*const gUnknown_0855C374[])(struct Task *) = +void (*const sHallOfFameRecordEffectFuncs[])(struct Task *) = { HallOfFameRecordEffect_0, HallOfFameRecordEffect_1, @@ -569,7 +573,7 @@ void (*const gUnknown_0855C374[])(struct Task *) = HallOfFameRecordEffect_3 }; -void (*const gUnknown_0855C384[])(struct Sprite *) = +void (*const sPokeballGlowEffectFuncs[])(struct Sprite *) = { PokeballGlowEffect_0, PokeballGlowEffect_1, @@ -597,83 +601,83 @@ const u8 gUnknown_0855C3C4[] = { 0, 0, 0, 0}; bool8 (*const sFallWarpFieldEffectFuncs[])(struct Task *) = { + FallWarpEffect_0, FallWarpEffect_1, FallWarpEffect_2, FallWarpEffect_3, FallWarpEffect_4, FallWarpEffect_5, FallWarpEffect_6, - FallWarpEffect_7, }; -bool8 (*const sEscalatorWarpFieldEffectFuncs[])(struct Task *) = +bool8 (*const sEscalatorWarpOutFieldEffectFuncs[])(struct Task *) = { - EscalatorWarpEffect_1, - EscalatorWarpEffect_2, - EscalatorWarpEffect_3, - EscalatorWarpEffect_4, - EscalatorWarpEffect_5, - EscalatorWarpEffect_6, + EscalatorWarpOutEffect_0, + EscalatorWarpOutEffect_1, + EscalatorWarpOutEffect_2, + EscalatorWarpOutEffect_3, + EscalatorWarpOutEffect_4, + EscalatorWarpOutEffect_5, }; -bool8 (*const gUnknown_0855C3FC[])(struct Task *) = +bool8 (*const sEscalatorWarpInFieldEffectFuncs[])(struct Task *) = { - sub_80B7114, - sub_80B7190, - sub_80B71D0, - sub_80B7230, - sub_80B7270, - sub_80B72D0, - sub_80B72F4, + EscalatorWarpInEffect_0, + EscalatorWarpInEffect_1, + EscalatorWarpInEffect_2, + EscalatorWarpInEffect_3, + EscalatorWarpInEffect_4, + EscalatorWarpInEffect_5, + EscalatorWarpInEffect_6, }; -bool8 (*const gUnknown_0855C418[])(struct Task *, struct ObjectEvent *) = +bool8 (*const sWaterfallFieldEffectFuncs[])(struct Task *, struct ObjectEvent *) = { - sub_80B73D0, - waterfall_1_do_anim_probably, - waterfall_2_wait_anim_finish_probably, - sub_80B7450, - sub_80B7478, + WaterfallFieldEffect_0, + WaterfallFieldEffect_1, + WaterfallFieldEffect_2, + WaterfallFieldEffect_3, + WaterfallFieldEffect_4, }; -bool8 (*const gUnknown_0855C42C[])(struct Task *) = +bool8 (*const sDiveFieldEffectFuncs[])(struct Task *) = { - dive_1_lock, - dive_2_unknown, - dive_3_unknown, + DiveFieldEffect_0, + DiveFieldEffect_1, + DiveFieldEffect_2, }; bool8 (*const sLavaridgeGymB1FWarpEffectFuncs[])(struct Task *, struct ObjectEvent *, struct Sprite *) = { + LavaridgeGymB1FWarpEffect_0, LavaridgeGymB1FWarpEffect_1, LavaridgeGymB1FWarpEffect_2, LavaridgeGymB1FWarpEffect_3, LavaridgeGymB1FWarpEffect_4, LavaridgeGymB1FWarpEffect_5, - LavaridgeGymB1FWarpEffect_6, }; bool8 (*const sLavaridgeGymB1FWarpExitEffectFuncs[])(struct Task *, struct ObjectEvent *, struct Sprite *) = { + LavaridgeGymB1FWarpExitEffect_0, LavaridgeGymB1FWarpExitEffect_1, LavaridgeGymB1FWarpExitEffect_2, LavaridgeGymB1FWarpExitEffect_3, - LavaridgeGymB1FWarpExitEffect_4, }; bool8 (*const sLavaridgeGym1FWarpEffectFuncs[])(struct Task *, struct ObjectEvent *, struct Sprite *) = { + LavaridgeGym1FWarpEffect_0, LavaridgeGym1FWarpEffect_1, LavaridgeGym1FWarpEffect_2, LavaridgeGym1FWarpEffect_3, LavaridgeGym1FWarpEffect_4, - LavaridgeGym1FWarpEffect_5, }; -void (*const gEscapeRopeFieldEffectFuncs[])(struct Task *) = +void (*const sEscapeRopeWarpOutFieldEffectFuncs[])(struct Task *) = { - EscapeRopeFieldEffect_Step0, - EscapeRopeFieldEffect_Step1, + EscapeRopeWarpOutFieldEffect_0, + EscapeRopeWarpOutFieldEffect_1, }; // .text @@ -993,7 +997,7 @@ static void Task_PokecenterHeal(u8 taskId) { struct Task *task; task = &gTasks[taskId]; - gUnknown_0855C364[task->data[0]](task); + sPokecenterHealEffectFuncs[task->data[0]](task); } static void PokecenterHealEffect_0(struct Task *task) @@ -1047,7 +1051,7 @@ static void Task_HallOfFameRecord(u8 taskId) { struct Task *task; task = &gTasks[taskId]; - gUnknown_0855C374[task->data[0]](task); + sHallOfFameRecordEffectFuncs[task->data[0]](task); } static void HallOfFameRecordEffect_0(struct Task *task) @@ -1107,7 +1111,7 @@ static u8 CreatePokeballGlowSprite(s16 data6, s16 x, s16 y, u16 data5) static void SpriteCB_PokeballGlowEffect(struct Sprite *sprite) { - gUnknown_0855C384[sprite->data[0]](sprite); + sPokeballGlowEffectFuncs[sprite->data[0]](sprite); } static void PokeballGlowEffect_0(struct Sprite *sprite) @@ -1292,19 +1296,19 @@ void SpriteCB_HallOfFameMonitor(struct Sprite *sprite) void ReturnToFieldFromFlyMapSelect(void) { SetMainCallback2(CB2_ReturnToField); - gFieldCallback = FieldCallback_Fly; + gFieldCallback = FieldCallback_UseFly; } -static void FieldCallback_Fly(void) +static void FieldCallback_UseFly(void) { FadeInFromBlack(); - CreateTask(task00_8084310, 0); + CreateTask(Task_UseFly, 0); ScriptContext2_Enable(); FreezeObjectEvents(); gFieldCallback = NULL; } -static void task00_8084310(u8 taskId) +static void Task_UseFly(u8 taskId) { struct Task *task; task = &gTasks[taskId]; @@ -1315,7 +1319,7 @@ static void task00_8084310(u8 taskId) return; } gFieldEffectArguments[0] = GetCursorSelectionMonId(); - if ((int)gFieldEffectArguments[0] > 5) + if ((int)gFieldEffectArguments[0] > PARTY_SIZE - 1) { gFieldEffectArguments[0] = 0; } @@ -1327,18 +1331,18 @@ static void task00_8084310(u8 taskId) Overworld_ResetStateAfterFly(); WarpIntoMap(); SetMainCallback2(CB2_LoadMap); - gFieldCallback = mapldr_08084390; + gFieldCallback = FieldCallback_FlyIntoMap; DestroyTask(taskId); } } -static void mapldr_08084390(void) +static void FieldCallback_FlyIntoMap(void) { Overworld_PlaySpecialMapMusic(); FadeInFromBlack(); - CreateTask(c3_080843F8, 0); + CreateTask(Task_FlyIntoMap, 0); gObjectEvents[gPlayerAvatar.objectEventId].invisible = TRUE; - if (gPlayerAvatar.flags & 0x08) + if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING) { ObjectEventTurn(&gObjectEvents[gPlayerAvatar.objectEventId], DIR_WEST); } @@ -1347,7 +1351,7 @@ static void mapldr_08084390(void) gFieldCallback = NULL; } -static void c3_080843F8(u8 taskId) +static void Task_FlyIntoMap(u8 taskId) { struct Task *task; task = &gTasks[taskId]; @@ -1385,7 +1389,7 @@ static void Task_FallWarpFieldEffect(u8 taskId) while (sFallWarpFieldEffectFuncs[task->data[0]](task)); // return code signifies whether to continue blocking here } -static bool8 FallWarpEffect_1(struct Task *task) +static bool8 FallWarpEffect_0(struct Task *task) { struct ObjectEvent *playerObject; struct Sprite *playerSprite; @@ -1403,7 +1407,7 @@ static bool8 FallWarpEffect_1(struct Task *task) return TRUE; } -static bool8 FallWarpEffect_2(struct Task *task) +static bool8 FallWarpEffect_1(struct Task *task) { if (IsWeatherNotFadingIn()) { @@ -1412,7 +1416,7 @@ static bool8 FallWarpEffect_2(struct Task *task) return FALSE; } -static bool8 FallWarpEffect_3(struct Task *task) +static bool8 FallWarpEffect_2(struct Task *task) { struct Sprite *sprite; s16 centerToCornerVecY; @@ -1427,7 +1431,7 @@ static bool8 FallWarpEffect_3(struct Task *task) return FALSE; } -static bool8 FallWarpEffect_4(struct Task *task) +static bool8 FallWarpEffect_3(struct Task *task) { struct ObjectEvent *objectEvent; struct Sprite *sprite; @@ -1461,7 +1465,7 @@ static bool8 FallWarpEffect_4(struct Task *task) return FALSE; } -static bool8 FallWarpEffect_5(struct Task *task) +static bool8 FallWarpEffect_4(struct Task *task) { task->data[0]++; task->data[1] = 4; @@ -1470,7 +1474,7 @@ static bool8 FallWarpEffect_5(struct Task *task) return TRUE; } -static bool8 FallWarpEffect_6(struct Task *task) +static bool8 FallWarpEffect_5(struct Task *task) { SetCameraPanning(0, task->data[1]); task->data[1] = -task->data[1]; @@ -1486,7 +1490,7 @@ static bool8 FallWarpEffect_6(struct Task *task) return FALSE; } -static bool8 FallWarpEffect_7(struct Task *task) +static bool8 FallWarpEffect_6(struct Task *task) { gPlayerAvatar.preventStep = FALSE; ScriptContext2_Disable(); @@ -1500,31 +1504,31 @@ static bool8 FallWarpEffect_7(struct Task *task) void StartEscalatorWarp(u8 metatileBehavior, u8 priority) { u8 taskId; - taskId = CreateTask(Task_EscalatorWarpFieldEffect, priority); - gTasks[taskId].data[1] = 0; + taskId = CreateTask(Task_EscalatorWarpOut, priority); + gTasks[taskId].data[1] = FALSE; if (metatileBehavior == MB_UP_ESCALATOR) { - gTasks[taskId].data[1] = 1; + gTasks[taskId].data[1] = TRUE; } } -static void Task_EscalatorWarpFieldEffect(u8 taskId) +static void Task_EscalatorWarpOut(u8 taskId) { struct Task *task; task = &gTasks[taskId]; - while (sEscalatorWarpFieldEffectFuncs[task->data[0]](task)); + while (sEscalatorWarpOutFieldEffectFuncs[task->data[0]](task)); } -static bool8 EscalatorWarpEffect_1(struct Task *task) +static bool8 EscalatorWarpOutEffect_0(struct Task *task) { FreezeObjectEvents(); CameraObjectReset2(); - sub_80E1558(task->data[1]); + StartEscalator(task->data[1]); task->data[0]++; return FALSE; } -static bool8 EscalatorWarpEffect_2(struct Task *task) +static bool8 EscalatorWarpOutEffect_1(struct Task *task) { struct ObjectEvent *objectEvent; objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; @@ -1543,7 +1547,7 @@ static bool8 EscalatorWarpEffect_2(struct Task *task) return FALSE; } -static bool8 EscalatorWarpEffect_3(struct Task *task) +static bool8 EscalatorWarpOutEffect_2(struct Task *task) { sub_80B6FB8(task); if (task->data[2] > 3) @@ -1554,14 +1558,14 @@ static bool8 EscalatorWarpEffect_3(struct Task *task) return FALSE; } -static bool8 EscalatorWarpEffect_4(struct Task *task) +static bool8 EscalatorWarpOutEffect_3(struct Task *task) { sub_80B6FB8(task); sub_80B7060(); return FALSE; } -static bool8 EscalatorWarpEffect_5(struct Task *task) +static bool8 EscalatorWarpOutEffect_4(struct Task *task) { sub_80B7004(task); if (task->data[2] > 3) @@ -1572,7 +1576,7 @@ static bool8 EscalatorWarpEffect_5(struct Task *task) return FALSE; } -static bool8 EscalatorWarpEffect_6(struct Task *task) +static bool8 EscalatorWarpOutEffect_5(struct Task *task) { sub_80B7004(task); sub_80B7060(); @@ -1615,31 +1619,31 @@ static void sub_80B7060(void) { if (!gPaletteFade.active && BGMusicStopped() == TRUE) { - sub_80E1570(); + StopEscalator(); WarpIntoMap(); - gFieldCallback = sub_80B70B4; + gFieldCallback = FieldCallback_EscalatorWarpIn; SetMainCallback2(CB2_LoadMap); - DestroyTask(FindTaskIdByFunc(Task_EscalatorWarpFieldEffect)); + DestroyTask(FindTaskIdByFunc(Task_EscalatorWarpOut)); } } -static void sub_80B70B4(void) +static void FieldCallback_EscalatorWarpIn(void) { Overworld_PlaySpecialMapMusic(); WarpFadeInScreen(); ScriptContext2_Enable(); - CreateTask(sub_80B70DC, 0); + CreateTask(Task_EscalatorWarpIn, 0); gFieldCallback = NULL; } -static void sub_80B70DC(u8 taskId) +static void Task_EscalatorWarpIn(u8 taskId) { struct Task *task; task = &gTasks[taskId]; - while (gUnknown_0855C3FC[task->data[0]](task)); + while (sEscalatorWarpInFieldEffectFuncs[task->data[0]](task)); } -static bool8 sub_80B7114(struct Task *task) +static bool8 EscalatorWarpInEffect_0(struct Task *task) { struct ObjectEvent *objectEvent; s16 x; @@ -1652,19 +1656,19 @@ static bool8 sub_80B7114(struct Task *task) behavior = MapGridGetMetatileBehaviorAt(x, y); task->data[0]++; task->data[1] = 16; - if (behavior == 0x6b) + if (behavior == MB_DOWN_ESCALATOR) { - behavior = 1; + behavior = TRUE; task->data[0] = 3; - } else + } else // MB_UP_ESCALATOR { - behavior = 0; + behavior = FALSE; } - sub_80E1558(behavior); + StartEscalator(behavior); return TRUE; } -static bool8 sub_80B7190(struct Task *task) +static bool8 EscalatorWarpInEffect_1(struct Task *task) { struct Sprite *sprite; sprite = &gSprites[gPlayerAvatar.spriteId]; @@ -1674,7 +1678,7 @@ static bool8 sub_80B7190(struct Task *task) return FALSE; } -static bool8 sub_80B71D0(struct Task *task) +static bool8 EscalatorWarpInEffect_2(struct Task *task) { struct Sprite *sprite; sprite = &gSprites[gPlayerAvatar.spriteId]; @@ -1694,7 +1698,7 @@ static bool8 sub_80B71D0(struct Task *task) return FALSE; } -static bool8 sub_80B7230(struct Task *task) +static bool8 EscalatorWarpInEffect_3(struct Task *task) { struct Sprite *sprite; sprite = &gSprites[gPlayerAvatar.spriteId]; @@ -1704,7 +1708,7 @@ static bool8 sub_80B7230(struct Task *task) return FALSE; } -static bool8 sub_80B7270(struct Task *task) +static bool8 EscalatorWarpInEffect_4(struct Task *task) { struct Sprite *sprite; sprite = &gSprites[gPlayerAvatar.spriteId]; @@ -1724,18 +1728,18 @@ static bool8 sub_80B7270(struct Task *task) return FALSE; } -static bool8 sub_80B72D0(struct Task *task) +static bool8 EscalatorWarpInEffect_5(struct Task *task) { - if (sub_80E1584()) + if (IsEscalatorMoving()) { return FALSE; } - sub_80E1570(); + StopEscalator(); task->data[0]++; return TRUE; } -static bool8 sub_80B72F4(struct Task *task) +static bool8 EscalatorWarpInEffect_6(struct Task *task) { struct ObjectEvent *objectEvent; objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; @@ -1744,7 +1748,7 @@ static bool8 sub_80B72F4(struct Task *task) CameraObjectReset1(); ScriptContext2_Disable(); ObjectEventSetHeldMovement(objectEvent, GetWalkNormalMovementAction(DIR_EAST)); - DestroyTask(FindTaskIdByFunc(sub_80B70DC)); + DestroyTask(FindTaskIdByFunc(Task_EscalatorWarpIn)); } return FALSE; } @@ -1752,18 +1756,18 @@ static bool8 sub_80B72F4(struct Task *task) bool8 FldEff_UseWaterfall(void) { u8 taskId; - taskId = CreateTask(sub_80B7384, 0xff); + taskId = CreateTask(Task_UseWaterfall, 0xff); gTasks[taskId].data[1] = gFieldEffectArguments[0]; - sub_80B7384(taskId); + Task_UseWaterfall(taskId); return FALSE; } -static void sub_80B7384(u8 taskId) +static void Task_UseWaterfall(u8 taskId) { - while (gUnknown_0855C418[gTasks[taskId].data[0]](&gTasks[taskId], &gObjectEvents[gPlayerAvatar.objectEventId])); + while (sWaterfallFieldEffectFuncs[gTasks[taskId].data[0]](&gTasks[taskId], &gObjectEvents[gPlayerAvatar.objectEventId])); } -static bool8 sub_80B73D0(struct Task *task, struct ObjectEvent *objectEvent) +static bool8 WaterfallFieldEffect_0(struct Task *task, struct ObjectEvent *objectEvent) { ScriptContext2_Enable(); gPlayerAvatar.preventStep = TRUE; @@ -1771,7 +1775,7 @@ static bool8 sub_80B73D0(struct Task *task, struct ObjectEvent *objectEvent) return FALSE; } -static bool8 waterfall_1_do_anim_probably(struct Task *task, struct ObjectEvent *objectEvent) +static bool8 WaterfallFieldEffect_1(struct Task *task, struct ObjectEvent *objectEvent) { ScriptContext2_Enable(); if (!ObjectEventIsMovementOverridden(objectEvent)) @@ -1784,7 +1788,7 @@ static bool8 waterfall_1_do_anim_probably(struct Task *task, struct ObjectEvent return FALSE; } -static bool8 waterfall_2_wait_anim_finish_probably(struct Task *task, struct ObjectEvent *objectEvent) +static bool8 WaterfallFieldEffect_2(struct Task *task, struct ObjectEvent *objectEvent) { if (FieldEffectActiveListContains(FLDEFF_FIELD_MOVE_SHOW_MON)) { @@ -1794,14 +1798,14 @@ static bool8 waterfall_2_wait_anim_finish_probably(struct Task *task, struct Obj return TRUE; } -static bool8 sub_80B7450(struct Task *task, struct ObjectEvent *objectEvent) +static bool8 WaterfallFieldEffect_3(struct Task *task, struct ObjectEvent *objectEvent) { ObjectEventSetHeldMovement(objectEvent, GetWalkSlowMovementAction(DIR_NORTH)); task->data[0]++; return FALSE; } -static bool8 sub_80B7478(struct Task *task, struct ObjectEvent *objectEvent) +static bool8 WaterfallFieldEffect_4(struct Task *task, struct ObjectEvent *objectEvent) { if (!ObjectEventClearHeldMovementIfFinished(objectEvent)) { @@ -1809,12 +1813,13 @@ static bool8 sub_80B7478(struct Task *task, struct ObjectEvent *objectEvent) } if (MetatileBehavior_IsWaterfall(objectEvent->currentMetatileBehavior)) { + // Still ascending waterfall task->data[0] = 3; return TRUE; } ScriptContext2_Disable(); gPlayerAvatar.preventStep = FALSE; - DestroyTask(FindTaskIdByFunc(sub_80B7384)); + DestroyTask(FindTaskIdByFunc(Task_UseWaterfall)); FieldEffectActiveListRemove(FLDEFF_USE_WATERFALL); return FALSE; } @@ -1822,26 +1827,26 @@ static bool8 sub_80B7478(struct Task *task, struct ObjectEvent *objectEvent) bool8 FldEff_UseDive(void) { u8 taskId; - taskId = CreateTask(Task_Dive, 0xff); + taskId = CreateTask(Task_UseDive, 0xff); gTasks[taskId].data[15] = gFieldEffectArguments[0]; gTasks[taskId].data[14] = gFieldEffectArguments[1]; - Task_Dive(taskId); + Task_UseDive(taskId); return FALSE; } -void Task_Dive(u8 taskId) +void Task_UseDive(u8 taskId) { - while (gUnknown_0855C42C[gTasks[taskId].data[0]](&gTasks[taskId])); + while (sDiveFieldEffectFuncs[gTasks[taskId].data[0]](&gTasks[taskId])); } -static bool8 dive_1_lock(struct Task *task) +static bool8 DiveFieldEffect_0(struct Task *task) { gPlayerAvatar.preventStep = TRUE; task->data[0]++; return FALSE; } -static bool8 dive_2_unknown(struct Task *task) +static bool8 DiveFieldEffect_1(struct Task *task) { ScriptContext2_Enable(); gFieldEffectArguments[0] = task->data[15]; @@ -1850,14 +1855,14 @@ static bool8 dive_2_unknown(struct Task *task) return FALSE; } -static bool8 dive_3_unknown(struct Task *task) +static bool8 DiveFieldEffect_2(struct Task *task) { struct MapPosition mapPosition; PlayerGetDestCoords(&mapPosition.x, &mapPosition.y); if (!FieldEffectActiveListContains(FLDEFF_FIELD_MOVE_SHOW_MON)) { - dive_warp(&mapPosition, gObjectEvents[gPlayerAvatar.objectEventId].currentMetatileBehavior); - DestroyTask(FindTaskIdByFunc(Task_Dive)); + TryDoDiveWarp(&mapPosition, gObjectEvents[gPlayerAvatar.objectEventId].currentMetatileBehavior); + DestroyTask(FindTaskIdByFunc(Task_UseDive)); FieldEffectActiveListRemove(FLDEFF_USE_DIVE); } return FALSE; @@ -1873,7 +1878,7 @@ static void Task_LavaridgeGymB1FWarp(u8 taskId) while (sLavaridgeGymB1FWarpEffectFuncs[gTasks[taskId].data[0]](&gTasks[taskId], &gObjectEvents[gPlayerAvatar.objectEventId], &gSprites[gPlayerAvatar.spriteId])); } -static bool8 LavaridgeGymB1FWarpEffect_1(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 LavaridgeGymB1FWarpEffect_0(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) { FreezeObjectEvents(); CameraObjectReset2(); @@ -1885,7 +1890,7 @@ static bool8 LavaridgeGymB1FWarpEffect_1(struct Task *task, struct ObjectEvent * return TRUE; } -static bool8 LavaridgeGymB1FWarpEffect_2(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 LavaridgeGymB1FWarpEffect_1(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) { SetCameraPanning(0, task->data[1]); task->data[1] = -task->data[1]; @@ -1898,7 +1903,7 @@ static bool8 LavaridgeGymB1FWarpEffect_2(struct Task *task, struct ObjectEvent * return FALSE; } -static bool8 LavaridgeGymB1FWarpEffect_3(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 LavaridgeGymB1FWarpEffect_2(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) { sprite->pos2.y = 0; task->data[3] = 1; @@ -1912,7 +1917,7 @@ static bool8 LavaridgeGymB1FWarpEffect_3(struct Task *task, struct ObjectEvent * return TRUE; } -static bool8 LavaridgeGymB1FWarpEffect_4(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 LavaridgeGymB1FWarpEffect_3(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) { s16 centerToCornerVecY; SetCameraPanning(0, task->data[1]); @@ -1955,7 +1960,7 @@ static bool8 LavaridgeGymB1FWarpEffect_4(struct Task *task, struct ObjectEvent * return FALSE; } -static bool8 LavaridgeGymB1FWarpEffect_5(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 LavaridgeGymB1FWarpEffect_4(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) { TryFadeOutOldMapMusic(); WarpFadeOutScreen(); @@ -1963,7 +1968,7 @@ static bool8 LavaridgeGymB1FWarpEffect_5(struct Task *task, struct ObjectEvent * return FALSE; } -static bool8 LavaridgeGymB1FWarpEffect_6(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 LavaridgeGymB1FWarpEffect_5(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (!gPaletteFade.active && BGMusicStopped() == TRUE) { @@ -1989,7 +1994,7 @@ static void Task_LavaridgeGymB1FWarpExit(u8 taskId) while (sLavaridgeGymB1FWarpExitEffectFuncs[gTasks[taskId].data[0]](&gTasks[taskId], &gObjectEvents[gPlayerAvatar.objectEventId], &gSprites[gPlayerAvatar.spriteId])); } -static bool8 LavaridgeGymB1FWarpExitEffect_1(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 LavaridgeGymB1FWarpExitEffect_0(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) { CameraObjectReset2(); FreezeObjectEvents(); @@ -1999,7 +2004,7 @@ static bool8 LavaridgeGymB1FWarpExitEffect_1(struct Task *task, struct ObjectEve return FALSE; } -static bool8 LavaridgeGymB1FWarpExitEffect_2(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 LavaridgeGymB1FWarpExitEffect_1(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (IsWeatherNotFadingIn()) { @@ -2013,7 +2018,7 @@ static bool8 LavaridgeGymB1FWarpExitEffect_2(struct Task *task, struct ObjectEve return FALSE; } -static bool8 LavaridgeGymB1FWarpExitEffect_3(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 LavaridgeGymB1FWarpExitEffect_2(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) { sprite = &gSprites[task->data[1]]; if (sprite->animCmdIndex > 1) @@ -2027,7 +2032,7 @@ static bool8 LavaridgeGymB1FWarpExitEffect_3(struct Task *task, struct ObjectEve return FALSE; } -static bool8 LavaridgeGymB1FWarpExitEffect_4(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 LavaridgeGymB1FWarpExitEffect_3(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (ObjectEventClearHeldMovementIfFinished(objectEvent)) { @@ -2044,9 +2049,9 @@ u8 FldEff_LavaridgeGymWarp(void) { u8 spriteId; sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8); - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[33], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_LAVARIDGE_GYM_WARP], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); gSprites[spriteId].oam.priority = gFieldEffectArguments[3]; - gSprites[spriteId].coordOffsetEnabled = 1; + gSprites[spriteId].coordOffsetEnabled = TRUE; return spriteId; } @@ -2068,7 +2073,7 @@ static void Task_LavaridgeGym1FWarp(u8 taskId) while(sLavaridgeGym1FWarpEffectFuncs[gTasks[taskId].data[0]](&gTasks[taskId], &gObjectEvents[gPlayerAvatar.objectEventId], &gSprites[gPlayerAvatar.spriteId])); } -static bool8 LavaridgeGym1FWarpEffect_1(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 LavaridgeGym1FWarpEffect_0(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) { FreezeObjectEvents(); CameraObjectReset2(); @@ -2078,7 +2083,7 @@ static bool8 LavaridgeGym1FWarpEffect_1(struct Task *task, struct ObjectEvent *o return FALSE; } -static bool8 LavaridgeGym1FWarpEffect_2(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 LavaridgeGym1FWarpEffect_1(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (ObjectEventClearHeldMovementIfFinished(objectEvent)) { @@ -2100,7 +2105,7 @@ static bool8 LavaridgeGym1FWarpEffect_2(struct Task *task, struct ObjectEvent *o return FALSE; } -static bool8 LavaridgeGym1FWarpEffect_3(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 LavaridgeGym1FWarpEffect_2(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (gSprites[task->data[1]].animCmdIndex == 2) { @@ -2110,7 +2115,7 @@ static bool8 LavaridgeGym1FWarpEffect_3(struct Task *task, struct ObjectEvent *o return FALSE; } -static bool8 LavaridgeGym1FWarpEffect_4(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 LavaridgeGym1FWarpEffect_3(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (!FieldEffectActiveListContains(FLDEFF_POP_OUT_OF_ASH)) { @@ -2121,7 +2126,7 @@ static bool8 LavaridgeGym1FWarpEffect_4(struct Task *task, struct ObjectEvent *o return FALSE; } -static bool8 LavaridgeGym1FWarpEffect_5(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 LavaridgeGym1FWarpEffect_4(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (!gPaletteFade.active && BGMusicStopped() == TRUE) { @@ -2137,9 +2142,9 @@ u8 FldEff_PopOutOfAsh(void) { u8 spriteId; sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8); - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[32], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_JUMP_OUT_OF_ASH], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); gSprites[spriteId].oam.priority = gFieldEffectArguments[3]; - gSprites[spriteId].coordOffsetEnabled = 1; + gSprites[spriteId].coordOffsetEnabled = TRUE; return spriteId; } @@ -2155,22 +2160,22 @@ void StartEscapeRopeFieldEffect(void) { ScriptContext2_Enable(); FreezeObjectEvents(); - CreateTask(DoEscapeRopeFieldEffect, 0x50); + CreateTask(Task_EscapeRopeWarpOut, 0x50); } -static void DoEscapeRopeFieldEffect(u8 taskId) +static void Task_EscapeRopeWarpOut(u8 taskId) { - gEscapeRopeFieldEffectFuncs[gTasks[taskId].data[0]](&gTasks[taskId]); + sEscapeRopeWarpOutFieldEffectFuncs[gTasks[taskId].data[0]](&gTasks[taskId]); } -static void EscapeRopeFieldEffect_Step0(struct Task *task) +static void EscapeRopeWarpOutFieldEffect_0(struct Task *task) { task->data[0]++; task->data[14] = 64; task->data[15] = GetPlayerFacingDirection(); } -static void EscapeRopeFieldEffect_Step1(struct Task *task) +static void EscapeRopeWarpOutFieldEffect_1(struct Task *task) { struct ObjectEvent *objectEvent; u8 spinDirections[5] = {DIR_SOUTH, DIR_WEST, DIR_EAST, DIR_NORTH, DIR_SOUTH}; @@ -2187,9 +2192,9 @@ static void EscapeRopeFieldEffect_Step1(struct Task *task) SetObjectEventDirection(objectEvent, task->data[15]); SetWarpDestinationToEscapeWarp(); WarpIntoMap(); - gFieldCallback = mapldr_080859D4; + gFieldCallback = FieldCallback_EscapeRopeWarpIn; SetMainCallback2(CB2_LoadMap); - DestroyTask(FindTaskIdByFunc(DoEscapeRopeFieldEffect)); + DestroyTask(FindTaskIdByFunc(Task_EscapeRopeWarpOut)); } else if (task->data[1] == 0 || (--task->data[1]) == 0) { ObjectEventSetHeldMovement(objectEvent, GetFaceDirectionMovementAction(spinDirections[objectEvent->facingDirection])); @@ -2202,12 +2207,12 @@ static void EscapeRopeFieldEffect_Step1(struct Task *task) } } -void (*const gUnknown_0855C484[])(struct Task *) = { - sub_80B7EC4, - sub_80B7EE8 +void (*const sEscapeRopeWarpInFieldEffectFuncs[])(struct Task *) = { + EscapeRopeWarpInFieldEffect_0, + EscapeRopeWarpInFieldEffect_1 }; -static void mapldr_080859D4(void) +static void FieldCallback_EscapeRopeWarpIn(void) { Overworld_PlaySpecialMapMusic(); WarpFadeInScreen(); @@ -2215,15 +2220,15 @@ static void mapldr_080859D4(void) FreezeObjectEvents(); gFieldCallback = NULL; gObjectEvents[gPlayerAvatar.objectEventId].invisible = TRUE; - CreateTask(sub_80B7E94, 0); + CreateTask(Task_EscapeRopeWarpIn, 0); } -static void sub_80B7E94(u8 taskId) +static void Task_EscapeRopeWarpIn(u8 taskId) { - gUnknown_0855C484[gTasks[taskId].data[0]](&gTasks[taskId]); + sEscapeRopeWarpInFieldEffectFuncs[gTasks[taskId].data[0]](&gTasks[taskId]); } -static void sub_80B7EC4(struct Task *task) +static void EscapeRopeWarpInFieldEffect_0(struct Task *task) { if (IsWeatherNotFadingIn()) { @@ -2232,9 +2237,9 @@ static void sub_80B7EC4(struct Task *task) } } -static void sub_80B7EE8(struct Task *task) +static void EscapeRopeWarpInFieldEffect_1(struct Task *task) { - u8 spinDirections[5] = {1, 3, 4, 2, 1}; + u8 spinDirections[5] = {DIR_SOUTH, DIR_WEST, DIR_EAST, DIR_NORTH, DIR_SOUTH}; struct ObjectEvent *objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; if (task->data[1] == 0 || (--task->data[1]) == 0) { @@ -2247,7 +2252,7 @@ static void sub_80B7EE8(struct Task *task) objectEvent->invisible = FALSE; ScriptContext2_Disable(); UnfreezeObjectEvents(); - DestroyTask(FindTaskIdByFunc(sub_80B7E94)); + DestroyTask(FindTaskIdByFunc(Task_EscapeRopeWarpIn)); return; } ObjectEventSetHeldMovement(objectEvent, GetFaceDirectionMovementAction(spinDirections[objectEvent->facingDirection])); @@ -2260,24 +2265,24 @@ static void sub_80B7EE8(struct Task *task) objectEvent->invisible ^= 1; } -void CreateTeleportFieldEffectTask(void) +void FldEff_TeleportWarpOut(void) { - CreateTask(ExecuteTeleportFieldEffectTask, 0); + CreateTask(Task_TeleportWarpOut, 0); } -static void (*const sTeleportFieldEffectTasks[])(struct Task *) = { - TeleportFieldEffectTask1, - TeleportFieldEffectTask2, - TeleportFieldEffectTask3, - TeleportFieldEffectTask4 +static void (*const sTeleportWarpOutFieldEffectFuncs[])(struct Task *) = { + TeleportWarpOutFieldEffect_0, + TeleportWarpOutFieldEffect_1, + TeleportWarpOutFieldEffect_2, + TeleportWarpOutFieldEffect_3 }; -static void ExecuteTeleportFieldEffectTask(u8 taskId) +static void Task_TeleportWarpOut(u8 taskId) { - sTeleportFieldEffectTasks[gTasks[taskId].data[0]](&gTasks[taskId]); + sTeleportWarpOutFieldEffectFuncs[gTasks[taskId].data[0]](&gTasks[taskId]); } -static void TeleportFieldEffectTask1(struct Task *task) +static void TeleportWarpOutFieldEffect_0(struct Task *task) { ScriptContext2_Enable(); FreezeObjectEvents(); @@ -2286,7 +2291,7 @@ static void TeleportFieldEffectTask1(struct Task *task) task->data[0]++; } -static void TeleportFieldEffectTask2(struct Task *task) +static void TeleportWarpOutFieldEffect_1(struct Task *task) { u8 spinDirections[5] = {DIR_SOUTH, DIR_WEST, DIR_EAST, DIR_NORTH, DIR_SOUTH}; struct ObjectEvent *objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; @@ -2306,7 +2311,7 @@ static void TeleportFieldEffectTask2(struct Task *task) } } -static void TeleportFieldEffectTask3(struct Task *task) +static void TeleportWarpOutFieldEffect_2(struct Task *task) { u8 spinDirections[5] = {DIR_SOUTH, DIR_WEST, DIR_EAST, DIR_NORTH, DIR_SOUTH}; struct ObjectEvent *objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; @@ -2334,7 +2339,7 @@ static void TeleportFieldEffectTask3(struct Task *task) } } -static void TeleportFieldEffectTask4(struct Task *task) +static void TeleportWarpOutFieldEffect_3(struct Task *task) { if (!gPaletteFade.active) { @@ -2349,13 +2354,13 @@ static void TeleportFieldEffectTask4(struct Task *task) SetWarpDestinationToLastHealLocation(); WarpIntoMap(); SetMainCallback2(CB2_LoadMap); - gFieldCallback = mapldr_08085D88; - DestroyTask(FindTaskIdByFunc(ExecuteTeleportFieldEffectTask)); + gFieldCallback = FieldCallback_TeleportWarpIn; + DestroyTask(FindTaskIdByFunc(Task_TeleportWarpOut)); } } } -static void mapldr_08085D88(void) +static void FieldCallback_TeleportWarpIn(void) { Overworld_PlaySpecialMapMusic(); WarpFadeInScreen(); @@ -2364,21 +2369,21 @@ static void mapldr_08085D88(void) gFieldCallback = NULL; gObjectEvents[gPlayerAvatar.objectEventId].invisible = TRUE; CameraObjectReset2(); - CreateTask(sub_80B8250, 0); + CreateTask(Task_TeleportWarpIn, 0); } -void (*const gUnknown_0855C49C[])(struct Task *) = { - sub_80B8280, - sub_80B830C, - sub_80B8410 +void (*const sTeleportWarpInFieldEffectFuncs[])(struct Task *) = { + TeleportWarpInFieldEffect_0, + TeleportWarpInFieldEffect_1, + TeleportWarpInFieldEffect_2 }; -static void sub_80B8250(u8 taskId) +static void Task_TeleportWarpIn(u8 taskId) { - gUnknown_0855C49C[gTasks[taskId].data[0]](&gTasks[taskId]); + sTeleportWarpInFieldEffectFuncs[gTasks[taskId].data[0]](&gTasks[taskId]); } -static void sub_80B8280(struct Task *task) +static void TeleportWarpInFieldEffect_0(struct Task *task) { struct Sprite *sprite; s16 centerToCornerVecY; @@ -2397,9 +2402,9 @@ static void sub_80B8280(struct Task *task) } } -static void sub_80B830C(struct Task *task) +static void TeleportWarpInFieldEffect_1(struct Task *task) { - u8 spinDirections[5] = {1, 3, 4, 2, 1}; + u8 spinDirections[5] = {DIR_SOUTH, DIR_WEST, DIR_EAST, DIR_NORTH, DIR_SOUTH}; struct ObjectEvent *objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; struct Sprite *sprite = &gSprites[gPlayerAvatar.spriteId]; if ((sprite->pos2.y += task->data[1]) >= -8) @@ -2436,9 +2441,9 @@ static void sub_80B830C(struct Task *task) } } -static void sub_80B8410(struct Task *task) +static void TeleportWarpInFieldEffect_2(struct Task *task) { - u8 spinDirections[5] = {1, 3, 4, 2, 1}; + u8 spinDirections[5] = {DIR_SOUTH, DIR_WEST, DIR_EAST, DIR_NORTH, DIR_SOUTH}; struct ObjectEvent *objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; if ((--task->data[1]) == 0) { @@ -2449,7 +2454,7 @@ static void sub_80B8410(struct Task *task) ScriptContext2_Disable(); CameraObjectReset1(); UnfreezeObjectEvents(); - DestroyTask(FindTaskIdByFunc(sub_80B8250)); + DestroyTask(FindTaskIdByFunc(Task_TeleportWarpIn)); } } } @@ -2459,10 +2464,10 @@ bool8 FldEff_FieldMoveShowMon(void) u8 taskId; if (IsMapTypeOutdoors(GetCurrentMapType()) == TRUE) { - taskId = CreateTask(sub_80B8554, 0xff); + taskId = CreateTask(Task_FieldMoveShowMonOutdoors, 0xff); } else { - taskId = CreateTask(sub_80B88B4, 0xff); + taskId = CreateTask(Task_FieldMoveShowMonIndoors, 0xff); } gTasks[taskId].data[15] = sub_80B8C60(gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); return FALSE; @@ -2482,22 +2487,22 @@ bool8 FldEff_FieldMoveShowMonInit(void) return FALSE; } -void (*const gUnknown_0855C4A8[])(struct Task *) = { - sub_80B8584, - sub_80B85F8, - sub_80B8660, - sub_80B86EC, - sub_80B871C, - sub_80B8770, - overworld_bg_setup_2, +void (*const sFieldMoveShowMonOutdoorsEffectFuncs[])(struct Task *) = { + FieldMoveShowMonOutdoorsEffect_0, + FieldMoveShowMonOutdoorsEffect_1, + FieldMoveShowMonOutdoorsEffect_2, + FieldMoveShowMonOutdoorsEffect_3, + FieldMoveShowMonOutdoorsEffect_4, + FieldMoveShowMonOutdoorsEffect_5, + FieldMoveShowMonOutdoorsEffect_6, }; -static void sub_80B8554(u8 taskId) +static void Task_FieldMoveShowMonOutdoors(u8 taskId) { - gUnknown_0855C4A8[gTasks[taskId].data[0]](&gTasks[taskId]); + sFieldMoveShowMonOutdoorsEffectFuncs[gTasks[taskId].data[0]](&gTasks[taskId]); } -static void sub_80B8584(struct Task *task) +static void FieldMoveShowMonOutdoorsEffect_0(struct Task *task) { task->data[11] = REG_WININ; task->data[12] = REG_WINOUT; @@ -2510,11 +2515,11 @@ static void sub_80B8584(struct Task *task) SetGpuReg(REG_OFFSET_WIN0V, task->data[2]); SetGpuReg(REG_OFFSET_WININ, task->data[3]); SetGpuReg(REG_OFFSET_WINOUT, task->data[4]); - SetVBlankCallback(sub_80B880C); + SetVBlankCallback(VBlankCB_FieldMoveShowMonOutdoors); task->data[0]++; } -static void sub_80B85F8(struct Task *task) +static void FieldMoveShowMonOutdoorsEffect_1(struct Task *task) { u16 offset = ((REG_BG0CNT >> 2) << 14); u16 delta = ((REG_BG0CNT >> 8) << 11); @@ -2525,7 +2530,7 @@ static void sub_80B85F8(struct Task *task) task->data[0]++; } -static void sub_80B8660(struct Task *task) +static void FieldMoveShowMonOutdoorsEffect_2(struct Task *task) { s16 v0; s16 v2; @@ -2558,7 +2563,7 @@ static void sub_80B8660(struct Task *task) } } -static void sub_80B86EC(struct Task *task) +static void FieldMoveShowMonOutdoorsEffect_3(struct Task *task) { task->data[5] -= 16; if (gSprites[task->data[15]].data[7]) @@ -2567,7 +2572,7 @@ static void sub_80B86EC(struct Task *task) } } -static void sub_80B871C(struct Task *task) +static void FieldMoveShowMonOutdoorsEffect_4(struct Task *task) { s16 v2; s16 v3; @@ -2591,7 +2596,7 @@ static void sub_80B871C(struct Task *task) } } -static void sub_80B8770(struct Task *task) +static void FieldMoveShowMonOutdoorsEffect_5(struct Task *task) { u16 bg0cnt = (REG_BG0CNT >> 8) << 11; CpuFill32(0, (void *)VRAM + bg0cnt, 0x800); @@ -2602,21 +2607,21 @@ static void sub_80B8770(struct Task *task) task->data[0]++; } -static void overworld_bg_setup_2(struct Task *task) +static void FieldMoveShowMonOutdoorsEffect_6(struct Task *task) { IntrCallback callback; LoadWordFromTwoHalfwords((u16 *)&task->data[13], (u32 *)&callback); SetVBlankCallback(callback); - sub_8197200(); + InitTextBoxGfxAndPrinters(); FreeResourcesAndDestroySprite(&gSprites[task->data[15]], task->data[15]); FieldEffectActiveListRemove(FLDEFF_FIELD_MOVE_SHOW_MON); - DestroyTask(FindTaskIdByFunc(sub_80B8554)); + DestroyTask(FindTaskIdByFunc(Task_FieldMoveShowMonOutdoors)); } -static void sub_80B880C(void) +static void VBlankCB_FieldMoveShowMonOutdoors(void) { IntrCallback callback; - struct Task *task = &gTasks[FindTaskIdByFunc(sub_80B8554)]; + struct Task *task = &gTasks[FindTaskIdByFunc(Task_FieldMoveShowMonOutdoors)]; LoadWordFromTwoHalfwords((u16 *)&task->data[13], (u32 *)&callback); callback(); SetGpuReg(REG_OFFSET_WIN0H, task->data[1]); @@ -2638,31 +2643,31 @@ static void sub_80B8874(u16 offs) } } -void (*const gUnknown_0855C4C4[])(struct Task *) = { - sub_80B88E4, - sub_80B8920, - sub_80B898C, - sub_80B89DC, - sub_80B8A0C, - sub_80B8A44, - sub_80B8A64, +void (*const sFieldMoveShowMonIndoorsEffectFuncs[])(struct Task *) = { + FieldMoveShowMonIndoorsEffect_0, + FieldMoveShowMonIndoorsEffect_1, + FieldMoveShowMonIndoorsEffect_2, + FieldMoveShowMonIndoorsEffect_3, + FieldMoveShowMonIndoorsEffect_4, + FieldMoveShowMonIndoorsEffect_5, + FieldMoveShowMonIndoorsEffect_6, }; -static void sub_80B88B4(u8 taskId) +static void Task_FieldMoveShowMonIndoors(u8 taskId) { - gUnknown_0855C4C4[gTasks[taskId].data[0]](&gTasks[taskId]); + sFieldMoveShowMonIndoorsEffectFuncs[gTasks[taskId].data[0]](&gTasks[taskId]); } -static void sub_80B88E4(struct Task *task) +static void FieldMoveShowMonIndoorsEffect_0(struct Task *task) { SetGpuReg(REG_OFFSET_BG0HOFS, task->data[1]); SetGpuReg(REG_OFFSET_BG0VOFS, task->data[2]); StoreWordInTwoHalfwords((u16 *)&task->data[13], (u32)gMain.vblankCallback); - SetVBlankCallback(sub_80B8AE0); + SetVBlankCallback(VBlankCB_FieldMoveShowMonIndoors); task->data[0]++; } -static void sub_80B8920(struct Task *task) +static void FieldMoveShowMonIndoorsEffect_1(struct Task *task) { u16 offset; u16 delta; @@ -2675,7 +2680,7 @@ static void sub_80B8920(struct Task *task) task->data[0]++; } -static void sub_80B898C(struct Task *task) +static void FieldMoveShowMonIndoorsEffect_2(struct Task *task) { if (sub_80B8B38(task)) { @@ -2687,7 +2692,7 @@ static void sub_80B898C(struct Task *task) sub_80B8B28(task); } -static void sub_80B89DC(struct Task *task) +static void FieldMoveShowMonIndoorsEffect_3(struct Task *task) { sub_80B8B28(task); if (gSprites[task->data[15]].data[7]) @@ -2696,7 +2701,7 @@ static void sub_80B89DC(struct Task *task) } } -static void sub_80B8A0C(struct Task *task) +static void FieldMoveShowMonIndoorsEffect_4(struct Task *task) { sub_80B8B28(task); task->data[3] = task->data[1] & 7; @@ -2706,7 +2711,7 @@ static void sub_80B8A0C(struct Task *task) task->data[0]++; } -static void sub_80B8A44(struct Task *task) +static void FieldMoveShowMonIndoorsEffect_5(struct Task *task) { sub_80B8B28(task); if (sub_80B8BF0(task)) @@ -2715,7 +2720,7 @@ static void sub_80B8A44(struct Task *task) } } -static void sub_80B8A64(struct Task *task) +static void FieldMoveShowMonIndoorsEffect_6(struct Task *task) { IntrCallback intrCallback; u16 bg0cnt; @@ -2723,17 +2728,17 @@ static void sub_80B8A64(struct Task *task) CpuFill32(0, (void *)VRAM + bg0cnt, 0x800); LoadWordFromTwoHalfwords((u16 *)&task->data[13], (u32 *)&intrCallback); SetVBlankCallback(intrCallback); - sub_8197200(); + InitTextBoxGfxAndPrinters(); FreeResourcesAndDestroySprite(&gSprites[task->data[15]], task->data[15]); FieldEffectActiveListRemove(FLDEFF_FIELD_MOVE_SHOW_MON); - DestroyTask(FindTaskIdByFunc(sub_80B88B4)); + DestroyTask(FindTaskIdByFunc(Task_FieldMoveShowMonIndoors)); } -static void sub_80B8AE0(void) +static void VBlankCB_FieldMoveShowMonIndoors(void) { IntrCallback intrCallback; struct Task *task; - task = &gTasks[FindTaskIdByFunc(sub_80B88B4)]; + task = &gTasks[FindTaskIdByFunc(Task_FieldMoveShowMonIndoors)]; LoadWordFromTwoHalfwords((u16 *)&task->data[13], (u32 *)&intrCallback); intrCallback(); SetGpuReg(REG_OFFSET_BG0HOFS, task->data[1]); @@ -2855,50 +2860,50 @@ static void sub_80B8D20(struct Sprite *sprite) u8 FldEff_UseSurf(void) { - u8 taskId = CreateTask(sub_80B8D84, 0xff); + u8 taskId = CreateTask(Task_SurfFieldEffect, 0xff); gTasks[taskId].data[15] = gFieldEffectArguments[0]; Overworld_ClearSavedMusic(); Overworld_ChangeMusicTo(MUS_NAMINORI); return FALSE; } -void (*const gUnknown_0855C4E0[])(struct Task *) = { - sub_80B8DB4, - sub_80B8E14, - sub_80B8E60, - sub_80B8EA8, - sub_80B8F24, +void (*const sSurfFieldEffectFuncs[])(struct Task *) = { + SurfFieldEffect_1, + SurfFieldEffect_2, + SurfFieldEffect_3, + SurfFieldEffect_4, + SurfFieldEffect_5, }; -static void sub_80B8D84(u8 taskId) +static void Task_SurfFieldEffect(u8 taskId) { - gUnknown_0855C4E0[gTasks[taskId].data[0]](&gTasks[taskId]); + sSurfFieldEffectFuncs[gTasks[taskId].data[0]](&gTasks[taskId]); } -static void sub_80B8DB4(struct Task *task) +static void SurfFieldEffect_1(struct Task *task) { ScriptContext2_Enable(); FreezeObjectEvents(); gPlayerAvatar.preventStep = TRUE; - SetPlayerAvatarStateMask(8); + SetPlayerAvatarStateMask(PLAYER_AVATAR_FLAG_SURFING); PlayerGetDestCoords(&task->data[1], &task->data[2]); MoveCoords(gObjectEvents[gPlayerAvatar.objectEventId].movementDirection, &task->data[1], &task->data[2]); task->data[0]++; } -static void sub_80B8E14(struct Task *task) +static void SurfFieldEffect_2(struct Task *task) { struct ObjectEvent *objectEvent; objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; if (!ObjectEventIsMovementOverridden(objectEvent) || ObjectEventClearHeldMovementIfFinished(objectEvent)) { - sub_808C114(); + SetPlayerAvatarFieldMove(); ObjectEventSetHeldMovement(objectEvent, MOVEMENT_ACTION_START_ANIM_IN_DIRECTION); task->data[0]++; } } -static void sub_80B8E60(struct Task *task) +static void SurfFieldEffect_3(struct Task *task) { struct ObjectEvent *objectEvent; objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; @@ -2910,13 +2915,13 @@ static void sub_80B8E60(struct Task *task) } } -static void sub_80B8EA8(struct Task *task) +static void SurfFieldEffect_4(struct Task *task) { struct ObjectEvent *objectEvent; if (!FieldEffectActiveListContains(FLDEFF_FIELD_MOVE_SHOW_MON)) { objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; - ObjectEventSetGraphicsId(objectEvent, GetPlayerAvatarGraphicsIdByStateId(3)); + ObjectEventSetGraphicsId(objectEvent, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_SURFING)); ObjectEventClearHeldMovementIfFinished(objectEvent); ObjectEventSetHeldMovement(objectEvent, GetJumpSpecialMovementAction(objectEvent->movementDirection)); gFieldEffectArguments[0] = task->data[1]; @@ -2927,27 +2932,27 @@ static void sub_80B8EA8(struct Task *task) } } -static void sub_80B8F24(struct Task *task) +static void SurfFieldEffect_5(struct Task *task) { struct ObjectEvent *objectEvent; objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; if (ObjectEventClearHeldMovementIfFinished(objectEvent)) { gPlayerAvatar.preventStep = FALSE; - gPlayerAvatar.flags &= 0xdf; + gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_5; ObjectEventSetHeldMovement(objectEvent, GetFaceDirectionMovementAction(objectEvent->movementDirection)); sub_81555AC(objectEvent->fieldEffectSpriteId, 1); UnfreezeObjectEvents(); ScriptContext2_Disable(); FieldEffectActiveListRemove(FLDEFF_USE_SURF); - DestroyTask(FindTaskIdByFunc(sub_80B8D84)); + DestroyTask(FindTaskIdByFunc(Task_SurfFieldEffect)); } } u8 sub_80B8F98(void) { u8 i, j, k; - u8 spriteId = CreateSprite(gFieldEffectObjectTemplatePointers[36], 0x78, -0x18, 1); + u8 spriteId = CreateSprite(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_RAYQUAZA], 0x78, -0x18, 1); struct Sprite *sprite = &gSprites[spriteId]; sprite->oam.priority = 1; @@ -2983,18 +2988,18 @@ u8 sub_80B8F98(void) u8 FldEff_NPCFlyOut(void) { - u8 spriteId = CreateSprite(gFieldEffectObjectTemplatePointers[26], 0x78, 0, 1); + u8 spriteId = CreateSprite(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_BIRD], 0x78, 0, 1); struct Sprite *sprite = &gSprites[spriteId]; sprite->oam.paletteNum = 0; sprite->oam.priority = 1; - sprite->callback = sub_80B9128; + sprite->callback = SpriteCB_NPCFlyOut; sprite->data[1] = gFieldEffectArguments[0]; PlaySE(SE_W019); return spriteId; } -static void sub_80B9128(struct Sprite *sprite) +static void SpriteCB_NPCFlyOut(struct Sprite *sprite) { struct Sprite *npcSprite; @@ -3004,7 +3009,7 @@ static void sub_80B9128(struct Sprite *sprite) if (sprite->data[0]) { npcSprite = &gSprites[sprite->data[1]]; - npcSprite->coordOffsetEnabled = 0; + npcSprite->coordOffsetEnabled = FALSE; npcSprite->pos1.x = sprite->pos1.x + sprite->pos2.x; npcSprite->pos1.y = sprite->pos1.y + sprite->pos2.y - 8; npcSprite->pos2.x = 0; @@ -3016,45 +3021,47 @@ static void sub_80B9128(struct Sprite *sprite) } } +#define tAvatarFlags data[15] + u8 FldEff_UseFly(void) { - u8 taskId = CreateTask(sub_80B91D4, 0xfe); + u8 taskId = CreateTask(Task_FlyOut, 254); gTasks[taskId].data[1] = gFieldEffectArguments[0]; return 0; } -void (*const gUnknown_0855C4F4[])(struct Task *) = { - sub_80B9204, - sub_80B925C, - sub_80B92A0, - sub_80B92F8, - sub_80B933C, - sub_80B9390, - sub_80B9418, - sub_80B9474, - sub_80B9494, +void (*const sFlyOutFieldEffectFuncs[])(struct Task *) = { + FlyOutFieldEffect_0, + FlyOutFieldEffect_1, + FlyOutFieldEffect_2, + FlyOutFieldEffect_3, + FlyOutFieldEffect_4, + FlyOutFieldEffect_5, + FlyOutFieldEffect_6, + FlyOutFieldEffect_7, + FlyOutFieldEffect_8, }; -static void sub_80B91D4(u8 taskId) +static void Task_FlyOut(u8 taskId) { - gUnknown_0855C4F4[gTasks[taskId].data[0]](&gTasks[taskId]); + sFlyOutFieldEffectFuncs[gTasks[taskId].data[0]](&gTasks[taskId]); } -static void sub_80B9204(struct Task *task) +static void FlyOutFieldEffect_0(struct Task *task) { struct ObjectEvent *objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; if (!ObjectEventIsMovementOverridden(objectEvent) || ObjectEventClearHeldMovementIfFinished(objectEvent)) { - task->data[15] = gPlayerAvatar.flags; + task->tAvatarFlags = gPlayerAvatar.flags; gPlayerAvatar.preventStep = TRUE; - SetPlayerAvatarStateMask(1); - sub_808C114(); + SetPlayerAvatarStateMask(PLAYER_AVATAR_FLAG_ON_FOOT); + SetPlayerAvatarFieldMove(); ObjectEventSetHeldMovement(objectEvent, MOVEMENT_ACTION_START_ANIM_IN_DIRECTION); task->data[0]++; } } -static void sub_80B925C(struct Task *task) +static void FlyOutFieldEffect_1(struct Task *task) { struct ObjectEvent *objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; if (ObjectEventClearHeldMovementIfFinished(objectEvent)) @@ -3065,12 +3072,12 @@ static void sub_80B925C(struct Task *task) } } -static void sub_80B92A0(struct Task *task) +static void FlyOutFieldEffect_2(struct Task *task) { if (!FieldEffectActiveListContains(FLDEFF_FIELD_MOVE_SHOW_MON)) { struct ObjectEvent *objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; - if (task->data[15] & 0x08) + if (task->tAvatarFlags & PLAYER_AVATAR_FLAG_SURFING) { sub_81555AC(objectEvent->fieldEffectSpriteId, 2); sub_81555D8(objectEvent->fieldEffectSpriteId, 0); @@ -3080,7 +3087,7 @@ static void sub_80B92A0(struct Task *task) } } -static void sub_80B92F8(struct Task *task) +static void FlyOutFieldEffect_3(struct Task *task) { if (sub_80B9508(task->data[1])) { @@ -3091,7 +3098,7 @@ static void sub_80B92F8(struct Task *task) } } -static void sub_80B933C(struct Task *task) +static void FlyOutFieldEffect_4(struct Task *task) { struct ObjectEvent *objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; if ((task->data[2] == 0 || (--task->data[2]) == 0) && ObjectEventClearHeldMovementIfFinished(objectEvent)) @@ -3102,16 +3109,16 @@ static void sub_80B933C(struct Task *task) } } -static void sub_80B9390(struct Task *task) +static void FlyOutFieldEffect_5(struct Task *task) { if ((++task->data[2]) >= 8) { struct ObjectEvent *objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; - ObjectEventSetGraphicsId(objectEvent, GetPlayerAvatarGraphicsIdByStateId(0x03)); + ObjectEventSetGraphicsId(objectEvent, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_SURFING)); StartSpriteAnim(&gSprites[objectEvent->spriteId], 0x16); - objectEvent->inanimate = 1; + objectEvent->inanimate = TRUE; ObjectEventSetHeldMovement(objectEvent, MOVEMENT_ACTION_JUMP_IN_PLACE_LEFT); - if (task->data[15] & 0x08) + if (task->tAvatarFlags & PLAYER_AVATAR_FLAG_SURFING) { DestroySprite(&gSprites[objectEvent->fieldEffectSpriteId]); } @@ -3120,21 +3127,21 @@ static void sub_80B9390(struct Task *task) } } -static void sub_80B9418(struct Task *task) +static void FlyOutFieldEffect_6(struct Task *task) { if ((++task->data[2]) >= 10) { struct ObjectEvent *objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; ObjectEventClearHeldMovementIfActive(objectEvent); - objectEvent->inanimate = 0; - objectEvent->hasShadow = 0; + objectEvent->inanimate = FALSE; + objectEvent->hasShadow = FALSE; sub_80B9560(task->data[1], objectEvent->spriteId); CameraObjectReset2(); task->data[0]++; } } -static void sub_80B9474(struct Task *task) +static void FlyOutFieldEffect_7(struct Task *task) { if (sub_80B9508(task->data[1])) { @@ -3143,12 +3150,12 @@ static void sub_80B9474(struct Task *task) } } -static void sub_80B9494(struct Task *task) +static void FlyOutFieldEffect_8(struct Task *task) { if (!gPaletteFade.active) { FieldEffectActiveListRemove(FLDEFF_USE_FLY); - DestroyTask(FindTaskIdByFunc(sub_80B91D4)); + DestroyTask(FindTaskIdByFunc(Task_FlyOut)); } } @@ -3156,7 +3163,7 @@ static u8 sub_80B94C4(void) { u8 spriteId; struct Sprite *sprite; - spriteId = CreateSprite(gFieldEffectObjectTemplatePointers[26], 0xff, 0xb4, 0x1); + spriteId = CreateSprite(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_BIRD], 0xff, 0xb4, 0x1); sprite = &gSprites[spriteId]; sprite->oam.paletteNum = 0; sprite->oam.priority = 1; @@ -3245,7 +3252,7 @@ static void sub_80B963C(struct Sprite *sprite) if (sprite->data[6] != MAX_SPRITES) { struct Sprite *sprite1 = &gSprites[sprite->data[6]]; - sprite1->coordOffsetEnabled = 0; + sprite1->coordOffsetEnabled = FALSE; sprite1->pos1.x = sprite->pos1.x + sprite->pos2.x; sprite1->pos1.y = sprite->pos1.y + sprite->pos2.y - 8; sprite1->pos2.x = 0; @@ -3309,26 +3316,26 @@ void sub_80B9794(u8 spriteId) u8 FldEff_FlyIn(void) { - CreateTask(sub_80B97D4, 0xfe); + CreateTask(Task_FlyIn, 0xfe); return 0; } -void (*const gUnknown_0855C550[])(struct Task *) = { - sub_80B9804, - sub_80B98B8, - sub_80B9924, - sub_80B9978, - sub_80B99F0, - sub_80B9A28, - sub_80B9A60, +void (*const sFlyInFieldEffectFuncs[])(struct Task *) = { + FlyInFieldEffect_0, + FlyInFieldEffect_1, + FlyInFieldEffect_2, + FlyInFieldEffect_3, + FlyInFieldEffect_4, + FlyInFieldEffect_5, + FlyInFieldEffect_6, }; -static void sub_80B97D4(u8 taskId) +static void Task_FlyIn(u8 taskId) { - gUnknown_0855C550[gTasks[taskId].data[0]](&gTasks[taskId]); + sFlyInFieldEffectFuncs[gTasks[taskId].data[0]](&gTasks[taskId]); } -static void sub_80B9804(struct Task *task) +static void FlyInFieldEffect_0(struct Task *task) { struct ObjectEvent *objectEvent; objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; @@ -3336,14 +3343,14 @@ static void sub_80B9804(struct Task *task) { task->data[0]++; task->data[2] = 17; - task->data[15] = gPlayerAvatar.flags; + task->tAvatarFlags = gPlayerAvatar.flags; gPlayerAvatar.preventStep = TRUE; - SetPlayerAvatarStateMask(0x01); - if (task->data[15] & 0x08) + SetPlayerAvatarStateMask(PLAYER_AVATAR_FLAG_ON_FOOT); + if (task->tAvatarFlags & PLAYER_AVATAR_FLAG_SURFING) { sub_81555AC(objectEvent->fieldEffectSpriteId, 0); } - ObjectEventSetGraphicsId(objectEvent, GetPlayerAvatarGraphicsIdByStateId(0x3)); + ObjectEventSetGraphicsId(objectEvent, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_SURFING)); CameraObjectReset2(); ObjectEventTurn(objectEvent, DIR_WEST); StartSpriteAnim(&gSprites[objectEvent->spriteId], 0x16); @@ -3354,7 +3361,7 @@ static void sub_80B9804(struct Task *task) } } -static void sub_80B98B8(struct Task *task) +static void FlyInFieldEffect_1(struct Task *task) { struct ObjectEvent *objectEvent; struct Sprite *sprite; @@ -3372,9 +3379,9 @@ static void sub_80B98B8(struct Task *task) } } -static void sub_80B9924(struct Task *task) +static void FlyInFieldEffect_2(struct Task *task) { - s16 unknown_0855C56C[18] = { + s16 sYPositions[18] = { -2, -4, -5, @@ -3395,14 +3402,14 @@ static void sub_80B9924(struct Task *task) 8 }; struct Sprite *sprite = &gSprites[gPlayerAvatar.spriteId]; - sprite->pos2.y = unknown_0855C56C[task->data[2]]; - if ((++task->data[2]) >= 18) + sprite->pos2.y = sYPositions[task->data[2]]; + if ((++task->data[2]) >= (int)ARRAY_COUNT(sYPositions)) { task->data[0]++; } } -static void sub_80B9978(struct Task *task) +static void FlyInFieldEffect_3(struct Task *task) { struct ObjectEvent *objectEvent; struct Sprite *sprite; @@ -3410,18 +3417,18 @@ static void sub_80B9978(struct Task *task) { objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; sprite = &gSprites[objectEvent->spriteId]; - objectEvent->inanimate = 0; + objectEvent->inanimate = FALSE; MoveObjectEventToMapCoords(objectEvent, objectEvent->currentCoords.x, objectEvent->currentCoords.y); sprite->pos2.x = 0; sprite->pos2.y = 0; - sprite->coordOffsetEnabled = 1; - sub_808C114(); + sprite->coordOffsetEnabled = TRUE; + SetPlayerAvatarFieldMove(); ObjectEventSetHeldMovement(objectEvent, MOVEMENT_ACTION_START_ANIM_IN_DIRECTION); task->data[0]++; } } -static void sub_80B99F0(struct Task *task) +static void FlyInFieldEffect_4(struct Task *task) { if (ObjectEventClearHeldMovementIfFinished(&gObjectEvents[gPlayerAvatar.objectEventId])) { @@ -3430,7 +3437,7 @@ static void sub_80B99F0(struct Task *task) } } -static void sub_80B9A28(struct Task *task) +static void FlyInFieldEffect_5(struct Task *task) { if (sub_80B9508(task->data[1])) { @@ -3440,35 +3447,35 @@ static void sub_80B9A28(struct Task *task) } } -static void sub_80B9A60(struct Task *task) +static void FlyInFieldEffect_6(struct Task *task) { u8 state; struct ObjectEvent *objectEvent; if ((--task->data[1]) == 0) { objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; - state = 0; - if (task->data[15] & 0x08) + state = PLAYER_AVATAR_STATE_NORMAL; + if (task->tAvatarFlags & PLAYER_AVATAR_FLAG_SURFING) { - state = 3; + state = PLAYER_AVATAR_STATE_SURFING; sub_81555AC(objectEvent->fieldEffectSpriteId, 1); } ObjectEventSetGraphicsId(objectEvent, GetPlayerAvatarGraphicsIdByStateId(state)); ObjectEventTurn(objectEvent, DIR_SOUTH); - gPlayerAvatar.flags = task->data[15]; + gPlayerAvatar.flags = task->tAvatarFlags; gPlayerAvatar.preventStep = FALSE; FieldEffectActiveListRemove(FLDEFF_FLY_IN); - DestroyTask(FindTaskIdByFunc(sub_80B97D4)); + DestroyTask(FindTaskIdByFunc(Task_FlyIn)); } } -bool8 sub_80B9ADC(void) +bool8 FldEff_DestroyDeoxysRock(void) { u8 taskId; u8 objectEventIdBuffer; if (!TryGetObjectEventIdByLocalIdAndMap(gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2], &objectEventIdBuffer)) { - taskId = CreateTask(sub_80B9BE8, 0x50); + taskId = CreateTask(Task_DestroyDeoxysRock, 0x50); gTasks[taskId].data[2] = objectEventIdBuffer; gTasks[taskId].data[6] = gFieldEffectArguments[0]; gTasks[taskId].data[7] = gFieldEffectArguments[1]; @@ -3476,12 +3483,12 @@ bool8 sub_80B9ADC(void) } else { - FieldEffectActiveListRemove(0x41); + FieldEffectActiveListRemove(FLDEFF_DESTROY_DEOXYS_ROCK); } return FALSE; } -void sub_80B9B3C(u8 taskId) +static void Task_PanCameraForDestroyingDeoxysRock(u8 taskId) { s16 *data = gTasks[taskId].data; if (data[7] != 0) @@ -3520,31 +3527,29 @@ void sub_80B9BD0(u8 taskId) gTasks[taskId].data[7] = 1; } -void (*const gUnknown_0855C590[])(s16*, u8) = { - sub_80B9C28, - sub_80B9C54, - sub_80B9CDC, +void (*const sDestroyDeoxysRockFieldEffectFuncs[])(s16*, u8) = { + DestroyDeoxysRockFieldEffect_0, + DestroyDeoxysRockFieldEffect_1, + DestroyDeoxysRockFieldEffect_2, }; -static void sub_80B9BE8(u8 taskId) +static void Task_DestroyDeoxysRock(u8 taskId) { s16 *data = gTasks[taskId].data; InstallCameraPanAheadCallback(); SetCameraPanningCallback(0); - gUnknown_0855C590[data[1]](data, taskId); + sDestroyDeoxysRockFieldEffectFuncs[data[1]](data, taskId); } -void sub_80B9C28(s16* data, u8 taskId) +static void DestroyDeoxysRockFieldEffect_0(s16* data, u8 taskId) { - u8 newTaskId = CreateTask(sub_80B9B3C, 0x5A); + u8 newTaskId = CreateTask(Task_PanCameraForDestroyingDeoxysRock, 0x5A); PlaySE(SE_T_KAMI2); data[5] = newTaskId; data[1]++; } -void sub_80B9D24(struct Sprite*); - -void sub_80B9C54(s16* data, u8 taskId) +static void DestroyDeoxysRockFieldEffect_1(s16* data, u8 taskId) { if (++data[3] > 0x78) { @@ -3560,13 +3565,13 @@ void sub_80B9C54(s16* data, u8 taskId) } } -void sub_80B9CDC(s16* a0, u8 taskId) +static void DestroyDeoxysRockFieldEffect_2(s16* a0, u8 taskId) { - if (!gPaletteFade.active && !FuncIsActiveTask(sub_80B9B3C)) + if (!gPaletteFade.active && !FuncIsActiveTask(Task_PanCameraForDestroyingDeoxysRock)) { InstallCameraPanAheadCallback(); RemoveObjectEventByLocalIdAndMap(a0[6], a0[7], a0[8]); - FieldEffectActiveListRemove(0x41); + FieldEffectActiveListRemove(FLDEFF_DESTROY_DEOXYS_ROCK); DestroyTask(taskId); } } @@ -3615,7 +3620,7 @@ const struct SpriteTemplate gUnknown_0855C5EC = { .callback = sub_80B9DB8 }; -void sub_80B9D24(struct Sprite* sprite) +static void sub_80B9D24(struct Sprite* sprite) { int i; int xPos = (s16)gTotalCameraPixelOffsetX + sprite->pos1.x + sprite->pos2.x; @@ -3658,7 +3663,7 @@ static void sub_80B9DB8(struct Sprite* sprite) DestroySprite(sprite); } -bool8 Fldeff_MoveDeoxysRock(struct Sprite* sprite) +bool8 FldEff_MoveDeoxysRock(struct Sprite* sprite) { u8 objectEventIdBuffer; if (!TryGetObjectEventIdByLocalIdAndMap(gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2], &objectEventIdBuffer)) @@ -3672,7 +3677,7 @@ bool8 Fldeff_MoveDeoxysRock(struct Sprite* sprite) xPos = (gFieldEffectArguments[3] - xPos) * 16; yPos = (gFieldEffectArguments[4] - yPos) * 16; ShiftObjectEventCoords(object, gFieldEffectArguments[3] + 7, gFieldEffectArguments[4] + 7); - taskId = CreateTask(Fldeff_MoveDeoxysRock_Step, 0x50); + taskId = CreateTask(Task_MoveDeoxysRock, 0x50); gTasks[taskId].data[1] = object->spriteId; gTasks[taskId].data[2] = gSprites[object->spriteId].pos1.x + xPos; gTasks[taskId].data[3] = gSprites[object->spriteId].pos1.y + yPos; @@ -3682,7 +3687,7 @@ bool8 Fldeff_MoveDeoxysRock(struct Sprite* sprite) return FALSE; } -static void Fldeff_MoveDeoxysRock_Step(u8 taskId) +static void Task_MoveDeoxysRock(u8 taskId) { // BUG: Possible divide by zero s16 *data = gTasks[taskId].data; @@ -3711,7 +3716,7 @@ static void Fldeff_MoveDeoxysRock_Step(u8 taskId) sprite->pos1.y = data[3]; ShiftStillObjectEventCoords(object); object->triggerGroundEffectsOnStop = TRUE; - FieldEffectActiveListRemove(0x42); + FieldEffectActiveListRemove(FLDEFF_MOVE_DEOXYS_ROCK); DestroyTask(taskId); } break; diff --git a/src/field_effect_helpers.c b/src/field_effect_helpers.c index 52c30ab0f..d6bffd206 100755 --- a/src/field_effect_helpers.c +++ b/src/field_effect_helpers.c @@ -166,7 +166,7 @@ u8 CreateWarpArrowSprite(void) u8 spriteId; struct Sprite *sprite; - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[8], 0, 0, 0x52); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_ARROW], 0, 0, 0x52); if (spriteId != MAX_SPRITES) { sprite = &gSprites[spriteId]; @@ -202,11 +202,11 @@ void ShowWarpArrowSprite(u8 spriteId, u8 direction, s16 x, s16 y) } } -const u8 gShadowEffectTemplateIds[] = { - 0, - 1, - 2, - 3 +static const u8 sShadowEffectTemplateIds[] = { + FLDEFFOBJ_SHADOW_S, + FLDEFFOBJ_SHADOW_M, + FLDEFFOBJ_SHADOW_L, + FLDEFFOBJ_SHADOW_XL }; const u16 gShadowVerticalOffsets[] = { @@ -224,7 +224,7 @@ u32 FldEff_Shadow(void) objectEventId = GetObjectEventIdByLocalIdAndMap(gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); graphicsInfo = GetObjectEventGraphicsInfo(gObjectEvents[objectEventId].graphicsId); - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[gShadowEffectTemplateIds[graphicsInfo->shadowSize]], 0, 0, 0x94); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[sShadowEffectTemplateIds[graphicsInfo->shadowSize]], 0, 0, 0x94); if (spriteId != MAX_SPRITES) { gSprites[spriteId].coordOffsetEnabled = TRUE; @@ -275,7 +275,7 @@ u32 FldEff_TallGrass(void) x = gFieldEffectArguments[0]; y = gFieldEffectArguments[1]; sub_80930E0(&x, &y, 8, 8); - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[4], x, y, 0); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_TALL_GRASS], x, y, 0); if (spriteId != MAX_SPRITES) { sprite = &gSprites[spriteId]; @@ -341,7 +341,7 @@ u32 FldEff_JumpTallGrass(void) struct Sprite *sprite; sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 12); - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[10], gFieldEffectArguments[0], gFieldEffectArguments[1], 0); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_JUMP_TALL_GRASS], gFieldEffectArguments[0], gFieldEffectArguments[1], 0); if (spriteId != MAX_SPRITES) { sprite = &gSprites[spriteId]; @@ -381,7 +381,7 @@ u32 FldEff_LongGrass(void) x = gFieldEffectArguments[0]; y = gFieldEffectArguments[1]; sub_80930E0(&x, &y, 8, 8); - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[15], x, y, 0); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_LONG_GRASS], x, y, 0); if (spriteId != MAX_SPRITES) { sprite = &gSprites[spriteId]; @@ -444,7 +444,7 @@ u32 FldEff_JumpLongGrass(void) struct Sprite *sprite; sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8); - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[16], gFieldEffectArguments[0], gFieldEffectArguments[1], 0); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_JUMP_LONG_GRASS], gFieldEffectArguments[0], gFieldEffectArguments[1], 0); if (spriteId != MAX_SPRITES) { sprite = &gSprites[spriteId]; @@ -465,7 +465,7 @@ u32 FldEff_ShortGrass(void) objectEventId = GetObjectEventIdByLocalIdAndMap(gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); objectEvent = &gObjectEvents[objectEventId]; - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[30], 0, 0, 0); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_SHORT_GRASS], 0, 0, 0); if (spriteId != MAX_SPRITES) { sprite = &(gSprites[spriteId]); @@ -522,7 +522,7 @@ u32 FldEff_SandFootprints(void) struct Sprite *sprite; sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8); - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[11], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_SAND_FOOTPRINTS], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); if (spriteId != MAX_SPRITES) { sprite = &gSprites[spriteId]; @@ -540,7 +540,7 @@ u32 FldEff_DeepSandFootprints(void) struct Sprite *sprite; sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8); - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[23], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_DEEP_SAND_FOOTPRINTS], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); if (spriteId != MAX_SPRITES) { sprite = &gSprites[spriteId]; @@ -558,7 +558,7 @@ u32 FldEff_BikeTireTracks(void) struct Sprite *sprite; sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8); - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[27], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_BIKE_TIRE_TRACKS], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); if (spriteId != MAX_SPRITES) { sprite = &gSprites[spriteId]; @@ -611,7 +611,7 @@ u32 FldEff_Splash(void) objectEventId = GetObjectEventIdByLocalIdAndMap(gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); objectEvent = &gObjectEvents[objectEventId]; - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[13], 0, 0, 0); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_SPLASH], 0, 0, 0); if (spriteId != MAX_SPRITES) { graphicsInfo = GetObjectEventGraphicsInfo(objectEvent->graphicsId); @@ -650,7 +650,7 @@ u32 FldEff_JumpSmallSplash(void) struct Sprite *sprite; sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 12); - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[14], gFieldEffectArguments[0], gFieldEffectArguments[1], 0); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_JUMP_SMALL_SPLASH], gFieldEffectArguments[0], gFieldEffectArguments[1], 0); if (spriteId != MAX_SPRITES) { sprite = &gSprites[spriteId]; @@ -668,7 +668,7 @@ u32 FldEff_JumpBigSplash(void) struct Sprite *sprite; sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8); - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[12], gFieldEffectArguments[0], gFieldEffectArguments[1], 0); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_JUMP_BIG_SPLASH], gFieldEffectArguments[0], gFieldEffectArguments[1], 0); if (spriteId != MAX_SPRITES) { sprite = &gSprites[spriteId]; @@ -690,7 +690,7 @@ u32 FldEff_FeetInFlowingWater(void) objectEventId = GetObjectEventIdByLocalIdAndMap(gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); objectEvent = &gObjectEvents[objectEventId]; - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[13], 0, 0, 0); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_SPLASH], 0, 0, 0); if (spriteId != MAX_SPRITES) { graphicsInfo = GetObjectEventGraphicsInfo(objectEvent->graphicsId); @@ -744,7 +744,7 @@ u32 FldEff_Ripple(void) u8 spriteId; struct Sprite *sprite; - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[5], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_RIPPLE], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); if (spriteId != MAX_SPRITES) { sprite = &gSprites[spriteId]; @@ -764,7 +764,7 @@ u32 FldEff_HotSpringsWater(void) objectEventId = GetObjectEventIdByLocalIdAndMap(gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); objectEvent = &gObjectEvents[objectEventId]; - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[31], 0, 0, 0); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_HOT_SPRINGS_WATER], 0, 0, 0); if (spriteId != MAX_SPRITES) { sprite = &gSprites[spriteId]; @@ -806,7 +806,7 @@ u32 FldEff_Unknown19(void) struct Sprite *sprite; sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8); - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[17], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_17], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); if (spriteId != MAX_SPRITES) { sprite = &gSprites[spriteId]; @@ -817,19 +817,19 @@ u32 FldEff_Unknown19(void) return 0; } -u32 FldEff_Unknown20(void) +u32 FldEff_UnusedGrass(void) { u8 spriteId; struct Sprite *sprite; sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8); - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[18], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_UNUSED_GRASS], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); if (spriteId != MAX_SPRITES) { sprite = &gSprites[spriteId]; sprite->coordOffsetEnabled = TRUE; sprite->oam.priority = gFieldEffectArguments[3]; - sprite->data[0] = FLDEFF_UNKNOWN_20; + sprite->data[0] = FLDEFF_UNUSED_GRASS; } return 0; } @@ -840,7 +840,7 @@ u32 FldEff_Unknown21(void) struct Sprite *sprite; sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8); - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[19], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_19], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); if (spriteId != MAX_SPRITES) { sprite = &gSprites[spriteId]; @@ -857,7 +857,7 @@ u32 FldEff_Unknown22(void) struct Sprite *sprite; sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8); - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[20], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_20], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); if (spriteId != MAX_SPRITES) { sprite = &gSprites[spriteId]; @@ -889,7 +889,7 @@ u32 FldEff_Ash(void) x = gFieldEffectArguments[0]; y = gFieldEffectArguments[1]; sub_80930E0(&x, &y, 8, 8); - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[6], x, y, gFieldEffectArguments[2]); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_ASH], x, y, gFieldEffectArguments[2]); if (spriteId != MAX_SPRITES) { sprite = &gSprites[spriteId]; @@ -945,7 +945,7 @@ u32 FldEff_SurfBlob(void) struct Sprite *sprite; sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8); - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[7], gFieldEffectArguments[0], gFieldEffectArguments[1], 0x96); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_SURF_BLOB], gFieldEffectArguments[0], gFieldEffectArguments[1], 0x96); if (spriteId !=MAX_SPRITES) { sprite = &gSprites[spriteId]; @@ -1107,7 +1107,7 @@ u32 FldEff_Dust(void) struct Sprite *sprite; sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 12); - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[9], gFieldEffectArguments[0], gFieldEffectArguments[1], 0); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_GROUND_IMPACT_DUST], gFieldEffectArguments[0], gFieldEffectArguments[1], 0); if (spriteId != MAX_SPRITES) { sprite = &gSprites[spriteId]; @@ -1129,7 +1129,7 @@ u32 FldEff_SandPile(void) objectEventId = GetObjectEventIdByLocalIdAndMap(gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); objectEvent = &gObjectEvents[objectEventId]; - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[29], 0, 0, 0); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_SAND_PILE], 0, 0, 0); if (spriteId != MAX_SPRITES) { graphicsInfo = GetObjectEventGraphicsInfo(objectEvent->graphicsId); @@ -1183,7 +1183,7 @@ u32 FldEff_Bubbles(void) struct Sprite *sprite; sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 0); - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[34], gFieldEffectArguments[0], gFieldEffectArguments[1], 0x52); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_BUBBLES], gFieldEffectArguments[0], gFieldEffectArguments[1], 0x52); if (spriteId != MAX_SPRITES) { sprite = &gSprites[spriteId]; @@ -1211,7 +1211,7 @@ u32 FldEff_BerryTreeGrowthSparkle(void) struct Sprite *sprite; sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 4); - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[22], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_SPARKLE], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); if (spriteId != MAX_SPRITES) { sprite = &gSprites[spriteId]; @@ -1225,20 +1225,20 @@ u32 FldEff_BerryTreeGrowthSparkle(void) u32 ShowTreeDisguiseFieldEffect(void) { - return ShowDisguiseFieldEffect(FLDEFF_TREE_DISGUISE, 24, 4); + return ShowDisguiseFieldEffect(FLDEFF_TREE_DISGUISE, FLDEFFOBJ_TREE_DISGUISE, 4); } u32 ShowMountainDisguiseFieldEffect(void) { - return ShowDisguiseFieldEffect(FLDEFF_MOUNTAIN_DISGUISE, 25, 3); + return ShowDisguiseFieldEffect(FLDEFF_MOUNTAIN_DISGUISE, FLDEFFOBJ_MOUNTAIN_DISGUISE, 3); } u32 ShowSandDisguiseFieldEffect(void) { - return ShowDisguiseFieldEffect(FLDEFF_SAND_DISGUISE, 28, 2); + return ShowDisguiseFieldEffect(FLDEFF_SAND_DISGUISE, FLDEFFOBJ_SAND_DISGUISE, 2); } -static u32 ShowDisguiseFieldEffect(u8 fldEff, u8 templateIdx, u8 paletteNum) +static u32 ShowDisguiseFieldEffect(u8 fldEff, u8 fldEffObj, u8 paletteNum) { u8 spriteId; struct Sprite *sprite; @@ -1248,7 +1248,7 @@ static u32 ShowDisguiseFieldEffect(u8 fldEff, u8 templateIdx, u8 paletteNum) FieldEffectActiveListRemove(fldEff); return MAX_SPRITES; } - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[templateIdx], 0, 0, 0); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[fldEffObj], 0, 0, 0); if (spriteId != MAX_SPRITES) { sprite = &gSprites[spriteId]; @@ -1331,7 +1331,7 @@ u32 FldEff_Sparkle(void) gFieldEffectArguments[0] += 7; gFieldEffectArguments[1] += 7; sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8); - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[35], gFieldEffectArguments[0], gFieldEffectArguments[1], 0x52); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_SMALL_SPARKLE], gFieldEffectArguments[0], gFieldEffectArguments[1], 0x52); if (spriteId != MAX_SPRITES) { gSprites[spriteId].oam.priority = gFieldEffectArguments[2]; diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c index b0918a78d..c482f39d6 100644 --- a/src/field_player_avatar.c +++ b/src/field_player_avatar.c @@ -379,9 +379,9 @@ static bool8 TryInterruptObjectEventSpecialAnim(struct ObjectEvent *playerObjEve static void npc_clear_strange_bits(struct ObjectEvent *objEvent) { - objEvent->inanimate = 0; - objEvent->disableAnim = 0; - objEvent->facingDirectionLocked = 0; + objEvent->inanimate = FALSE; + objEvent->disableAnim = FALSE; + objEvent->facingDirectionLocked = FALSE; gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_DASH; } @@ -424,14 +424,14 @@ static u8 GetForcedMovementByMetatileBehavior(void) static bool8 ForcedMovement_None(void) { - if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_6) + if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_FORCED_MOVE) { struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; - playerObjEvent->facingDirectionLocked = 0; - playerObjEvent->enableAnim = 1; + playerObjEvent->facingDirectionLocked = FALSE; + playerObjEvent->enableAnim = TRUE; SetObjectEventDirection(playerObjEvent, playerObjEvent->facingDirection); - gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_6; + gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_FORCED_MOVE; } return FALSE; } @@ -441,7 +441,7 @@ static u8 DoForcedMovement(u8 direction, void (*b)(u8)) struct PlayerAvatar *playerAvatar = &gPlayerAvatar; u8 collision = CheckForPlayerAvatarCollision(direction); - playerAvatar->flags |= PLAYER_AVATAR_FLAG_6; + playerAvatar->flags |= PLAYER_AVATAR_FLAG_FORCED_MOVE; if (collision) { ForcedMovement_None(); @@ -453,7 +453,7 @@ static u8 DoForcedMovement(u8 direction, void (*b)(u8)) { if (collision == COLLISION_LEDGE_JUMP) PlayerJumpLedge(direction); - playerAvatar->flags |= PLAYER_AVATAR_FLAG_6; + playerAvatar->flags |= PLAYER_AVATAR_FLAG_FORCED_MOVE; playerAvatar->runningState = MOVING; return 1; } @@ -470,7 +470,7 @@ static u8 DoForcedMovementInCurrentDirection(void (*a)(u8)) { struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; - playerObjEvent->disableAnim = 1; + playerObjEvent->disableAnim = TRUE; return DoForcedMovement(playerObjEvent->movementDirection, a); } @@ -519,12 +519,12 @@ static bool8 ForcedMovement_PushedEastByCurrent(void) return DoForcedMovement(DIR_EAST, PlayerRideWaterCurrent); } -u8 ForcedMovement_Slide(u8 direction, void (*b)(u8)) +static u8 ForcedMovement_Slide(u8 direction, void (*b)(u8)) { struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; - playerObjEvent->disableAnim = 1; - playerObjEvent->facingDirectionLocked = 1; + playerObjEvent->disableAnim = TRUE; + playerObjEvent->facingDirectionLocked = TRUE; return DoForcedMovement(direction, b); } @@ -567,8 +567,8 @@ static bool8 ForcedMovement_MuddySlope(void) if (playerObjEvent->movementDirection != DIR_NORTH || GetPlayerSpeed() <= 3) { Bike_UpdateBikeCounterSpeed(0); - playerObjEvent->facingDirectionLocked = 1; - return DoForcedMovement(1, PlayerGoSpeed2); + playerObjEvent->facingDirectionLocked = TRUE; + return DoForcedMovement(DIR_SOUTH, PlayerGoSpeed2); } else { @@ -1328,7 +1328,7 @@ void ClearPlayerAvatarInfo(void) void SetPlayerAvatarStateMask(u8 flags) { - gPlayerAvatar.flags &= (PLAYER_AVATAR_FLAG_DASH | PLAYER_AVATAR_FLAG_6 | PLAYER_AVATAR_FLAG_5); + gPlayerAvatar.flags &= (PLAYER_AVATAR_FLAG_DASH | PLAYER_AVATAR_FLAG_FORCED_MOVE | PLAYER_AVATAR_FLAG_5); gPlayerAvatar.flags |= flags; } @@ -1404,13 +1404,13 @@ void SetPlayerInvisibility(bool8 invisible) gSprites[gObjectEvents[gPlayerAvatar.objectEventId].fieldEffectSpriteId].invisible = invisible; } -void sub_808C114(void) +void SetPlayerAvatarFieldMove(void) { ObjectEventSetGraphicsId(&gObjectEvents[gPlayerAvatar.objectEventId], GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_FIELD_MOVE)); StartSpriteAnim(&gSprites[gPlayerAvatar.spriteId], 0); } -void sub_808C15C(u8 direction) +static void SetPlayerAvatarFishing(u8 direction) { ObjectEventSetGraphicsId(&gObjectEvents[gPlayerAvatar.objectEventId], GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_FISHING)); StartSpriteAnim(&gSprites[gPlayerAvatar.spriteId], GetFishingDirectionAnimNum(direction)); @@ -1423,7 +1423,7 @@ void PlayerUseAcroBikeOnBumpySlope(u8 direction) SeekSpriteAnim(&gSprites[gPlayerAvatar.spriteId], 1); } -void sub_808C228(u8 direction) +void SetPlayerAvatarWatering(u8 direction) { ObjectEventSetGraphicsId(&gObjectEvents[gPlayerAvatar.objectEventId], GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_WATERING)); StartSpriteAnim(&gSprites[gPlayerAvatar.spriteId], GetFaceDirectionAnimNum(direction)); @@ -1739,8 +1739,8 @@ static bool8 Fishing2(struct Task *task) task->tPlayerGfxId = gObjectEvents[gPlayerAvatar.objectEventId].graphicsId; playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; ObjectEventClearHeldMovementIfActive(playerObjEvent); - playerObjEvent->enableAnim = 1; - sub_808C15C(playerObjEvent->facingDirection); + playerObjEvent->enableAnim = TRUE; + SetPlayerAvatarFishing(playerObjEvent->facingDirection); task->tStep++; return FALSE; } diff --git a/src/field_region_map.c b/src/field_region_map.c index b442675f3..fc6f0fa76 100644 --- a/src/field_region_map.c +++ b/src/field_region_map.c @@ -116,7 +116,7 @@ static void MCB2_InitRegionMapRegisters(void) InitWindows(sFieldRegionMapWindowTemplates); DeactivateAllTextPrinters(); LoadUserWindowBorderGfx(0, 0x27, 0xd0); - clear_scheduled_bg_copies_to_vram(); + ClearScheduledBgCopiesToVram(); SetMainCallback2(MCB2_FieldUpdateRegionMap); SetVBlankCallback(VBCB_FieldUpdateRegionMap); } @@ -134,7 +134,7 @@ static void MCB2_FieldUpdateRegionMap(void) AnimateSprites(); BuildOamBuffer(); UpdatePaletteFade(); - do_scheduled_bg_tilemap_copies_to_vram(); + DoScheduledBgTilemapCopiesToVram(); } static void FieldUpdateRegionMap(void) diff --git a/src/field_screen_effect.c b/src/field_screen_effect.c index 51f719fc9..971e58cf4 100644 --- a/src/field_screen_effect.c +++ b/src/field_screen_effect.c @@ -12,6 +12,7 @@ #include "field_special_scene.h" #include "field_weather.h" #include "gpu_regs.h" +#include "io_reg.h" #include "link.h" #include "link_rfu.h" #include "load_save.h" @@ -34,13 +35,11 @@ #include "trainer_hill.h" #include "fldeff.h" -extern const u16 gOrbEffectBackgroundLayerFlags[]; - // This file's functions. static void sub_8080B9C(u8); static void Task_ExitNonAnimDoor(u8); static void Task_ExitNonDoor(u8); -static void task0A_fade_n_map_maybe(u8); +static void Task_DoContestHallWarp(u8); static void sub_808115C(u8); static void FillPalBufferWhite(void); static void Task_ExitDoor(u8); @@ -314,7 +313,7 @@ static void FieldCB_MossdeepGymWarpExit(void) PlaySE(SE_TK_WARPOUT); CreateTask(Task_ExitNonDoor, 10); ScriptContext2_Enable(); - sub_8085540(0xE); + SetObjectEventLoadFlag((~SKIP_OBJECT_EVENT_LOAD) & 0xF); } static void Task_ExitDoor(u8 taskId) @@ -558,7 +557,7 @@ void DoTeleportWarp(void) void DoMossdeepGymWarp(void) { - sub_8085540(1); + SetObjectEventLoadFlag(SKIP_OBJECT_EVENT_LOAD); ScriptContext2_Enable(); SaveObjectEvents(); TryFadeOutOldMapMusic(); @@ -576,19 +575,21 @@ void DoPortholeWarp(void) gFieldCallback = FieldCB_ShowPortholeView; } -static void sub_80AF8E0(u8 taskId) +#define tState data[0] + +static void Task_DoCableClubWarp(u8 taskId) { struct Task *task = &gTasks[taskId]; - switch (task->data[0]) + switch (task->tState) { case 0: ScriptContext2_Enable(); - task->data[0]++; + task->tState++; break; case 1: if (!PaletteFadeActive() && BGMusicStopped()) - task->data[0]++; + task->tState++; break; case 2: WarpIntoMap(); @@ -598,13 +599,15 @@ static void sub_80AF8E0(u8 taskId) } } +#undef tState + void DoCableClubWarp(void) { ScriptContext2_Enable(); TryFadeOutOldMapMusic(); WarpFadeOutScreen(); PlaySE(SE_KAIDAN); - CreateTask(sub_80AF8E0, 10); + CreateTask(Task_DoCableClubWarp, 10); } static void Task_ReturnToWorldFromLinkRoom(u8 taskId) @@ -727,7 +730,7 @@ static void Task_DoDoorWarp(u8 taskId) } } -static void task0A_fade_n_map_maybe(u8 taskId) +static void Task_DoContestHallWarp(u8 taskId) { struct Task *task = &gTasks[taskId]; @@ -746,7 +749,7 @@ static void task0A_fade_n_map_maybe(u8 taskId) break; case 2: WarpIntoMap(); - SetMainCallback2(sub_8086024); + SetMainCallback2(CB2_ReturnToFieldContestHall); DestroyTask(taskId); break; } @@ -760,7 +763,7 @@ void DoContestHallWarp(void) PlayRainStoppingSoundEffect(); PlaySE(SE_KAIDAN); gFieldCallback = FieldCB_WarpExitFadeFromBlack; - CreateTask(task0A_fade_n_map_maybe, 10); + CreateTask(Task_DoContestHallWarp, 10); } static void SetFlashScanlineEffectWindowBoundary(u16 *dest, u32 y, s32 left, s32 right) diff --git a/src/fieldmap.c b/src/fieldmap.c index e953e0f93..a046bf4fa 100644 --- a/src/fieldmap.c +++ b/src/fieldmap.c @@ -943,7 +943,7 @@ static bool8 SkipCopyingMetatileFromSavedMap(u16* mapMetatilePtr, u16 mapWidth, return FALSE; } -void copy_tileset_patterns_to_vram(struct Tileset const *tileset, u16 numTiles, u16 offset) +static void CopyTilesetToVram(struct Tileset const *tileset, u16 numTiles, u16 offset) { if (tileset) { @@ -954,7 +954,7 @@ void copy_tileset_patterns_to_vram(struct Tileset const *tileset, u16 numTiles, } } -void copy_tileset_patterns_to_vram2(struct Tileset const *tileset, u16 numTiles, u16 offset) +static void CopyTilesetToVramUsingHeap(struct Tileset const *tileset, u16 numTiles, u16 offset) { if (tileset) { @@ -975,7 +975,7 @@ void nullsub_90(void) } -void apply_map_tileset_palette(struct Tileset const *tileset, u16 destOffset, u16 size) +void LoadTilesetPalette(struct Tileset const *tileset, u16 destOffset, u16 size) { u16 black = RGB_BLACK; @@ -1000,45 +1000,45 @@ void apply_map_tileset_palette(struct Tileset const *tileset, u16 destOffset, u1 } } -void copy_map_tileset1_to_vram(struct MapLayout const *mapLayout) +void CopyPrimaryTilesetToVram(struct MapLayout const *mapLayout) { - copy_tileset_patterns_to_vram(mapLayout->primaryTileset, NUM_TILES_IN_PRIMARY, 0); + CopyTilesetToVram(mapLayout->primaryTileset, NUM_TILES_IN_PRIMARY, 0); } -void copy_map_tileset2_to_vram(struct MapLayout const *mapLayout) +void CopySecondaryTilesetToVram(struct MapLayout const *mapLayout) { - copy_tileset_patterns_to_vram(mapLayout->secondaryTileset, NUM_TILES_TOTAL - NUM_TILES_IN_PRIMARY, NUM_TILES_IN_PRIMARY); + CopyTilesetToVram(mapLayout->secondaryTileset, NUM_TILES_TOTAL - NUM_TILES_IN_PRIMARY, NUM_TILES_IN_PRIMARY); } -void copy_map_tileset2_to_vram_2(struct MapLayout const *mapLayout) +void CopySecondaryTilesetToVramUsingHeap(struct MapLayout const *mapLayout) { - copy_tileset_patterns_to_vram2(mapLayout->secondaryTileset, NUM_TILES_TOTAL - NUM_TILES_IN_PRIMARY, NUM_TILES_IN_PRIMARY); + CopyTilesetToVramUsingHeap(mapLayout->secondaryTileset, NUM_TILES_TOTAL - NUM_TILES_IN_PRIMARY, NUM_TILES_IN_PRIMARY); } -void apply_map_tileset1_palette(struct MapLayout const *mapLayout) +static void LoadPrimaryTilesetPalette(struct MapLayout const *mapLayout) { - apply_map_tileset_palette(mapLayout->primaryTileset, 0, NUM_PALS_IN_PRIMARY * 16 * 2); + LoadTilesetPalette(mapLayout->primaryTileset, 0, NUM_PALS_IN_PRIMARY * 16 * 2); } -void apply_map_tileset2_palette(struct MapLayout const *mapLayout) +void LoadSecondaryTilesetPalette(struct MapLayout const *mapLayout) { - apply_map_tileset_palette(mapLayout->secondaryTileset, NUM_PALS_IN_PRIMARY * 16, (NUM_PALS_TOTAL - NUM_PALS_IN_PRIMARY) * 16 * 2); + LoadTilesetPalette(mapLayout->secondaryTileset, NUM_PALS_IN_PRIMARY * 16, (NUM_PALS_TOTAL - NUM_PALS_IN_PRIMARY) * 16 * 2); } -void copy_map_tileset1_tileset2_to_vram(struct MapLayout const *mapLayout) +void CopyMapTilesetsToVram(struct MapLayout const *mapLayout) { if (mapLayout) { - copy_tileset_patterns_to_vram2(mapLayout->primaryTileset, NUM_TILES_IN_PRIMARY, 0); - copy_tileset_patterns_to_vram2(mapLayout->secondaryTileset, NUM_TILES_TOTAL - NUM_TILES_IN_PRIMARY, NUM_TILES_IN_PRIMARY); + CopyTilesetToVramUsingHeap(mapLayout->primaryTileset, NUM_TILES_IN_PRIMARY, 0); + CopyTilesetToVramUsingHeap(mapLayout->secondaryTileset, NUM_TILES_TOTAL - NUM_TILES_IN_PRIMARY, NUM_TILES_IN_PRIMARY); } } -void apply_map_tileset1_tileset2_palette(struct MapLayout const *mapLayout) +void LoadMapTilesetPalettes(struct MapLayout const *mapLayout) { if (mapLayout) { - apply_map_tileset1_palette(mapLayout); - apply_map_tileset2_palette(mapLayout); + LoadPrimaryTilesetPalette(mapLayout); + LoadSecondaryTilesetPalette(mapLayout); } } diff --git a/src/fldeff_cut.c b/src/fldeff_cut.c index 88927959e..f5e06e8f6 100644 --- a/src/fldeff_cut.c +++ b/src/fldeff_cut.c @@ -281,7 +281,7 @@ static void FieldCallback_CutGrass(void) bool8 FldEff_UseCutOnGrass(void) { - u8 taskId = oei_task_add(); + u8 taskId = CreateFieldMoveTask(); gTasks[taskId].data[8] = (u32)StartCutGrassFieldEffect >> 16; gTasks[taskId].data[9] = (u32)StartCutGrassFieldEffect; @@ -297,7 +297,7 @@ static void FieldCallback_CutTree(void) bool8 FldEff_UseCutOnTree(void) { - u8 taskId = oei_task_add(); + u8 taskId = CreateFieldMoveTask(); gTasks[taskId].data[8] = (u32)StartCutTreeFieldEffect >> 16; gTasks[taskId].data[9] = (u32)StartCutTreeFieldEffect; diff --git a/src/fldeff_dig.c b/src/fldeff_dig.c index ee5caa0df..322758a42 100644 --- a/src/fldeff_dig.c +++ b/src/fldeff_dig.c @@ -37,7 +37,7 @@ static void hm2_dig(void) bool8 FldEff_UseDig(void) { - u8 taskId = oei_task_add(); + u8 taskId = CreateFieldMoveTask(); gTasks[taskId].data[8] = (u32)sub_8135780 >> 16; gTasks[taskId].data[9] = (u32)sub_8135780; diff --git a/src/fldeff_escalator.c b/src/fldeff_escalator.c index 10fb78ee2..d1f262b5c 100644 --- a/src/fldeff_escalator.c +++ b/src/fldeff_escalator.c @@ -8,161 +8,188 @@ static EWRAM_DATA u8 sEscalatorAnim_TaskId = 0; -static void sub_80E12E8(u8 taskId, const s16 *list, u16 isImpassableFlag) -{ - s16 r5 = gTasks[taskId].data[4] - 1; - s16 r3 = gTasks[taskId].data[5] - 1; - s16 r4 = gTasks[taskId].data[1]; - s16 y; - s16 x; +static void SetEscalatorMetatile(u8 taskId, const s16 *metatileIds, u16 metatileMasks); +static void Task_DrawEscalator(u8 taskId); +static void Task_DrawTeleporterHousing(u8 taskId); +static void Task_DrawTeleporterCable(u8 taskId); - if (gTasks[taskId].data[2] == 0) - { - for (y = 0; y < 3; y++) - { - for (x = 0; x < 3; x++) - { - s16 metatileId = MapGridGetMetatileIdAt(r5 + x, r3 + y); +#define ESCALATOR_STAGES 3 +#define LAST_ESCALATOR_STAGE (ESCALATOR_STAGES - 1) - if (list[r4] == metatileId) - { - if (r4 != 2) - MapGridSetMetatileIdAt(r5 + x, r3 + y, isImpassableFlag | list[r4 + 1]); - else - MapGridSetMetatileIdAt(r5 + x, r3 + y, isImpassableFlag | list[0]); - } - } - } - } - else - { - for (y = 0; y < 3; y++) - { - for (x = 0; x < 3; x++) - { - s16 metatileId = MapGridGetMetatileIdAt(r5 + x, r3 + y); - - if (list[2 - r4] == metatileId) - { - if (r4 != 2) - MapGridSetMetatileIdAt(r5 + x, r3 + y, isImpassableFlag | list[1 - r4]); - else - MapGridSetMetatileIdAt(r5 + x, r3 + y, isImpassableFlag | list[2]); - } - } - } - } -} - -static const u16 sElevatorMetatiles_1F_0[] = { +static const u16 sElevatorMetatiles_1F_0[ESCALATOR_STAGES] = { METATILE_ID(PokemonCenter, Elevator1F_Tile0_Frame2), METATILE_ID(PokemonCenter, Elevator1F_Tile0_Frame1), METATILE_ID(PokemonCenter, Elevator1F_Tile0_Frame0) }; -static const u16 sElevatorMetatiles_1F_1[] = { +static const u16 sElevatorMetatiles_1F_1[ESCALATOR_STAGES] = { METATILE_ID(PokemonCenter, Elevator1F_Tile1_Frame2), METATILE_ID(PokemonCenter, Elevator1F_Tile1_Frame1), METATILE_ID(PokemonCenter, Elevator1F_Tile1_Frame0) }; -static const u16 sElevatorMetatiles_1F_2[] = { +static const u16 sElevatorMetatiles_1F_2[ESCALATOR_STAGES] = { METATILE_ID(PokemonCenter, Elevator1F_Tile2_Frame2), METATILE_ID(PokemonCenter, Elevator1F_Tile2_Frame1), METATILE_ID(PokemonCenter, Elevator1F_Tile2_Frame0) }; -static const u16 sElevatorMetatiles_1F_3[] = { +static const u16 sElevatorMetatiles_1F_3[ESCALATOR_STAGES] = { METATILE_ID(PokemonCenter, Elevator1F_Tile3_Frame2), METATILE_ID(PokemonCenter, Elevator1F_Tile3_Frame1), METATILE_ID(PokemonCenter, Elevator1F_Tile3_Frame0) }; -static const u16 sElevatorMetatiles_2F_0[] = { +static const u16 sElevatorMetatiles_2F_0[ESCALATOR_STAGES] = { METATILE_ID(PokemonCenter, Elevator2F_Tile0_Frame0), METATILE_ID(PokemonCenter, Elevator2F_Tile0_Frame1), METATILE_ID(PokemonCenter, Elevator2F_Tile0_Frame2) }; -static const u16 sElevatorMetatiles_2F_1[] = { +static const u16 sElevatorMetatiles_2F_1[ESCALATOR_STAGES] = { METATILE_ID(PokemonCenter, Elevator2F_Tile1_Frame0), METATILE_ID(PokemonCenter, Elevator2F_Tile1_Frame1), METATILE_ID(PokemonCenter, Elevator2F_Tile1_Frame2) }; -static const u16 sElevatorMetatiles_2F_2[] = { +static const u16 sElevatorMetatiles_2F_2[ESCALATOR_STAGES] = { METATILE_ID(PokemonCenter, Elevator2F_Tile2_Frame0), METATILE_ID(PokemonCenter, Elevator2F_Tile2_Frame1), METATILE_ID(PokemonCenter, Elevator2F_Tile2_Frame2) }; -static void sub_80E1444(u8 taskId) +#define tState data[0] +#define tTransitionStage data[1] +#define tGoingUp data[2] +#define tDrawingEscalator data[3] +#define tPlayerX data[4] +#define tPlayerY data[5] + +static void SetEscalatorMetatile(u8 taskId, const s16 *metatileIds, u16 metatileMasks) { - s16 *data = gTasks[taskId].data; + s16 x = gTasks[taskId].tPlayerX - 1; + s16 y = gTasks[taskId].tPlayerY - 1; + s16 transitionStage = gTasks[taskId].tTransitionStage; + s16 i; + s16 j; - data[3] = 1; - - switch (data[0]) + // Check all the escalator sections and only progress the selected one to the next stage + if (!gTasks[taskId].tGoingUp) { - case 0: - sub_80E12E8(taskId, sElevatorMetatiles_1F_0, 0); - break; - case 1: - sub_80E12E8(taskId, sElevatorMetatiles_1F_1, 0); - break; - case 2: - sub_80E12E8(taskId, sElevatorMetatiles_1F_2, METATILE_COLLISION_MASK); - break; - case 3: - sub_80E12E8(taskId, sElevatorMetatiles_1F_3, 0); - break; - case 4: - sub_80E12E8(taskId, sElevatorMetatiles_2F_0, METATILE_COLLISION_MASK); - break; - case 5: - sub_80E12E8(taskId, sElevatorMetatiles_2F_1, 0); - break; - case 6: - sub_80E12E8(taskId, sElevatorMetatiles_2F_2, 0); - break; + for (i = 0; i < 3; i++) + { + for (j = 0; j < 3; j++) + { + s16 metatileId = MapGridGetMetatileIdAt(x + j, y + i); + + if (metatileIds[transitionStage] == metatileId) + { + if (transitionStage != LAST_ESCALATOR_STAGE) + MapGridSetMetatileIdAt(x + j, y + i, metatileMasks | metatileIds[transitionStage + 1]); + else + MapGridSetMetatileIdAt(x + j, y + i, metatileMasks | metatileIds[0]); + } + } + } } - - data[0] = (data[0] + 1) & 7; - if (!data[0]) + else { - DrawWholeMapView(); - data[1] = (data[1] + 1) % 3; - data[3] = 0; + for (i = 0; i < 3; i++) + { + for (j = 0; j < 3; j++) + { + s16 metatileId = MapGridGetMetatileIdAt(x + j, y + i); + + if (metatileIds[LAST_ESCALATOR_STAGE - transitionStage] == metatileId) + { + if (transitionStage != LAST_ESCALATOR_STAGE) + MapGridSetMetatileIdAt(x + j, y + i, metatileMasks | metatileIds[1 - transitionStage]); + else + MapGridSetMetatileIdAt(x + j, y + i, metatileMasks | metatileIds[LAST_ESCALATOR_STAGE]); + } + } + } } } -static u8 sub_80E150C(u16 var) +static void Task_DrawEscalator(u8 taskId) { - u8 taskId = CreateTask(sub_80E1444, 0); s16 *data = gTasks[taskId].data; - PlayerGetDestCoords(&data[4], &data[5]); - data[0] = 0; - data[1] = 0; - data[2] = var; - sub_80E1444(taskId); + tDrawingEscalator = TRUE; + + // Set tile for each section of the escalator in sequence for current transition stage + switch (tState) + { + case 0: + SetEscalatorMetatile(taskId, sElevatorMetatiles_1F_0, 0); + break; + case 1: + SetEscalatorMetatile(taskId, sElevatorMetatiles_1F_1, 0); + break; + case 2: + SetEscalatorMetatile(taskId, sElevatorMetatiles_1F_2, METATILE_COLLISION_MASK); + break; + case 3: + SetEscalatorMetatile(taskId, sElevatorMetatiles_1F_3, 0); + break; + case 4: + SetEscalatorMetatile(taskId, sElevatorMetatiles_2F_0, METATILE_COLLISION_MASK); + break; + case 5: + SetEscalatorMetatile(taskId, sElevatorMetatiles_2F_1, 0); + break; + case 6: + SetEscalatorMetatile(taskId, sElevatorMetatiles_2F_2, 0); + break; + } + + tState = (tState + 1) & 7; + + // If all metatiles of the escalator have been set, draw map and progress to next stage + if (tState == 0) + { + DrawWholeMapView(); + tTransitionStage = (tTransitionStage + 1) % ESCALATOR_STAGES; + tDrawingEscalator = FALSE; + } +} + +static u8 CreateEscalatorTask(bool16 goingUp) +{ + u8 taskId = CreateTask(Task_DrawEscalator, 0); + s16 *data = gTasks[taskId].data; + + PlayerGetDestCoords(&tPlayerX, &tPlayerY); + tState = 0; + tTransitionStage = 0; + tGoingUp = goingUp; + Task_DrawEscalator(taskId); return taskId; } -void sub_80E1558(u8 var) +void StartEscalator(bool8 goingUp) { - sEscalatorAnim_TaskId = sub_80E150C(var); + sEscalatorAnim_TaskId = CreateEscalatorTask(goingUp); } -void sub_80E1570(void) +void StopEscalator(void) { DestroyTask(sEscalatorAnim_TaskId); } -bool8 sub_80E1584(void) +bool8 IsEscalatorMoving(void) { - if (gTasks[sEscalatorAnim_TaskId].data[3] == 0 && gTasks[sEscalatorAnim_TaskId].data[1] == 2) + if (gTasks[sEscalatorAnim_TaskId].tDrawingEscalator == FALSE + && gTasks[sEscalatorAnim_TaskId].tTransitionStage == LAST_ESCALATOR_STAGE) return FALSE; else return TRUE; } + +#undef tState +#undef tTransitionStage +#undef tGoingUp +#undef tDrawingEscalator +#undef tPlayerX +#undef tPlayerY diff --git a/src/fldeff_flash.c b/src/fldeff_flash.c index 3cb91d4b1..d10635a56 100644 --- a/src/fldeff_flash.c +++ b/src/fldeff_flash.c @@ -96,7 +96,7 @@ bool8 SetUpFieldMove_Flash(void) static void FieldCallback_Flash(void) { - u8 taskId = oei_task_add(); + u8 taskId = CreateFieldMoveTask(); gFieldEffectArguments[0] = GetCursorSelectionMonId(); gTasks[taskId].data[8] = (uintptr_t)FldEff_UseFlash >> 16; gTasks[taskId].data[9] = (uintptr_t)FldEff_UseFlash; diff --git a/src/fldeff_misc.c b/src/fldeff_misc.c index 9574ac563..f197b7b33 100644 --- a/src/fldeff_misc.c +++ b/src/fldeff_misc.c @@ -497,7 +497,7 @@ static void SetCurrentSecretBase(void) static void AdjustSecretPowerSpritePixelOffsets(void) { - if (gPlayerAvatar.flags & 0x6) + if (gPlayerAvatar.flags & (PLAYER_AVATAR_FLAG_MACH_BIKE | PLAYER_AVATAR_FLAG_ACRO_BIKE)) { switch (gFieldEffectArguments[1]) { @@ -590,7 +590,7 @@ static void FieldCallback_SecretBaseCave(void) bool8 FldEff_UseSecretPowerCave(void) { - u8 taskId = oei_task_add(); + u8 taskId = CreateFieldMoveTask(); gTasks[taskId].data[8] = (u32)StartSecretBaseCaveFieldEffect >> 16; gTasks[taskId].data[9] = (u32)StartSecretBaseCaveFieldEffect; @@ -650,7 +650,7 @@ static void FieldCallback_SecretBaseTree(void) bool8 FldEff_UseSecretPowerTree(void) { - u8 taskId = oei_task_add(); + u8 taskId = CreateFieldMoveTask(); gTasks[taskId].data[8] = (u32)StartSecretBaseTreeFieldEffect >> 16; gTasks[taskId].data[9] = (u32)StartSecretBaseTreeFieldEffect; @@ -724,7 +724,7 @@ static void FieldCallback_SecretBaseShrub(void) bool8 FldEff_UseSecretPowerShrub(void) { - u8 taskId = oei_task_add(); + u8 taskId = CreateFieldMoveTask(); gTasks[taskId].data[8] = (u32)StartSecretBaseShrubFieldEffect >> 16; gTasks[taskId].data[9] = (u32)StartSecretBaseShrubFieldEffect; @@ -1010,7 +1010,7 @@ void DoSecretBaseGlitterMatSparkle(void) sub_80930E0(&x, &y, 8, 4); - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[22], x, y, 0); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_SPARKLE], x, y, 0); if (spriteId != MAX_SPRITES) { gSprites[spriteId].coordOffsetEnabled = TRUE; @@ -1236,7 +1236,7 @@ static void Task_WateringBerryTreeAnim_1(u8 taskId) if (!ObjectEventIsMovementOverridden(playerObjEvent) || ObjectEventClearHeldMovementIfFinished(playerObjEvent)) { - sub_808C228(GetPlayerFacingDirection()); + SetPlayerAvatarWatering(GetPlayerFacingDirection()); ObjectEventSetHeldMovement(playerObjEvent, GetWalkInPlaceNormalMovementAction(GetPlayerFacingDirection())); gTasks[taskId].func = Task_WateringBerryTreeAnim_2; } diff --git a/src/fldeff_rocksmash.c b/src/fldeff_rocksmash.c index 614fa6135..4d7dcb66e 100644 --- a/src/fldeff_rocksmash.c +++ b/src/fldeff_rocksmash.c @@ -20,11 +20,12 @@ #include "constants/songs.h" // static functions -static void task08_080C9820(u8 taskId); -static void sub_8135578(u8 taskId); -static void sub_813552C(u8 taskId); -static void sub_813561C(u8 taskId); -static void sub_81356C4(void); +static void Task_DoFieldMove_0(u8 taskId); +static void Task_DoFieldMove_1(u8 taskId); +static void Task_DoFieldMove_2(u8 taskId); +static void Task_DoFieldMove_3(u8 taskId); + +static void FieldCallback_RockSmash(void); static void sub_8135714(void); // text @@ -46,13 +47,13 @@ bool8 CheckObjectGraphicsInFrontOfPlayer(u8 graphicsId) } } -u8 oei_task_add(void) +u8 CreateFieldMoveTask(void) { GetXYCoordsOneStepInFrontOfPlayer(&gPlayerFacingPosition.x, &gPlayerFacingPosition.y); - return CreateTask(task08_080C9820, 8); + return CreateTask(Task_DoFieldMove_0, 8); } -static void task08_080C9820(u8 taskId) +static void Task_DoFieldMove_0(u8 taskId) { u8 objEventId; @@ -65,47 +66,47 @@ static void task08_080C9820(u8 taskId) if (gMapHeader.mapType == MAP_TYPE_UNDERWATER) { FieldEffectStart(FLDEFF_FIELD_MOVE_SHOW_MON_INIT); - gTasks[taskId].func = sub_8135578; + gTasks[taskId].func = Task_DoFieldMove_2; } else { - sub_808C114(); + SetPlayerAvatarFieldMove(); ObjectEventSetHeldMovement(&gObjectEvents[objEventId], MOVEMENT_ACTION_START_ANIM_IN_DIRECTION); - gTasks[taskId].func = sub_813552C; + gTasks[taskId].func = Task_DoFieldMove_1; } } } -static void sub_813552C(u8 taskId) +static void Task_DoFieldMove_1(u8 taskId) { if (ObjectEventCheckHeldMovementStatus(&gObjectEvents[gPlayerAvatar.objectEventId]) == TRUE) { FieldEffectStart(FLDEFF_FIELD_MOVE_SHOW_MON_INIT); - gTasks[taskId].func = sub_8135578; + gTasks[taskId].func = Task_DoFieldMove_2; } } -static void sub_8135578(u8 taskId) +static void Task_DoFieldMove_2(u8 taskId) { if (!FieldEffectActiveListContains(FLDEFF_FIELD_MOVE_SHOW_MON)) { gFieldEffectArguments[1] = GetPlayerFacingDirection(); - if (gFieldEffectArguments[1] == 1) + if (gFieldEffectArguments[1] == DIR_SOUTH) gFieldEffectArguments[2] = 0; - if (gFieldEffectArguments[1] == 2) + if (gFieldEffectArguments[1] == DIR_NORTH) gFieldEffectArguments[2] = 1; - if (gFieldEffectArguments[1] == 3) + if (gFieldEffectArguments[1] == DIR_WEST) gFieldEffectArguments[2] = 2; - if (gFieldEffectArguments[1] == 4) + if (gFieldEffectArguments[1] == DIR_EAST) gFieldEffectArguments[2] = 3; ObjectEventSetGraphicsId(&gObjectEvents[gPlayerAvatar.objectEventId], GetPlayerAvatarGraphicsIdByCurrentState()); StartSpriteAnim(&gSprites[gPlayerAvatar.spriteId], gFieldEffectArguments[2]); - FieldEffectActiveListRemove(6); - gTasks[taskId].func = sub_813561C; + FieldEffectActiveListRemove(FLDEFF_FIELD_MOVE_SHOW_MON); + gTasks[taskId].func = Task_DoFieldMove_3; } } -static void sub_813561C(u8 taskId) +static void Task_DoFieldMove_3(u8 taskId) { void (*func)(void) = (void (*)(void))(((u16)gTasks[taskId].data[8] << 16) | (u16)gTasks[taskId].data[9]); @@ -128,7 +129,7 @@ bool8 SetUpFieldMove_RockSmash(void) else if (CheckObjectGraphicsInFrontOfPlayer(OBJ_EVENT_GFX_BREAKABLE_ROCK) == TRUE) { gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu; - gPostMenuFieldCallback = sub_81356C4; + gPostMenuFieldCallback = FieldCallback_RockSmash; return TRUE; } else @@ -137,7 +138,7 @@ bool8 SetUpFieldMove_RockSmash(void) } } -static void sub_81356C4(void) +static void FieldCallback_RockSmash(void) { gFieldEffectArguments[0] = GetCursorSelectionMonId(); ScriptContext1_SetupScript(EventScript_FldEffRockSmash); @@ -145,7 +146,7 @@ static void sub_81356C4(void) bool8 FldEff_UseRockSmash(void) { - u8 taskId = oei_task_add(); + u8 taskId = CreateFieldMoveTask(); gTasks[taskId].data[8] = (u32)sub_8135714 >> 16; gTasks[taskId].data[9] = (u32)sub_8135714; diff --git a/src/fldeff_strength.c b/src/fldeff_strength.c index f479ef68d..800e45821 100644 --- a/src/fldeff_strength.c +++ b/src/fldeff_strength.c @@ -35,7 +35,7 @@ static void FldEff_UseStrength(void) bool8 sub_8145E2C(void) { - u8 taskId = oei_task_add(); + u8 taskId = CreateFieldMoveTask(); gTasks[taskId].data[8] = (u32)sub_8145E74 >> 16; gTasks[taskId].data[9] = (u32)sub_8145E74; GetMonNickname(&gPlayerParty[gFieldEffectArguments[0]], gStringVar1); diff --git a/src/fldeff_sweetscent.c b/src/fldeff_sweetscent.c index 788310b5d..1ee82674e 100644 --- a/src/fldeff_sweetscent.c +++ b/src/fldeff_sweetscent.c @@ -41,7 +41,7 @@ bool8 FldEff_SweetScent(void) u8 taskId; SetWeatherScreenFadeOut(); - taskId = oei_task_add(); + taskId = CreateFieldMoveTask(); gTasks[taskId].data[8] = (u32)StartSweetScentFieldEffect >> 16; gTasks[taskId].data[9] = (u32)StartSweetScentFieldEffect; return FALSE; diff --git a/src/fldeff_teleport.c b/src/fldeff_teleport.c index cbf8ee6cc..3f087e5da 100644 --- a/src/fldeff_teleport.c +++ b/src/fldeff_teleport.c @@ -30,7 +30,7 @@ static void FieldCallback_Teleport(void) bool8 FldEff_UseTeleport(void) { - u8 taskId = oei_task_add(); + u8 taskId = CreateFieldMoveTask(); gTasks[taskId].data[8] = (u32)StartTeleportFieldEffect >> 16; gTasks[taskId].data[9] = (u32)StartTeleportFieldEffect; SetPlayerAvatarTransitionFlags(PLAYER_AVATAR_FLAG_ON_FOOT); @@ -40,5 +40,5 @@ bool8 FldEff_UseTeleport(void) static void StartTeleportFieldEffect(void) { FieldEffectActiveListRemove(FLDEFF_USE_TELEPORT); - CreateTeleportFieldEffectTask(); + FldEff_TeleportWarpOut(); } diff --git a/src/hall_of_fame.c b/src/hall_of_fame.c index 1606c2de5..5405b7c42 100644 --- a/src/hall_of_fame.c +++ b/src/hall_of_fame.c @@ -1299,7 +1299,7 @@ static bool8 sub_8175024(void) break; case 3: InitStandardTextBoxWindows(); - sub_8197200(); + InitTextBoxGfxAndPrinters(); break; case 4: SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON); diff --git a/src/item_menu.c b/src/item_menu.c index 43e657328..7b069303a 100755 --- a/src/item_menu.c +++ b/src/item_menu.c @@ -600,7 +600,7 @@ void CB2_BagMenuRun(void) RunTasks(); AnimateSprites(); BuildOamBuffer(); - do_scheduled_bg_tilemap_copies_to_vram(); + DoScheduledBgTilemapCopiesToVram(); UpdatePaletteFade(); } @@ -627,7 +627,7 @@ bool8 SetupBagMenu(void) { case 0: SetVBlankHBlankCallbacksToNull(); - clear_scheduled_bg_copies_to_vram(); + ClearScheduledBgCopiesToVram(); gMain.state++; break; case 1: diff --git a/src/menu.c b/src/menu.c index 738c904ce..9cd7ca6b1 100644 --- a/src/menu.c +++ b/src/menu.c @@ -57,9 +57,9 @@ static EWRAM_DATA u8 sPaletteNum = 0; static EWRAM_DATA u8 sYesNoWindowId = 0; static EWRAM_DATA u8 sWindowId = 0; static EWRAM_DATA u16 sFiller = 0; // needed to align -static EWRAM_DATA bool8 gUnknown_0203CDA4[4] = {FALSE}; -static EWRAM_DATA u16 gUnknown_0203CDA8 = 0; -static EWRAM_DATA void *gUnknown_0203CDAC[0x20] = {NULL}; +static EWRAM_DATA bool8 sScheduledBgCopiesToVram[4] = {FALSE}; +static EWRAM_DATA u16 sTempTileDataBufferIdx = 0; +static EWRAM_DATA void *sTempTileDataBuffer[0x20] = {NULL}; const u16 gUnknown_0860F074[] = INCBIN_U16("graphics/interface/860F074.gbapal"); @@ -154,7 +154,7 @@ void FreeAllOverworldWindowBuffers(void) FreeAllWindowBuffers(); } -void sub_8197200(void) +void InitTextBoxGfxAndPrinters(void) { ChangeBgX(0, 0, 0); ChangeBgY(0, 0, 0); @@ -1737,48 +1737,48 @@ u8 sub_8199944(u8 windowId, u8 optionWidth, u8 columns, u8 rows, u8 initialCurso return sMenu.cursorPos; } -void clear_scheduled_bg_copies_to_vram(void) +void ClearScheduledBgCopiesToVram(void) { - memset(gUnknown_0203CDA4, 0, sizeof(gUnknown_0203CDA4)); + memset(sScheduledBgCopiesToVram, 0, sizeof(sScheduledBgCopiesToVram)); } void ScheduleBgCopyTilemapToVram(u8 bgId) { - gUnknown_0203CDA4[bgId] = TRUE; + sScheduledBgCopiesToVram[bgId] = TRUE; } -void do_scheduled_bg_tilemap_copies_to_vram(void) +void DoScheduledBgTilemapCopiesToVram(void) { - if (gUnknown_0203CDA4[0] == TRUE) + if (sScheduledBgCopiesToVram[0] == TRUE) { CopyBgTilemapBufferToVram(0); - gUnknown_0203CDA4[0] = FALSE; + sScheduledBgCopiesToVram[0] = FALSE; } - if (gUnknown_0203CDA4[1] == TRUE) + if (sScheduledBgCopiesToVram[1] == TRUE) { CopyBgTilemapBufferToVram(1); - gUnknown_0203CDA4[1] = FALSE; + sScheduledBgCopiesToVram[1] = FALSE; } - if (gUnknown_0203CDA4[2] == TRUE) + if (sScheduledBgCopiesToVram[2] == TRUE) { CopyBgTilemapBufferToVram(2); - gUnknown_0203CDA4[2] = FALSE; + sScheduledBgCopiesToVram[2] = FALSE; } - if (gUnknown_0203CDA4[3] == TRUE) + if (sScheduledBgCopiesToVram[3] == TRUE) { CopyBgTilemapBufferToVram(3); - gUnknown_0203CDA4[3] = FALSE; + sScheduledBgCopiesToVram[3] = FALSE; } } void ResetTempTileDataBuffers(void) { int i; - for (i = 0; i < (s32)ARRAY_COUNT(gUnknown_0203CDAC); i++) + for (i = 0; i < (int)ARRAY_COUNT(sTempTileDataBuffer); i++) { - gUnknown_0203CDAC[i] = NULL; + sTempTileDataBuffer[i] = NULL; } - gUnknown_0203CDA8 = 0; + sTempTileDataBufferIdx = 0; } bool8 FreeTempTileDataBuffersIfPossible(void) @@ -1787,13 +1787,13 @@ bool8 FreeTempTileDataBuffersIfPossible(void) if (!IsDma3ManagerBusyWithBgCopy()) { - if (gUnknown_0203CDA8) + if (sTempTileDataBufferIdx) { - for (i = 0; i < gUnknown_0203CDA8; i++) + for (i = 0; i < sTempTileDataBufferIdx; i++) { - FREE_AND_SET_NULL(gUnknown_0203CDAC[i]); + FREE_AND_SET_NULL(sTempTileDataBuffer[i]); } - gUnknown_0203CDA8 = 0; + sTempTileDataBufferIdx = 0; } return FALSE; } @@ -1806,7 +1806,7 @@ bool8 FreeTempTileDataBuffersIfPossible(void) void *DecompressAndCopyTileDataToVram(u8 bgId, const void *src, u32 size, u16 offset, u8 mode) { u32 sizeOut; - if (gUnknown_0203CDA8 < ARRAY_COUNT(gUnknown_0203CDAC)) + if (sTempTileDataBufferIdx < ARRAY_COUNT(sTempTileDataBuffer)) { void *ptr = malloc_and_decompress(src, &sizeOut); if (!size) @@ -1814,7 +1814,7 @@ void *DecompressAndCopyTileDataToVram(u8 bgId, const void *src, u32 size, u16 of if (ptr) { copy_decompressed_tile_data_to_vram(bgId, ptr, size, offset, mode); - gUnknown_0203CDAC[gUnknown_0203CDA8++] = ptr; + sTempTileDataBuffer[sTempTileDataBufferIdx++] = ptr; } return ptr; } diff --git a/src/move_relearner.c b/src/move_relearner.c index 8c4cf7b2e..1c863804b 100644 --- a/src/move_relearner.c +++ b/src/move_relearner.c @@ -384,7 +384,7 @@ static void CB2_InitLearnMove(void) ResetSpriteData(); FreeAllSpritePalettes(); ResetTasks(); - clear_scheduled_bg_copies_to_vram(); + ClearScheduledBgCopiesToVram(); sMoveRelearnerStruct = AllocZeroed(sizeof(*sMoveRelearnerStruct)); sMoveRelearnerStruct->partyMon = gSpecialVar_0x8004; SetVBlankCallback(VBlankCB_MoveRelearner); @@ -412,7 +412,7 @@ static void CB2_InitLearnMoveReturnFromSelectMove(void) ResetSpriteData(); FreeAllSpritePalettes(); ResetTasks(); - clear_scheduled_bg_copies_to_vram(); + ClearScheduledBgCopiesToVram(); sMoveRelearnerStruct = AllocZeroed(sizeof(*sMoveRelearnerStruct)); sMoveRelearnerStruct->state = MENU_STATE_FADE_FROM_SUMMARY_SCREEN; sMoveRelearnerStruct->partyMon = gSpecialVar_0x8004; @@ -452,7 +452,7 @@ static void CB2_MoveRelearnerMain(void) RunTasks(); AnimateSprites(); BuildOamBuffer(); - do_scheduled_bg_tilemap_copies_to_vram(); + DoScheduledBgTilemapCopiesToVram(); UpdatePaletteFade(); } diff --git a/src/naming_screen.c b/src/naming_screen.c index 161d4a7e0..83285d89d 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -347,7 +347,7 @@ static void NamingScreen_InitBGs(void) ChangeBgY(3, 0, 0); InitStandardTextBoxWindows(); - sub_8197200(); + InitTextBoxGfxAndPrinters(); for (i = 0; i < 5; i++) gNamingScreenData->windows[i] = AddWindow(&gUnknown_0858BE10[i]); diff --git a/src/overworld.c b/src/overworld.c index 8937af8f1..530699f83 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -7,10 +7,11 @@ #include "cable_club.h" #include "clock.h" #include "event_data.h" +#include "event_object_movement.h" +#include "event_scripts.h" #include "field_camera.h" #include "field_control_avatar.h" #include "field_effect.h" -#include "event_object_movement.h" #include "field_message_box.h" #include "field_player_avatar.h" #include "field_screen_effect.h" @@ -22,6 +23,7 @@ #include "fldeff.h" #include "gpu_regs.h" #include "heal_location.h" +#include "io_reg.h" #include "link.h" #include "link_rfu.h" #include "load_save.h" @@ -82,44 +84,22 @@ #define FACING_FORCED_LEFT 9 #define FACING_FORCED_RIGHT 10 -// event scripts -extern const u8 EventScript_WhiteOut[]; -extern const u8 EventScript_ResetMrBriney[]; -extern const u8 EventScript_DoLinkRoomExit[]; -extern const u8 CableClub_EventScript_TooBusyToNotice[]; -extern const u8 CableClub_EventScript_ReadTrainerCard[]; -extern const u8 CableClub_EventScript_ReadTrainerCardColored[]; -extern const u8 EventScript_BattleColosseum_4P_PlayerSpot0[]; -extern const u8 EventScript_BattleColosseum_4P_PlayerSpot1[]; -extern const u8 EventScript_BattleColosseum_4P_PlayerSpot2[]; -extern const u8 EventScript_BattleColosseum_4P_PlayerSpot3[]; -extern const u8 EventScript_RecordCenter_Spot0[]; -extern const u8 EventScript_RecordCenter_Spot1[]; -extern const u8 EventScript_RecordCenter_Spot2[]; -extern const u8 EventScript_RecordCenter_Spot3[]; -extern const u8 EventScript_BattleColosseum_2P_PlayerSpot0[]; -extern const u8 EventScript_BattleColosseum_2P_PlayerSpot1[]; -extern const u8 EventScript_TradeCenter_Chair1[]; -extern const u8 EventScript_TradeCenter_Chair0[]; -extern const u8 EventScript_ConfirmLeaveTradeRoom[]; -extern const u8 EventScript_TerminateLink[]; - extern const struct MapLayout *const gMapLayouts[]; extern const struct MapHeader *const *const gMapGroups[]; -extern const int gMaxFlashLevel; -extern const u16 gOverworldBackgroundLayerFlags[]; static void Overworld_ResetStateAfterWhiteOut(void); -static void c2_80567AC(void); +static void CB2_ReturnToFieldLocal(void); +static void CB2_ReturnToFieldLink(void); +static void CB2_LoadMapOnReturnToFieldCableClub(void); static void CB2_LoadMap2(void); static void VBlankCB_Field(void); static void SpriteCB_LinkPlayer(struct Sprite *sprite); static void ChooseAmbientCrySpecies(void); -static void do_load_map_stuff_loop(u8 *state); -static bool32 map_loading_iteration_3(u8 *state); -static bool32 sub_8086638(u8 *state); -static bool32 load_map_stuff(u8 *state, u32); -static bool32 map_loading_iteration_2_link(u8 *state); +static void DoMapLoadLoop(u8 *state); +static bool32 LoadMapInStepsLink(u8 *state); +static bool32 ReturnToFieldLocal(u8 *state); +static bool32 LoadMapInStepsLocal(u8 *state, bool32); +static bool32 ReturnToFieldLink(u8 *state); static void mli4_mapscripts_and_other(void); static void InitOverworldGraphicsRegisters(void); static u8 GetSpriteForLinkedPlayer(u8); @@ -131,7 +111,7 @@ static void sub_80869DC(void); static void sub_8086B14(void); static void SetCameraToTrackGuestPlayer(void); static void sub_8086988(bool32 arg0); -static void sub_8086A80(void); +static void SetCameraToTrackPlayer(void); static void sub_8086A68(void); static void sub_8086860(void); static void SetCameraToTrackGuestPlayer_2(void); @@ -155,7 +135,7 @@ static void InitLinkPlayerObjectEventPos(struct ObjectEvent *objEvent, s16 x, s1 static void sub_80877DC(u8 linkPlayerId, u8 a2); static void sub_808780C(u8 linkPlayerId); static u8 GetSpriteForLinkedPlayer(u8 linkPlayerId); -static void sub_8087584(void); +static void RunTerminateLinkScript(void); static u32 GetLinkSendQueueLength(void); static void ZeroLinkPlayerObjectEvent(struct LinkPlayerObjectEvent *linkPlayerObjEvent); static const u8 *TryInteractWithPlayer(struct TradeRoomPlayer *a1); @@ -181,14 +161,14 @@ static void CB1_UpdateLinkState(void); static void SetKeyInterceptCallback(u16 (*func)(u32)); static void SetFieldVBlankCallback(void); static void FieldClearVBlankHBlankCallbacks(void); -static void sub_8085810(void); +static void TransitionMapMusic(void); static u8 GetAdjustedInitialTransitionFlags(struct InitialPlayerAvatarState *playerStruct, u16 a2, u8 a3); static u8 GetAdjustedInitialDirection(struct InitialPlayerAvatarState *playerStruct, u8 a2, u16 a3, u8 a4); static u16 GetCenterScreenMetatileBehavior(void); // IWRAM bss vars static void *sUnusedOverworldCallback; -static u8 sPlayerTradingStates[4]; +static u8 sPlayerTradingStates[MAX_LINK_PLAYERS]; // This callback is called with a player's key code. It then returns an // adjusted key code, effectively intercepting the input before anything // can process it. @@ -208,13 +188,13 @@ u8 gLocalLinkPlayerId; // This is our player id in a multiplayer mode. u8 gFieldLinkPlayerCount; // EWRAM vars -EWRAM_DATA static u8 sUnknown_020322D8 = 0; +EWRAM_DATA static u8 sObjectEventLoadFlag = 0; EWRAM_DATA struct WarpData gLastUsedWarp = {0}; EWRAM_DATA static struct WarpData sWarpDestination = {0}; // new warp position -EWRAM_DATA static struct WarpData gFixedDiveWarp = {0}; -EWRAM_DATA static struct WarpData gFixedHoleWarp = {0}; +EWRAM_DATA static struct WarpData sFixedDiveWarp = {0}; +EWRAM_DATA static struct WarpData sFixedHoleWarp = {0}; EWRAM_DATA static u16 sLastMapSectionId = 0; -EWRAM_DATA static struct InitialPlayerAvatarState gInitialPlayerAvatarState = {0}; +EWRAM_DATA static struct InitialPlayerAvatarState sInitialPlayerAvatarState = {0}; EWRAM_DATA static u16 sAmbientCrySpecies = 0; EWRAM_DATA static bool8 sIsAmbientCryWaterMon = FALSE; EWRAM_DATA struct LinkPlayerObjectEvent gLinkPlayerObjectEvents[4] = {0}; @@ -229,16 +209,9 @@ static const struct WarpData sDummyWarpData = .y = -1, }; -static const u8 sUnusedData[] = +static const u32 sUnusedData[] = { - 0xB0, 0x04, 0x00, 0x00, - 0x10, 0x0E, 0x00, 0x00, - 0xB0, 0x04, 0x00, 0x00, - 0x60, 0x09, 0x00, 0x00, - 0x32, 0x00, 0x00, 0x00, - 0x50, 0x00, 0x00, 0x00, - 0xD4, 0xFF, 0xFF, 0xFF, - 0x2C, 0x00, 0x00, 0x00, + 1200, 3600, 1200, 2400, 50, 80, -44, 44 }; const struct UCoords32 gDirectionToVectors[] = @@ -549,9 +522,9 @@ void Overworld_SetObjEventTemplateMovementType(u8 localId, u8 movementType) static void mapdata_load_assets_to_gpu_and_full_redraw(void) { - move_tilemap_camera_to_upper_left_corner(); - copy_map_tileset1_tileset2_to_vram(gMapHeader.mapLayout); - apply_map_tileset1_tileset2_palette(gMapHeader.mapLayout); + ResetFieldCamera(); + CopyMapTilesetsToVram(gMapHeader.mapLayout); + LoadMapTilesetPalettes(gMapHeader.mapLayout); DrawWholeMapView(); InitTilesetAnimations(); } @@ -568,14 +541,14 @@ void ApplyCurrentWarp(void) { gLastUsedWarp = gSaveBlock1Ptr->location; gSaveBlock1Ptr->location = sWarpDestination; - gFixedDiveWarp = sDummyWarpData; - gFixedHoleWarp = sDummyWarpData; + sFixedDiveWarp = sDummyWarpData; + sFixedHoleWarp = sDummyWarpData; } static void ClearDiveAndHoleWarps(void) { - gFixedDiveWarp = sDummyWarpData; - gFixedHoleWarp = sDummyWarpData; + sFixedDiveWarp = sDummyWarpData; + sFixedHoleWarp = sDummyWarpData; } static void SetWarpData(struct WarpData *warp, s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y) @@ -717,25 +690,25 @@ void SetWarpDestinationToEscapeWarp(void) void SetFixedDiveWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y) { - SetWarpData(&gFixedDiveWarp, mapGroup, mapNum, warpId, x, y); + SetWarpData(&sFixedDiveWarp, mapGroup, mapNum, warpId, x, y); } static void SetWarpDestinationToDiveWarp(void) { - sWarpDestination = gFixedDiveWarp; + sWarpDestination = sFixedDiveWarp; } void SetFixedHoleWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y) { - SetWarpData(&gFixedHoleWarp, mapGroup, mapNum, warpId, x, y); + SetWarpData(&sFixedHoleWarp, mapGroup, mapNum, warpId, x, y); } void SetWarpDestinationToFixedHoleWarp(s16 x, s16 y) { - if (IsDummyWarp(&gFixedHoleWarp) == TRUE) + if (IsDummyWarp(&sFixedHoleWarp) == TRUE) sWarpDestination = gLastUsedWarp; else - SetWarpDestination(gFixedHoleWarp.mapGroup, gFixedHoleWarp.mapNum, -1, x, y); + SetWarpDestination(sFixedHoleWarp.mapGroup, sFixedHoleWarp.mapNum, -1, x, y); } static void SetWarpDestinationToContinueGameWarp(void) @@ -787,7 +760,7 @@ static bool8 SetDiveWarp(u8 dir, u16 x, u16 y) else { RunOnDiveWarpMapScript(); - if (IsDummyWarp(&gFixedDiveWarp)) + if (IsDummyWarp(&sFixedDiveWarp)) return FALSE; SetWarpDestinationToDiveWarp(); } @@ -809,8 +782,10 @@ void LoadMapFromCameraTransition(u8 mapGroup, u8 mapNum) s32 paletteIndex; SetWarpDestination(mapGroup, mapNum, -1, -1, -1); - if (gMapHeader.regionMapSectionId != 0x3A) - sub_8085810(); + + // Dont transition map music between BF Outside West/East + if (gMapHeader.regionMapSectionId != MAPSEC_BATTLE_FRONTIER) + TransitionMapMusic(); ApplyCurrentWarp(); LoadCurrentMapData(); @@ -827,8 +802,8 @@ void LoadMapFromCameraTransition(u8 mapGroup, u8 mapNum) Overworld_ClearSavedMusic(); RunOnTransitionMapScript(); InitMap(); - copy_map_tileset2_to_vram_2(gMapHeader.mapLayout); - apply_map_tileset2_palette(gMapHeader.mapLayout); + CopySecondaryTilesetToVramUsingHeap(gMapHeader.mapLayout); + LoadSecondaryTilesetPalette(gMapHeader.mapLayout); for (paletteIndex = 6; paletteIndex < 13; paletteIndex++) ApplyWeatherGammaShiftToPal(paletteIndex); @@ -840,17 +815,18 @@ void LoadMapFromCameraTransition(u8 mapGroup, u8 mapNum) ResetFieldTasksArgs(); RunOnResumeMapScript(); - if (gMapHeader.regionMapSectionId != MAPSEC_BATTLE_FRONTIER || gMapHeader.regionMapSectionId != sLastMapSectionId) + if (gMapHeader.regionMapSectionId != MAPSEC_BATTLE_FRONTIER + || gMapHeader.regionMapSectionId != sLastMapSectionId) ShowMapNamePopup(); } -static void mli0_load_map(u32 a1) +static void LoadMapFromWarp(bool32 a1) { bool8 isOutdoors; bool8 isIndoors; LoadCurrentMapData(); - if (!(sUnknown_020322D8 & 1)) + if (!(sObjectEventLoadFlag & SKIP_OBJECT_EVENT_LOAD)) { if (gMapHeader.mapLayoutId == LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_FLOOR) LoadBattlePyramidObjectEventTemplates(); @@ -869,7 +845,7 @@ static void mli0_load_map(u32 a1) ResetCyclingRoadChallengeData(); RestartWildEncounterImmunitySteps(); TryUpdateRandomTrainerRematches(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum); - if (a1 != 1) + if (a1 != TRUE) DoTimeBasedEvents(); SetSav1WeatherFromCurrMapHeader(); ChooseAmbientCrySpecies(); @@ -887,7 +863,7 @@ static void mli0_load_map(u32 a1) else InitMap(); - if (a1 != 1 && isIndoors) + if (a1 != TRUE && isIndoors) { UpdateTVScreensOnMap(gBackupMapLayout.width, gBackupMapLayout.height); InitSecretBaseAppearance(TRUE); @@ -896,24 +872,24 @@ static void mli0_load_map(u32 a1) void ResetInitialPlayerAvatarState(void) { - gInitialPlayerAvatarState.direction = DIR_SOUTH; - gInitialPlayerAvatarState.transitionFlags = PLAYER_AVATAR_FLAG_ON_FOOT; + sInitialPlayerAvatarState.direction = DIR_SOUTH; + sInitialPlayerAvatarState.transitionFlags = PLAYER_AVATAR_FLAG_ON_FOOT; } void StoreInitialPlayerAvatarState(void) { - gInitialPlayerAvatarState.direction = GetPlayerFacingDirection(); + sInitialPlayerAvatarState.direction = GetPlayerFacingDirection(); if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_MACH_BIKE)) - gInitialPlayerAvatarState.transitionFlags = PLAYER_AVATAR_FLAG_MACH_BIKE; + sInitialPlayerAvatarState.transitionFlags = PLAYER_AVATAR_FLAG_MACH_BIKE; else if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_ACRO_BIKE)) - gInitialPlayerAvatarState.transitionFlags = PLAYER_AVATAR_FLAG_ACRO_BIKE; + sInitialPlayerAvatarState.transitionFlags = PLAYER_AVATAR_FLAG_ACRO_BIKE; else if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING)) - gInitialPlayerAvatarState.transitionFlags = PLAYER_AVATAR_FLAG_SURFING; + sInitialPlayerAvatarState.transitionFlags = PLAYER_AVATAR_FLAG_SURFING; else if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_UNDERWATER)) - gInitialPlayerAvatarState.transitionFlags = PLAYER_AVATAR_FLAG_UNDERWATER; + sInitialPlayerAvatarState.transitionFlags = PLAYER_AVATAR_FLAG_UNDERWATER; else - gInitialPlayerAvatarState.transitionFlags = PLAYER_AVATAR_FLAG_ON_FOOT; + sInitialPlayerAvatarState.transitionFlags = PLAYER_AVATAR_FLAG_ON_FOOT; } static struct InitialPlayerAvatarState *GetInitialPlayerAvatarState(void) @@ -921,11 +897,11 @@ static struct InitialPlayerAvatarState *GetInitialPlayerAvatarState(void) struct InitialPlayerAvatarState playerStruct; u8 mapType = GetCurrentMapType(); u16 metatileBehavior = GetCenterScreenMetatileBehavior(); - u8 transitionFlags = GetAdjustedInitialTransitionFlags(&gInitialPlayerAvatarState, metatileBehavior, mapType); + u8 transitionFlags = GetAdjustedInitialTransitionFlags(&sInitialPlayerAvatarState, metatileBehavior, mapType); playerStruct.transitionFlags = transitionFlags; - playerStruct.direction = GetAdjustedInitialDirection(&gInitialPlayerAvatarState, transitionFlags, metatileBehavior, mapType); - gInitialPlayerAvatarState = playerStruct; - return &gInitialPlayerAvatarState; + playerStruct.direction = GetAdjustedInitialDirection(&sInitialPlayerAvatarState, transitionFlags, metatileBehavior, mapType); + sInitialPlayerAvatarState = playerStruct; + return &sInitialPlayerAvatarState; } static u8 GetAdjustedInitialTransitionFlags(struct InitialPlayerAvatarState *playerStruct, u16 metatileBehavior, u8 mapType) @@ -1012,14 +988,15 @@ void SetCurrentMapLayout(u16 mapLayoutId) gMapHeader.mapLayout = GetMapLayout(); } -void sub_8085540(u8 var) +void SetObjectEventLoadFlag(u8 flag) { - sUnknown_020322D8 = var; + sObjectEventLoadFlag = flag; } -u8 sub_808554C(void) +// Unused, sObjectEventLoadFlag is read directly +static u8 GetObjectEventLoadFlag(void) { - return sUnknown_020322D8; + return sObjectEventLoadFlag; } static bool16 ShouldLegendaryMusicPlayAtLocation(struct WarpData *warp) @@ -1179,10 +1156,10 @@ void Overworld_SetSavedMusic(u16 songNum) void Overworld_ClearSavedMusic(void) { - gSaveBlock1Ptr->savedMusic = 0; + gSaveBlock1Ptr->savedMusic = MUS_DUMMY; } -static void sub_8085810(void) +static void TransitionMapMusic(void) { if (FlagGet(FLAG_DONT_TRANSITION_MUSIC) != TRUE) { @@ -1477,7 +1454,7 @@ static void OverworldBasic(void) BuildOamBuffer(); UpdatePaletteFade(); UpdateTilesetAnimations(); - do_scheduled_bg_tilemap_copies_to_vram(); + DoScheduledBgTilemapCopiesToVram(); } // This CB2 is used when starting @@ -1507,7 +1484,7 @@ void SetUnusedCallback(void *func) sUnusedOverworldCallback = func; } -static bool8 map_post_load_hook_exec(void) +static bool8 RunFieldCallback(void) { if (gFieldCallback2) { @@ -1546,7 +1523,7 @@ void CB2_NewGame(void) ScriptContext2_Disable(); gFieldCallback = ExecuteTruckSequence; gFieldCallback2 = NULL; - do_load_map_stuff_loop(&gMain.state); + DoMapLoadLoop(&gMain.state); SetFieldVBlankCallback(); SetMainCallback1(CB1_Overworld); SetMainCallback2(CB2_Overworld); @@ -1554,7 +1531,7 @@ void CB2_NewGame(void) void CB2_WhiteOut(void) { - u8 val; + u8 state; if (++gMain.state >= 120) { @@ -1566,8 +1543,8 @@ void CB2_WhiteOut(void) ScriptContext1_Init(); ScriptContext2_Disable(); gFieldCallback = FieldCB_WarpExitFadeFromBlack; - val = 0; - do_load_map_stuff_loop(&val); + state = 0; + DoMapLoadLoop(&state); SetFieldVBlankCallback(); SetMainCallback1(CB1_Overworld); SetMainCallback2(CB2_Overworld); @@ -1586,13 +1563,13 @@ void CB2_LoadMap(void) static void CB2_LoadMap2(void) { - do_load_map_stuff_loop(&gMain.state); + DoMapLoadLoop(&gMain.state); SetFieldVBlankCallback(); SetMainCallback1(CB1_Overworld); SetMainCallback2(CB2_Overworld); } -void sub_8086024(void) +void CB2_ReturnToFieldContestHall(void) { if (!gMain.state) { @@ -1601,7 +1578,7 @@ void sub_8086024(void) ScriptContext2_Disable(); SetMainCallback1(NULL); } - if (load_map_stuff(&gMain.state, 1)) + if (LoadMapInStepsLocal(&gMain.state, TRUE)) { SetFieldVBlankCallback(); SetMainCallback1(CB1_Overworld); @@ -1613,12 +1590,12 @@ void CB2_ReturnToFieldCableClub(void) { FieldClearVBlankHBlankCallbacks(); gFieldCallback = FieldCB_ReturnToFieldWirelessLink; - SetMainCallback2(c2_80567AC); + SetMainCallback2(CB2_LoadMapOnReturnToFieldCableClub); } -static void c2_80567AC(void) +static void CB2_LoadMapOnReturnToFieldCableClub(void) { - if (map_loading_iteration_3(&gMain.state)) + if (LoadMapInStepsLink(&gMain.state)) { SetFieldVBlankCallback(); SetMainCallback1(CB1_UpdateLinkState); @@ -1640,18 +1617,18 @@ void CB2_ReturnToField(void) } } -void CB2_ReturnToFieldLocal(void) +static void CB2_ReturnToFieldLocal(void) { - if (sub_8086638(&gMain.state)) + if (ReturnToFieldLocal(&gMain.state)) { SetFieldVBlankCallback(); SetMainCallback2(CB2_Overworld); } } -void CB2_ReturnToFieldLink(void) +static void CB2_ReturnToFieldLink(void) { - if (!sub_8087598() && map_loading_iteration_2_link(&gMain.state)) + if (!sub_8087598() && ReturnToFieldLink(&gMain.state)) SetMainCallback2(CB2_Overworld); } @@ -1812,7 +1789,7 @@ static void InitCurrentFlashLevelScanlineEffect(void) } } -static bool32 map_loading_iteration_3(u8 *state) +static bool32 LoadMapInStepsLink(u8 *state) { switch (*state) { @@ -1825,7 +1802,7 @@ static bool32 map_loading_iteration_3(u8 *state) (*state)++; break; case 1: - mli0_load_map(1); + LoadMapFromWarp(TRUE); (*state)++; break; case 2: @@ -1842,25 +1819,25 @@ static bool32 map_loading_iteration_3(u8 *state) case 4: InitCurrentFlashLevelScanlineEffect(); InitOverworldGraphicsRegisters(); - sub_8197200(); + InitTextBoxGfxAndPrinters(); (*state)++; break; case 5: - move_tilemap_camera_to_upper_left_corner(); + ResetFieldCamera(); (*state)++; break; case 6: - copy_map_tileset1_to_vram(gMapHeader.mapLayout); + CopyPrimaryTilesetToVram(gMapHeader.mapLayout); (*state)++; break; case 7: - copy_map_tileset2_to_vram(gMapHeader.mapLayout); + CopySecondaryTilesetToVram(gMapHeader.mapLayout); (*state)++; break; case 8: if (FreeTempTileDataBuffersIfPossible() != TRUE) { - apply_map_tileset1_tileset2_palette(gMapHeader.mapLayout); + LoadMapTilesetPalettes(gMapHeader.mapLayout); (*state)++; } break; @@ -1881,7 +1858,7 @@ static bool32 map_loading_iteration_3(u8 *state) (*state)++; break; case 12: - if (map_post_load_hook_exec()) + if (RunFieldCallback()) (*state)++; break; case 13: @@ -1891,13 +1868,13 @@ static bool32 map_loading_iteration_3(u8 *state) return FALSE; } -static bool32 load_map_stuff(u8 *state, u32 a2) +static bool32 LoadMapInStepsLocal(u8 *state, bool32 a2) { switch (*state) { case 0: FieldClearVBlankHBlankCallbacks(); - mli0_load_map(a2); + LoadMapFromWarp(a2); (*state)++; break; case 1: @@ -1911,31 +1888,31 @@ static bool32 load_map_stuff(u8 *state, u32 a2) break; case 3: mli4_mapscripts_and_other(); - sub_8086A80(); + SetCameraToTrackPlayer(); (*state)++; break; case 4: InitCurrentFlashLevelScanlineEffect(); InitOverworldGraphicsRegisters(); - sub_8197200(); + InitTextBoxGfxAndPrinters(); (*state)++; break; case 5: - move_tilemap_camera_to_upper_left_corner(); + ResetFieldCamera(); (*state)++; break; case 6: - copy_map_tileset1_to_vram(gMapHeader.mapLayout); + CopyPrimaryTilesetToVram(gMapHeader.mapLayout); (*state)++; break; case 7: - copy_map_tileset2_to_vram(gMapHeader.mapLayout); + CopySecondaryTilesetToVram(gMapHeader.mapLayout); (*state)++; break; case 8: if (FreeTempTileDataBuffersIfPossible() != TRUE) { - apply_map_tileset1_tileset2_palette(gMapHeader.mapLayout); + LoadMapTilesetPalettes(gMapHeader.mapLayout); (*state)++; } break; @@ -1953,7 +1930,7 @@ static bool32 load_map_stuff(u8 *state, u32 a2) (*state)++; break; case 12: - if (map_post_load_hook_exec()) + if (RunFieldCallback()) (*state)++; break; case 13: @@ -1963,16 +1940,16 @@ static bool32 load_map_stuff(u8 *state, u32 a2) return FALSE; } -static bool32 sub_8086638(u8 *state) +static bool32 ReturnToFieldLocal(u8 *state) { switch (*state) { case 0: sub_80867C8(); sub_80867D8(); - sub_8086988(0); + sub_8086988(FALSE); sub_8086A68(); - sub_8086A80(); + SetCameraToTrackPlayer(); (*state)++; break; case 1: @@ -1981,7 +1958,7 @@ static bool32 sub_8086638(u8 *state) (*state)++; break; case 2: - if (map_post_load_hook_exec()) + if (RunFieldCallback()) (*state)++; break; case 3: @@ -1991,7 +1968,7 @@ static bool32 sub_8086638(u8 *state) return FALSE; } -static bool32 map_loading_iteration_2_link(u8 *state) +static bool32 ReturnToFieldLink(u8 *state) { switch (*state) { @@ -2002,7 +1979,7 @@ static bool32 map_loading_iteration_2_link(u8 *state) (*state)++; break; case 1: - sub_8086988(1); + sub_8086988(TRUE); (*state)++; break; case 2: @@ -2014,25 +1991,25 @@ static bool32 map_loading_iteration_2_link(u8 *state) case 3: InitCurrentFlashLevelScanlineEffect(); InitOverworldGraphicsRegisters(); - sub_8197200(); + InitTextBoxGfxAndPrinters(); (*state)++; break; case 4: - move_tilemap_camera_to_upper_left_corner(); + ResetFieldCamera(); (*state)++; break; case 5: - copy_map_tileset1_to_vram(gMapHeader.mapLayout); + CopyPrimaryTilesetToVram(gMapHeader.mapLayout); (*state)++; break; case 6: - copy_map_tileset2_to_vram(gMapHeader.mapLayout); + CopySecondaryTilesetToVram(gMapHeader.mapLayout); (*state)++; break; case 7: if (FreeTempTileDataBuffersIfPossible() != TRUE) { - apply_map_tileset1_tileset2_palette(gMapHeader.mapLayout); + LoadMapTilesetPalettes(gMapHeader.mapLayout); (*state)++; } break; @@ -2053,7 +2030,7 @@ static bool32 map_loading_iteration_2_link(u8 *state) (*state)++; break; case 12: - if (map_post_load_hook_exec()) + if (RunFieldCallback()) (*state)++; break; case 10: @@ -2068,9 +2045,9 @@ static bool32 map_loading_iteration_2_link(u8 *state) return FALSE; } -static void do_load_map_stuff_loop(u8 *state) +static void DoMapLoadLoop(u8 *state) { - while (!load_map_stuff(state, 0)); + while (!LoadMapInStepsLocal(state, FALSE)); } static void sub_80867C8(void) @@ -2094,13 +2071,13 @@ static void sub_8086860(void) { InitCurrentFlashLevelScanlineEffect(); InitOverworldGraphicsRegisters(); - sub_8197200(); + InitTextBoxGfxAndPrinters(); mapdata_load_assets_to_gpu_and_full_redraw(); } static void InitOverworldGraphicsRegisters(void) { - clear_scheduled_bg_copies_to_vram(); + ClearScheduledBgCopiesToVram(); ResetTempTileDataBuffers(); SetGpuReg(REG_OFFSET_MOSAIC, 0); SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN1_BG_ALL | WININ_WIN1_OBJ); @@ -2133,7 +2110,7 @@ static void InitOverworldGraphicsRegisters(void) InitFieldMessageBox(); } -static void sub_8086988(u32 a1) +static void sub_8086988(bool32 a1) { ResetTasks(); ResetSpriteData(); @@ -2189,9 +2166,9 @@ static void sub_8086A68(void) RunOnReturnToFieldMapScript(); } -static void sub_8086A80(void) +static void SetCameraToTrackPlayer(void) { - gObjectEvents[gPlayerAvatar.objectEventId].trackedByCamera = 1; + gObjectEvents[gPlayerAvatar.objectEventId].trackedByCamera = TRUE; InitCameraUpdateCallback(gPlayerAvatar.spriteId); } @@ -2294,7 +2271,7 @@ static void CheckRfuKeepAliveTimer(void) static void ResetAllTradingStates(void) { s32 i; - for (i = 0; i < 4; i++) + for (i = 0; i < MAX_LINK_PLAYERS; i++) sPlayerTradingStates[i] = PLAYER_TRADING_STATE_IDLE; } @@ -2345,7 +2322,7 @@ static void HandleLinkPlayerKeyInput(u32 playerId, u16 key, struct TradeRoomPlay if (trainer->isLocalPlayer) { SetKeyInterceptCallback(KeyInterCB_DeferToEventScript); - sub_8087584(); + RunTerminateLinkScript(); } return; } @@ -2763,7 +2740,7 @@ static const u8 *TryInteractWithPlayer(struct TradeRoomPlayer *player) otherPlayerPos.height = 0; linkPlayerId = GetLinkPlayerIdAt(otherPlayerPos.x, otherPlayerPos.y); - if (linkPlayerId != 4) + if (linkPlayerId != MAX_LINK_PLAYERS) { if (!player->isLocalPlayer) return CableClub_EventScript_TooBusyToNotice; @@ -2843,7 +2820,7 @@ static void InitMenuBasedScript(const u8 *script) ScriptContext2_Enable(); } -static void sub_8087584(void) +static void RunTerminateLinkScript(void) { ScriptContext1_SetupScript(EventScript_TerminateLink); ScriptContext2_Enable(); diff --git a/src/party_menu.c b/src/party_menu.c index c4497e824..5769d3158 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -464,7 +464,7 @@ static void CB2_UpdatePartyMenu(void) RunTasks(); AnimateSprites(); BuildOamBuffer(); - do_scheduled_bg_tilemap_copies_to_vram(); + DoScheduledBgTilemapCopiesToVram(); UpdatePaletteFade(); } @@ -491,7 +491,7 @@ static bool8 ShowPartyMenu(void) case 0: SetVBlankHBlankCallbacksToNull(); ResetVramOamAndBgCntRegs(); - clear_scheduled_bg_copies_to_vram(); + ClearScheduledBgCopiesToVram(); gMain.state++; break; case 1: diff --git a/src/pokeblock.c b/src/pokeblock.c index 523c4ad91..9be3ad24d 100644 --- a/src/pokeblock.c +++ b/src/pokeblock.c @@ -475,7 +475,7 @@ static void CB2_PokeblockMenu(void) RunTasks(); AnimateSprites(); BuildOamBuffer(); - do_scheduled_bg_tilemap_copies_to_vram(); + DoScheduledBgTilemapCopiesToVram(); UpdatePaletteFade(); } @@ -507,7 +507,7 @@ static bool8 InitPokeblockMenu(void) { case 0: SetVBlankHBlankCallbacksToNull(); - clear_scheduled_bg_copies_to_vram(); + ClearScheduledBgCopiesToVram(); gMain.state++; break; case 1: diff --git a/src/pokeblock_feed.c b/src/pokeblock_feed.c index f6e6a19b2..72e54ae4c 100644 --- a/src/pokeblock_feed.c +++ b/src/pokeblock_feed.c @@ -518,7 +518,7 @@ static void CB2_PokeblockFeed(void) RunTasks(); AnimateSprites(); BuildOamBuffer(); - do_scheduled_bg_tilemap_copies_to_vram(); + DoScheduledBgTilemapCopiesToVram(); UpdatePaletteFade(); } @@ -536,7 +536,7 @@ static bool8 TransitionToPokeblockFeedScene(void) case 0: sPokeblockFeed = AllocZeroed(sizeof(*sPokeblockFeed)); SetVBlankHBlankCallbacksToNull(); - clear_scheduled_bg_copies_to_vram(); + ClearScheduledBgCopiesToVram(); gMain.state++; break; case 1: diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index 30a29b6ea..104f92c73 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -2146,7 +2146,7 @@ static void VblankCb_PSS(void) static void Cb2_PSS(void) { RunTasks(); - do_scheduled_bg_tilemap_copies_to_vram(); + DoScheduledBgTilemapCopiesToVram(); ScrollBackground(); sub_80CAA14(); AnimateSprites(); @@ -2214,7 +2214,7 @@ static void sub_80C7E98(void) gReservedSpriteTileCount = 0x280; sub_80D2A90(&sPSSData->unk_0020, sPSSData->unk_0028, 8); gKeyRepeatStartDelay = 20; - clear_scheduled_bg_copies_to_vram(); + ClearScheduledBgCopiesToVram(); sub_80D259C(3); sub_80D2644(0, 1, gUnknown_0857239C, 8, 4); sub_80D2770(0, 1, 0); diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index e8b30f773..a3efe09d7 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -1120,7 +1120,7 @@ static void MainCB2(void) RunTasks(); AnimateSprites(); BuildOamBuffer(); - do_scheduled_bg_tilemap_copies_to_vram(); + DoScheduledBgTilemapCopiesToVram(); UpdatePaletteFade(); } @@ -1143,7 +1143,7 @@ static bool8 LoadGraphics(void) case 0: SetVBlankHBlankCallbacksToNull(); ResetVramOamAndBgCntRegs(); - clear_scheduled_bg_copies_to_vram(); + ClearScheduledBgCopiesToVram(); gMain.state++; break; case 1: diff --git a/src/rayquaza_scene.c b/src/rayquaza_scene.c index d902b7319..986a2d3a2 100644 --- a/src/rayquaza_scene.c +++ b/src/rayquaza_scene.c @@ -1244,7 +1244,7 @@ void DoRayquazaScene(u8 animId, bool8 onlyOneAnim, void (*callback)(void)) static void CB2_InitRayquazaScene(void) { SetVBlankHBlankCallbacksToNull(); - clear_scheduled_bg_copies_to_vram(); + ClearScheduledBgCopiesToVram(); ScanlineEffect_Stop(); FreeAllSpritePalettes(); ResetPaletteFade(); @@ -1260,7 +1260,7 @@ static void CB2_RayquazaScene(void) RunTasks(); AnimateSprites(); BuildOamBuffer(); - do_scheduled_bg_tilemap_copies_to_vram(); + DoScheduledBgTilemapCopiesToVram(); UpdatePaletteFade(); } diff --git a/src/region_map.c b/src/region_map.c index 287e97fe9..5880ad216 100644 --- a/src/region_map.c +++ b/src/region_map.c @@ -1684,7 +1684,7 @@ void CB2_OpenFlyMap(void) break; case 3: LoadUserWindowBorderGfx(0, 0x65, 0xd0); - clear_scheduled_bg_copies_to_vram(); + ClearScheduledBgCopiesToVram(); gMain.state++; break; case 4: @@ -1747,7 +1747,7 @@ static void CB2_FlyMap(void) sFlyMap->callback(); AnimateSprites(); BuildOamBuffer(); - do_scheduled_bg_tilemap_copies_to_vram(); + DoScheduledBgTilemapCopiesToVram(); } static void SetFlyMapCallback(void callback(void)) diff --git a/src/reset_rtc_screen.c b/src/reset_rtc_screen.c index 2756aa861..c948cde4c 100644 --- a/src/reset_rtc_screen.c +++ b/src/reset_rtc_screen.c @@ -467,7 +467,7 @@ void CB2_InitResetRtcScreen(void) static void sub_809F048(void) { - clear_scheduled_bg_copies_to_vram(); + ClearScheduledBgCopiesToVram(); ResetBgsAndClearDma3BusyFlags(0); InitBgsFromTemplates(0, sBackgroundTemplates, ARRAY_COUNT(sBackgroundTemplates)); ScheduleBgCopyTilemapToVram(0); @@ -483,7 +483,7 @@ static void CB2_ResetRtcScreen(void) RunTasks(); AnimateSprites(); BuildOamBuffer(); - do_scheduled_bg_tilemap_copies_to_vram(); + DoScheduledBgTilemapCopiesToVram(); UpdatePaletteFade(); } diff --git a/src/roulette.c b/src/roulette.c index 58e120cb5..79a1adedc 100644 --- a/src/roulette.c +++ b/src/roulette.c @@ -859,7 +859,7 @@ static void sub_8140388(void) SetBgTilemapBuffer(1, gUnknown_0203AB88->tilemapBuffers[2]); SetBgTilemapBuffer(2, gUnknown_0203AB88->tilemapBuffers[6]); InitWindows(gUnknown_085B614C); - sub_8197200(); + InitTextBoxGfxAndPrinters(); gUnknown_0203AB8C = 0; gUnknown_0203AB88->unk_397C = malloc_and_decompress(gUnknown_085B5DFC, &size); } diff --git a/src/shop.c b/src/shop.c index 837ba1bca..4fc44beee 100755 --- a/src/shop.c +++ b/src/shop.c @@ -416,7 +416,7 @@ static void CB2_BuyMenu(void) RunTasks(); AnimateSprites(); BuildOamBuffer(); - do_scheduled_bg_tilemap_copies_to_vram(); + DoScheduledBgTilemapCopiesToVram(); UpdatePaletteFade(); } @@ -446,7 +446,7 @@ static void CB2_InitBuyMenu(void) ResetPaletteFade(); ResetSpriteData(); ResetTasks(); - clear_scheduled_bg_copies_to_vram(); + ClearScheduledBgCopiesToVram(); gShopDataPtr = AllocZeroed(sizeof(struct ShopData)); gShopDataPtr->scrollIndicatorsTaskId = 0xFF; gShopDataPtr->itemSpriteIds[0] = 0xFF; diff --git a/src/starter_choose.c b/src/starter_choose.c index dbdb1a8b3..b919a8a17 100644 --- a/src/starter_choose.c +++ b/src/starter_choose.c @@ -417,7 +417,7 @@ void CB2_ChooseStarter(void) DeactivateAllTextPrinters(); LoadUserWindowBorderGfx(0, 0x2A8, 0xD0); - clear_scheduled_bg_copies_to_vram(); + ClearScheduledBgCopiesToVram(); ScanlineEffect_Stop(); ResetTasks(); ResetSpriteData(); @@ -477,7 +477,7 @@ static void MainCallback2_StarterChoose(void) RunTasks(); AnimateSprites(); BuildOamBuffer(); - do_scheduled_bg_tilemap_copies_to_vram(); + DoScheduledBgTilemapCopiesToVram(); UpdatePaletteFade(); } diff --git a/src/wallclock.c b/src/wallclock.c index 00ab65817..aa2bd8019 100644 --- a/src/wallclock.c +++ b/src/wallclock.c @@ -660,7 +660,7 @@ static void LoadWallClockGraphics(void) InitWindows(gUnknown_085B21DC); DeactivateAllTextPrinters(); LoadUserWindowBorderGfx(0, 0x250, 0xd0); - clear_scheduled_bg_copies_to_vram(); + ClearScheduledBgCopiesToVram(); ScanlineEffect_Stop(); ResetTasks(); ResetSpriteData(); @@ -780,7 +780,7 @@ static void WallClockMainCallback(void) RunTasks(); AnimateSprites(); BuildOamBuffer(); - do_scheduled_bg_tilemap_copies_to_vram(); + DoScheduledBgTilemapCopiesToVram(); UpdatePaletteFade(); } From 4ea6992172a53eb263d5f4342c5e08dfc3f8096a Mon Sep 17 00:00:00 2001 From: GriffinR Date: Wed, 24 Jun 2020 16:27:00 -0400 Subject: [PATCH 2/9] Continue documenting overworld/field effects --- asm/macros/trainer_hill.inc | 6 +- data/field_effect_scripts.s | 42 +- data/maps/TrainerHill_Entrance/scripts.inc | 4 +- data/scripts/trainer_hill.inc | 4 +- ...{lavaridge_gym_warp.png => ash_launch.png} | Bin .../{jump_out_of_ash.png => ash_puff.png} | Bin ...hop_big_splash.png => jump_big_splash.png} | Bin ...small_splash.png => jump_small_splash.png} | Bin ...hop_tall_grass.png => jump_tall_grass.png} | Bin graphics/field_effects/pics/unused_grass.png | Bin 344 -> 0 bytes .../field_effects/pics/unused_grass_2.png | Bin 389 -> 344 bytes .../field_effects/pics/unused_grass_3.png | Bin 0 -> 389 bytes .../{unknown_20.png => water_surfacing.png} | Bin .../deoxys_rock_fragment_bottom_left.png} | Bin .../deoxys_rock_fragment_bottom_right.png} | Bin .../deoxys_rock_fragment_top_left.png} | Bin .../deoxys_rock_fragment_top_right.png} | Bin ...ig_hof_monitor.png => hof_monitor_big.png} | Bin ..._hof_monitor.png => hof_monitor_small.png} | Bin .../trainer_hill_ereader.pal} | 0 include/constants/field_effects.h | 33 +- include/constants/trainer_hill.h | 2 +- include/event_object_movement.h | 18 +- include/field_effect.h | 4 +- include/field_effect_helpers.h | 10 +- include/field_player_avatar.h | 4 +- include/fieldmap.h | 8 +- include/trainer_hill.h | 4 +- include/tv.h | 2 +- spritesheet_rules.mk | 16 +- src/battle_transition.c | 10 +- .../field_effect_object_template_pointers.h | 16 +- src/data/field_effects/field_effect_objects.h | 790 ++++-- .../object_events/object_event_graphics.h | 16 +- src/event_object_movement.c | 112 +- src/field_effect.c | 2155 +++++++++-------- src/field_effect_helpers.c | 193 +- src/field_player_avatar.c | 14 +- src/field_screen_effect.c | 2 +- src/fieldmap.c | 15 +- src/fldeff_cut.c | 4 +- src/fldeff_misc.c | 18 +- src/item_use.c | 2 +- src/overworld.c | 76 +- src/trainer_hill.c | 25 +- src/trainer_see.c | 6 +- src/tv.c | 2 +- 47 files changed, 2045 insertions(+), 1568 deletions(-) rename graphics/field_effects/pics/{lavaridge_gym_warp.png => ash_launch.png} (100%) rename graphics/field_effects/pics/{jump_out_of_ash.png => ash_puff.png} (100%) rename graphics/field_effects/pics/{bike_hop_big_splash.png => jump_big_splash.png} (100%) rename graphics/field_effects/pics/{bike_hop_small_splash.png => jump_small_splash.png} (100%) rename graphics/field_effects/pics/{bike_hop_tall_grass.png => jump_tall_grass.png} (100%) delete mode 100644 graphics/field_effects/pics/unused_grass.png create mode 100644 graphics/field_effects/pics/unused_grass_3.png rename graphics/field_effects/pics/{unknown_20.png => water_surfacing.png} (100%) rename graphics/{unknown/unknown_55C1B0.png => misc/deoxys_rock_fragment_bottom_left.png} (100%) rename graphics/{unknown/unknown_55C1D0.png => misc/deoxys_rock_fragment_bottom_right.png} (100%) rename graphics/{unknown/unknown_55C170.png => misc/deoxys_rock_fragment_top_left.png} (100%) rename graphics/{unknown/unknown_55C190.png => misc/deoxys_rock_fragment_top_right.png} (100%) rename graphics/misc/{big_hof_monitor.png => hof_monitor_big.png} (100%) rename graphics/misc/{small_hof_monitor.png => hof_monitor_small.png} (100%) rename graphics/{pokenav/862A5D4.pal => misc/trainer_hill_ereader.pal} (100%) diff --git a/asm/macros/trainer_hill.inc b/asm/macros/trainer_hill.inc index d5c84fd02..65c8c6bef 100644 --- a/asm/macros/trainer_hill.inc +++ b/asm/macros/trainer_hill.inc @@ -52,9 +52,9 @@ special CallTrainerHillFunction .endm - @ Unknown, dummied. Only side effect is setting VAR_RESULT to 0. - .macro trainerhill_clearresult - setvar VAR_0x8004, TRAINER_HILL_FUNC_CLEAR_RESULT + @ Unknown, dummied. E-Reader association is assumed. Only side effect is setting VAR_RESULT to 0. + .macro trainerhill_getusingereader + setvar VAR_0x8004, TRAINER_HILL_FUNC_GET_IN_EREADER_MODE special CallTrainerHillFunction .endm diff --git a/data/field_effect_scripts.s b/data/field_effect_scripts.s index 2eddf3126..6850154d3 100644 --- a/data/field_effect_scripts.s +++ b/data/field_effect_scripts.s @@ -17,17 +17,17 @@ gFieldEffectScriptPointers:: @ 82DB9D4 .4byte gFieldEffectScript_UseSurf @ FLDEFF_USE_SURF .4byte gFieldEffectScript_GroundImpactDust @ FLDEFF_DUST .4byte gFieldEffectScript_UseSecretPowerCave @ FLDEFF_USE_SECRET_POWER_CAVE - .4byte gFieldEffectScript_BikeHopTallGrass @ FLDEFF_JUMP_TALL_GRASS + .4byte gFieldEffectScript_JumpTallGrass @ FLDEFF_JUMP_TALL_GRASS .4byte gFieldEffectScript_SandFootprints @ FLDEFF_SAND_FOOTPRINTS - .4byte gFieldEffectScript_BikeHopBigSplash @ FLDEFF_JUMP_BIG_SPLASH + .4byte gFieldEffectScript_JumpBigSplash @ FLDEFF_JUMP_BIG_SPLASH .4byte gFieldEffectScript_Splash @ FLDEFF_SPLASH - .4byte gFieldEffectScript_BikeHopSmallSplash @ FLDEFF_JUMP_SMALL_SPLASH + .4byte gFieldEffectScript_JumpSmallSplash @ FLDEFF_JUMP_SMALL_SPLASH .4byte gFieldEffectScript_LongGrass @ FLDEFF_LONG_GRASS .4byte gFieldEffectScript_JumpLongGrass @ FLDEFF_JUMP_LONG_GRASS .4byte gFieldEffectScript_Unknown19 @ FLDEFF_UNKNOWN_19 - .4byte gFieldEffectScript_UnusedGrass @ FLDEFF_UNUSED_GRASS + .4byte gFieldEffectScript_UnusedGrass2 @ FLDEFF_UNUSED_GRASS_2 .4byte gFieldEffectScript_Unknown21 @ FLDEFF_UNKNOWN_21 - .4byte gFieldEffectScript_Unknown22 @ FLDEFF_UNKNOWN_22 + .4byte gFieldEffectScript_WaterSurfacing @ FLDEFF_WATER_SURFACING .4byte gFieldEffectScript_BerryTreeGrowthSparkle @ FLDEFF_BERRY_TREE_GROWTH_SPARKLE .4byte gFieldEffectScript_DeepSandFootprints @ FLDEFF_DEEP_SAND_FOOTPRINTS .4byte gFieldEffectScript_PokeCenterHeal @ FLDEFF_POKECENTER_HEAL @@ -54,8 +54,8 @@ gFieldEffectScriptPointers:: @ 82DB9D4 .4byte gFieldEffectScript_HeartIcon @ FLDEFF_HEART_ICON .4byte gFieldEffectScript_Unknown47 @ FLDEFF_NOP_47 .4byte gFieldEffectScript_Unknown48 @ FLDEFF_NOP_48 - .4byte gFieldEffectScript_JumpOutOfAsh @ FLDEFF_POP_OUT_OF_ASH - .4byte gFieldEffectScript_LavaridgeGymWarp @ FLDEFF_LAVARIDGE_GYM_WARP + .4byte gFieldEffectScript_AshPuff @ FLDEFF_ASH_PUFF + .4byte gFieldEffectScript_AshLaunch @ FLDEFF_ASH_LAUNCH .4byte gFieldEffectScript_SweetScent @ FLDEFF_SWEET_SCENT .4byte gFieldEffectScript_SandPillar @ FLDEFF_SAND_PILLAR .4byte gFieldEffectScript_Bubbles @ FLDEFF_BUBBLES @@ -69,7 +69,7 @@ gFieldEffectScriptPointers:: @ 82DB9D4 .4byte gFieldEffectScript_SecretBaseBootPC @ FLDEFF_PCTURN_ON .4byte gFieldEffectScript_HallOfFameRecord @ FLDEFF_HALL_OF_FAME_RECORD .4byte gFieldEffectScript_UseTeleport @ FLDEFF_USE_TELEPORT - .4byte gFieldEffectScript_Rayquaza @ FLDEFF_RAYQUAZA + .4byte gFieldEffectScript_RayquazaSpotlight @ FLDEFF_RAYQUAZA_SPOTLIGHT .4byte gFieldEffectScript_DestroyDeoxysRock @ FLDEFF_DESTROY_DEOXYS_ROCK .4byte gFieldEffectScript_MoveDeoxysRock @ FLDEFF_MOVE_DEOXYS_ROCK @@ -121,7 +121,7 @@ gFieldEffectScript_UseSecretPowerCave:: @ 82DBB32 field_eff_callnative FldEff_UseSecretPowerCave field_eff_end -gFieldEffectScript_BikeHopTallGrass:: @ 82DBB38 +gFieldEffectScript_JumpTallGrass:: @ 82DBB38 field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo1, FldEff_JumpTallGrass field_eff_end @@ -129,7 +129,7 @@ gFieldEffectScript_SandFootprints:: @ 82DBB42 field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_SandFootprints field_eff_end -gFieldEffectScript_BikeHopBigSplash:: @ 82DBB4C +gFieldEffectScript_JumpBigSplash:: @ 82DBB4C field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_JumpBigSplash field_eff_end @@ -137,7 +137,7 @@ gFieldEffectScript_Splash:: @ 82DBB56 field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_Splash field_eff_end -gFieldEffectScript_BikeHopSmallSplash:: @ 82DBB60 +gFieldEffectScript_JumpSmallSplash:: @ 82DBB60 field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_JumpSmallSplash field_eff_end @@ -153,16 +153,16 @@ gFieldEffectScript_Unknown19:: @ 82DBB7E field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo1, FldEff_Unknown19 field_eff_end -gFieldEffectScript_UnusedGrass:: @ 82DBB88 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo1, FldEff_UnusedGrass +gFieldEffectScript_UnusedGrass2:: @ 82DBB88 + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo1, FldEff_UnusedGrass2 field_eff_end gFieldEffectScript_Unknown21:: @ 82DBB92 field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_Unknown21 field_eff_end -gFieldEffectScript_Unknown22:: @ 82DBB9C - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_Unknown22 +gFieldEffectScript_WaterSurfacing:: @ 82DBB9C + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_WaterSurfacing field_eff_end gFieldEffectScript_BerryTreeGrowthSparkle:: @ 82DBBA6 @@ -271,12 +271,12 @@ gFieldEffectScript_Unknown48:: @ 82DBC66 field_eff_callnative FldEff_NopA700 field_eff_end -gFieldEffectScript_JumpOutOfAsh:: @ 82DBC6C - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo2, FldEff_PopOutOfAsh +gFieldEffectScript_AshPuff:: @ 82DBC6C + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo2, FldEff_AshPuff field_eff_end -gFieldEffectScript_LavaridgeGymWarp:: @ 82DBC76 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo2, FldEff_LavaridgeGymWarp +gFieldEffectScript_AshLaunch:: @ 82DBC76 + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo2, FldEff_AshLaunch field_eff_end gFieldEffectScript_SweetScent:: @ 82DBC80 @@ -332,8 +332,8 @@ gFieldEffectScript_UseTeleport:: @ 82DBCED field_eff_callnative FldEff_UseTeleport field_eff_end -gFieldEffectScript_Rayquaza:: @ 82DBCF3 - field_eff_callnative sub_80B8F98 +gFieldEffectScript_RayquazaSpotlight:: @ 82DBCF3 + field_eff_callnative FldEff_RayquazaSpotlight field_eff_end gFieldEffectScript_DestroyDeoxysRock:: @ 82DBCF9 diff --git a/data/maps/TrainerHill_Entrance/scripts.inc b/data/maps/TrainerHill_Entrance/scripts.inc index e1311b6d1..b3bec46b0 100644 --- a/data/maps/TrainerHill_Entrance/scripts.inc +++ b/data/maps/TrainerHill_Entrance/scripts.inc @@ -18,8 +18,8 @@ TrainerHill_Entrance_OnWarp: @ 82680CF TrainerHill_Entrance_OnResume: @ 82680D0 trainerhill_resumetimer setvar VAR_TEMP_0, 0 - trainerhill_clearresult - compare VAR_RESULT, 0 @ VAR_RESULT always 0 here + trainerhill_getusingereader + compare VAR_RESULT, FALSE @ VAR_RESULT always FALSE here goto_if_eq TrainerHill_Entrance_EventScript_TryFaceAttendant setobjectxy OBJ_EVENT_ID_PLAYER, 9, 6 applymovement OBJ_EVENT_ID_PLAYER, TrainerHill_Entrance_Movement_PlayerFaceAttendant diff --git a/data/scripts/trainer_hill.inc b/data/scripts/trainer_hill.inc index ca692e1ef..34d0462bb 100644 --- a/data/scripts/trainer_hill.inc +++ b/data/scripts/trainer_hill.inc @@ -32,8 +32,8 @@ EventScript_TrainerHillTimer:: @ 82C8393 TrainerHill_1F_EventScript_DummyWarpToEntranceCounter:: @ 82C83A6 setvar VAR_TEMP_2, 1 - trainerhill_clearresult - compare VAR_RESULT, 1 @ VAR_RESULT always 0 here + trainerhill_getusingereader + compare VAR_RESULT, TRUE @ VAR_RESULT always FALSE here goto_if_eq TrainerHill_1F_EventScript_WarpSilentToEntranceCounter end diff --git a/graphics/field_effects/pics/lavaridge_gym_warp.png b/graphics/field_effects/pics/ash_launch.png similarity index 100% rename from graphics/field_effects/pics/lavaridge_gym_warp.png rename to graphics/field_effects/pics/ash_launch.png diff --git a/graphics/field_effects/pics/jump_out_of_ash.png b/graphics/field_effects/pics/ash_puff.png similarity index 100% rename from graphics/field_effects/pics/jump_out_of_ash.png rename to graphics/field_effects/pics/ash_puff.png diff --git a/graphics/field_effects/pics/bike_hop_big_splash.png b/graphics/field_effects/pics/jump_big_splash.png similarity index 100% rename from graphics/field_effects/pics/bike_hop_big_splash.png rename to graphics/field_effects/pics/jump_big_splash.png diff --git a/graphics/field_effects/pics/bike_hop_small_splash.png b/graphics/field_effects/pics/jump_small_splash.png similarity index 100% rename from graphics/field_effects/pics/bike_hop_small_splash.png rename to graphics/field_effects/pics/jump_small_splash.png diff --git a/graphics/field_effects/pics/bike_hop_tall_grass.png b/graphics/field_effects/pics/jump_tall_grass.png similarity index 100% rename from graphics/field_effects/pics/bike_hop_tall_grass.png rename to graphics/field_effects/pics/jump_tall_grass.png diff --git a/graphics/field_effects/pics/unused_grass.png b/graphics/field_effects/pics/unused_grass.png deleted file mode 100644 index 65f4d97e29f9d738995b8e5e67053d3d0d99cd74..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 344 zcmV-e0jK_nP)%W`?qaOPi_P|w=Kqv~VzjK3q}9c9#iT*BgBYZ0)|W4J0002v zNklyiR;lE?ZvEWtaeaEh7>Yp#i3@awkjx2U|P7&dxZ qwRy^&G(+uS(C)MozC?BEcm4v??T4!bpiRC20000yiR;lE?ZvEWtaeaEh7>Yp#iUaJE)9r_=1fWg600000NkvXX Hu0mjfA|iaY delta 303 zcmV+~0nq-~0)+#RUw;7*NklqBOO3N`=9&Yf;Kro zMG`W_3_JU@#voIN(*F@7Zcz~X1N{!|6t+SHP!ezIr1Z(=mC>W+~=Oq;>EPAZgj1ejA@|^((Qi6$6&40)OEW0#zPTg1qEXlYu zFT}uNFm{f?DY^jWi}+(g4|5NmoF1NMh7Mg^qd|-XlT*vJSQS}(3lr0~zu248Ps_>n zJPR`YZ`;?Q-l$x0oNlua4)>eume;|lC;ysU;REh z!Sqx8Cz%W`?qaOPi_P|w=Kqv~VzjK3q}9c9#iT*BgBYZ0)|W4J0003H zNklqBOO3N`=9&Yf;KroMG`W_3_JU@#voIN(*F@7 zZcz~X1N{!|6t+SHP!ezIr1Z(=mC>W+~ z=Oq;>EPAZgj1ejA@|^((Qi6$6&By{QyEJxA-B<-I$+$Ex#K2-Oc8j_+vs3 za}S=J9-e204qaTML5u~HQ_Hnj66Vtc9*qhT&%gOdU3o`w0+t;Dqs9bTJZnF>$ z_nYgM*TJbL|Dc^^2K#XmTtz0QZ~~9heuBr#PfmAV{XROu^i%yOnfC>^`>Po`{Z!xK jB4$euanimPaused = FALSE; } -bool8 sub_8095B0C(struct ObjectEvent *objectEvent, struct Sprite *sprite) +bool8 DoFigure8Anim(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - if (sub_8097758(sprite)) + if (AnimateSpriteInFigure8(sprite)) { ShiftStillObjectEventCoords(objectEvent); objectEvent->triggerGroundEffectsOnStop = TRUE; @@ -6884,14 +6886,14 @@ bool8 sub_8095B0C(struct ObjectEvent *objectEvent, struct Sprite *sprite) bool8 MovementAction_Figure8_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - sub_8095AF0(objectEvent, sprite); + InitFigure8Anim(objectEvent, sprite); sprite->data[2] = 1; return MovementAction_Figure8_Step1(objectEvent, sprite); } bool8 MovementAction_Figure8_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - if (sub_8095B0C(objectEvent, sprite)) + if (DoFigure8Anim(objectEvent, sprite)) { sprite->data[2] = 2; return TRUE; @@ -8094,26 +8096,26 @@ void GroundEffect_Seaweed(struct ObjectEvent *objEvent, struct Sprite *sprite) } static void (*const sGroundEffectFuncs[])(struct ObjectEvent *objEvent, struct Sprite *sprite) = { - GroundEffect_SpawnOnTallGrass, - GroundEffect_StepOnTallGrass, - GroundEffect_SpawnOnLongGrass, - GroundEffect_StepOnLongGrass, - GroundEffect_WaterReflection, - GroundEffect_IceReflection, - GroundEffect_FlowingWater, - GroundEffect_SandTracks, - GroundEffect_DeepSandTracks, - GroundEffect_Ripple, - GroundEffect_StepOnPuddle, - GroundEffect_SandHeap, - GroundEffect_JumpOnTallGrass, - GroundEffect_JumpOnLongGrass, - GroundEffect_JumpOnShallowWater, - GroundEffect_JumpOnWater, - GroundEffect_JumpLandingDust, - GroundEffect_ShortGrass, - GroundEffect_HotSprings, - GroundEffect_Seaweed + GroundEffect_SpawnOnTallGrass, // GROUND_EFFECT_FLAG_TALL_GRASS_ON_SPAWN + GroundEffect_StepOnTallGrass, // GROUND_EFFECT_FLAG_TALL_GRASS_ON_MOVE + GroundEffect_SpawnOnLongGrass, // GROUND_EFFECT_FLAG_LONG_GRASS_ON_SPAWN + GroundEffect_StepOnLongGrass, // GROUND_EFFECT_FLAG_LONG_GRASS_ON_MOVE + GroundEffect_WaterReflection, // GROUND_EFFECT_FLAG_ICE_REFLECTION + GroundEffect_IceReflection, // GROUND_EFFECT_FLAG_REFLECTION + GroundEffect_FlowingWater, // GROUND_EFFECT_FLAG_SHALLOW_FLOWING_WATER + GroundEffect_SandTracks, // GROUND_EFFECT_FLAG_SAND + GroundEffect_DeepSandTracks, // GROUND_EFFECT_FLAG_DEEP_SAND + GroundEffect_Ripple, // GROUND_EFFECT_FLAG_RIPPLES + GroundEffect_StepOnPuddle, // GROUND_EFFECT_FLAG_PUDDLE + GroundEffect_SandHeap, // GROUND_EFFECT_FLAG_SAND_PILE + GroundEffect_JumpOnTallGrass, // GROUND_EFFECT_FLAG_LAND_IN_TALL_GRASS + GroundEffect_JumpOnLongGrass, // GROUND_EFFECT_FLAG_LAND_IN_LONG_GRASS + GroundEffect_JumpOnShallowWater, // GROUND_EFFECT_FLAG_LAND_IN_SHALLOW_WATER + GroundEffect_JumpOnWater, // GROUND_EFFECT_FLAG_LAND_IN_DEEP_WATER + GroundEffect_JumpLandingDust, // GROUND_EFFECT_FLAG_LAND_ON_NORMAL_GROUND + GroundEffect_ShortGrass, // GROUND_EFFECT_FLAG_SHORT_GRASS + GroundEffect_HotSprings, // GROUND_EFFECT_FLAG_HOT_SPRINGS + GroundEffect_Seaweed // GROUND_EFFECT_FLAG_SEAWEED }; static void DoFlaggedGroundEffects(struct ObjectEvent *objEvent, struct Sprite *sprite, u32 flags) @@ -8391,7 +8393,7 @@ bool8 sub_80976EC(struct Sprite *sprite) return FALSE; } -static const s8 gUnknown_0850E772[] = { +static const s8 sFigure8XOffsets[FIGURE_8_LENGTH] = { 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 1, 1, @@ -8403,7 +8405,7 @@ static const s8 gUnknown_0850E772[] = { 0, 1, 0, 0, 0, 0, 0, 0, }; -static const s8 gUnknown_0850E7BA[] = { +static const s8 sFigure8YOffsets[FIGURE_8_LENGTH] = { 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, @@ -8415,57 +8417,57 @@ static const s8 gUnknown_0850E7BA[] = { -1, -1, -1, -1, -1, -1, -1, -2, }; -s16 sub_8097728(s16 a1) +s16 GetFigure8YOffset(s16 idx) { - return gUnknown_0850E7BA[a1]; + return sFigure8YOffsets[idx]; } -s16 sub_809773C(s16 a1) +s16 GetFigure8XOffset(s16 idx) { - return gUnknown_0850E772[a1]; + return sFigure8XOffsets[idx]; } -void sub_8097750(struct Sprite *sprite) +static void InitSpriteForFigure8Anim(struct Sprite *sprite) { sprite->data[6] = 0; sprite->data[7] = 0; } -bool8 sub_8097758(struct Sprite *sprite) +static bool8 AnimateSpriteInFigure8(struct Sprite *sprite) { - bool8 result = FALSE; + bool8 finished = FALSE; switch(sprite->data[7]) { - case 0: - sprite->pos2.x += sub_809773C(sprite->data[6]); - sprite->pos2.y += sub_8097728(sprite->data[6]); - break; - case 1: - sprite->pos2.x -= sub_809773C(0x47 - sprite->data[6]); - sprite->pos2.y += sub_8097728(0x47 - sprite->data[6]); - break; - case 2: - sprite->pos2.x -= sub_809773C(sprite->data[6]); - sprite->pos2.y += sub_8097728(sprite->data[6]); - break; - case 3: - sprite->pos2.x += sub_809773C(0x47 - sprite->data[6]); - sprite->pos2.y += sub_8097728(0x47 - sprite->data[6]); - break; + case 0: + sprite->pos2.x += GetFigure8XOffset(sprite->data[6]); + sprite->pos2.y += GetFigure8YOffset(sprite->data[6]); + break; + case 1: + sprite->pos2.x -= GetFigure8XOffset((FIGURE_8_LENGTH - 1) - sprite->data[6]); + sprite->pos2.y += GetFigure8YOffset((FIGURE_8_LENGTH - 1) - sprite->data[6]); + break; + case 2: + sprite->pos2.x -= GetFigure8XOffset(sprite->data[6]); + sprite->pos2.y += GetFigure8YOffset(sprite->data[6]); + break; + case 3: + sprite->pos2.x += GetFigure8XOffset((FIGURE_8_LENGTH - 1) - sprite->data[6]); + sprite->pos2.y += GetFigure8YOffset((FIGURE_8_LENGTH - 1) - sprite->data[6]); + break; } - if(++sprite->data[6] == 0x48) + if (++sprite->data[6] == FIGURE_8_LENGTH) { sprite->data[6] = 0; sprite->data[7]++; } - if(sprite->data[7] == 0x4) + if (sprite->data[7] == 4) { sprite->pos2.y = 0; sprite->pos2.x = 0; - result = TRUE; + finished = TRUE; } - return result; + return finished; } static const s8 gUnknown_0850E802[] = { diff --git a/src/field_effect.c b/src/field_effect.c index 284d9b0e7..fbf6bd10c 100644 --- a/src/field_effect.c +++ b/src/field_effect.c @@ -39,30 +39,32 @@ EWRAM_DATA s32 gFieldEffectArguments[8] = {0}; // Static type declarations static void Task_PokecenterHeal(u8 taskId); -static void PokecenterHealEffect_0(struct Task *); -static void PokecenterHealEffect_1(struct Task *); -static void PokecenterHealEffect_2(struct Task *); -static void PokecenterHealEffect_3(struct Task *); +static void PokecenterHealEffect_Init(struct Task *); +static void PokecenterHealEffect_WaitForBallPlacement(struct Task *); +static void PokecenterHealEffect_WaitForBallFlashing(struct Task *); +static void PokecenterHealEffect_WaitForSoundAndEnd(struct Task *); +static u8 CreatePokecenterMonitorSprite(s16, s16); +static void SpriteCB_PokecenterMonitor(struct Sprite *); static void Task_HallOfFameRecord(u8 taskId); -static void HallOfFameRecordEffect_0(struct Task *); -static void HallOfFameRecordEffect_1(struct Task *); -static void HallOfFameRecordEffect_2(struct Task *); -static void HallOfFameRecordEffect_3(struct Task *); +static void HallOfFameRecordEffect_Init(struct Task *); +static void HallOfFameRecordEffect_WaitForBallPlacement(struct Task *); +static void HallOfFameRecordEffect_WaitForBallFlashing(struct Task *); +static void HallOfFameRecordEffect_WaitForSoundAndEnd(struct Task *); +static void CreateHofMonitorSprite(s16, s16, s16, bool8); +static void SpriteCB_HallOfFameMonitor(struct Sprite *); -static u8 CreatePokeballGlowSprite(s16, s16, s16, u16); +static u8 CreateGlowingPokeballsEffect(s16, s16, s16, bool16); static void SpriteCB_PokeballGlowEffect(struct Sprite *); -static void PokeballGlowEffect_0(struct Sprite *); -static void PokeballGlowEffect_1(struct Sprite *); -static void PokeballGlowEffect_2(struct Sprite *); -static void PokeballGlowEffect_3(struct Sprite *); -static void PokeballGlowEffect_4(struct Sprite *); -static void PokeballGlowEffect_5(struct Sprite *); -static void PokeballGlowEffect_6(struct Sprite *); -static void PokeballGlowEffect_7(struct Sprite *); - -static u8 PokecenterHealEffectHelper(s16, s16); -static void HallOfFameRecordEffectHelper(s16, s16, s16, u8); +static void PokeballGlowEffect_PlaceBalls(struct Sprite *); +static void PokeballGlowEffect_TryPlaySe(struct Sprite *); +static void PokeballGlowEffect_Flash1(struct Sprite *); +static void PokeballGlowEffect_Flash2(struct Sprite *); +static void PokeballGlowEffect_WaitAfterFlash(struct Sprite *); +static void PokeballGlowEffect_Dummy(struct Sprite *); +static void PokeballGlowEffect_WaitForSound(struct Sprite *); +static void PokeballGlowEffect_Idle(struct Sprite *); +static void SpriteCB_PokeballGlow(struct Sprite *); static void FieldCallback_UseFly(void); static void Task_UseFly(u8); @@ -70,169 +72,165 @@ static void FieldCallback_FlyIntoMap(void); static void Task_FlyIntoMap(u8); static void Task_FallWarpFieldEffect(u8); -static bool8 FallWarpEffect_0(struct Task *); -static bool8 FallWarpEffect_1(struct Task *); -static bool8 FallWarpEffect_2(struct Task *); -static bool8 FallWarpEffect_3(struct Task *); -static bool8 FallWarpEffect_4(struct Task *); -static bool8 FallWarpEffect_5(struct Task *); -static bool8 FallWarpEffect_6(struct Task *); +static bool8 FallWarpEffect_Init(struct Task *); +static bool8 FallWarpEffect_WaitWeather(struct Task *); +static bool8 FallWarpEffect_StartFall(struct Task *); +static bool8 FallWarpEffect_Fall(struct Task *); +static bool8 FallWarpEffect_Land(struct Task *); +static bool8 FallWarpEffect_CameraShake(struct Task *); +static bool8 FallWarpEffect_End(struct Task *); static void Task_EscalatorWarpOut(u8); -static bool8 EscalatorWarpOutEffect_0(struct Task *); -static bool8 EscalatorWarpOutEffect_1(struct Task *); -static bool8 EscalatorWarpOutEffect_2(struct Task *); -static bool8 EscalatorWarpOutEffect_3(struct Task *); -static bool8 EscalatorWarpOutEffect_4(struct Task *); -static bool8 EscalatorWarpOutEffect_5(struct Task *); - -static void sub_80B6FB8(struct Task *); -static void sub_80B7004(struct Task *); -static void sub_80B7050(void); -static void sub_80B7060(void); +static bool8 EscalatorWarpOut_Init(struct Task *); +static bool8 EscalatorWarpOut_WaitForPlayer(struct Task *); +static bool8 EscalatorWarpOut_Up_Ride(struct Task *); +static bool8 EscalatorWarpOut_Up_End(struct Task *); +static bool8 EscalatorWarpOut_Down_Ride(struct Task *); +static bool8 EscalatorWarpOut_Down_End(struct Task *); +static void RideUpEscalatorOut(struct Task *); +static void RideDownEscalatorOut(struct Task *); +static void FadeOutAtEndOfEscalator(void); +static void WarpAtEndOfEscalator(void); static void FieldCallback_EscalatorWarpIn(void); static void Task_EscalatorWarpIn(u8); -static bool8 EscalatorWarpInEffect_0(struct Task *); -static bool8 EscalatorWarpInEffect_1(struct Task *); -static bool8 EscalatorWarpInEffect_2(struct Task *); -static bool8 EscalatorWarpInEffect_3(struct Task *); -static bool8 EscalatorWarpInEffect_4(struct Task *); -static bool8 EscalatorWarpInEffect_5(struct Task *); -static bool8 EscalatorWarpInEffect_6(struct Task *); +static bool8 EscalatorWarpIn_Init(struct Task *); +static bool8 EscalatorWarpIn_Down_Init(struct Task *); +static bool8 EscalatorWarpIn_Down_Ride(struct Task *); +static bool8 EscalatorWarpIn_Up_Init(struct Task *); +static bool8 EscalatorWarpIn_Up_Ride(struct Task *); +static bool8 EscalatorWarpIn_WaitForMovement(struct Task *); +static bool8 EscalatorWarpIn_End(struct Task *); static void Task_UseWaterfall(u8); -static bool8 WaterfallFieldEffect_0(struct Task *, struct ObjectEvent *); -static bool8 WaterfallFieldEffect_1(struct Task *, struct ObjectEvent *); -static bool8 WaterfallFieldEffect_2(struct Task *, struct ObjectEvent *); -static bool8 WaterfallFieldEffect_3(struct Task *, struct ObjectEvent *); -static bool8 WaterfallFieldEffect_4(struct Task *, struct ObjectEvent *); +static bool8 WaterfallFieldEffect_Init(struct Task *, struct ObjectEvent *); +static bool8 WaterfallFieldEffect_ShowMon(struct Task *, struct ObjectEvent *); +static bool8 WaterfallFieldEffect_WaitForShowMon(struct Task *, struct ObjectEvent *); +static bool8 WaterfallFieldEffect_RideUp(struct Task *, struct ObjectEvent *); +static bool8 WaterfallFieldEffect_ContinueRideOrEnd(struct Task *, struct ObjectEvent *); static void Task_UseDive(u8); -static bool8 DiveFieldEffect_0(struct Task *); -static bool8 DiveFieldEffect_1(struct Task *); -static bool8 DiveFieldEffect_2(struct Task *); +static bool8 DiveFieldEffect_Init(struct Task *); +static bool8 DiveFieldEffect_ShowMon(struct Task *); +static bool8 DiveFieldEffect_TryWarp(struct Task *); static void Task_LavaridgeGymB1FWarp(u8); -static bool8 LavaridgeGymB1FWarpEffect_0(struct Task *, struct ObjectEvent *, struct Sprite *); -static bool8 LavaridgeGymB1FWarpEffect_1(struct Task *, struct ObjectEvent *, struct Sprite *); -static bool8 LavaridgeGymB1FWarpEffect_2(struct Task *, struct ObjectEvent *, struct Sprite *); -static bool8 LavaridgeGymB1FWarpEffect_3(struct Task *, struct ObjectEvent *, struct Sprite *); -static bool8 LavaridgeGymB1FWarpEffect_4(struct Task *, struct ObjectEvent *, struct Sprite *); -static bool8 LavaridgeGymB1FWarpEffect_5(struct Task *, struct ObjectEvent *, struct Sprite *); +static bool8 LavaridgeGymB1FWarpEffect_Init(struct Task *, struct ObjectEvent *, struct Sprite *); +static bool8 LavaridgeGymB1FWarpEffect_CameraShake(struct Task *, struct ObjectEvent *, struct Sprite *); +static bool8 LavaridgeGymB1FWarpEffect_Launch(struct Task *, struct ObjectEvent *, struct Sprite *); +static bool8 LavaridgeGymB1FWarpEffect_Rise(struct Task *, struct ObjectEvent *, struct Sprite *); +static bool8 LavaridgeGymB1FWarpEffect_FadeOut(struct Task *, struct ObjectEvent *, struct Sprite *); +static bool8 LavaridgeGymB1FWarpEffect_Warp(struct Task *, struct ObjectEvent *, struct Sprite *); static void FieldCB_LavaridgeGymB1FWarpExit(void); static void Task_LavaridgeGymB1FWarpExit(u8); -static bool8 LavaridgeGymB1FWarpExitEffect_0(struct Task *, struct ObjectEvent *, struct Sprite *); -static bool8 LavaridgeGymB1FWarpExitEffect_1(struct Task *, struct ObjectEvent *, struct Sprite *); -static bool8 LavaridgeGymB1FWarpExitEffect_2(struct Task *, struct ObjectEvent *, struct Sprite *); -static bool8 LavaridgeGymB1FWarpExitEffect_3(struct Task *, struct ObjectEvent *, struct Sprite *); +static bool8 LavaridgeGymB1FWarpExitEffect_Init(struct Task *, struct ObjectEvent *, struct Sprite *); +static bool8 LavaridgeGymB1FWarpExitEffect_StartPopOut(struct Task *, struct ObjectEvent *, struct Sprite *); +static bool8 LavaridgeGymB1FWarpExitEffect_PopOut(struct Task *, struct ObjectEvent *, struct Sprite *); +static bool8 LavaridgeGymB1FWarpExitEffect_End(struct Task *, struct ObjectEvent *, struct Sprite *); static void Task_LavaridgeGym1FWarp(u8); -static bool8 LavaridgeGym1FWarpEffect_0(struct Task *, struct ObjectEvent *, struct Sprite *); -static bool8 LavaridgeGym1FWarpEffect_1(struct Task *, struct ObjectEvent *, struct Sprite *); -static bool8 LavaridgeGym1FWarpEffect_2(struct Task *, struct ObjectEvent *, struct Sprite *); -static bool8 LavaridgeGym1FWarpEffect_3(struct Task *, struct ObjectEvent *, struct Sprite *); -static bool8 LavaridgeGym1FWarpEffect_4(struct Task *, struct ObjectEvent *, struct Sprite *); +static bool8 LavaridgeGym1FWarpEffect_Init(struct Task *, struct ObjectEvent *, struct Sprite *); +static bool8 LavaridgeGym1FWarpEffect_AshPuff(struct Task *, struct ObjectEvent *, struct Sprite *); +static bool8 LavaridgeGym1FWarpEffect_Disappear(struct Task *, struct ObjectEvent *, struct Sprite *); +static bool8 LavaridgeGym1FWarpEffect_FadeOut(struct Task *, struct ObjectEvent *, struct Sprite *); +static bool8 LavaridgeGym1FWarpEffect_Warp(struct Task *, struct ObjectEvent *, struct Sprite *); static void Task_EscapeRopeWarpOut(u8); -static void EscapeRopeWarpOutFieldEffect_0(struct Task *); -static void EscapeRopeWarpOutFieldEffect_1(struct Task *); +static void EscapeRopeWarpOutEffect_Init(struct Task *); +static void EscapeRopeWarpOutEffect_Spin(struct Task *); static void FieldCallback_EscapeRopeWarpIn(void); static void Task_EscapeRopeWarpIn(u8); -static void EscapeRopeWarpInFieldEffect_0(struct Task *); -static void EscapeRopeWarpInFieldEffect_1(struct Task *); +static void EscapeRopeWarpInEffect_Init(struct Task *); +static void EscapeRopeWarpInEffect_Spin(struct Task *); static void Task_TeleportWarpOut(u8); -static void TeleportWarpOutFieldEffect_0(struct Task*); -static void TeleportWarpOutFieldEffect_1(struct Task*); -static void TeleportWarpOutFieldEffect_2(struct Task*); -static void TeleportWarpOutFieldEffect_3(struct Task*); +static void TeleportWarpOutFieldEffect_Init(struct Task*); +static void TeleportWarpOutFieldEffect_SpinGround(struct Task*); +static void TeleportWarpOutFieldEffect_SpinExit(struct Task*); +static void TeleportWarpOutFieldEffect_End(struct Task*); static void FieldCallback_TeleportWarpIn(void); static void Task_TeleportWarpIn(u8); -static void TeleportWarpInFieldEffect_0(struct Task *); -static void TeleportWarpInFieldEffect_1(struct Task *); -static void TeleportWarpInFieldEffect_2(struct Task *); +static void TeleportWarpInFieldEffect_Init(struct Task *); +static void TeleportWarpInFieldEffect_SpinEnter(struct Task *); +static void TeleportWarpInFieldEffect_SpinGround(struct Task *); static void Task_FieldMoveShowMonOutdoors(u8); -static void FieldMoveShowMonOutdoorsEffect_0(struct Task *); -static void FieldMoveShowMonOutdoorsEffect_1(struct Task *); -static void FieldMoveShowMonOutdoorsEffect_2(struct Task *); -static void FieldMoveShowMonOutdoorsEffect_3(struct Task *); -static void FieldMoveShowMonOutdoorsEffect_4(struct Task *); -static void FieldMoveShowMonOutdoorsEffect_5(struct Task *); -static void FieldMoveShowMonOutdoorsEffect_6(struct Task *); - +static void FieldMoveShowMonOutdoorsEffect_Init(struct Task *); +static void FieldMoveShowMonOutdoorsEffect_LoadGfx(struct Task *); +static void FieldMoveShowMonOutdoorsEffect_CreateBanner(struct Task *); +static void FieldMoveShowMonOutdoorsEffect_WaitForMon(struct Task *); +static void FieldMoveShowMonOutdoorsEffect_ShrinkBanner(struct Task *); +static void FieldMoveShowMonOutdoorsEffect_RestoreBg(struct Task *); +static void FieldMoveShowMonOutdoorsEffect_End(struct Task *); static void VBlankCB_FieldMoveShowMonOutdoors(void); -static void sub_80B8874(u16); +static void LoadFieldMoveOutdoorStreaksTilemap(u16); static void Task_FieldMoveShowMonIndoors(u8); -static void FieldMoveShowMonIndoorsEffect_0(struct Task *); -static void FieldMoveShowMonIndoorsEffect_1(struct Task *); -static void FieldMoveShowMonIndoorsEffect_2(struct Task *); -static void FieldMoveShowMonIndoorsEffect_3(struct Task *); -static void FieldMoveShowMonIndoorsEffect_4(struct Task *); -static void FieldMoveShowMonIndoorsEffect_5(struct Task *); -static void FieldMoveShowMonIndoorsEffect_6(struct Task *); - +static void FieldMoveShowMonIndoorsEffect_Init(struct Task *); +static void FieldMoveShowMonIndoorsEffect_LoadGfx(struct Task *); +static void FieldMoveShowMonIndoorsEffect_SlideBannerOn(struct Task *); +static void FieldMoveShowMonIndoorsEffect_WaitForMon(struct Task *); +static void FieldMoveShowMonIndoorsEffect_RestoreBg(struct Task *); +static void FieldMoveShowMonIndoorsEffect_SlideBannerOff(struct Task *); +static void FieldMoveShowMonIndoorsEffect_End(struct Task *); static void VBlankCB_FieldMoveShowMonIndoors(void); -static void sub_80B8B28(struct Task *); -static bool8 sub_80B8B38(struct Task *); -static bool8 sub_80B8BF0(struct Task *); +static void AnimateIndoorShowMonBg(struct Task *); +static bool8 SlideIndoorBannerOnscreen(struct Task *); +static bool8 SlideIndoorBannerOffscreen(struct Task *); -static u8 sub_80B8C60(u32, u32, u32); -static void sub_80B8CC0(struct Sprite *); -static void sub_80B8D04(struct Sprite *); -static void sub_80B8D20(struct Sprite *); +static u8 InitFieldMoveMonSprite(u32, u32, u32); +static void SpriteCB_FieldMoveMonSlideOnscreen(struct Sprite *); +static void SpriteCB_FieldMoveMonWaitAfterCry(struct Sprite *); +static void SpriteCB_FieldMoveMonSlideOffscreen(struct Sprite *); static void Task_SurfFieldEffect(u8); -static void SurfFieldEffect_1(struct Task *); -static void SurfFieldEffect_2(struct Task *); -static void SurfFieldEffect_3(struct Task *); -static void SurfFieldEffect_4(struct Task *); -static void SurfFieldEffect_5(struct Task *); +static void SurfFieldEffect_Init(struct Task *); +static void SurfFieldEffect_FieldMovePose(struct Task *); +static void SurfFieldEffect_ShowMon(struct Task *); +static void SurfFieldEffect_JumpOnSurfBlob(struct Task *); +static void SurfFieldEffect_End(struct Task *); static void SpriteCB_NPCFlyOut(struct Sprite *); static void Task_FlyOut(u8); -static void FlyOutFieldEffect_0(struct Task *); -static void FlyOutFieldEffect_1(struct Task *); -static void FlyOutFieldEffect_2(struct Task *); -static void FlyOutFieldEffect_3(struct Task *); -static void FlyOutFieldEffect_4(struct Task *); -static void FlyOutFieldEffect_5(struct Task *); -static void FlyOutFieldEffect_6(struct Task *); -static void FlyOutFieldEffect_7(struct Task *); -static void FlyOutFieldEffect_8(struct Task *); +static void FlyOutFieldEffect_FieldMovePose(struct Task *); +static void FlyOutFieldEffect_ShowMon(struct Task *); +static void FlyOutFieldEffect_BirdLeaveBall(struct Task *); +static void FlyOutFieldEffect_WaitBirdLeave(struct Task *); +static void FlyOutFieldEffect_BirdSwoopDown(struct Task *); +static void FlyOutFieldEffect_JumpOnBird(struct Task *); +static void FlyOutFieldEffect_FlyOffWithBird(struct Task *); +static void FlyOutFieldEffect_WaitFlyOff(struct Task *); +static void FlyOutFieldEffect_End(struct Task *); -static u8 sub_80B94C4(void); -static u8 sub_80B9508(u8); -static void sub_80B9524(u8); -static void sub_80B9560(u8, u8); -static void sub_80B957C(struct Sprite *); -static void sub_80B963C(struct Sprite *); +static u8 CreateFlyBirdSprite(void); +static u8 GetFlyBirdAnimCompleted(u8); +static void StartFlyBirdSwoopDown(u8); +static void SetFlyBirdPlayerSpriteId(u8, u8); +static void SpriteCB_FlyBirdLeaveBall(struct Sprite *); +static void SpriteCB_FlyBirdSwoopDown(struct Sprite *); static void Task_FlyIn(u8); -static void FlyInFieldEffect_0(struct Task *); -static void FlyInFieldEffect_1(struct Task *); -static void FlyInFieldEffect_2(struct Task *); -static void FlyInFieldEffect_3(struct Task *); -static void FlyInFieldEffect_4(struct Task *); -static void FlyInFieldEffect_5(struct Task *); -static void FlyInFieldEffect_6(struct Task *); +static void FlyInFieldEffect_BirdSwoopDown(struct Task *); +static void FlyInFieldEffect_FlyInWithBird(struct Task *); +static void FlyInFieldEffect_JumpOffBird(struct Task *); +static void FlyInFieldEffect_FieldMovePose(struct Task *); +static void FlyInFieldEffect_BirdReturnToBall(struct Task *); +static void FlyInFieldEffect_WaitBirdReturn(struct Task *); +static void FlyInFieldEffect_End(struct Task *); static void Task_DestroyDeoxysRock(u8 taskId); -static void DestroyDeoxysRockFieldEffect_0(s16*, u8); -static void DestroyDeoxysRockFieldEffect_1(s16*, u8); -static void DestroyDeoxysRockFieldEffect_2(s16*, u8); +static void DestroyDeoxysRockEffect_CameraShake(s16*, u8); +static void DestroyDeoxysRockEffect_RockFragments(s16*, u8); +static void DestroyDeoxysRockEffect_WaitAndEnd(s16*, u8); +static void CreateDeoxysRockFragments(struct Sprite*); +static void SpriteCB_DeoxysRockFragment(struct Sprite* sprite); -static void sub_80B9DB8(struct Sprite* sprite); static void Task_MoveDeoxysRock(u8 taskId); -static void sub_80B9D24(struct Sprite*); - // Static RAM declarations static u8 sActiveList[32]; @@ -244,34 +242,33 @@ extern const struct CompressedSpriteSheet gTrainerFrontPicTable[]; extern u8 *gFieldEffectScriptPointers[]; extern const struct SpriteTemplate *const gFieldEffectObjectTemplatePointers[]; -// .rodata -const u32 gNewGameBirchPic[] = INCBIN_U32("graphics/birch_speech/birch.4bpp"); -const u32 gUnusedBirchBeauty[] = INCBIN_U32("graphics/unused/intro_birch_beauty.4bpp"); -const u16 gNewGameBirchPalette[16] = INCBIN_U16("graphics/birch_speech/birch.gbapal"); -const u32 gSpriteImage_855A970[] = INCBIN_U32("graphics/misc/pokeball_glow.4bpp"); -const u16 gFieldEffectObjectPalette4[16] = INCBIN_U16("graphics/field_effects/palettes/04.gbapal"); -const u32 gSpriteImage_855A9B0[] = INCBIN_U32("graphics/misc/pokecenter_monitor/0.4bpp"); -const u32 gSpriteImage_855AA70[] = INCBIN_U32("graphics/misc/pokecenter_monitor/1.4bpp"); -const u32 gSpriteImage_855AB30[] = INCBIN_U32("graphics/misc/big_hof_monitor.4bpp"); -const u8 gSpriteImage_855AD30[] = INCBIN_U8("graphics/misc/small_hof_monitor.4bpp"); -const u16 gFieldEffectObjectPalette5[16] = INCBIN_U16("graphics/field_effects/palettes/05.gbapal"); +static const u32 sNewGameBirch_Gfx[] = INCBIN_U32("graphics/birch_speech/birch.4bpp"); +static const u32 sUnusedBirchBeauty[] = INCBIN_U32("graphics/unused/intro_birch_beauty.4bpp"); +static const u16 sNewGameBirch_Pal[16] = INCBIN_U16("graphics/birch_speech/birch.gbapal"); +static const u32 sPokeballGlow_Gfx[] = INCBIN_U32("graphics/misc/pokeball_glow.4bpp"); +static const u16 sFieldEffectObjectPalette4[16] = INCBIN_U16("graphics/field_effects/palettes/04.gbapal"); +static const u32 sPokecenterMonitor0_Gfx[] = INCBIN_U32("graphics/misc/pokecenter_monitor/0.4bpp"); +static const u32 sPokecenterMonitor1_Gfx[] = INCBIN_U32("graphics/misc/pokecenter_monitor/1.4bpp"); +static const u32 sHofMonitorBig_Gfx[] = INCBIN_U32("graphics/misc/hof_monitor_big.4bpp"); +static const u8 sHofMonitorSmall_Gfx[] = INCBIN_U8("graphics/misc/hof_monitor_small.4bpp"); +static const u16 sFieldEffectObjectPalette5[16] = INCBIN_U16("graphics/field_effects/palettes/05.gbapal"); // Graphics for the lights streaking past your Pokemon when it uses a field move. -const u32 gFieldMoveStreaksTiles[] = INCBIN_U32("graphics/misc/field_move_streaks.4bpp"); -const u16 gFieldMoveStreaksPalette[16] = INCBIN_U16("graphics/misc/field_move_streaks.gbapal"); -const u16 gFieldMoveStreaksTilemap[] = INCBIN_U16("graphics/misc/field_move_streaks_map.bin"); +static const u32 sFieldMoveStreaksOutdoors_Gfx[] = INCBIN_U32("graphics/misc/field_move_streaks.4bpp"); +static const u16 sFieldMoveStreaksOutdoors_Pal[16] = INCBIN_U16("graphics/misc/field_move_streaks.gbapal"); +static const u16 sFieldMoveStreaksOutdoors_Tilemap[320] = INCBIN_U16("graphics/misc/field_move_streaks_map.bin"); -// The following light streaks effect is used when the map is dark (e.g. a cave). -const u32 gDarknessFieldMoveStreaksTiles[] = INCBIN_U32("graphics/misc/darkness_field_move_streaks.4bpp"); -const u16 gDarknessFieldMoveStreaksPalette[16] = INCBIN_U16("graphics/misc/darkness_field_move_streaks.gbapal"); -const u16 gDarknessFieldMoveStreaksTilemap[] = INCBIN_U16("graphics/misc/darkness_field_move_streaks_map.bin"); +// The following light streaks effect is used when the map is indoors +static const u32 sFieldMoveStreaksIndoors_Gfx[] = INCBIN_U32("graphics/misc/darkness_field_move_streaks.4bpp"); +static const u16 sFieldMoveStreaksIndoors_Pal[16] = INCBIN_U16("graphics/misc/darkness_field_move_streaks.gbapal"); +static const u16 sFieldMoveStreaksIndoors_Tilemap[320] = INCBIN_U16("graphics/misc/darkness_field_move_streaks_map.bin"); -const u16 gUnknown_0855B610[16] = INCBIN_U16("graphics/misc/spotlight.gbapal"); -const u8 gUnknown_0855B630[] = INCBIN_U8("graphics/misc/spotlight.4bpp"); -const u8 gUnknown_0855C170[] = INCBIN_U8("graphics/unknown/unknown_55C170.4bpp"); -const u8 gUnknown_0855C190[] = INCBIN_U8("graphics/unknown/unknown_55C190.4bpp"); -const u8 gUnknown_0855C1B0[] = INCBIN_U8("graphics/unknown/unknown_55C1B0.4bpp"); -const u8 gUnknown_0855C1D0[] = INCBIN_U8("graphics/unknown/unknown_55C1D0.4bpp"); +static const u16 sSpotlight_Pal[16] = INCBIN_U16("graphics/misc/spotlight.gbapal"); +static const u8 sSpotlight_Gfx[] = INCBIN_U8("graphics/misc/spotlight.4bpp"); +static const u8 sRockFragment_TopLeft[] = INCBIN_U8("graphics/misc/deoxys_rock_fragment_top_left.4bpp"); +static const u8 sRockFragment_TopRight[] = INCBIN_U8("graphics/misc/deoxys_rock_fragment_top_right.4bpp"); +static const u8 sRockFragment_BottomLeft[] = INCBIN_U8("graphics/misc/deoxys_rock_fragment_bottom_left.4bpp"); +static const u8 sRockFragment_BottomRight[] = INCBIN_U8("graphics/misc/deoxys_rock_fragment_bottom_right.4bpp"); bool8 (*const gFieldEffectScriptFuncs[])(u8 **, u32 *) = { @@ -285,7 +282,7 @@ bool8 (*const gFieldEffectScriptFuncs[])(u8 **, u32 *) = FieldEffectCmd_loadfadedpal_callnative, }; -const struct OamData gNewGameBirchOamAttributes = +static const struct OamData sOam_64x64 = { .y = 0, .affineMode = ST_OAM_AFFINE_OFF, @@ -299,7 +296,7 @@ const struct OamData gNewGameBirchOamAttributes = .paletteNum = 0, }; -const struct OamData gOamData_855C218 = +static const struct OamData sOam_8x8 = { .y = 0, .affineMode = ST_OAM_AFFINE_OFF, @@ -313,7 +310,7 @@ const struct OamData gOamData_855C218 = .paletteNum = 0, }; -const struct OamData gOamData_855C220 = +static const struct OamData sOam_16x16 = { .y = 0, .affineMode = ST_OAM_AFFINE_OFF, @@ -327,52 +324,52 @@ const struct OamData gOamData_855C220 = .paletteNum = 0, }; -const struct SpriteFrameImage gNewGameBirchPicTable[] = +static const struct SpriteFrameImage sPicTable_NewGameBirch[] = { - obj_frame_tiles(gNewGameBirchPic) + obj_frame_tiles(sNewGameBirch_Gfx) }; -const struct SpritePalette gNewGameBirchObjectPaletteInfo = +static const struct SpritePalette sSpritePalette_NewGameBirch = { - .data = gNewGameBirchPalette, - .tag = 0x1006 + .data = sNewGameBirch_Pal, + .tag = FLDEFF_PAL_TAG_6 }; -const union AnimCmd gNewGameBirchImageAnim[] = +static const union AnimCmd sAnim_NewGameBirch[] = { ANIMCMD_FRAME(.imageValue = 0, .duration = 1), ANIMCMD_END }; -const union AnimCmd *const gNewGameBirchImageAnimTable[] = +static const union AnimCmd *const sAnimTable_NewGameBirch[] = { - gNewGameBirchImageAnim + sAnim_NewGameBirch }; -const struct SpriteTemplate gNewGameBirchObjectTemplate = +static const struct SpriteTemplate sSpriteTemplate_NewGameBirch = { .tileTag = 0xFFFF, - .paletteTag = 4102, - .oam = &gNewGameBirchOamAttributes, - .anims = gNewGameBirchImageAnimTable, - .images = gNewGameBirchPicTable, + .paletteTag = FLDEFF_PAL_TAG_6, + .oam = &sOam_64x64, + .anims = sAnimTable_NewGameBirch, + .images = sPicTable_NewGameBirch, .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCallbackDummy }; const struct SpritePalette gFieldEffectObjectPaletteInfo4 = { - .data = gFieldEffectObjectPalette4, - .tag = 0x1007 + .data = sFieldEffectObjectPalette4, + .tag = FLDEFF_PAL_TAG_7 }; const struct SpritePalette gFieldEffectObjectPaletteInfo5 = { - .data = gFieldEffectObjectPalette5, - .tag = 0x1010 + .data = sFieldEffectObjectPalette5, + .tag = FLDEFF_PAL_TAG_16 }; -const struct OamData gOamData_855C26C = +static const struct OamData sOam_32x16 = { .y = 0, .affineMode = ST_OAM_AFFINE_OFF, @@ -386,28 +383,28 @@ const struct OamData gOamData_855C26C = .paletteNum = 0, }; -const struct SpriteFrameImage gSpriteImageTable_855C274[] = +static const struct SpriteFrameImage sPicTable_PokeballGlow[] = { - obj_frame_tiles(gSpriteImage_855A970) + obj_frame_tiles(sPokeballGlow_Gfx) }; -const struct SpriteFrameImage gSpriteImageTable_855C27C[] = +static const struct SpriteFrameImage sPicTable_PokecenterMonitor[] = { - obj_frame_tiles(gSpriteImage_855A9B0), - obj_frame_tiles(gSpriteImage_855AA70) + obj_frame_tiles(sPokecenterMonitor0_Gfx), + obj_frame_tiles(sPokecenterMonitor1_Gfx) }; -const struct SpriteFrameImage gSpriteImageTable_855C28C[] = +static const struct SpriteFrameImage sPicTable_HofMonitorBig[] = { - obj_frame_tiles(gSpriteImage_855AB30) + obj_frame_tiles(sHofMonitorBig_Gfx) }; -const struct SpriteFrameImage gSpriteImageTable_855C294[] = +static const struct SpriteFrameImage sPicTable_HofMonitorSmall[] = { - {.data = gSpriteImage_855AD30, .size = 0x200} // the macro breaks down here + {.data = sHofMonitorSmall_Gfx, .size = 0x200} // the macro breaks down here }; -const struct Subsprite gSubspriteTable_855C29C[] = +static const struct Subsprite sSubsprites_PokecenterMonitor[] = { { .x = -12, @@ -443,9 +440,9 @@ const struct Subsprite gSubspriteTable_855C29C[] = } }; -const struct SubspriteTable gUnknown_0855C2AC = subsprite_table(gSubspriteTable_855C29C); +static const struct SubspriteTable sSubspriteTable_PokecenterMonitor = subsprite_table(sSubsprites_PokecenterMonitor); -const struct Subsprite gSubspriteTable_855C2B4[] = +static const struct Subsprite sSubsprites_HofMonitorBig[] = { { .x = -32, @@ -481,7 +478,7 @@ const struct Subsprite gSubspriteTable_855C2B4[] = } }; -const struct SubspriteTable gUnknown_0855C2C4 = subsprite_table(gSubspriteTable_855C2B4); +static const struct SubspriteTable sSubspriteTable_HofMonitorBig = subsprite_table(sSubsprites_HofMonitorBig); const union AnimCmd gSpriteAnim_855C2CC[] = { @@ -508,84 +505,84 @@ const union AnimCmd *const gSpriteAnimTable_855C2F8[] = gSpriteAnim_855C2D4 }; -const union AnimCmd *const gSpriteAnimTable_855C300[] = +static const union AnimCmd *const sAnimTable_HofMonitor[] = { gSpriteAnim_855C2CC }; -const struct SpriteTemplate gSpriteTemplate_855C304 = +static const struct SpriteTemplate sSpriteTemplate_PokeballGlow = { .tileTag = 0xFFFF, - .paletteTag = 4103, - .oam = &gOamData_855C218, + .paletteTag = FLDEFF_PAL_TAG_7, + .oam = &sOam_8x8, .anims = gSpriteAnimTable_855C2F8, - .images = gSpriteImageTable_855C274, + .images = sPicTable_PokeballGlow, .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCB_PokeballGlow }; -const struct SpriteTemplate gSpriteTemplate_855C31C = +static const struct SpriteTemplate sSpriteTemplate_PokecenterMonitor = { .tileTag = 0xFFFF, - .paletteTag = 4100, - .oam = &gOamData_855C220, + .paletteTag = FLDEFF_PAL_TAG_4, + .oam = &sOam_16x16, .anims = gSpriteAnimTable_855C2F8, - .images = gSpriteImageTable_855C27C, + .images = sPicTable_PokecenterMonitor, .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCB_PokecenterMonitor }; -const struct SpriteTemplate gSpriteTemplate_855C334 = +static const struct SpriteTemplate sSpriteTemplate_HofMonitorBig = { .tileTag = 0xFFFF, - .paletteTag = 4112, - .oam = &gOamData_855C220, - .anims = gSpriteAnimTable_855C300, - .images = gSpriteImageTable_855C28C, + .paletteTag = FLDEFF_PAL_TAG_16, + .oam = &sOam_16x16, + .anims = sAnimTable_HofMonitor, + .images = sPicTable_HofMonitorBig, .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCB_HallOfFameMonitor }; -const struct SpriteTemplate gSpriteTemplate_855C34C = +static const struct SpriteTemplate sSpriteTemplate_HofMonitorSmall = { .tileTag = 0xFFFF, - .paletteTag = 4112, - .oam = &gOamData_855C26C, - .anims = gSpriteAnimTable_855C300, - .images = gSpriteImageTable_855C294, + .paletteTag = FLDEFF_PAL_TAG_16, + .oam = &sOam_32x16, + .anims = sAnimTable_HofMonitor, + .images = sPicTable_HofMonitorSmall, .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCB_HallOfFameMonitor }; void (*const sPokecenterHealEffectFuncs[])(struct Task *) = { - PokecenterHealEffect_0, - PokecenterHealEffect_1, - PokecenterHealEffect_2, - PokecenterHealEffect_3 + PokecenterHealEffect_Init, + PokecenterHealEffect_WaitForBallPlacement, + PokecenterHealEffect_WaitForBallFlashing, + PokecenterHealEffect_WaitForSoundAndEnd }; void (*const sHallOfFameRecordEffectFuncs[])(struct Task *) = { - HallOfFameRecordEffect_0, - HallOfFameRecordEffect_1, - HallOfFameRecordEffect_2, - HallOfFameRecordEffect_3 + HallOfFameRecordEffect_Init, + HallOfFameRecordEffect_WaitForBallPlacement, + HallOfFameRecordEffect_WaitForBallFlashing, + HallOfFameRecordEffect_WaitForSoundAndEnd }; void (*const sPokeballGlowEffectFuncs[])(struct Sprite *) = { - PokeballGlowEffect_0, - PokeballGlowEffect_1, - PokeballGlowEffect_2, - PokeballGlowEffect_3, - PokeballGlowEffect_4, - PokeballGlowEffect_5, - PokeballGlowEffect_6, - PokeballGlowEffect_7 + PokeballGlowEffect_PlaceBalls, + PokeballGlowEffect_TryPlaySe, + PokeballGlowEffect_Flash1, + PokeballGlowEffect_Flash2, + PokeballGlowEffect_WaitAfterFlash, + PokeballGlowEffect_Dummy, + PokeballGlowEffect_WaitForSound, + PokeballGlowEffect_Idle }; -const struct Coords16 gUnknown_0855C3A4[] = +static const struct Coords16 sPokeballCoordOffsets[PARTY_SIZE] = { {.x = 0, .y = 0}, {.x = 6, .y = 0}, @@ -595,93 +592,91 @@ const struct Coords16 gUnknown_0855C3A4[] = {.x = 6, .y = 8} }; -const u8 gUnknown_0855C3BC[] = {16, 12, 8, 0}; -const u8 gUnknown_0855C3C0[] = {16, 12, 8, 0}; -const u8 gUnknown_0855C3C4[] = { 0, 0, 0, 0}; +static const u8 sPokeballGlowReds[] = {16, 12, 8, 0}; +static const u8 sPokeballGlowGreens[] = {16, 12, 8, 0}; +static const u8 sPokeballGlowBlues[] = { 0, 0, 0, 0}; bool8 (*const sFallWarpFieldEffectFuncs[])(struct Task *) = { - FallWarpEffect_0, - FallWarpEffect_1, - FallWarpEffect_2, - FallWarpEffect_3, - FallWarpEffect_4, - FallWarpEffect_5, - FallWarpEffect_6, + FallWarpEffect_Init, + FallWarpEffect_WaitWeather, + FallWarpEffect_StartFall, + FallWarpEffect_Fall, + FallWarpEffect_Land, + FallWarpEffect_CameraShake, + FallWarpEffect_End, }; bool8 (*const sEscalatorWarpOutFieldEffectFuncs[])(struct Task *) = { - EscalatorWarpOutEffect_0, - EscalatorWarpOutEffect_1, - EscalatorWarpOutEffect_2, - EscalatorWarpOutEffect_3, - EscalatorWarpOutEffect_4, - EscalatorWarpOutEffect_5, + EscalatorWarpOut_Init, + EscalatorWarpOut_WaitForPlayer, + EscalatorWarpOut_Up_Ride, + EscalatorWarpOut_Up_End, + EscalatorWarpOut_Down_Ride, + EscalatorWarpOut_Down_End, }; bool8 (*const sEscalatorWarpInFieldEffectFuncs[])(struct Task *) = { - EscalatorWarpInEffect_0, - EscalatorWarpInEffect_1, - EscalatorWarpInEffect_2, - EscalatorWarpInEffect_3, - EscalatorWarpInEffect_4, - EscalatorWarpInEffect_5, - EscalatorWarpInEffect_6, + EscalatorWarpIn_Init, + EscalatorWarpIn_Down_Init, + EscalatorWarpIn_Down_Ride, + EscalatorWarpIn_Up_Init, + EscalatorWarpIn_Up_Ride, + EscalatorWarpIn_WaitForMovement, + EscalatorWarpIn_End, }; bool8 (*const sWaterfallFieldEffectFuncs[])(struct Task *, struct ObjectEvent *) = { - WaterfallFieldEffect_0, - WaterfallFieldEffect_1, - WaterfallFieldEffect_2, - WaterfallFieldEffect_3, - WaterfallFieldEffect_4, + WaterfallFieldEffect_Init, + WaterfallFieldEffect_ShowMon, + WaterfallFieldEffect_WaitForShowMon, + WaterfallFieldEffect_RideUp, + WaterfallFieldEffect_ContinueRideOrEnd, }; bool8 (*const sDiveFieldEffectFuncs[])(struct Task *) = { - DiveFieldEffect_0, - DiveFieldEffect_1, - DiveFieldEffect_2, + DiveFieldEffect_Init, + DiveFieldEffect_ShowMon, + DiveFieldEffect_TryWarp, }; bool8 (*const sLavaridgeGymB1FWarpEffectFuncs[])(struct Task *, struct ObjectEvent *, struct Sprite *) = { - LavaridgeGymB1FWarpEffect_0, - LavaridgeGymB1FWarpEffect_1, - LavaridgeGymB1FWarpEffect_2, - LavaridgeGymB1FWarpEffect_3, - LavaridgeGymB1FWarpEffect_4, - LavaridgeGymB1FWarpEffect_5, + LavaridgeGymB1FWarpEffect_Init, + LavaridgeGymB1FWarpEffect_CameraShake, + LavaridgeGymB1FWarpEffect_Launch, + LavaridgeGymB1FWarpEffect_Rise, + LavaridgeGymB1FWarpEffect_FadeOut, + LavaridgeGymB1FWarpEffect_Warp, }; bool8 (*const sLavaridgeGymB1FWarpExitEffectFuncs[])(struct Task *, struct ObjectEvent *, struct Sprite *) = { - LavaridgeGymB1FWarpExitEffect_0, - LavaridgeGymB1FWarpExitEffect_1, - LavaridgeGymB1FWarpExitEffect_2, - LavaridgeGymB1FWarpExitEffect_3, + LavaridgeGymB1FWarpExitEffect_Init, + LavaridgeGymB1FWarpExitEffect_StartPopOut, + LavaridgeGymB1FWarpExitEffect_PopOut, + LavaridgeGymB1FWarpExitEffect_End, }; bool8 (*const sLavaridgeGym1FWarpEffectFuncs[])(struct Task *, struct ObjectEvent *, struct Sprite *) = { - LavaridgeGym1FWarpEffect_0, - LavaridgeGym1FWarpEffect_1, - LavaridgeGym1FWarpEffect_2, - LavaridgeGym1FWarpEffect_3, - LavaridgeGym1FWarpEffect_4, + LavaridgeGym1FWarpEffect_Init, + LavaridgeGym1FWarpEffect_AshPuff, + LavaridgeGym1FWarpEffect_Disappear, + LavaridgeGym1FWarpEffect_FadeOut, + LavaridgeGym1FWarpEffect_Warp, }; -void (*const sEscapeRopeWarpOutFieldEffectFuncs[])(struct Task *) = +void (*const sEscapeRopeWarpOutEffectFuncs[])(struct Task *) = { - EscapeRopeWarpOutFieldEffect_0, - EscapeRopeWarpOutFieldEffect_1, + EscapeRopeWarpOutEffect_Init, + EscapeRopeWarpOutEffect_Spin, }; -// .text - u32 FieldEffectStart(u8 id) { u8 *script; @@ -885,7 +880,7 @@ u8 CreateTrainerSprite(u8 trainerSpriteID, s16 x, s16 y, u8 subpriority, u8 *buf LoadCompressedSpriteSheetOverrideBuffer(&gTrainerFrontPicTable[trainerSpriteID], buffer); spriteTemplate.tileTag = gTrainerFrontPicTable[trainerSpriteID].tag; spriteTemplate.paletteTag = gTrainerFrontPicPaletteTable[trainerSpriteID].tag; - spriteTemplate.oam = &gNewGameBirchOamAttributes; + spriteTemplate.oam = &sOam_64x64; spriteTemplate.anims = gDummySpriteAnimTable; spriteTemplate.images = NULL; spriteTemplate.affineAnims = gDummySpriteAffineAnimTable; @@ -901,8 +896,8 @@ void LoadTrainerGfx_TrainerCard(u8 gender, u16 palOffset, u8 *dest) u8 AddNewGameBirchObject(s16 x, s16 y, u8 subpriority) { - LoadSpritePalette(&gNewGameBirchObjectPaletteInfo); - return CreateSprite(&gNewGameBirchObjectTemplate, x, y, subpriority); + LoadSpritePalette(&sSpritePalette_NewGameBirch); + return CreateSprite(&sSpriteTemplate_NewGameBirch, x, y, subpriority); } u8 CreateMonSprite_PicBox(u16 species, s16 x, s16 y, u8 subpriority) @@ -915,10 +910,10 @@ u8 CreateMonSprite_PicBox(u16 species, s16 x, s16 y, u8 subpriority) return spriteId; } -u8 CreateMonSprite_FieldMove(u16 species, u32 d, u32 g, s16 x, s16 y, u8 subpriority) +u8 CreateMonSprite_FieldMove(u16 species, u32 otId, u32 personality, s16 x, s16 y, u8 subpriority) { - const struct CompressedSpritePalette *spritePalette = GetMonSpritePalStructFromOtIdPersonality(species, d, g); - u16 spriteId = CreateMonPicSprite_HandleDeoxys(species, d, g, 1, x, y, 0, spritePalette->tag); + const struct CompressedSpritePalette *spritePalette = GetMonSpritePalStructFromOtIdPersonality(species, otId, personality); + u16 spriteId = CreateMonPicSprite_HandleDeoxys(species, otId, personality, 1, x, y, 0, spritePalette->tag); PreservePaletteInWeather(IndexOfSpritePaletteTag(spritePalette->tag) + 0x10); if (spriteId == 0xFFFF) return MAX_SPRITES; @@ -978,6 +973,28 @@ void MultiplyPaletteRGBComponents(u16 i, u8 r, u8 g, u8 b) gPlttBufferFaded[i] = outPal; } +// Task data for Task_PokecenterHeal and Task_HallOfFameRecord +#define tState data[0] +#define tNumMons data[1] +#define tFirstBallX data[2] +#define tFirstBallY data[3] +#define tMonitorX data[4] +#define tMonitorY data[5] +#define tBallSpriteId data[6] +#define tMonitorSpriteId data[7] +#define tStartHofFlash data[15] + +// Sprite data for SpriteCB_PokeballGlowEffect +#define sState data[0] +#define sTimer data[1] +#define sCounter data[2] +#define sPlayHealSe data[5] +#define sNumMons data[6] +#define sSpriteId data[7] + +// Sprite data for SpriteCB_PokeballGlow +#define sEffectSpriteId data[0] + bool8 FldEff_PokecenterHeal(void) { u8 nPokemon; @@ -985,11 +1002,11 @@ bool8 FldEff_PokecenterHeal(void) nPokemon = CalculatePlayerPartyCount(); task = &gTasks[CreateTask(Task_PokecenterHeal, 0xff)]; - task->data[1] = nPokemon; - task->data[2] = 0x5d; - task->data[3] = 0x24; - task->data[4] = 0x7c; - task->data[5] = 0x18; + task->tNumMons = nPokemon; + task->tFirstBallX = 93; + task->tFirstBallY = 36; + task->tMonitorX = 124; + task->tMonitorY = 24; return FALSE; } @@ -997,38 +1014,38 @@ static void Task_PokecenterHeal(u8 taskId) { struct Task *task; task = &gTasks[taskId]; - sPokecenterHealEffectFuncs[task->data[0]](task); + sPokecenterHealEffectFuncs[task->tState](task); } -static void PokecenterHealEffect_0(struct Task *task) +static void PokecenterHealEffect_Init(struct Task *task) { - task->data[0]++; - task->data[6] = CreatePokeballGlowSprite(task->data[1], task->data[2], task->data[3], 1); - task->data[7] = PokecenterHealEffectHelper(task->data[4], task->data[5]); + task->tState++; + task->tBallSpriteId = CreateGlowingPokeballsEffect(task->tNumMons, task->tFirstBallX, task->tFirstBallY, TRUE); + task->tMonitorSpriteId = CreatePokecenterMonitorSprite(task->tMonitorX, task->tMonitorY); } -static void PokecenterHealEffect_1(struct Task *task) +static void PokecenterHealEffect_WaitForBallPlacement(struct Task *task) { - if (gSprites[task->data[6]].data[0] > 1) + if (gSprites[task->tBallSpriteId].sState > 1) { - gSprites[task->data[7]].data[0]++; - task->data[0]++; + gSprites[task->tMonitorSpriteId].sState++; + task->tState++; } } -static void PokecenterHealEffect_2(struct Task *task) +static void PokecenterHealEffect_WaitForBallFlashing(struct Task *task) { - if (gSprites[task->data[6]].data[0] > 4) + if (gSprites[task->tBallSpriteId].sState > 4) { - task->data[0]++; + task->tState++; } } -static void PokecenterHealEffect_3(struct Task *task) +static void PokecenterHealEffect_WaitForSoundAndEnd(struct Task *task) { - if (gSprites[task->data[6]].data[0] > 6) + if (gSprites[task->tBallSpriteId].sState > 6) { - DestroySprite(&gSprites[task->data[6]]); + DestroySprite(&gSprites[task->tBallSpriteId]); FieldEffectActiveListRemove(FLDEFF_POKECENTER_HEAL); DestroyTask(FindTaskIdByFunc(Task_PokecenterHeal)); } @@ -1041,9 +1058,9 @@ bool8 FldEff_HallOfFameRecord(void) nPokemon = CalculatePlayerPartyCount(); task = &gTasks[CreateTask(Task_HallOfFameRecord, 0xff)]; - task->data[1] = nPokemon; - task->data[2] = 0x75; - task->data[3] = 0x34; + task->tNumMons = nPokemon; + task->tFirstBallX = 117; + task->tFirstBallY = 52; return FALSE; } @@ -1051,51 +1068,50 @@ static void Task_HallOfFameRecord(u8 taskId) { struct Task *task; task = &gTasks[taskId]; - sHallOfFameRecordEffectFuncs[task->data[0]](task); + sHallOfFameRecordEffectFuncs[task->tState](task); } -static void HallOfFameRecordEffect_0(struct Task *task) +static void HallOfFameRecordEffect_Init(struct Task *task) { u8 taskId; - task->data[0]++; - task->data[6] = CreatePokeballGlowSprite(task->data[1], task->data[2], task->data[3], 0); + task->tState++; + task->tBallSpriteId = CreateGlowingPokeballsEffect(task->tNumMons, task->tFirstBallX, task->tFirstBallY, FALSE); taskId = FindTaskIdByFunc(Task_HallOfFameRecord); - HallOfFameRecordEffectHelper(taskId, 0x78, 0x18, 0); - HallOfFameRecordEffectHelper(taskId, 0x28, 0x08, 1); - HallOfFameRecordEffectHelper(taskId, 0x48, 0x08, 1); - HallOfFameRecordEffectHelper(taskId, 0xa8, 0x08, 1); - HallOfFameRecordEffectHelper(taskId, 0xc8, 0x08, 1); + CreateHofMonitorSprite(taskId, 120, 24, FALSE); + CreateHofMonitorSprite(taskId, 40, 8, TRUE); + CreateHofMonitorSprite(taskId, 72, 8, TRUE); + CreateHofMonitorSprite(taskId, 168, 8, TRUE); + CreateHofMonitorSprite(taskId, 200, 8, TRUE); } -static void HallOfFameRecordEffect_1(struct Task *task) +static void HallOfFameRecordEffect_WaitForBallPlacement(struct Task *task) { - if (gSprites[task->data[6]].data[0] > 1) + if (gSprites[task->tBallSpriteId].sState > 1) { - task->data[15]++; // was this ever initialized? is this ever used? - task->data[0]++; + task->tStartHofFlash++; + task->tState++; } } -static void HallOfFameRecordEffect_2(struct Task *task) +static void HallOfFameRecordEffect_WaitForBallFlashing(struct Task *task) { - if (gSprites[task->data[6]].data[0] > 4) + if (gSprites[task->tBallSpriteId].sState > 4) { - task->data[0]++; + task->tState++; } } -static void HallOfFameRecordEffect_3(struct Task *task) +static void HallOfFameRecordEffect_WaitForSoundAndEnd(struct Task *task) { - if (gSprites[task->data[6]].data[0] > 6) + if (gSprites[task->tBallSpriteId].sState > 6) { - DestroySprite(&gSprites[task->data[6]]); + DestroySprite(&gSprites[task->tBallSpriteId]); FieldEffectActiveListRemove(FLDEFF_HALL_OF_FAME_RECORD); DestroyTask(FindTaskIdByFunc(Task_HallOfFameRecord)); } } - -static u8 CreatePokeballGlowSprite(s16 data6, s16 x, s16 y, u16 data5) +static u8 CreateGlowingPokeballsEffect(s16 numMons, s16 x, s16 y, bool16 playHealSe) { u8 spriteId; struct Sprite *sprite; @@ -1103,150 +1119,150 @@ static u8 CreatePokeballGlowSprite(s16 data6, s16 x, s16 y, u16 data5) sprite = &gSprites[spriteId]; sprite->pos2.x = x; sprite->pos2.y = y; - sprite->data[5] = data5; - sprite->data[6] = data6; - sprite->data[7] = spriteId; + sprite->sPlayHealSe = playHealSe; + sprite->sNumMons = numMons; + sprite->sSpriteId = spriteId; return spriteId; } static void SpriteCB_PokeballGlowEffect(struct Sprite *sprite) { - sPokeballGlowEffectFuncs[sprite->data[0]](sprite); + sPokeballGlowEffectFuncs[sprite->sState](sprite); } -static void PokeballGlowEffect_0(struct Sprite *sprite) +static void PokeballGlowEffect_PlaceBalls(struct Sprite *sprite) { - u8 endSpriteId; - if (sprite->data[1] == 0 || (--sprite->data[1]) == 0) + u8 spriteId; + if (sprite->sTimer == 0 || (--sprite->sTimer) == 0) { - sprite->data[1] = 25; - endSpriteId = CreateSpriteAtEnd(&gSpriteTemplate_855C304, gUnknown_0855C3A4[sprite->data[2]].x + sprite->pos2.x, gUnknown_0855C3A4[sprite->data[2]].y + sprite->pos2.y, 0); - gSprites[endSpriteId].oam.priority = 2; - gSprites[endSpriteId].data[0] = sprite->data[7]; - sprite->data[2]++; - sprite->data[6]--; + sprite->sTimer = 25; + spriteId = CreateSpriteAtEnd(&sSpriteTemplate_PokeballGlow, sPokeballCoordOffsets[sprite->sCounter].x + sprite->pos2.x, sPokeballCoordOffsets[sprite->sCounter].y + sprite->pos2.y, 0); + gSprites[spriteId].oam.priority = 2; + gSprites[spriteId].sEffectSpriteId = sprite->sSpriteId; + sprite->sCounter++; + sprite->sNumMons--; PlaySE(SE_BOWA); } - if (sprite->data[6] == 0) + if (sprite->sNumMons == 0) { - sprite->data[1] = 32; - sprite->data[0]++; + sprite->sTimer = 32; + sprite->sState++; } } -static void PokeballGlowEffect_1(struct Sprite *sprite) +static void PokeballGlowEffect_TryPlaySe(struct Sprite *sprite) { - if ((--sprite->data[1]) == 0) + if ((--sprite->sTimer) == 0) { - sprite->data[0]++; - sprite->data[1] = 8; - sprite->data[2] = 0; + sprite->sState++; + sprite->sTimer = 8; + sprite->sCounter = 0; sprite->data[3] = 0; - if (sprite->data[5]) + if (sprite->sPlayHealSe) { PlayFanfare(MUS_ME_ASA); } } } -static void PokeballGlowEffect_2(struct Sprite *sprite) +static void PokeballGlowEffect_Flash1(struct Sprite *sprite) { u8 phase; - if ((--sprite->data[1]) == 0) + if ((--sprite->sTimer) == 0) { - sprite->data[1] = 8; - sprite->data[2]++; - sprite->data[2] &= 3; - if (sprite->data[2] == 0) - { + sprite->sTimer = 8; + sprite->sCounter++; + sprite->sCounter &= 3; + + if (sprite->sCounter == 0) sprite->data[3]++; - } } - phase = (sprite->data[2] + 3) & 3; - MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(0x1007) << 4) + 0x108, gUnknown_0855C3BC[phase], gUnknown_0855C3C0[phase], gUnknown_0855C3C4[phase]); - phase = (sprite->data[2] + 2) & 3; - MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(0x1007) << 4) + 0x106, gUnknown_0855C3BC[phase], gUnknown_0855C3C0[phase], gUnknown_0855C3C4[phase]); - phase = (sprite->data[2] + 1) & 3; - MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(0x1007) << 4) + 0x102, gUnknown_0855C3BC[phase], gUnknown_0855C3C0[phase], gUnknown_0855C3C4[phase]); - phase = sprite->data[2]; - MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(0x1007) << 4) + 0x105, gUnknown_0855C3BC[phase], gUnknown_0855C3C0[phase], gUnknown_0855C3C4[phase]); - MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(0x1007) << 4) + 0x103, gUnknown_0855C3BC[phase], gUnknown_0855C3C0[phase], gUnknown_0855C3C4[phase]); + phase = (sprite->sCounter + 3) & 3; + MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_7) << 4) + 0x108, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]); + phase = (sprite->sCounter + 2) & 3; + MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_7) << 4) + 0x106, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]); + phase = (sprite->sCounter + 1) & 3; + MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_7) << 4) + 0x102, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]); + phase = sprite->sCounter; + MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_7) << 4) + 0x105, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]); + MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_7) << 4) + 0x103, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]); if (sprite->data[3] > 2) { - sprite->data[0]++; - sprite->data[1] = 8; - sprite->data[2] = 0; + sprite->sState++; + sprite->sTimer = 8; + sprite->sCounter = 0; } } -static void PokeballGlowEffect_3(struct Sprite *sprite) +static void PokeballGlowEffect_Flash2(struct Sprite *sprite) { u8 phase; - if ((--sprite->data[1]) == 0) + if ((--sprite->sTimer) == 0) { - sprite->data[1] = 8; - sprite->data[2]++; - sprite->data[2] &= 3; - if (sprite->data[2] == 3) + sprite->sTimer = 8; + sprite->sCounter++; + sprite->sCounter &= 3; + if (sprite->sCounter == 3) { - sprite->data[0]++; - sprite->data[1] = 30; + sprite->sState++; + sprite->sTimer = 30; } } - phase = sprite->data[2]; - MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(0x1007) << 4) + 0x108, gUnknown_0855C3BC[phase], gUnknown_0855C3C0[phase], gUnknown_0855C3C4[phase]); - MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(0x1007) << 4) + 0x106, gUnknown_0855C3BC[phase], gUnknown_0855C3C0[phase], gUnknown_0855C3C4[phase]); - MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(0x1007) << 4) + 0x102, gUnknown_0855C3BC[phase], gUnknown_0855C3C0[phase], gUnknown_0855C3C4[phase]); - MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(0x1007) << 4) + 0x105, gUnknown_0855C3BC[phase], gUnknown_0855C3C0[phase], gUnknown_0855C3C4[phase]); - MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(0x1007) << 4) + 0x103, gUnknown_0855C3BC[phase], gUnknown_0855C3C0[phase], gUnknown_0855C3C4[phase]); + phase = sprite->sCounter; + MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_7) << 4) + 0x108, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]); + MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_7) << 4) + 0x106, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]); + MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_7) << 4) + 0x102, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]); + MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_7) << 4) + 0x105, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]); + MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_7) << 4) + 0x103, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]); } -static void PokeballGlowEffect_4(struct Sprite *sprite) +static void PokeballGlowEffect_WaitAfterFlash(struct Sprite *sprite) { - if ((--sprite->data[1]) == 0) + if ((--sprite->sTimer) == 0) { - sprite->data[0]++; + sprite->sState++; } } -static void PokeballGlowEffect_5(struct Sprite *sprite) +static void PokeballGlowEffect_Dummy(struct Sprite *sprite) { - sprite->data[0]++; + sprite->sState++; } -static void PokeballGlowEffect_6(struct Sprite *sprite) +static void PokeballGlowEffect_WaitForSound(struct Sprite *sprite) { - if (sprite->data[5] == 0 || IsFanfareTaskInactive()) + if (sprite->sPlayHealSe == FALSE || IsFanfareTaskInactive()) { - sprite->data[0]++; + sprite->sState++; } } -static void PokeballGlowEffect_7(struct Sprite *sprite) +static void PokeballGlowEffect_Idle(struct Sprite *sprite) { + // Idle until destroyed } -void SpriteCB_PokeballGlow(struct Sprite *sprite) +static void SpriteCB_PokeballGlow(struct Sprite *sprite) { - if (gSprites[sprite->data[0]].data[0] > 4) + if (gSprites[sprite->sEffectSpriteId].sState > 4) { FieldEffectFreeGraphicsResources(sprite); } } -static u8 PokecenterHealEffectHelper(s16 x, s16 y) +static u8 CreatePokecenterMonitorSprite(s16 x, s16 y) { - u8 spriteIdAtEnd; + u8 spriteId; struct Sprite *sprite; - spriteIdAtEnd = CreateSpriteAtEnd(&gSpriteTemplate_855C31C, x, y, 0); - sprite = &gSprites[spriteIdAtEnd]; + spriteId = CreateSpriteAtEnd(&sSpriteTemplate_PokecenterMonitor, x, y, 0); + sprite = &gSprites[spriteId]; sprite->oam.priority = 2; sprite->invisible = TRUE; - SetSubspriteTables(sprite, &gUnknown_0855C2AC); - return spriteIdAtEnd; + SetSubspriteTables(sprite, &sSubspriteTable_PokecenterMonitor); + return spriteId; } -void SpriteCB_PokecenterMonitor(struct Sprite *sprite) +static void SpriteCB_PokecenterMonitor(struct Sprite *sprite) { if (sprite->data[0] != 0) { @@ -1260,24 +1276,24 @@ void SpriteCB_PokecenterMonitor(struct Sprite *sprite) } } -static void HallOfFameRecordEffectHelper(s16 a0, s16 a1, s16 a2, u8 a3) +static void CreateHofMonitorSprite(s16 taskId, s16 x, s16 y, bool8 isSmallMonitor) { - u8 spriteIdAtEnd; - if (!a3) + u8 spriteId; + if (!isSmallMonitor) { - spriteIdAtEnd = CreateSpriteAtEnd(&gSpriteTemplate_855C334, a1, a2, 0); - SetSubspriteTables(&gSprites[spriteIdAtEnd], &gUnknown_0855C2C4); + spriteId = CreateSpriteAtEnd(&sSpriteTemplate_HofMonitorBig, x, y, 0); + SetSubspriteTables(&gSprites[spriteId], &sSubspriteTable_HofMonitorBig); } else { - spriteIdAtEnd = CreateSpriteAtEnd(&gSpriteTemplate_855C34C, a1, a2, 0); + spriteId = CreateSpriteAtEnd(&sSpriteTemplate_HofMonitorSmall, x, y, 0); } - gSprites[spriteIdAtEnd].invisible = TRUE; - gSprites[spriteIdAtEnd].data[0] = a0; + gSprites[spriteId].invisible = TRUE; + gSprites[spriteId].data[0] = taskId; } -void SpriteCB_HallOfFameMonitor(struct Sprite *sprite) +static void SpriteCB_HallOfFameMonitor(struct Sprite *sprite) { - if (gTasks[sprite->data[0]].data[15]) + if (gTasks[sprite->data[0]].tStartHofFlash) { if (sprite->data[1] == 0 || (--sprite->data[1]) == 0) { @@ -1292,6 +1308,22 @@ void SpriteCB_HallOfFameMonitor(struct Sprite *sprite) } } +#undef tState +#undef tNumMons +#undef tFirstBallX +#undef tFirstBallY +#undef tMonitorX +#undef tMonitorY +#undef tBallSpriteId +#undef tMonitorSpriteId +#undef tStartHofFlash +#undef sState +#undef sTimer +#undef sCounter +#undef sPlayHealSe +#undef sNumMons +#undef sSpriteId +#undef sEffectSpriteId void ReturnToFieldFromFlyMapSelect(void) { @@ -1315,14 +1347,12 @@ static void Task_UseFly(u8 taskId) if (!task->data[0]) { if (!IsWeatherNotFadingIn()) - { return; - } + gFieldEffectArguments[0] = GetCursorSelectionMonId(); if ((int)gFieldEffectArguments[0] > PARTY_SIZE - 1) - { gFieldEffectArguments[0] = 0; - } + FieldEffectStart(FLDEFF_USE_FLY); task->data[0]++; } @@ -1372,6 +1402,15 @@ static void Task_FlyIntoMap(u8 taskId) } } +#define tState data[0] +#define tFallOffset data[1] +#define tTotalFall data[2] +#define tSetTrigger data[3] +#define tSubsprMode data[4] + +#define tVertShake data[1] // re-used +#define tNumShakes data[2] + void FieldCB_FallWarpExit(void) { Overworld_PlaySpecialMapMusic(); @@ -1386,10 +1425,10 @@ static void Task_FallWarpFieldEffect(u8 taskId) { struct Task *task; task = &gTasks[taskId]; - while (sFallWarpFieldEffectFuncs[task->data[0]](task)); // return code signifies whether to continue blocking here + while (sFallWarpFieldEffectFuncs[task->tState](task)); } -static bool8 FallWarpEffect_0(struct Task *task) +static bool8 FallWarpEffect_Init(struct Task *task) { struct ObjectEvent *playerObject; struct Sprite *playerSprite; @@ -1399,59 +1438,57 @@ static bool8 FallWarpEffect_0(struct Task *task) gObjectEvents[gPlayerAvatar.objectEventId].invisible = TRUE; gPlayerAvatar.preventStep = TRUE; ObjectEventSetHeldMovement(playerObject, GetFaceDirectionMovementAction(GetPlayerFacingDirection())); - task->data[4] = playerSprite->subspriteMode; + task->tSubsprMode = playerSprite->subspriteMode; playerObject->fixedPriority = 1; playerSprite->oam.priority = 1; playerSprite->subspriteMode = SUBSPRITES_IGNORE_PRIORITY; - task->data[0]++; + task->tState++; return TRUE; } -static bool8 FallWarpEffect_1(struct Task *task) +static bool8 FallWarpEffect_WaitWeather(struct Task *task) { if (IsWeatherNotFadingIn()) - { - task->data[0]++; - } + task->tState++; + return FALSE; } -static bool8 FallWarpEffect_2(struct Task *task) +static bool8 FallWarpEffect_StartFall(struct Task *task) { struct Sprite *sprite; s16 centerToCornerVecY; sprite = &gSprites[gPlayerAvatar.spriteId]; centerToCornerVecY = -(sprite->centerToCornerVecY << 1); sprite->pos2.y = -(sprite->pos1.y + sprite->centerToCornerVecY + gSpriteCoordOffsetY + centerToCornerVecY); - task->data[1] = 1; - task->data[2] = 0; + task->tFallOffset = 1; + task->tTotalFall = 0; gObjectEvents[gPlayerAvatar.objectEventId].invisible = FALSE; PlaySE(SE_RU_HYUU); - task->data[0]++; + task->tState++; return FALSE; } -static bool8 FallWarpEffect_3(struct Task *task) +static bool8 FallWarpEffect_Fall(struct Task *task) { struct ObjectEvent *objectEvent; struct Sprite *sprite; objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; sprite = &gSprites[gPlayerAvatar.spriteId]; - sprite->pos2.y += task->data[1]; - if (task->data[1] < 8) + sprite->pos2.y += task->tFallOffset; + if (task->tFallOffset < 8) { - task->data[2] += task->data[1]; - if (task->data[2] & 0xf) - { - task->data[1] <<= 1; - } + task->tTotalFall += task->tFallOffset; + + if (task->tTotalFall & 0xf) + task->tFallOffset <<= 1; } - if (task->data[3] == 0 && sprite->pos2.y >= -16) + if (task->tSetTrigger == FALSE && sprite->pos2.y >= -16) { - task->data[3]++; + task->tSetTrigger++; objectEvent->fixedPriority = 0; - sprite->subspriteMode = task->data[4]; + sprite->subspriteMode = task->tSubsprMode; objectEvent->triggerGroundEffectsOnMove = 1; } if (sprite->pos2.y >= 0) @@ -1460,37 +1497,36 @@ static bool8 FallWarpEffect_3(struct Task *task) objectEvent->triggerGroundEffectsOnStop = 1; objectEvent->landingJump = 1; sprite->pos2.y = 0; - task->data[0]++; + task->tState++; } return FALSE; } -static bool8 FallWarpEffect_4(struct Task *task) +static bool8 FallWarpEffect_Land(struct Task *task) { - task->data[0]++; - task->data[1] = 4; - task->data[2] = 0; + task->tState++; + task->tVertShake = 4; + task->tNumShakes = 0; SetCameraPanningCallback(NULL); return TRUE; } -static bool8 FallWarpEffect_5(struct Task *task) +static bool8 FallWarpEffect_CameraShake(struct Task *task) { - SetCameraPanning(0, task->data[1]); - task->data[1] = -task->data[1]; - task->data[2]++; - if ((task->data[2] & 3) == 0) - { - task->data[1] >>= 1; - } - if (task->data[1] == 0) - { - task->data[0]++; - } + SetCameraPanning(0, task->tVertShake); + task->tVertShake = -task->tVertShake; + task->tNumShakes++; + + if ((task->tNumShakes & 3) == 0) + task->tVertShake >>= 1; + + if (task->tVertShake == 0) + task->tState++; + return FALSE; } -static bool8 FallWarpEffect_6(struct Task *task) +static bool8 FallWarpEffect_End(struct Task *task) { gPlayerAvatar.preventStep = FALSE; ScriptContext2_Disable(); @@ -1501,14 +1537,25 @@ static bool8 FallWarpEffect_6(struct Task *task) return FALSE; } +#undef tState +#undef tFallOffset +#undef tTotalFall +#undef tSetTrigger +#undef tSubsprMode +#undef tVertShake +#undef tNumShakes + +#define tState data[0] +#define tGoingUp data[1] + void StartEscalatorWarp(u8 metatileBehavior, u8 priority) { u8 taskId; taskId = CreateTask(Task_EscalatorWarpOut, priority); - gTasks[taskId].data[1] = FALSE; + gTasks[taskId].tGoingUp = FALSE; if (metatileBehavior == MB_UP_ESCALATOR) { - gTasks[taskId].data[1] = TRUE; + gTasks[taskId].tGoingUp = TRUE; } } @@ -1516,74 +1563,74 @@ static void Task_EscalatorWarpOut(u8 taskId) { struct Task *task; task = &gTasks[taskId]; - while (sEscalatorWarpOutFieldEffectFuncs[task->data[0]](task)); + while (sEscalatorWarpOutFieldEffectFuncs[task->tState](task)); } -static bool8 EscalatorWarpOutEffect_0(struct Task *task) +static bool8 EscalatorWarpOut_Init(struct Task *task) { FreezeObjectEvents(); CameraObjectReset2(); - StartEscalator(task->data[1]); - task->data[0]++; + StartEscalator(task->tGoingUp); + task->tState++; return FALSE; } -static bool8 EscalatorWarpOutEffect_1(struct Task *task) +static bool8 EscalatorWarpOut_WaitForPlayer(struct Task *task) { struct ObjectEvent *objectEvent; objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; if (!ObjectEventIsMovementOverridden(objectEvent) || ObjectEventClearHeldMovementIfFinished(objectEvent)) { ObjectEventSetHeldMovement(objectEvent, GetFaceDirectionMovementAction(GetPlayerFacingDirection())); - task->data[0]++; + task->tState++; task->data[2] = 0; task->data[3] = 0; - if ((u8)task->data[1] == 0) + if ((u8)task->tGoingUp == FALSE) { - task->data[0] = 4; + task->tState = 4; // jump to EscalatorWarpOut_Down_Ride } PlaySE(SE_ESUKA); } return FALSE; } -static bool8 EscalatorWarpOutEffect_2(struct Task *task) +static bool8 EscalatorWarpOut_Up_Ride(struct Task *task) { - sub_80B6FB8(task); + RideUpEscalatorOut(task); if (task->data[2] > 3) { - sub_80B7050(); - task->data[0]++; + FadeOutAtEndOfEscalator(); + task->tState++; } return FALSE; } -static bool8 EscalatorWarpOutEffect_3(struct Task *task) +static bool8 EscalatorWarpOut_Up_End(struct Task *task) { - sub_80B6FB8(task); - sub_80B7060(); + RideUpEscalatorOut(task); + WarpAtEndOfEscalator(); return FALSE; } -static bool8 EscalatorWarpOutEffect_4(struct Task *task) +static bool8 EscalatorWarpOut_Down_Ride(struct Task *task) { - sub_80B7004(task); + RideDownEscalatorOut(task); if (task->data[2] > 3) { - sub_80B7050(); - task->data[0]++; + FadeOutAtEndOfEscalator(); + task->tState++; } return FALSE; } -static bool8 EscalatorWarpOutEffect_5(struct Task *task) +static bool8 EscalatorWarpOut_Down_End(struct Task *task) { - sub_80B7004(task); - sub_80B7060(); + RideDownEscalatorOut(task); + WarpAtEndOfEscalator(); return FALSE; } -static void sub_80B6FB8(struct Task *task) +static void RideUpEscalatorOut(struct Task *task) { struct Sprite *sprite; sprite = &gSprites[gPlayerAvatar.spriteId]; @@ -1596,7 +1643,7 @@ static void sub_80B6FB8(struct Task *task) } } -static void sub_80B7004(struct Task *task) +static void RideDownEscalatorOut(struct Task *task) { struct Sprite *sprite; sprite = &gSprites[gPlayerAvatar.spriteId]; @@ -1609,13 +1656,13 @@ static void sub_80B7004(struct Task *task) } } -static void sub_80B7050(void) +static void FadeOutAtEndOfEscalator(void) { TryFadeOutOldMapMusic(); WarpFadeOutScreen(); } -static void sub_80B7060(void) +static void WarpAtEndOfEscalator(void) { if (!gPaletteFade.active && BGMusicStopped() == TRUE) { @@ -1627,6 +1674,9 @@ static void sub_80B7060(void) } } +#undef tState +#undef tGoingUp + static void FieldCallback_EscalatorWarpIn(void) { Overworld_PlaySpecialMapMusic(); @@ -1636,14 +1686,16 @@ static void FieldCallback_EscalatorWarpIn(void) gFieldCallback = NULL; } +#define tState data[0] + static void Task_EscalatorWarpIn(u8 taskId) { struct Task *task; task = &gTasks[taskId]; - while (sEscalatorWarpInFieldEffectFuncs[task->data[0]](task)); + while (sEscalatorWarpInFieldEffectFuncs[task->tState](task)); } -static bool8 EscalatorWarpInEffect_0(struct Task *task) +static bool8 EscalatorWarpIn_Init(struct Task *task) { struct ObjectEvent *objectEvent; s16 x; @@ -1654,31 +1706,35 @@ static bool8 EscalatorWarpInEffect_0(struct Task *task) ObjectEventSetHeldMovement(objectEvent, GetFaceDirectionMovementAction(DIR_EAST)); PlayerGetDestCoords(&x, &y); behavior = MapGridGetMetatileBehaviorAt(x, y); - task->data[0]++; + task->tState++; task->data[1] = 16; + if (behavior == MB_DOWN_ESCALATOR) { + // If dest is down escalator tile, player is riding up behavior = TRUE; - task->data[0] = 3; - } else // MB_UP_ESCALATOR + task->tState = 3; // jump to EscalatorWarpIn_Up_Init + } + else // MB_UP_ESCALATOR { + // If dest is up escalator tile, player is riding down behavior = FALSE; } StartEscalator(behavior); return TRUE; } -static bool8 EscalatorWarpInEffect_1(struct Task *task) +static bool8 EscalatorWarpIn_Down_Init(struct Task *task) { struct Sprite *sprite; sprite = &gSprites[gPlayerAvatar.spriteId]; sprite->pos2.x = Cos(0x84, task->data[1]); sprite->pos2.y = Sin(0x94, task->data[1]); - task->data[0]++; + task->tState++; return FALSE; } -static bool8 EscalatorWarpInEffect_2(struct Task *task) +static bool8 EscalatorWarpIn_Down_Ride(struct Task *task) { struct Sprite *sprite; sprite = &gSprites[gPlayerAvatar.spriteId]; @@ -1693,22 +1749,22 @@ static bool8 EscalatorWarpInEffect_2(struct Task *task) { sprite->pos2.x = 0; sprite->pos2.y = 0; - task->data[0] = 5; + task->tState = 5; } return FALSE; } -static bool8 EscalatorWarpInEffect_3(struct Task *task) +static bool8 EscalatorWarpIn_Up_Init(struct Task *task) { struct Sprite *sprite; sprite = &gSprites[gPlayerAvatar.spriteId]; sprite->pos2.x = Cos(0x7c, task->data[1]); sprite->pos2.y = Sin(0x76, task->data[1]); - task->data[0]++; + task->tState++; return FALSE; } -static bool8 EscalatorWarpInEffect_4(struct Task *task) +static bool8 EscalatorWarpIn_Up_Ride(struct Task *task) { struct Sprite *sprite; sprite = &gSprites[gPlayerAvatar.spriteId]; @@ -1723,23 +1779,23 @@ static bool8 EscalatorWarpInEffect_4(struct Task *task) { sprite->pos2.x = 0; sprite->pos2.y = 0; - task->data[0]++; + task->tState++; } return FALSE; } -static bool8 EscalatorWarpInEffect_5(struct Task *task) +static bool8 EscalatorWarpIn_WaitForMovement(struct Task *task) { if (IsEscalatorMoving()) { return FALSE; } StopEscalator(); - task->data[0]++; + task->tState++; return TRUE; } -static bool8 EscalatorWarpInEffect_6(struct Task *task) +static bool8 EscalatorWarpIn_End(struct Task *task) { struct ObjectEvent *objectEvent; objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; @@ -1753,70 +1809,75 @@ static bool8 EscalatorWarpInEffect_6(struct Task *task) return FALSE; } +#undef tState + +#define tState data[0] +#define tMonId data[1] + bool8 FldEff_UseWaterfall(void) { u8 taskId; taskId = CreateTask(Task_UseWaterfall, 0xff); - gTasks[taskId].data[1] = gFieldEffectArguments[0]; + gTasks[taskId].tMonId = gFieldEffectArguments[0]; Task_UseWaterfall(taskId); return FALSE; } static void Task_UseWaterfall(u8 taskId) { - while (sWaterfallFieldEffectFuncs[gTasks[taskId].data[0]](&gTasks[taskId], &gObjectEvents[gPlayerAvatar.objectEventId])); + while (sWaterfallFieldEffectFuncs[gTasks[taskId].tState](&gTasks[taskId], &gObjectEvents[gPlayerAvatar.objectEventId])); } -static bool8 WaterfallFieldEffect_0(struct Task *task, struct ObjectEvent *objectEvent) +static bool8 WaterfallFieldEffect_Init(struct Task *task, struct ObjectEvent *objectEvent) { ScriptContext2_Enable(); gPlayerAvatar.preventStep = TRUE; - task->data[0]++; + task->tState++; return FALSE; } -static bool8 WaterfallFieldEffect_1(struct Task *task, struct ObjectEvent *objectEvent) +static bool8 WaterfallFieldEffect_ShowMon(struct Task *task, struct ObjectEvent *objectEvent) { ScriptContext2_Enable(); if (!ObjectEventIsMovementOverridden(objectEvent)) { ObjectEventClearHeldMovementIfFinished(objectEvent); - gFieldEffectArguments[0] = task->data[1]; + gFieldEffectArguments[0] = task->tMonId; FieldEffectStart(FLDEFF_FIELD_MOVE_SHOW_MON_INIT); - task->data[0]++; + task->tState++; } return FALSE; } -static bool8 WaterfallFieldEffect_2(struct Task *task, struct ObjectEvent *objectEvent) +static bool8 WaterfallFieldEffect_WaitForShowMon(struct Task *task, struct ObjectEvent *objectEvent) { if (FieldEffectActiveListContains(FLDEFF_FIELD_MOVE_SHOW_MON)) { return FALSE; } - task->data[0]++; + task->tState++; return TRUE; } -static bool8 WaterfallFieldEffect_3(struct Task *task, struct ObjectEvent *objectEvent) +static bool8 WaterfallFieldEffect_RideUp(struct Task *task, struct ObjectEvent *objectEvent) { ObjectEventSetHeldMovement(objectEvent, GetWalkSlowMovementAction(DIR_NORTH)); - task->data[0]++; + task->tState++; return FALSE; } -static bool8 WaterfallFieldEffect_4(struct Task *task, struct ObjectEvent *objectEvent) +static bool8 WaterfallFieldEffect_ContinueRideOrEnd(struct Task *task, struct ObjectEvent *objectEvent) { if (!ObjectEventClearHeldMovementIfFinished(objectEvent)) - { return FALSE; - } + if (MetatileBehavior_IsWaterfall(objectEvent->currentMetatileBehavior)) { - // Still ascending waterfall - task->data[0] = 3; + // Still ascending waterfall, back to WaterfallFieldEffect_RideUp + task->tState = 3; return TRUE; } + ScriptContext2_Disable(); gPlayerAvatar.preventStep = FALSE; DestroyTask(FindTaskIdByFunc(Task_UseWaterfall)); @@ -1824,6 +1885,9 @@ static bool8 WaterfallFieldEffect_4(struct Task *task, struct ObjectEvent *objec return FALSE; } +#undef tState +#undef tMonId + bool8 FldEff_UseDive(void) { u8 taskId; @@ -1839,14 +1903,14 @@ void Task_UseDive(u8 taskId) while (sDiveFieldEffectFuncs[gTasks[taskId].data[0]](&gTasks[taskId])); } -static bool8 DiveFieldEffect_0(struct Task *task) +static bool8 DiveFieldEffect_Init(struct Task *task) { gPlayerAvatar.preventStep = TRUE; task->data[0]++; return FALSE; } -static bool8 DiveFieldEffect_1(struct Task *task) +static bool8 DiveFieldEffect_ShowMon(struct Task *task) { ScriptContext2_Enable(); gFieldEffectArguments[0] = task->data[15]; @@ -1855,10 +1919,12 @@ static bool8 DiveFieldEffect_1(struct Task *task) return FALSE; } -static bool8 DiveFieldEffect_2(struct Task *task) +static bool8 DiveFieldEffect_TryWarp(struct Task *task) { struct MapPosition mapPosition; PlayerGetDestCoords(&mapPosition.x, &mapPosition.y); + + // Wait for show mon first if (!FieldEffectActiveListContains(FLDEFF_FIELD_MOVE_SHOW_MON)) { TryDoDiveWarp(&mapPosition, gObjectEvents[gPlayerAvatar.objectEventId].currentMetatileBehavior); @@ -1878,7 +1944,7 @@ static void Task_LavaridgeGymB1FWarp(u8 taskId) while (sLavaridgeGymB1FWarpEffectFuncs[gTasks[taskId].data[0]](&gTasks[taskId], &gObjectEvents[gPlayerAvatar.objectEventId], &gSprites[gPlayerAvatar.spriteId])); } -static bool8 LavaridgeGymB1FWarpEffect_0(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 LavaridgeGymB1FWarpEffect_Init(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) { FreezeObjectEvents(); CameraObjectReset2(); @@ -1890,7 +1956,7 @@ static bool8 LavaridgeGymB1FWarpEffect_0(struct Task *task, struct ObjectEvent * return TRUE; } -static bool8 LavaridgeGymB1FWarpEffect_1(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 LavaridgeGymB1FWarpEffect_CameraShake(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) { SetCameraPanning(0, task->data[1]); task->data[1] = -task->data[1]; @@ -1903,7 +1969,7 @@ static bool8 LavaridgeGymB1FWarpEffect_1(struct Task *task, struct ObjectEvent * return FALSE; } -static bool8 LavaridgeGymB1FWarpEffect_2(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 LavaridgeGymB1FWarpEffect_Launch(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) { sprite->pos2.y = 0; task->data[3] = 1; @@ -1911,13 +1977,13 @@ static bool8 LavaridgeGymB1FWarpEffect_2(struct Task *task, struct ObjectEvent * gFieldEffectArguments[1] = objectEvent->currentCoords.y; gFieldEffectArguments[2] = sprite->subpriority - 1; gFieldEffectArguments[3] = sprite->oam.priority; - FieldEffectStart(FLDEFF_LAVARIDGE_GYM_WARP); + FieldEffectStart(FLDEFF_ASH_LAUNCH); PlaySE(SE_W153); task->data[0]++; return TRUE; } -static bool8 LavaridgeGymB1FWarpEffect_3(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 LavaridgeGymB1FWarpEffect_Rise(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) { s16 centerToCornerVecY; SetCameraPanning(0, task->data[1]); @@ -1960,7 +2026,7 @@ static bool8 LavaridgeGymB1FWarpEffect_3(struct Task *task, struct ObjectEvent * return FALSE; } -static bool8 LavaridgeGymB1FWarpEffect_4(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 LavaridgeGymB1FWarpEffect_FadeOut(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) { TryFadeOutOldMapMusic(); WarpFadeOutScreen(); @@ -1968,7 +2034,7 @@ static bool8 LavaridgeGymB1FWarpEffect_4(struct Task *task, struct ObjectEvent * return FALSE; } -static bool8 LavaridgeGymB1FWarpEffect_5(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 LavaridgeGymB1FWarpEffect_Warp(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (!gPaletteFade.active && BGMusicStopped() == TRUE) { @@ -1994,7 +2060,7 @@ static void Task_LavaridgeGymB1FWarpExit(u8 taskId) while (sLavaridgeGymB1FWarpExitEffectFuncs[gTasks[taskId].data[0]](&gTasks[taskId], &gObjectEvents[gPlayerAvatar.objectEventId], &gSprites[gPlayerAvatar.spriteId])); } -static bool8 LavaridgeGymB1FWarpExitEffect_0(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 LavaridgeGymB1FWarpExitEffect_Init(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) { CameraObjectReset2(); FreezeObjectEvents(); @@ -2004,7 +2070,7 @@ static bool8 LavaridgeGymB1FWarpExitEffect_0(struct Task *task, struct ObjectEve return FALSE; } -static bool8 LavaridgeGymB1FWarpExitEffect_1(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 LavaridgeGymB1FWarpExitEffect_StartPopOut(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (IsWeatherNotFadingIn()) { @@ -2012,13 +2078,13 @@ static bool8 LavaridgeGymB1FWarpExitEffect_1(struct Task *task, struct ObjectEve gFieldEffectArguments[1] = objectEvent->currentCoords.y; gFieldEffectArguments[2] = sprite->subpriority - 1; gFieldEffectArguments[3] = sprite->oam.priority; - task->data[1] = FieldEffectStart(FLDEFF_POP_OUT_OF_ASH); + task->data[1] = FieldEffectStart(FLDEFF_ASH_PUFF); task->data[0]++; } return FALSE; } -static bool8 LavaridgeGymB1FWarpExitEffect_2(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 LavaridgeGymB1FWarpExitEffect_PopOut(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) { sprite = &gSprites[task->data[1]]; if (sprite->animCmdIndex > 1) @@ -2032,7 +2098,7 @@ static bool8 LavaridgeGymB1FWarpExitEffect_2(struct Task *task, struct ObjectEve return FALSE; } -static bool8 LavaridgeGymB1FWarpExitEffect_3(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 LavaridgeGymB1FWarpExitEffect_End(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (ObjectEventClearHeldMovementIfFinished(objectEvent)) { @@ -2044,23 +2110,21 @@ static bool8 LavaridgeGymB1FWarpExitEffect_3(struct Task *task, struct ObjectEve return FALSE; } -// For the ash puff effect when warping off the B1F ash tiles -u8 FldEff_LavaridgeGymWarp(void) +// For the ash effect when jumping off the Lavaridge Gym B1F warp tiles +u8 FldEff_AshLaunch(void) { u8 spriteId; sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8); - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_LAVARIDGE_GYM_WARP], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_ASH_LAUNCH], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); gSprites[spriteId].oam.priority = gFieldEffectArguments[3]; gSprites[spriteId].coordOffsetEnabled = TRUE; return spriteId; } -void SpriteCB_LavaridgeGymWarp(struct Sprite *sprite) +void SpriteCB_AshLaunch(struct Sprite *sprite) { if (sprite->animEnded) - { - FieldEffectStop(sprite, FLDEFF_LAVARIDGE_GYM_WARP); - } + FieldEffectStop(sprite, FLDEFF_ASH_LAUNCH); } void StartLavaridgeGym1FWarp(u8 priority) @@ -2073,7 +2137,7 @@ static void Task_LavaridgeGym1FWarp(u8 taskId) while(sLavaridgeGym1FWarpEffectFuncs[gTasks[taskId].data[0]](&gTasks[taskId], &gObjectEvents[gPlayerAvatar.objectEventId], &gSprites[gPlayerAvatar.spriteId])); } -static bool8 LavaridgeGym1FWarpEffect_0(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 LavaridgeGym1FWarpEffect_Init(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) { FreezeObjectEvents(); CameraObjectReset2(); @@ -2083,7 +2147,7 @@ static bool8 LavaridgeGym1FWarpEffect_0(struct Task *task, struct ObjectEvent *o return FALSE; } -static bool8 LavaridgeGym1FWarpEffect_1(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 LavaridgeGym1FWarpEffect_AshPuff(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (ObjectEventClearHeldMovementIfFinished(objectEvent)) { @@ -2093,7 +2157,7 @@ static bool8 LavaridgeGym1FWarpEffect_1(struct Task *task, struct ObjectEvent *o gFieldEffectArguments[1] = objectEvent->currentCoords.y; gFieldEffectArguments[2] = sprite->subpriority - 1; gFieldEffectArguments[3] = sprite->oam.priority; - task->data[1] = FieldEffectStart(FLDEFF_POP_OUT_OF_ASH); + task->data[1] = FieldEffectStart(FLDEFF_ASH_PUFF); task->data[0]++; } else { @@ -2105,7 +2169,7 @@ static bool8 LavaridgeGym1FWarpEffect_1(struct Task *task, struct ObjectEvent *o return FALSE; } -static bool8 LavaridgeGym1FWarpEffect_2(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 LavaridgeGym1FWarpEffect_Disappear(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (gSprites[task->data[1]].animCmdIndex == 2) { @@ -2115,9 +2179,9 @@ static bool8 LavaridgeGym1FWarpEffect_2(struct Task *task, struct ObjectEvent *o return FALSE; } -static bool8 LavaridgeGym1FWarpEffect_3(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 LavaridgeGym1FWarpEffect_FadeOut(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) { - if (!FieldEffectActiveListContains(FLDEFF_POP_OUT_OF_ASH)) + if (!FieldEffectActiveListContains(FLDEFF_ASH_PUFF)) { TryFadeOutOldMapMusic(); WarpFadeOutScreen(); @@ -2126,7 +2190,7 @@ static bool8 LavaridgeGym1FWarpEffect_3(struct Task *task, struct ObjectEvent *o return FALSE; } -static bool8 LavaridgeGym1FWarpEffect_4(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 LavaridgeGym1FWarpEffect_Warp(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (!gPaletteFade.active && BGMusicStopped() == TRUE) { @@ -2138,24 +2202,29 @@ static bool8 LavaridgeGym1FWarpEffect_4(struct Task *task, struct ObjectEvent *o return FALSE; } -u8 FldEff_PopOutOfAsh(void) +// For the ash effect when a trainer pops out of ash, or when the player enters/exits a warp in Lavaridge Gym 1F +u8 FldEff_AshPuff(void) { u8 spriteId; sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8); - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_JUMP_OUT_OF_ASH], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_ASH_PUFF], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); gSprites[spriteId].oam.priority = gFieldEffectArguments[3]; gSprites[spriteId].coordOffsetEnabled = TRUE; return spriteId; } -void SpriteCB_PopOutOfAsh(struct Sprite *sprite) +void SpriteCB_AshPuff(struct Sprite *sprite) { if (sprite->animEnded) - { - FieldEffectStop(sprite, FLDEFF_POP_OUT_OF_ASH); - } + FieldEffectStop(sprite, FLDEFF_ASH_PUFF); } +#define tState data[0] +#define tSpinDelay data[1] +#define tNumTurns data[2] +#define tTimer data[14] +#define tStartDir data[15] + void StartEscapeRopeFieldEffect(void) { ScriptContext2_Enable(); @@ -2165,21 +2234,21 @@ void StartEscapeRopeFieldEffect(void) static void Task_EscapeRopeWarpOut(u8 taskId) { - sEscapeRopeWarpOutFieldEffectFuncs[gTasks[taskId].data[0]](&gTasks[taskId]); + sEscapeRopeWarpOutEffectFuncs[gTasks[taskId].tState](&gTasks[taskId]); } -static void EscapeRopeWarpOutFieldEffect_0(struct Task *task) +static void EscapeRopeWarpOutEffect_Init(struct Task *task) { - task->data[0]++; - task->data[14] = 64; - task->data[15] = GetPlayerFacingDirection(); + task->tState++; + task->tTimer = 64; + task->tStartDir = GetPlayerFacingDirection(); } -static void EscapeRopeWarpOutFieldEffect_1(struct Task *task) +static void EscapeRopeWarpOutEffect_Spin(struct Task *task) { struct ObjectEvent *objectEvent; u8 spinDirections[5] = {DIR_SOUTH, DIR_WEST, DIR_EAST, DIR_NORTH, DIR_SOUTH}; - if (task->data[14] != 0 && (--task->data[14]) == 0) + if (task->tTimer != 0 && (--task->tTimer) == 0) { TryFadeOutOldMapMusic(); WarpFadeOutScreen(); @@ -2187,29 +2256,28 @@ static void EscapeRopeWarpOutFieldEffect_1(struct Task *task) objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; if (!ObjectEventIsMovementOverridden(objectEvent) || ObjectEventClearHeldMovementIfFinished(objectEvent)) { - if (task->data[14] == 0 && !gPaletteFade.active && BGMusicStopped() == TRUE) + if (task->tTimer == 0 && !gPaletteFade.active && BGMusicStopped() == TRUE) { - SetObjectEventDirection(objectEvent, task->data[15]); + SetObjectEventDirection(objectEvent, task->tStartDir); SetWarpDestinationToEscapeWarp(); WarpIntoMap(); gFieldCallback = FieldCallback_EscapeRopeWarpIn; SetMainCallback2(CB2_LoadMap); DestroyTask(FindTaskIdByFunc(Task_EscapeRopeWarpOut)); - } else if (task->data[1] == 0 || (--task->data[1]) == 0) + } + else if (task->tSpinDelay == 0 || (--task->tSpinDelay) == 0) { ObjectEventSetHeldMovement(objectEvent, GetFaceDirectionMovementAction(spinDirections[objectEvent->facingDirection])); - if (task->data[2] < 12) - { - task->data[2]++; - } - task->data[1] = 8 >> (task->data[2] >> 2); + if (task->tNumTurns < 12) + task->tNumTurns++; + task->tSpinDelay = 8 >> (task->tNumTurns >> 2); } } } -void (*const sEscapeRopeWarpInFieldEffectFuncs[])(struct Task *) = { - EscapeRopeWarpInFieldEffect_0, - EscapeRopeWarpInFieldEffect_1 +void (*const sEscapeRopeWarpInEffectFuncs[])(struct Task *) = { + EscapeRopeWarpInEffect_Init, + EscapeRopeWarpInEffect_Spin }; static void FieldCallback_EscapeRopeWarpIn(void) @@ -2225,29 +2293,29 @@ static void FieldCallback_EscapeRopeWarpIn(void) static void Task_EscapeRopeWarpIn(u8 taskId) { - sEscapeRopeWarpInFieldEffectFuncs[gTasks[taskId].data[0]](&gTasks[taskId]); + sEscapeRopeWarpInEffectFuncs[gTasks[taskId].tState](&gTasks[taskId]); } -static void EscapeRopeWarpInFieldEffect_0(struct Task *task) +static void EscapeRopeWarpInEffect_Init(struct Task *task) { if (IsWeatherNotFadingIn()) { - task->data[0]++; - task->data[15] = GetPlayerFacingDirection(); + task->tState++; + task->tStartDir = GetPlayerFacingDirection(); } } -static void EscapeRopeWarpInFieldEffect_1(struct Task *task) +static void EscapeRopeWarpInEffect_Spin(struct Task *task) { u8 spinDirections[5] = {DIR_SOUTH, DIR_WEST, DIR_EAST, DIR_NORTH, DIR_SOUTH}; struct ObjectEvent *objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; - if (task->data[1] == 0 || (--task->data[1]) == 0) + if (task->tSpinDelay == 0 || (--task->tSpinDelay) == 0) { if (ObjectEventIsMovementOverridden(objectEvent) && !ObjectEventClearHeldMovementIfFinished(objectEvent)) { return; } - if (task->data[2] >= 32 && task->data[15] == GetPlayerFacingDirection()) + if (task->tNumTurns >= 32 && task->tStartDir == GetPlayerFacingDirection()) { objectEvent->invisible = FALSE; ScriptContext2_Disable(); @@ -2256,42 +2324,48 @@ static void EscapeRopeWarpInFieldEffect_1(struct Task *task) return; } ObjectEventSetHeldMovement(objectEvent, GetFaceDirectionMovementAction(spinDirections[objectEvent->facingDirection])); - if (task->data[2] < 32) - { - task->data[2]++; - } - task->data[1] = task->data[2] >> 2; + if (task->tNumTurns < 32) + task->tNumTurns++; + task->tSpinDelay = task->tNumTurns >> 2; } objectEvent->invisible ^= 1; } +#undef tState +#undef tSpinDelay +#undef tNumTurns +#undef tTimer +#undef tStartDir + +#define tState data[0] + void FldEff_TeleportWarpOut(void) { CreateTask(Task_TeleportWarpOut, 0); } static void (*const sTeleportWarpOutFieldEffectFuncs[])(struct Task *) = { - TeleportWarpOutFieldEffect_0, - TeleportWarpOutFieldEffect_1, - TeleportWarpOutFieldEffect_2, - TeleportWarpOutFieldEffect_3 + TeleportWarpOutFieldEffect_Init, + TeleportWarpOutFieldEffect_SpinGround, + TeleportWarpOutFieldEffect_SpinExit, + TeleportWarpOutFieldEffect_End }; static void Task_TeleportWarpOut(u8 taskId) { - sTeleportWarpOutFieldEffectFuncs[gTasks[taskId].data[0]](&gTasks[taskId]); + sTeleportWarpOutFieldEffectFuncs[gTasks[taskId].tState](&gTasks[taskId]); } -static void TeleportWarpOutFieldEffect_0(struct Task *task) +static void TeleportWarpOutFieldEffect_Init(struct Task *task) { ScriptContext2_Enable(); FreezeObjectEvents(); CameraObjectReset2(); task->data[15] = GetPlayerFacingDirection(); - task->data[0]++; + task->tState++; } -static void TeleportWarpOutFieldEffect_1(struct Task *task) +static void TeleportWarpOutFieldEffect_SpinGround(struct Task *task) { u8 spinDirections[5] = {DIR_SOUTH, DIR_WEST, DIR_EAST, DIR_NORTH, DIR_SOUTH}; struct ObjectEvent *objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; @@ -2303,7 +2377,7 @@ static void TeleportWarpOutFieldEffect_1(struct Task *task) } if (task->data[2] > 7 && task->data[15] == objectEvent->facingDirection) { - task->data[0]++; + task->tState++; task->data[1] = 4; task->data[2] = 8; task->data[3] = 1; @@ -2311,7 +2385,7 @@ static void TeleportWarpOutFieldEffect_1(struct Task *task) } } -static void TeleportWarpOutFieldEffect_2(struct Task *task) +static void TeleportWarpOutFieldEffect_SpinExit(struct Task *task) { u8 spinDirections[5] = {DIR_SOUTH, DIR_WEST, DIR_EAST, DIR_NORTH, DIR_SOUTH}; struct ObjectEvent *objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; @@ -2333,13 +2407,13 @@ static void TeleportWarpOutFieldEffect_2(struct Task *task) } if (task->data[4] >= 0xa8) { - task->data[0]++; + task->tState++; TryFadeOutOldMapMusic(); WarpFadeOutScreen(); } } -static void TeleportWarpOutFieldEffect_3(struct Task *task) +static void TeleportWarpOutFieldEffect_End(struct Task *task) { if (!gPaletteFade.active) { @@ -2373,9 +2447,9 @@ static void FieldCallback_TeleportWarpIn(void) } void (*const sTeleportWarpInFieldEffectFuncs[])(struct Task *) = { - TeleportWarpInFieldEffect_0, - TeleportWarpInFieldEffect_1, - TeleportWarpInFieldEffect_2 + TeleportWarpInFieldEffect_Init, + TeleportWarpInFieldEffect_SpinEnter, + TeleportWarpInFieldEffect_SpinGround }; static void Task_TeleportWarpIn(u8 taskId) @@ -2383,7 +2457,7 @@ static void Task_TeleportWarpIn(u8 taskId) sTeleportWarpInFieldEffectFuncs[gTasks[taskId].data[0]](&gTasks[taskId]); } -static void TeleportWarpInFieldEffect_0(struct Task *task) +static void TeleportWarpInFieldEffect_Init(struct Task *task) { struct Sprite *sprite; s16 centerToCornerVecY; @@ -2402,7 +2476,7 @@ static void TeleportWarpInFieldEffect_0(struct Task *task) } } -static void TeleportWarpInFieldEffect_1(struct Task *task) +static void TeleportWarpInFieldEffect_SpinEnter(struct Task *task) { u8 spinDirections[5] = {DIR_SOUTH, DIR_WEST, DIR_EAST, DIR_NORTH, DIR_SOUTH}; struct ObjectEvent *objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; @@ -2441,7 +2515,7 @@ static void TeleportWarpInFieldEffect_1(struct Task *task) } } -static void TeleportWarpInFieldEffect_2(struct Task *task) +static void TeleportWarpInFieldEffect_SpinGround(struct Task *task) { u8 spinDirections[5] = {DIR_SOUTH, DIR_WEST, DIR_EAST, DIR_NORTH, DIR_SOUTH}; struct ObjectEvent *objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; @@ -2459,17 +2533,34 @@ static void TeleportWarpInFieldEffect_2(struct Task *task) } } +// Task data for Task_FieldMoveShowMonOutDoors +#define tState data[0] +#define tWinHoriz data[1] +#define tWinVert data[2] +#define tWinIn data[3] +#define tWinOut data[4] +#define tBgHoriz data[5] +#define tBgVert data[6] +#define tMonSpriteId data[15] + +// Sprite data for field move mon sprite +#define sSpecies data[0] +#define sOnscreenTimer data[1] +#define sSlidOffscreen data[7] + +// There are two variants (outdoor/indoor) of the "show mon for a field move" effect +// Outdoor has a black background with thick white streaks and appears from the right by stretching vertically and horizontally +// Indoor has blue background with thin white streaks and appears from the left by stretching horizontally +// For both the background streaks move to the right, and the mon sprite enters from the right and exits left bool8 FldEff_FieldMoveShowMon(void) { u8 taskId; if (IsMapTypeOutdoors(GetCurrentMapType()) == TRUE) - { taskId = CreateTask(Task_FieldMoveShowMonOutdoors, 0xff); - } else - { + else taskId = CreateTask(Task_FieldMoveShowMonIndoors, 0xff); - } - gTasks[taskId].data[15] = sub_80B8C60(gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); + + gTasks[taskId].tMonSpriteId = InitFieldMoveMonSprite(gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); return FALSE; } @@ -2488,132 +2579,127 @@ bool8 FldEff_FieldMoveShowMonInit(void) } void (*const sFieldMoveShowMonOutdoorsEffectFuncs[])(struct Task *) = { - FieldMoveShowMonOutdoorsEffect_0, - FieldMoveShowMonOutdoorsEffect_1, - FieldMoveShowMonOutdoorsEffect_2, - FieldMoveShowMonOutdoorsEffect_3, - FieldMoveShowMonOutdoorsEffect_4, - FieldMoveShowMonOutdoorsEffect_5, - FieldMoveShowMonOutdoorsEffect_6, + FieldMoveShowMonOutdoorsEffect_Init, + FieldMoveShowMonOutdoorsEffect_LoadGfx, + FieldMoveShowMonOutdoorsEffect_CreateBanner, + FieldMoveShowMonOutdoorsEffect_WaitForMon, + FieldMoveShowMonOutdoorsEffect_ShrinkBanner, + FieldMoveShowMonOutdoorsEffect_RestoreBg, + FieldMoveShowMonOutdoorsEffect_End, }; static void Task_FieldMoveShowMonOutdoors(u8 taskId) { - sFieldMoveShowMonOutdoorsEffectFuncs[gTasks[taskId].data[0]](&gTasks[taskId]); + sFieldMoveShowMonOutdoorsEffectFuncs[gTasks[taskId].tState](&gTasks[taskId]); } -static void FieldMoveShowMonOutdoorsEffect_0(struct Task *task) +static void FieldMoveShowMonOutdoorsEffect_Init(struct Task *task) { task->data[11] = REG_WININ; task->data[12] = REG_WINOUT; StoreWordInTwoHalfwords(&task->data[13], (u32)gMain.vblankCallback); - task->data[1] = 0xf0f1; - task->data[2] = 0x5051; - task->data[3] = 0x3f; - task->data[4] = 0x3e; - SetGpuReg(REG_OFFSET_WIN0H, task->data[1]); - SetGpuReg(REG_OFFSET_WIN0V, task->data[2]); - SetGpuReg(REG_OFFSET_WININ, task->data[3]); - SetGpuReg(REG_OFFSET_WINOUT, task->data[4]); + task->tWinHoriz = WIN_RANGE(240, 241); + task->tWinVert = WIN_RANGE(80, 81); + task->tWinIn = WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR; + task->tWinOut = WINOUT_WIN01_BG1 | WINOUT_WIN01_BG2 | WINOUT_WIN01_BG3 | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR; + SetGpuReg(REG_OFFSET_WIN0H, task->tWinHoriz); + SetGpuReg(REG_OFFSET_WIN0V, task->tWinVert); + SetGpuReg(REG_OFFSET_WININ, task->tWinIn); + SetGpuReg(REG_OFFSET_WINOUT, task->tWinOut); SetVBlankCallback(VBlankCB_FieldMoveShowMonOutdoors); - task->data[0]++; + task->tState++; } -static void FieldMoveShowMonOutdoorsEffect_1(struct Task *task) +static void FieldMoveShowMonOutdoorsEffect_LoadGfx(struct Task *task) { u16 offset = ((REG_BG0CNT >> 2) << 14); u16 delta = ((REG_BG0CNT >> 8) << 11); - CpuCopy16(gFieldMoveStreaksTiles, (void *)(VRAM + offset), 0x200); + CpuCopy16(sFieldMoveStreaksOutdoors_Gfx, (void *)(VRAM + offset), 0x200); CpuFill32(0, (void *)(VRAM + delta), 0x800); - LoadPalette(gFieldMoveStreaksPalette, 0xf0, 0x20); - sub_80B8874(delta); - task->data[0]++; + LoadPalette(sFieldMoveStreaksOutdoors_Pal, 0xf0, 0x20); + LoadFieldMoveOutdoorStreaksTilemap(delta); + task->tState++; } -static void FieldMoveShowMonOutdoorsEffect_2(struct Task *task) +static void FieldMoveShowMonOutdoorsEffect_CreateBanner(struct Task *task) { - s16 v0; - s16 v2; - s16 v3; - task->data[5] -= 16; - v0 = ((u16)task->data[1] >> 8); - v2 = ((u16)task->data[2] >> 8); - v3 = ((u16)task->data[2] & 0xff); - v0 -= 16; - v2 -= 2; - v3 += 2; - if (v0 < 0) + s16 horiz; + s16 vertHi; + s16 vertLo; + task->tBgHoriz -= 16; + horiz = ((u16)task->tWinHoriz >> 8); + vertHi = ((u16)task->tWinVert >> 8); + vertLo = ((u16)task->tWinVert & 0xff); + horiz -= 16; + vertHi -= 2; + vertLo += 2; + + if (horiz < 0) + horiz = 0; + + if (vertHi < 40) + vertHi = 40; + + if (vertLo > 120) + vertLo = 120; + + task->tWinHoriz = (horiz << 8) | (task->tWinHoriz & 0xff); + task->tWinVert = (vertHi << 8) | vertLo; + if (horiz == 0 && vertHi == 40 && vertLo == 120) { - v0 = 0; - } - if (v2 < 0x28) - { - v2 = 0x28; - } - if (v3 > 0x78) - { - v3 = 0x78; - } - task->data[1] = (v0 << 8) | (task->data[1] & 0xff); - task->data[2] = (v2 << 8) | v3; - if (v0 == 0 && v2 == 0x28 && v3 == 0x78) - { - gSprites[task->data[15]].callback = sub_80B8CC0; - task->data[0]++; + gSprites[task->tMonSpriteId].callback = SpriteCB_FieldMoveMonSlideOnscreen; + task->tState++; } } -static void FieldMoveShowMonOutdoorsEffect_3(struct Task *task) +static void FieldMoveShowMonOutdoorsEffect_WaitForMon(struct Task *task) { - task->data[5] -= 16; - if (gSprites[task->data[15]].data[7]) - { - task->data[0]++; - } + task->tBgHoriz -= 16; + + if (gSprites[task->tMonSpriteId].sSlidOffscreen) + task->tState++; } -static void FieldMoveShowMonOutdoorsEffect_4(struct Task *task) +static void FieldMoveShowMonOutdoorsEffect_ShrinkBanner(struct Task *task) { - s16 v2; - s16 v3; - task->data[5] -= 16; - v2 = (task->data[2] >> 8); - v3 = (task->data[2] & 0xff); - v2 += 6; - v3 -= 6; - if (v2 > 0x50) - { - v2 = 0x50; - } - if (v3 < 0x51) - { - v3 = 0x51; - } - task->data[2] = (v2 << 8) | v3; - if (v2 == 0x50 && v3 == 0x51) - { - task->data[0]++; - } + s16 vertHi; + s16 vertLo; + task->tBgHoriz -= 16; + vertHi = (task->tWinVert >> 8); + vertLo = (task->tWinVert & 0xFF); + vertHi += 6; + vertLo -= 6; + + if (vertHi > 80) + vertHi = 80; + + if (vertLo < 81) + vertLo = 81; + + task->tWinVert = (vertHi << 8) | vertLo; + + if (vertHi == 80 && vertLo == 81) + task->tState++; } -static void FieldMoveShowMonOutdoorsEffect_5(struct Task *task) +static void FieldMoveShowMonOutdoorsEffect_RestoreBg(struct Task *task) { u16 bg0cnt = (REG_BG0CNT >> 8) << 11; CpuFill32(0, (void *)VRAM + bg0cnt, 0x800); - task->data[1] = 0xf1; - task->data[2] = 0xa1; - task->data[3] = task->data[11]; - task->data[4] = task->data[12]; - task->data[0]++; + task->tWinHoriz = 241; + task->tWinVert = 161; + task->tWinIn = task->data[11]; + task->tWinOut = task->data[12]; + task->tState++; } -static void FieldMoveShowMonOutdoorsEffect_6(struct Task *task) +static void FieldMoveShowMonOutdoorsEffect_End(struct Task *task) { IntrCallback callback; LoadWordFromTwoHalfwords((u16 *)&task->data[13], (u32 *)&callback); SetVBlankCallback(callback); InitTextBoxGfxAndPrinters(); - FreeResourcesAndDestroySprite(&gSprites[task->data[15]], task->data[15]); + FreeResourcesAndDestroySprite(&gSprites[task->tMonSpriteId], task->tMonSpriteId); FieldEffectActiveListRemove(FLDEFF_FIELD_MOVE_SHOW_MON); DestroyTask(FindTaskIdByFunc(Task_FieldMoveShowMonOutdoors)); } @@ -2624,103 +2710,116 @@ static void VBlankCB_FieldMoveShowMonOutdoors(void) struct Task *task = &gTasks[FindTaskIdByFunc(Task_FieldMoveShowMonOutdoors)]; LoadWordFromTwoHalfwords((u16 *)&task->data[13], (u32 *)&callback); callback(); - SetGpuReg(REG_OFFSET_WIN0H, task->data[1]); - SetGpuReg(REG_OFFSET_WIN0V, task->data[2]); - SetGpuReg(REG_OFFSET_WININ, task->data[3]); - SetGpuReg(REG_OFFSET_WINOUT, task->data[4]); - SetGpuReg(REG_OFFSET_BG0HOFS, task->data[5]); - SetGpuReg(REG_OFFSET_BG0VOFS, task->data[6]); + SetGpuReg(REG_OFFSET_WIN0H, task->tWinHoriz); + SetGpuReg(REG_OFFSET_WIN0V, task->tWinVert); + SetGpuReg(REG_OFFSET_WININ, task->tWinIn); + SetGpuReg(REG_OFFSET_WINOUT, task->tWinOut); + SetGpuReg(REG_OFFSET_BG0HOFS, task->tBgHoriz); + SetGpuReg(REG_OFFSET_BG0VOFS, task->tBgVert); } -static void sub_80B8874(u16 offs) +static void LoadFieldMoveOutdoorStreaksTilemap(u16 offs) { u16 i; u16 *dest; - dest = (u16 *)(VRAM + 0x140 + offs); - for (i = 0; i < 0x140; i++, dest++) + dest = (u16 *)(VRAM + ARRAY_COUNT(sFieldMoveStreaksOutdoors_Tilemap) + offs); + for (i = 0; i < ARRAY_COUNT(sFieldMoveStreaksOutdoors_Tilemap); i++, dest++) { - *dest = gFieldMoveStreaksTilemap[i] | METATILE_ELEVATION_MASK; + *dest = sFieldMoveStreaksOutdoors_Tilemap[i] | 0xF000; } } +#undef tState +#undef tWinHoriz +#undef tWinVert +#undef tWinIn +#undef tWinOut +#undef tBgHoriz +#undef tBgVert +#undef tMonSpriteId + +// Task data for Task_FieldMoveShowMonIndoors +#define tState data[0] +#define tBgHoriz data[1] +#define tBgVert data[2] +#define tBgOffsetIdx data[3] +#define tBgOffset data[4] +#define tMonSpriteId data[15] + void (*const sFieldMoveShowMonIndoorsEffectFuncs[])(struct Task *) = { - FieldMoveShowMonIndoorsEffect_0, - FieldMoveShowMonIndoorsEffect_1, - FieldMoveShowMonIndoorsEffect_2, - FieldMoveShowMonIndoorsEffect_3, - FieldMoveShowMonIndoorsEffect_4, - FieldMoveShowMonIndoorsEffect_5, - FieldMoveShowMonIndoorsEffect_6, + FieldMoveShowMonIndoorsEffect_Init, + FieldMoveShowMonIndoorsEffect_LoadGfx, + FieldMoveShowMonIndoorsEffect_SlideBannerOn, + FieldMoveShowMonIndoorsEffect_WaitForMon, + FieldMoveShowMonIndoorsEffect_RestoreBg, + FieldMoveShowMonIndoorsEffect_SlideBannerOff, + FieldMoveShowMonIndoorsEffect_End, }; static void Task_FieldMoveShowMonIndoors(u8 taskId) { - sFieldMoveShowMonIndoorsEffectFuncs[gTasks[taskId].data[0]](&gTasks[taskId]); + sFieldMoveShowMonIndoorsEffectFuncs[gTasks[taskId].tState](&gTasks[taskId]); } -static void FieldMoveShowMonIndoorsEffect_0(struct Task *task) +static void FieldMoveShowMonIndoorsEffect_Init(struct Task *task) { - SetGpuReg(REG_OFFSET_BG0HOFS, task->data[1]); - SetGpuReg(REG_OFFSET_BG0VOFS, task->data[2]); + SetGpuReg(REG_OFFSET_BG0HOFS, task->tBgHoriz); + SetGpuReg(REG_OFFSET_BG0VOFS, task->tBgVert); StoreWordInTwoHalfwords((u16 *)&task->data[13], (u32)gMain.vblankCallback); SetVBlankCallback(VBlankCB_FieldMoveShowMonIndoors); - task->data[0]++; + task->tState++; } -static void FieldMoveShowMonIndoorsEffect_1(struct Task *task) +static void FieldMoveShowMonIndoorsEffect_LoadGfx(struct Task *task) { u16 offset; u16 delta; offset = ((REG_BG0CNT >> 2) << 14); delta = ((REG_BG0CNT >> 8) << 11); task->data[12] = delta; - CpuCopy16(gDarknessFieldMoveStreaksTiles, (void *)(VRAM + offset), 0x80); + CpuCopy16(sFieldMoveStreaksIndoors_Gfx, (void *)(VRAM + offset), 0x80); CpuFill32(0, (void *)(VRAM + delta), 0x800); - LoadPalette(gDarknessFieldMoveStreaksPalette, 0xf0, 0x20); - task->data[0]++; + LoadPalette(sFieldMoveStreaksIndoors_Pal, 0xf0, 0x20); + task->tState++; } -static void FieldMoveShowMonIndoorsEffect_2(struct Task *task) +static void FieldMoveShowMonIndoorsEffect_SlideBannerOn(struct Task *task) { - if (sub_80B8B38(task)) + if (SlideIndoorBannerOnscreen(task)) { SetGpuReg(REG_OFFSET_WIN1H, 0x00f0); SetGpuReg(REG_OFFSET_WIN1V, 0x2878); - gSprites[task->data[15]].callback = sub_80B8CC0; - task->data[0]++; + gSprites[task->tMonSpriteId].callback = SpriteCB_FieldMoveMonSlideOnscreen; + task->tState++; } - sub_80B8B28(task); + AnimateIndoorShowMonBg(task); } -static void FieldMoveShowMonIndoorsEffect_3(struct Task *task) +static void FieldMoveShowMonIndoorsEffect_WaitForMon(struct Task *task) { - sub_80B8B28(task); - if (gSprites[task->data[15]].data[7]) - { - task->data[0]++; - } + AnimateIndoorShowMonBg(task); + if (gSprites[task->tMonSpriteId].sSlidOffscreen) + task->tState++; } -static void FieldMoveShowMonIndoorsEffect_4(struct Task *task) +static void FieldMoveShowMonIndoorsEffect_RestoreBg(struct Task *task) { - sub_80B8B28(task); - task->data[3] = task->data[1] & 7; - task->data[4] = 0; + AnimateIndoorShowMonBg(task); + task->tBgOffsetIdx = task->tBgHoriz & 7; + task->tBgOffset = 0; SetGpuReg(REG_OFFSET_WIN1H, 0xffff); SetGpuReg(REG_OFFSET_WIN1V, 0xffff); - task->data[0]++; + task->tState++; } -static void FieldMoveShowMonIndoorsEffect_5(struct Task *task) +static void FieldMoveShowMonIndoorsEffect_SlideBannerOff(struct Task *task) { - sub_80B8B28(task); - if (sub_80B8BF0(task)) - { - task->data[0]++; - } + AnimateIndoorShowMonBg(task); + if (SlideIndoorBannerOffscreen(task)) + task->tState++; } -static void FieldMoveShowMonIndoorsEffect_6(struct Task *task) +static void FieldMoveShowMonIndoorsEffect_End(struct Task *task) { IntrCallback intrCallback; u16 bg0cnt; @@ -2729,7 +2828,7 @@ static void FieldMoveShowMonIndoorsEffect_6(struct Task *task) LoadWordFromTwoHalfwords((u16 *)&task->data[13], (u32 *)&intrCallback); SetVBlankCallback(intrCallback); InitTextBoxGfxAndPrinters(); - FreeResourcesAndDestroySprite(&gSprites[task->data[15]], task->data[15]); + FreeResourcesAndDestroySprite(&gSprites[task->tMonSpriteId], task->tMonSpriteId); FieldEffectActiveListRemove(FLDEFF_FIELD_MOVE_SHOW_MON); DestroyTask(FindTaskIdByFunc(Task_FieldMoveShowMonIndoors)); } @@ -2741,116 +2840,123 @@ static void VBlankCB_FieldMoveShowMonIndoors(void) task = &gTasks[FindTaskIdByFunc(Task_FieldMoveShowMonIndoors)]; LoadWordFromTwoHalfwords((u16 *)&task->data[13], (u32 *)&intrCallback); intrCallback(); - SetGpuReg(REG_OFFSET_BG0HOFS, task->data[1]); - SetGpuReg(REG_OFFSET_BG0VOFS, task->data[2]); + SetGpuReg(REG_OFFSET_BG0HOFS, task->tBgHoriz); + SetGpuReg(REG_OFFSET_BG0VOFS, task->tBgVert); } -static void sub_80B8B28(struct Task *task) +static void AnimateIndoorShowMonBg(struct Task *task) { - task->data[1] -= 16; - task->data[3] += 16; + task->tBgHoriz -= 16; + task->tBgOffsetIdx += 16; } -static bool8 sub_80B8B38(struct Task *task) +static bool8 SlideIndoorBannerOnscreen(struct Task *task) { u16 i; u16 srcOffs; u16 dstOffs; u16 *dest; - if (task->data[4] >= 32) - { + + if (task->tBgOffset >= 32) return TRUE; - } - dstOffs = (task->data[3] >> 3) & 0x1f; - if (dstOffs >= task->data[4]) + + dstOffs = (task->tBgOffsetIdx >> 3) & 0x1f; + if (dstOffs >= task->tBgOffset) { dstOffs = (32 - dstOffs) & 0x1f; - srcOffs = (32 - task->data[4]) & 0x1f; + srcOffs = (32 - task->tBgOffset) & 0x1f; dest = (u16 *)(VRAM + 0x140 + (u16)task->data[12]); for (i = 0; i < 10; i++) { - dest[dstOffs + i * 32] = gDarknessFieldMoveStreaksTilemap[srcOffs + i * 32]; + dest[dstOffs + i * 32] = sFieldMoveStreaksIndoors_Tilemap[srcOffs + i * 32]; dest[dstOffs + i * 32] |= 0xf000; - dest[((dstOffs + 1) & 0x1f) + i * 32] = gDarknessFieldMoveStreaksTilemap[((srcOffs + 1) & 0x1f) + i * 32] | 0xf000; + dest[((dstOffs + 1) & 0x1f) + i * 32] = sFieldMoveStreaksIndoors_Tilemap[((srcOffs + 1) & 0x1f) + i * 32] | 0xf000; dest[((dstOffs + 1) & 0x1f) + i * 32] |= 0xf000; } - task->data[4] += 2; + task->tBgOffset += 2; } return FALSE; } -static bool8 sub_80B8BF0(struct Task *task) +static bool8 SlideIndoorBannerOffscreen(struct Task *task) { u16 i; u16 dstOffs; u16 *dest; - if (task->data[4] >= 32) - { + + if (task->tBgOffset >= 32) return TRUE; - } - dstOffs = task->data[3] >> 3; - if (dstOffs >= task->data[4]) + + dstOffs = task->tBgOffsetIdx >> 3; + if (dstOffs >= task->tBgOffset) { - dstOffs = (task->data[1] >> 3) & 0x1f; + dstOffs = (task->tBgHoriz >> 3) & 0x1f; dest = (u16 *)(VRAM + 0x140 + (u16)task->data[12]); for (i = 0; i < 10; i++) { dest[dstOffs + i * 32] = 0xf000; dest[((dstOffs + 1) & 0x1f) + i * 32] = 0xf000; } - task->data[4] += 2; + task->tBgOffset += 2; } return FALSE; } -static u8 sub_80B8C60(u32 a0, u32 a1, u32 a2) +#undef tState +#undef tBgHoriz +#undef tBgVert +#undef tBgOffsetIdx +#undef tBgOffset +#undef tMonSpriteId + +static u8 InitFieldMoveMonSprite(u32 species, u32 otId, u32 personality) { u16 v0; u8 monSprite; struct Sprite *sprite; - v0 = (a0 & 0x80000000) >> 16; - a0 &= 0x7fffffff; - monSprite = CreateMonSprite_FieldMove(a0, a1, a2, 0x140, 0x50, 0); + v0 = (species & 0x80000000) >> 16; + species &= 0x7fffffff; + monSprite = CreateMonSprite_FieldMove(species, otId, personality, 0x140, 0x50, 0); sprite = &gSprites[monSprite]; sprite->callback = SpriteCallbackDummy; sprite->oam.priority = 0; - sprite->data[0] = a0; + sprite->sSpecies = species; sprite->data[6] = v0; return monSprite; } -static void sub_80B8CC0(struct Sprite *sprite) +static void SpriteCB_FieldMoveMonSlideOnscreen(struct Sprite *sprite) { - if ((sprite->pos1.x -= 20) <= 0x78) + if ((sprite->pos1.x -= 20) <= 120) { - sprite->pos1.x = 0x78; - sprite->data[1] = 30; - sprite->callback = sub_80B8D04; + sprite->pos1.x = 120; + sprite->sOnscreenTimer = 30; + sprite->callback = SpriteCB_FieldMoveMonWaitAfterCry; if (sprite->data[6]) { - PlayCry2(sprite->data[0], 0, 0x7d, 0xa); + PlayCry2(sprite->sSpecies, 0, 0x7d, 0xa); } else { - PlayCry1(sprite->data[0], 0); + PlayCry1(sprite->sSpecies, 0); } } } -static void sub_80B8D04(struct Sprite *sprite) +static void SpriteCB_FieldMoveMonWaitAfterCry(struct Sprite *sprite) { - if ((--sprite->data[1]) == 0) + if ((--sprite->sOnscreenTimer) == 0) { - sprite->callback = sub_80B8D20; + sprite->callback = SpriteCB_FieldMoveMonSlideOffscreen; } } -static void sub_80B8D20(struct Sprite *sprite) +static void SpriteCB_FieldMoveMonSlideOffscreen(struct Sprite *sprite) { - if (sprite->pos1.x < -0x40) + if (sprite->pos1.x < -64) { - sprite->data[7] = 1; + sprite->sSlidOffscreen = TRUE; } else { @@ -2858,40 +2964,51 @@ static void sub_80B8D20(struct Sprite *sprite) } } +#undef tState +#undef tMonSpriteId +#undef sSpecies +#undef sSlidOffscreen +#undef sOnscreenTimer + +#define tState data[0] +#define tDestX data[1] +#define tDestY data[2] +#define tMonId data[15] + u8 FldEff_UseSurf(void) { u8 taskId = CreateTask(Task_SurfFieldEffect, 0xff); - gTasks[taskId].data[15] = gFieldEffectArguments[0]; + gTasks[taskId].tMonId = gFieldEffectArguments[0]; Overworld_ClearSavedMusic(); Overworld_ChangeMusicTo(MUS_NAMINORI); return FALSE; } void (*const sSurfFieldEffectFuncs[])(struct Task *) = { - SurfFieldEffect_1, - SurfFieldEffect_2, - SurfFieldEffect_3, - SurfFieldEffect_4, - SurfFieldEffect_5, + SurfFieldEffect_Init, + SurfFieldEffect_FieldMovePose, + SurfFieldEffect_ShowMon, + SurfFieldEffect_JumpOnSurfBlob, + SurfFieldEffect_End, }; static void Task_SurfFieldEffect(u8 taskId) { - sSurfFieldEffectFuncs[gTasks[taskId].data[0]](&gTasks[taskId]); + sSurfFieldEffectFuncs[gTasks[taskId].tState](&gTasks[taskId]); } -static void SurfFieldEffect_1(struct Task *task) +static void SurfFieldEffect_Init(struct Task *task) { ScriptContext2_Enable(); FreezeObjectEvents(); gPlayerAvatar.preventStep = TRUE; SetPlayerAvatarStateMask(PLAYER_AVATAR_FLAG_SURFING); - PlayerGetDestCoords(&task->data[1], &task->data[2]); - MoveCoords(gObjectEvents[gPlayerAvatar.objectEventId].movementDirection, &task->data[1], &task->data[2]); - task->data[0]++; + PlayerGetDestCoords(&task->tDestX, &task->tDestY); + MoveCoords(gObjectEvents[gPlayerAvatar.objectEventId].movementDirection, &task->tDestX, &task->tDestY); + task->tState++; } -static void SurfFieldEffect_2(struct Task *task) +static void SurfFieldEffect_FieldMovePose(struct Task *task) { struct ObjectEvent *objectEvent; objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; @@ -2899,23 +3016,23 @@ static void SurfFieldEffect_2(struct Task *task) { SetPlayerAvatarFieldMove(); ObjectEventSetHeldMovement(objectEvent, MOVEMENT_ACTION_START_ANIM_IN_DIRECTION); - task->data[0]++; + task->tState++; } } -static void SurfFieldEffect_3(struct Task *task) +static void SurfFieldEffect_ShowMon(struct Task *task) { struct ObjectEvent *objectEvent; objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; if (ObjectEventCheckHeldMovementStatus(objectEvent)) { - gFieldEffectArguments[0] = task->data[15] | 0x80000000; + gFieldEffectArguments[0] = task->tMonId | 0x80000000; FieldEffectStart(FLDEFF_FIELD_MOVE_SHOW_MON_INIT); - task->data[0]++; + task->tState++; } } -static void SurfFieldEffect_4(struct Task *task) +static void SurfFieldEffect_JumpOnSurfBlob(struct Task *task) { struct ObjectEvent *objectEvent; if (!FieldEffectActiveListContains(FLDEFF_FIELD_MOVE_SHOW_MON)) @@ -2924,15 +3041,15 @@ static void SurfFieldEffect_4(struct Task *task) ObjectEventSetGraphicsId(objectEvent, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_SURFING)); ObjectEventClearHeldMovementIfFinished(objectEvent); ObjectEventSetHeldMovement(objectEvent, GetJumpSpecialMovementAction(objectEvent->movementDirection)); - gFieldEffectArguments[0] = task->data[1]; - gFieldEffectArguments[1] = task->data[2]; + gFieldEffectArguments[0] = task->tDestX; + gFieldEffectArguments[1] = task->tDestY; gFieldEffectArguments[2] = gPlayerAvatar.objectEventId; objectEvent->fieldEffectSpriteId = FieldEffectStart(FLDEFF_SURF_BLOB); - task->data[0]++; + task->tState++; } } -static void SurfFieldEffect_5(struct Task *task) +static void SurfFieldEffect_End(struct Task *task) { struct ObjectEvent *objectEvent; objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; @@ -2941,7 +3058,7 @@ static void SurfFieldEffect_5(struct Task *task) gPlayerAvatar.preventStep = FALSE; gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_5; ObjectEventSetHeldMovement(objectEvent, GetFaceDirectionMovementAction(objectEvent->movementDirection)); - sub_81555AC(objectEvent->fieldEffectSpriteId, 1); + SetSurfBobState(objectEvent->fieldEffectSpriteId, 1); UnfreezeObjectEvents(); ScriptContext2_Disable(); FieldEffectActiveListRemove(FLDEFF_USE_SURF); @@ -2949,10 +3066,15 @@ static void SurfFieldEffect_5(struct Task *task) } } -u8 sub_80B8F98(void) +#undef tState +#undef tDestX +#undef tDestY +#undef tMonId + +u8 FldEff_RayquazaSpotlight(void) { u8 i, j, k; - u8 spriteId = CreateSprite(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_RAYQUAZA], 0x78, -0x18, 1); + u8 spriteId = CreateSprite(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_RAYQUAZA], 120, -24, 1); struct Sprite *sprite = &gSprites[spriteId]; sprite->oam.priority = 1; @@ -2966,7 +3088,7 @@ u8 sub_80B8F98(void) SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG0 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_BG1 | BLDCNT_TGT2_BG2 | BLDCNT_TGT2_BG3 | BLDCNT_TGT2_OBJ | BLDCNT_TGT2_BD); SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(14, 14)); SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR | WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR); - LoadPalette(gUnknown_0855B610, 0xC0, sizeof(gUnknown_0855B610)); + LoadPalette(sSpotlight_Pal, 0xC0, sizeof(sSpotlight_Pal)); SetGpuReg(REG_OFFSET_BG0VOFS, 120); for (i = 3; i < 15; i++) { @@ -2979,8 +3101,8 @@ u8 sub_80B8F98(void) { for (i = 0; i < 8; i++) { - *(u16*)(BG_CHAR_ADDR(2) + (k + 1) * 32 + i * 4) = (gUnknown_0855B630[k * 32 + i * 4 + 1] << 8) + gUnknown_0855B630[k * 32 + i * 4]; - *(u16*)(BG_CHAR_ADDR(2) + (k + 1) * 32 + i * 4 + 2) = (gUnknown_0855B630[k * 32 + i * 4 + 3] << 8) + gUnknown_0855B630[k * 32 + i * 4 + 2]; + *(u16*)(BG_CHAR_ADDR(2) + (k + 1) * 32 + i * 4) = (sSpotlight_Gfx[k * 32 + i * 4 + 1] << 8) + sSpotlight_Gfx[k * 32 + i * 4]; + *(u16*)(BG_CHAR_ADDR(2) + (k + 1) * 32 + i * 4 + 2) = (sSpotlight_Gfx[k * 32 + i * 4 + 3] << 8) + sSpotlight_Gfx[k * 32 + i * 4 + 2]; } } return spriteId; @@ -3015,39 +3137,47 @@ static void SpriteCB_NPCFlyOut(struct Sprite *sprite) npcSprite->pos2.x = 0; npcSprite->pos2.y = 0; } + if (sprite->data[2] >= 0x80) - { FieldEffectStop(sprite, FLDEFF_NPCFLY_OUT); - } } -#define tAvatarFlags data[15] +// Task data for Task_FlyOut/FlyIn +#define tState data[0] +#define tMonId data[1] +#define tBirdSpriteId data[1] //re-used +#define tTimer data[2] +#define tAvatarFlags data[15] + +// Sprite data for the fly bird +#define sPlayerSpriteId data[6] +#define sAnimCompleted data[7] u8 FldEff_UseFly(void) { u8 taskId = CreateTask(Task_FlyOut, 254); - gTasks[taskId].data[1] = gFieldEffectArguments[0]; + gTasks[taskId].tMonId = gFieldEffectArguments[0]; return 0; } void (*const sFlyOutFieldEffectFuncs[])(struct Task *) = { - FlyOutFieldEffect_0, - FlyOutFieldEffect_1, - FlyOutFieldEffect_2, - FlyOutFieldEffect_3, - FlyOutFieldEffect_4, - FlyOutFieldEffect_5, - FlyOutFieldEffect_6, - FlyOutFieldEffect_7, - FlyOutFieldEffect_8, + FlyOutFieldEffect_FieldMovePose, + FlyOutFieldEffect_ShowMon, + FlyOutFieldEffect_BirdLeaveBall, + FlyOutFieldEffect_WaitBirdLeave, + FlyOutFieldEffect_BirdSwoopDown, + FlyOutFieldEffect_JumpOnBird, + FlyOutFieldEffect_FlyOffWithBird, + FlyOutFieldEffect_WaitFlyOff, + FlyOutFieldEffect_End, }; static void Task_FlyOut(u8 taskId) { - sFlyOutFieldEffectFuncs[gTasks[taskId].data[0]](&gTasks[taskId]); + sFlyOutFieldEffectFuncs[gTasks[taskId].tState](&gTasks[taskId]); } -static void FlyOutFieldEffect_0(struct Task *task) +static void FlyOutFieldEffect_FieldMovePose(struct Task *task) { struct ObjectEvent *objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; if (!ObjectEventIsMovementOverridden(objectEvent) || ObjectEventClearHeldMovementIfFinished(objectEvent)) @@ -3057,61 +3187,61 @@ static void FlyOutFieldEffect_0(struct Task *task) SetPlayerAvatarStateMask(PLAYER_AVATAR_FLAG_ON_FOOT); SetPlayerAvatarFieldMove(); ObjectEventSetHeldMovement(objectEvent, MOVEMENT_ACTION_START_ANIM_IN_DIRECTION); - task->data[0]++; + task->tState++; } } -static void FlyOutFieldEffect_1(struct Task *task) +static void FlyOutFieldEffect_ShowMon(struct Task *task) { struct ObjectEvent *objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; if (ObjectEventClearHeldMovementIfFinished(objectEvent)) { - task->data[0]++; - gFieldEffectArguments[0] = task->data[1]; + task->tState++; + gFieldEffectArguments[0] = task->tMonId; FieldEffectStart(FLDEFF_FIELD_MOVE_SHOW_MON_INIT); } } -static void FlyOutFieldEffect_2(struct Task *task) +static void FlyOutFieldEffect_BirdLeaveBall(struct Task *task) { if (!FieldEffectActiveListContains(FLDEFF_FIELD_MOVE_SHOW_MON)) { struct ObjectEvent *objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; if (task->tAvatarFlags & PLAYER_AVATAR_FLAG_SURFING) { - sub_81555AC(objectEvent->fieldEffectSpriteId, 2); - sub_81555D8(objectEvent->fieldEffectSpriteId, 0); + SetSurfBobState(objectEvent->fieldEffectSpriteId, 2); + SetSurfBobWhileFlyingOutState(objectEvent->fieldEffectSpriteId, 0); } - task->data[1] = sub_80B94C4(); - task->data[0]++; + task->tBirdSpriteId = CreateFlyBirdSprite(); // Does "leave ball" animation by default + task->tState++; } } -static void FlyOutFieldEffect_3(struct Task *task) +static void FlyOutFieldEffect_WaitBirdLeave(struct Task *task) { - if (sub_80B9508(task->data[1])) + if (GetFlyBirdAnimCompleted(task->tBirdSpriteId)) { - task->data[0]++; - task->data[2] = 16; + task->tState++; + task->tTimer = 16; SetPlayerAvatarTransitionFlags(PLAYER_AVATAR_FLAG_ON_FOOT); ObjectEventSetHeldMovement(&gObjectEvents[gPlayerAvatar.objectEventId], MOVEMENT_ACTION_FACE_LEFT); } } -static void FlyOutFieldEffect_4(struct Task *task) +static void FlyOutFieldEffect_BirdSwoopDown(struct Task *task) { struct ObjectEvent *objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; - if ((task->data[2] == 0 || (--task->data[2]) == 0) && ObjectEventClearHeldMovementIfFinished(objectEvent)) + if ((task->tTimer == 0 || (--task->tTimer) == 0) && ObjectEventClearHeldMovementIfFinished(objectEvent)) { - task->data[0]++; + task->tState++; PlaySE(SE_W019); - sub_80B9524(task->data[1]); + StartFlyBirdSwoopDown(task->tBirdSpriteId); } } -static void FlyOutFieldEffect_5(struct Task *task) +static void FlyOutFieldEffect_JumpOnBird(struct Task *task) { - if ((++task->data[2]) >= 8) + if ((++task->tTimer) >= 8) { struct ObjectEvent *objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; ObjectEventSetGraphicsId(objectEvent, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_SURFING)); @@ -3122,35 +3252,35 @@ static void FlyOutFieldEffect_5(struct Task *task) { DestroySprite(&gSprites[objectEvent->fieldEffectSpriteId]); } - task->data[0]++; - task->data[2] = 0; + task->tState++; + task->tTimer = 0; } } -static void FlyOutFieldEffect_6(struct Task *task) +static void FlyOutFieldEffect_FlyOffWithBird(struct Task *task) { - if ((++task->data[2]) >= 10) + if ((++task->tTimer) >= 10) { struct ObjectEvent *objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; ObjectEventClearHeldMovementIfActive(objectEvent); objectEvent->inanimate = FALSE; objectEvent->hasShadow = FALSE; - sub_80B9560(task->data[1], objectEvent->spriteId); + SetFlyBirdPlayerSpriteId(task->tBirdSpriteId, objectEvent->spriteId); CameraObjectReset2(); - task->data[0]++; + task->tState++; } } -static void FlyOutFieldEffect_7(struct Task *task) +static void FlyOutFieldEffect_WaitFlyOff(struct Task *task) { - if (sub_80B9508(task->data[1])) + if (GetFlyBirdAnimCompleted(task->tBirdSpriteId)) { WarpFadeOutScreen(); - task->data[0]++; + task->tState++; } } -static void FlyOutFieldEffect_8(struct Task *task) +static void FlyOutFieldEffect_End(struct Task *task) { if (!gPaletteFade.active) { @@ -3159,7 +3289,7 @@ static void FlyOutFieldEffect_8(struct Task *task) } } -static u8 sub_80B94C4(void) +static u8 CreateFlyBirdSprite(void) { u8 spriteId; struct Sprite *sprite; @@ -3167,58 +3297,58 @@ static u8 sub_80B94C4(void) sprite = &gSprites[spriteId]; sprite->oam.paletteNum = 0; sprite->oam.priority = 1; - sprite->callback = sub_80B957C; + sprite->callback = SpriteCB_FlyBirdLeaveBall; return spriteId; } -static u8 sub_80B9508(u8 spriteId) +static u8 GetFlyBirdAnimCompleted(u8 spriteId) { - return gSprites[spriteId].data[7]; + return gSprites[spriteId].sAnimCompleted; } -static void sub_80B9524(u8 spriteId) +static void StartFlyBirdSwoopDown(u8 spriteId) { struct Sprite *sprite; sprite = &gSprites[spriteId]; - sprite->callback = sub_80B963C; - sprite->pos1.x = 0x78; - sprite->pos1.y = 0x00; + sprite->callback = SpriteCB_FlyBirdSwoopDown; + sprite->pos1.x = 120; + sprite->pos1.y = 0; sprite->pos2.x = 0; sprite->pos2.y = 0; memset(&sprite->data[0], 0, 8 * sizeof(u16) /* zero all data cells */); - sprite->data[6] = 0x40; + sprite->sPlayerSpriteId = MAX_SPRITES; } -static void sub_80B9560(u8 a0, u8 a1) +static void SetFlyBirdPlayerSpriteId(u8 birdSpriteId, u8 playerSpriteId) { - gSprites[a0].data[6] = a1; + gSprites[birdSpriteId].sPlayerSpriteId = playerSpriteId; } -const union AffineAnimCmd SpriteAffineAnim_855C518[] = { +static const union AffineAnimCmd sAffineAnim_FlyBirdLeaveBall[] = { AFFINEANIMCMD_FRAME(8, 8, -30, 0), AFFINEANIMCMD_FRAME(28, 28, 0, 30), AFFINEANIMCMD_END }; -const union AffineAnimCmd SpriteAffineAnim_855C530[] = { +static const union AffineAnimCmd sAffineAnim_FlyBirdReturnToBall[] = { AFFINEANIMCMD_FRAME(256, 256, 64, 0), AFFINEANIMCMD_FRAME(-10, -10, 0, 22), AFFINEANIMCMD_END }; -const union AffineAnimCmd *const gSpriteAffineAnimTable_0855C548[] = { - SpriteAffineAnim_855C518, - SpriteAffineAnim_855C530 +static const union AffineAnimCmd *const sAffineAnims_FlyBird[] = { + sAffineAnim_FlyBirdLeaveBall, + sAffineAnim_FlyBirdReturnToBall }; -static void sub_80B957C(struct Sprite *sprite) +static void SpriteCB_FlyBirdLeaveBall(struct Sprite *sprite) { - if (sprite->data[7] == 0) + if (sprite->sAnimCompleted == FALSE) { if (sprite->data[0] == 0) { sprite->oam.affineMode = ST_OAM_AFFINE_DOUBLE; - sprite->affineAnims = gSpriteAffineAnimTable_0855C548; + sprite->affineAnims = sAffineAnims_FlyBird; InitSpriteAffineAnim(sprite); StartSpriteAffineAnim(sprite, 0); sprite->pos1.x = 0x76; @@ -3236,7 +3366,7 @@ static void sub_80B957C(struct Sprite *sprite) } if (sprite->data[1] > 0x81) { - sprite->data[7]++; + sprite->sAnimCompleted++; sprite->oam.affineMode = ST_OAM_AFFINE_OFF; FreeOamMatrix(sprite->oam.matrixNum); CalcCenterToCornerVec(sprite, sprite->oam.shape, sprite->oam.size, ST_OAM_AFFINE_OFF); @@ -3244,14 +3374,14 @@ static void sub_80B957C(struct Sprite *sprite) } } -static void sub_80B963C(struct Sprite *sprite) +static void SpriteCB_FlyBirdSwoopDown(struct Sprite *sprite) { sprite->pos2.x = Cos(sprite->data[2], 0x8c); sprite->pos2.y = Sin(sprite->data[2], 0x48); sprite->data[2] = (sprite->data[2] + 4) & 0xff; - if (sprite->data[6] != MAX_SPRITES) + if (sprite->sPlayerSpriteId != MAX_SPRITES) { - struct Sprite *sprite1 = &gSprites[sprite->data[6]]; + struct Sprite *sprite1 = &gSprites[sprite->sPlayerSpriteId]; sprite1->coordOffsetEnabled = FALSE; sprite1->pos1.x = sprite->pos1.x + sprite->pos2.x; sprite1->pos1.y = sprite->pos1.y + sprite->pos2.y - 8; @@ -3260,18 +3390,18 @@ static void sub_80B963C(struct Sprite *sprite) } if (sprite->data[2] >= 0x80) { - sprite->data[7] = 1; + sprite->sAnimCompleted = TRUE; } } -void sub_80B96B0(struct Sprite *sprite) +static void SpriteCB_FlyBirdReturnToBall(struct Sprite *sprite) { - if (sprite->data[7] == 0) + if (sprite->sAnimCompleted == FALSE) { if (sprite->data[0] == 0) { sprite->oam.affineMode = ST_OAM_AFFINE_DOUBLE; - sprite->affineAnims = gSpriteAffineAnimTable_0855C548; + sprite->affineAnims = sAffineAnims_FlyBird; InitSpriteAffineAnim(sprite); StartSpriteAffineAnim(sprite, 1); sprite->pos1.x = 0x5e; @@ -3300,7 +3430,7 @@ void sub_80B96B0(struct Sprite *sprite) } if (sprite->data[3] >= 60) { - sprite->data[7]++; + sprite->sAnimCompleted++; sprite->oam.affineMode = ST_OAM_AFFINE_OFF; FreeOamMatrix(sprite->oam.matrixNum); sprite->invisible = TRUE; @@ -3308,78 +3438,78 @@ void sub_80B96B0(struct Sprite *sprite) } } -void sub_80B9794(u8 spriteId) +static void StartFlyBirdReturnToBall(u8 spriteId) { - sub_80B9524(spriteId); - gSprites[spriteId].callback = sub_80B96B0; + StartFlyBirdSwoopDown(spriteId); // Set up is the same, but overrwrites the callback below + gSprites[spriteId].callback = SpriteCB_FlyBirdReturnToBall; } u8 FldEff_FlyIn(void) { - CreateTask(Task_FlyIn, 0xfe); + CreateTask(Task_FlyIn, 254); return 0; } void (*const sFlyInFieldEffectFuncs[])(struct Task *) = { - FlyInFieldEffect_0, - FlyInFieldEffect_1, - FlyInFieldEffect_2, - FlyInFieldEffect_3, - FlyInFieldEffect_4, - FlyInFieldEffect_5, - FlyInFieldEffect_6, + FlyInFieldEffect_BirdSwoopDown, + FlyInFieldEffect_FlyInWithBird, + FlyInFieldEffect_JumpOffBird, + FlyInFieldEffect_FieldMovePose, + FlyInFieldEffect_BirdReturnToBall, + FlyInFieldEffect_WaitBirdReturn, + FlyInFieldEffect_End, }; static void Task_FlyIn(u8 taskId) { - sFlyInFieldEffectFuncs[gTasks[taskId].data[0]](&gTasks[taskId]); + sFlyInFieldEffectFuncs[gTasks[taskId].tState](&gTasks[taskId]); } -static void FlyInFieldEffect_0(struct Task *task) +static void FlyInFieldEffect_BirdSwoopDown(struct Task *task) { struct ObjectEvent *objectEvent; objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; if (!ObjectEventIsMovementOverridden(objectEvent) || ObjectEventClearHeldMovementIfFinished(objectEvent)) { - task->data[0]++; - task->data[2] = 17; + task->tState++; + task->tTimer = 17; task->tAvatarFlags = gPlayerAvatar.flags; gPlayerAvatar.preventStep = TRUE; SetPlayerAvatarStateMask(PLAYER_AVATAR_FLAG_ON_FOOT); if (task->tAvatarFlags & PLAYER_AVATAR_FLAG_SURFING) { - sub_81555AC(objectEvent->fieldEffectSpriteId, 0); + SetSurfBobState(objectEvent->fieldEffectSpriteId, 0); } ObjectEventSetGraphicsId(objectEvent, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_SURFING)); CameraObjectReset2(); ObjectEventTurn(objectEvent, DIR_WEST); StartSpriteAnim(&gSprites[objectEvent->spriteId], 0x16); objectEvent->invisible = FALSE; - task->data[1] = sub_80B94C4(); - sub_80B9524(task->data[1]); - sub_80B9560(task->data[1], objectEvent->spriteId); + task->tBirdSpriteId = CreateFlyBirdSprite(); + StartFlyBirdSwoopDown(task->tBirdSpriteId); + SetFlyBirdPlayerSpriteId(task->tBirdSpriteId, objectEvent->spriteId); } } -static void FlyInFieldEffect_1(struct Task *task) +static void FlyInFieldEffect_FlyInWithBird(struct Task *task) { struct ObjectEvent *objectEvent; struct Sprite *sprite; - if (task->data[2] == 0 || (--task->data[2]) == 0) + if (task->tTimer == 0 || (--task->tTimer) == 0) { objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; sprite = &gSprites[objectEvent->spriteId]; - sub_80B9560(task->data[1], 0x40); + SetFlyBirdPlayerSpriteId(task->tBirdSpriteId, MAX_SPRITES); sprite->pos1.x += sprite->pos2.x; sprite->pos1.y += sprite->pos2.y; sprite->pos2.x = 0; sprite->pos2.y = 0; - task->data[0]++; - task->data[2] = 0; + task->tState++; + task->tTimer = 0; } } -static void FlyInFieldEffect_2(struct Task *task) +static void FlyInFieldEffect_JumpOffBird(struct Task *task) { s16 sYPositions[18] = { -2, @@ -3402,18 +3532,17 @@ static void FlyInFieldEffect_2(struct Task *task) 8 }; struct Sprite *sprite = &gSprites[gPlayerAvatar.spriteId]; - sprite->pos2.y = sYPositions[task->data[2]]; - if ((++task->data[2]) >= (int)ARRAY_COUNT(sYPositions)) - { - task->data[0]++; - } + sprite->pos2.y = sYPositions[task->tTimer]; + + if ((++task->tTimer) >= (int)ARRAY_COUNT(sYPositions)) + task->tState++; } -static void FlyInFieldEffect_3(struct Task *task) +static void FlyInFieldEffect_FieldMovePose(struct Task *task) { struct ObjectEvent *objectEvent; struct Sprite *sprite; - if (sub_80B9508(task->data[1])) + if (GetFlyBirdAnimCompleted(task->tBirdSpriteId)) { objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; sprite = &gSprites[objectEvent->spriteId]; @@ -3424,30 +3553,30 @@ static void FlyInFieldEffect_3(struct Task *task) sprite->coordOffsetEnabled = TRUE; SetPlayerAvatarFieldMove(); ObjectEventSetHeldMovement(objectEvent, MOVEMENT_ACTION_START_ANIM_IN_DIRECTION); - task->data[0]++; + task->tState++; } } -static void FlyInFieldEffect_4(struct Task *task) +static void FlyInFieldEffect_BirdReturnToBall(struct Task *task) { if (ObjectEventClearHeldMovementIfFinished(&gObjectEvents[gPlayerAvatar.objectEventId])) { - task->data[0]++; - sub_80B9794(task->data[1]); + task->tState++; + StartFlyBirdReturnToBall(task->tBirdSpriteId); } } -static void FlyInFieldEffect_5(struct Task *task) +static void FlyInFieldEffect_WaitBirdReturn(struct Task *task) { - if (sub_80B9508(task->data[1])) + if (GetFlyBirdAnimCompleted(task->tBirdSpriteId)) { - DestroySprite(&gSprites[task->data[1]]); - task->data[0]++; - task->data[1] = 0x10; + DestroySprite(&gSprites[task->tBirdSpriteId]); + task->tState++; + task->data[1] = 16; } } -static void FlyInFieldEffect_6(struct Task *task) +static void FlyInFieldEffect_End(struct Task *task) { u8 state; struct ObjectEvent *objectEvent; @@ -3458,7 +3587,7 @@ static void FlyInFieldEffect_6(struct Task *task) if (task->tAvatarFlags & PLAYER_AVATAR_FLAG_SURFING) { state = PLAYER_AVATAR_STATE_SURFING; - sub_81555AC(objectEvent->fieldEffectSpriteId, 1); + SetSurfBobState(objectEvent->fieldEffectSpriteId, 1); } ObjectEventSetGraphicsId(objectEvent, GetPlayerAvatarGraphicsIdByStateId(state)); ObjectEventTurn(objectEvent, DIR_SOUTH); @@ -3469,17 +3598,33 @@ static void FlyInFieldEffect_6(struct Task *task) } } +#undef tState +#undef tMonId +#undef tBirdSpriteId +#undef tTimer +#undef tAvatarFlags +#undef sPlayerSpriteId +#undef sAnimCompleted + +#define tState data[1] +#define tObjectEventId data[2] +#define tTimer data[3] +#define tCameraTaskId data[5] +#define tLocalId data[6] +#define tMapNum data[7] +#define tMapGroup data[8] + bool8 FldEff_DestroyDeoxysRock(void) { u8 taskId; - u8 objectEventIdBuffer; - if (!TryGetObjectEventIdByLocalIdAndMap(gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2], &objectEventIdBuffer)) + u8 objectEventId; + if (!TryGetObjectEventIdByLocalIdAndMap(gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2], &objectEventId)) { - taskId = CreateTask(Task_DestroyDeoxysRock, 0x50); - gTasks[taskId].data[2] = objectEventIdBuffer; - gTasks[taskId].data[6] = gFieldEffectArguments[0]; - gTasks[taskId].data[7] = gFieldEffectArguments[1]; - gTasks[taskId].data[8] = gFieldEffectArguments[2]; + taskId = CreateTask(Task_DestroyDeoxysRock, 80); + gTasks[taskId].tObjectEventId = objectEventId; + gTasks[taskId].tLocalId = gFieldEffectArguments[0]; + gTasks[taskId].tMapNum = gFieldEffectArguments[1]; + gTasks[taskId].tMapGroup = gFieldEffectArguments[2]; } else { @@ -3488,49 +3633,58 @@ bool8 FldEff_DestroyDeoxysRock(void) return FALSE; } -static void Task_PanCameraForDestroyingDeoxysRock(u8 taskId) +#define tShakeDelay data[0] +#define tShakeUp data[1] +#define tShake data[5] +#define tEndDelay data[6] +#define tEnding data[7] + +static void Task_DeoxysRockCameraShake(u8 taskId) { s16 *data = gTasks[taskId].data; - if (data[7] != 0) + if (tEnding) { - if (++data[6] > 20) + if (++tEndDelay > 20) { - data[6] = 0; - if (data[5] != 0) - data[5]--; + tEndDelay = 0; + if (tShake != 0) + tShake--; } } else { - data[5] = 4; + tShake = 4; } - if (++data[0] > 1) + if (++tShakeDelay > 1) { - data[0] = 0; - if (++data[1] & 1) - { - SetCameraPanning(0, -data[5]); - } + tShakeDelay = 0; + + if (++tShakeUp & 1) + SetCameraPanning(0, -tShake); else - { - SetCameraPanning(0, data[5]); - } + SetCameraPanning(0, tShake); } UpdateCameraPanning(); - if (data[5] == 0) + if (tShake == 0) DestroyTask(taskId); } -void sub_80B9BD0(u8 taskId) +static void StartEndingDeoxysRockCameraShake(u8 taskId) { - gTasks[taskId].data[7] = 1; + gTasks[taskId].tEnding = TRUE; } -void (*const sDestroyDeoxysRockFieldEffectFuncs[])(s16*, u8) = { - DestroyDeoxysRockFieldEffect_0, - DestroyDeoxysRockFieldEffect_1, - DestroyDeoxysRockFieldEffect_2, +#undef tShakeDelay +#undef tShakeUp +#undef tShake +#undef tEndDelay +#undef tEnding + +void (*const sDestroyDeoxysRockEffectFuncs[])(s16*, u8) = { + DestroyDeoxysRockEffect_CameraShake, + DestroyDeoxysRockEffect_RockFragments, + DestroyDeoxysRockEffect_WaitAndEnd, }; static void Task_DestroyDeoxysRock(u8 taskId) @@ -3538,89 +3692,97 @@ static void Task_DestroyDeoxysRock(u8 taskId) s16 *data = gTasks[taskId].data; InstallCameraPanAheadCallback(); SetCameraPanningCallback(0); - sDestroyDeoxysRockFieldEffectFuncs[data[1]](data, taskId); + sDestroyDeoxysRockEffectFuncs[tState](data, taskId); } -static void DestroyDeoxysRockFieldEffect_0(s16* data, u8 taskId) +static void DestroyDeoxysRockEffect_CameraShake(s16* data, u8 taskId) { - u8 newTaskId = CreateTask(Task_PanCameraForDestroyingDeoxysRock, 0x5A); + u8 newTaskId = CreateTask(Task_DeoxysRockCameraShake, 90); PlaySE(SE_T_KAMI2); - data[5] = newTaskId; - data[1]++; + tCameraTaskId = newTaskId; + tState++; } -static void DestroyDeoxysRockFieldEffect_1(s16* data, u8 taskId) +static void DestroyDeoxysRockEffect_RockFragments(s16* data, u8 taskId) { - if (++data[3] > 0x78) + if (++tTimer > 120) { - struct Sprite *sprite = &gSprites[gObjectEvents[data[2]].spriteId]; - gObjectEvents[data[2]].invisible = TRUE; + struct Sprite *sprite = &gSprites[gObjectEvents[tObjectEventId].spriteId]; + gObjectEvents[tObjectEventId].invisible = TRUE; BlendPalettes(0x0000FFFF, 0x10, RGB_WHITE); BeginNormalPaletteFade(0x0000FFFF, 0, 0x10, 0, RGB_WHITE); - sub_80B9D24(sprite); + CreateDeoxysRockFragments(sprite); PlaySE(SE_T_KAMI); - sub_80B9BD0(data[5]); - data[3] = 0; - data[1]++; + StartEndingDeoxysRockCameraShake(tCameraTaskId); + tTimer = 0; + tState++; } } -static void DestroyDeoxysRockFieldEffect_2(s16* a0, u8 taskId) +static void DestroyDeoxysRockEffect_WaitAndEnd(s16* data, u8 taskId) { - if (!gPaletteFade.active && !FuncIsActiveTask(Task_PanCameraForDestroyingDeoxysRock)) + if (!gPaletteFade.active && !FuncIsActiveTask(Task_DeoxysRockCameraShake)) { InstallCameraPanAheadCallback(); - RemoveObjectEventByLocalIdAndMap(a0[6], a0[7], a0[8]); + RemoveObjectEventByLocalIdAndMap(tLocalId, tMapNum, tMapGroup); FieldEffectActiveListRemove(FLDEFF_DESTROY_DEOXYS_ROCK); DestroyTask(taskId); } } -const struct SpriteFrameImage gSpriteImageTable_855C59C[] = { - obj_frame_tiles(gUnknown_0855C170), - obj_frame_tiles(gUnknown_0855C190), - obj_frame_tiles(gUnknown_0855C1B0), - obj_frame_tiles(gUnknown_0855C1D0), +#undef tState +#undef tObjectEventId +#undef tTimer +#undef tCameraTaskId +#undef tLocalId +#undef tMapNum +#undef tMapGroup + +static const struct SpriteFrameImage sImages_DeoxysRockFragment[] = { + obj_frame_tiles(sRockFragment_TopLeft), + obj_frame_tiles(sRockFragment_TopRight), + obj_frame_tiles(sRockFragment_BottomLeft), + obj_frame_tiles(sRockFragment_BottomRight), }; -const union AnimCmd gSpriteAnim_855C5BC[] = { +static const union AnimCmd sAnim_RockFragment_TopLeft[] = { ANIMCMD_FRAME(.imageValue = 0), ANIMCMD_END }; -const union AnimCmd gSpriteAnim_855C5C4[] = { +static const union AnimCmd sAnim_RockFragment_TopRight[] = { ANIMCMD_FRAME(.imageValue = 1), ANIMCMD_END }; -const union AnimCmd gSpriteAnim_855C5CC[] = { +static const union AnimCmd sAnim_RockFragment_BottomLeft[] = { ANIMCMD_FRAME(.imageValue = 2), ANIMCMD_END }; -const union AnimCmd gSpriteAnim_855C5D4[] = { +static const union AnimCmd sAnim_RockFragment_BottomRight[] = { ANIMCMD_FRAME(.imageValue = 3), ANIMCMD_END }; -const union AnimCmd *const gSpriteAnimTable_855C5DC[] = { - gSpriteAnim_855C5BC, - gSpriteAnim_855C5C4, - gSpriteAnim_855C5CC, - gSpriteAnim_855C5D4, +static const union AnimCmd *const sAnims_DeoxysRockFragment[] = { + sAnim_RockFragment_TopLeft, + sAnim_RockFragment_TopRight, + sAnim_RockFragment_BottomLeft, + sAnim_RockFragment_BottomRight, }; -const struct SpriteTemplate gUnknown_0855C5EC = { +static const struct SpriteTemplate sSpriteTemplate_DeoxysRockFragment = { .tileTag = 0xFFFF, .paletteTag = 4378, - .oam = &gOamData_855C218, - .anims = gSpriteAnimTable_855C5DC, - .images = gSpriteImageTable_855C59C, + .oam = &sOam_8x8, + .anims = sAnims_DeoxysRockFragment, + .images = sImages_DeoxysRockFragment, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80B9DB8 + .callback = SpriteCB_DeoxysRockFragment }; -static void sub_80B9D24(struct Sprite* sprite) +static void CreateDeoxysRockFragments(struct Sprite* sprite) { int i; int xPos = (s16)gTotalCameraPixelOffsetX + sprite->pos1.x + sprite->pos2.x; @@ -3628,7 +3790,7 @@ static void sub_80B9D24(struct Sprite* sprite) for (i = 0; i < 4; i++) { - u8 spriteId = CreateSprite(&gUnknown_0855C5EC, xPos, yPos, 0); + u8 spriteId = CreateSprite(&sSpriteTemplate_DeoxysRockFragment, xPos, yPos, 0); if (spriteId != MAX_SPRITES) { StartSpriteAnim(&gSprites[spriteId], i); @@ -3638,8 +3800,9 @@ static void sub_80B9D24(struct Sprite* sprite) } } -static void sub_80B9DB8(struct Sprite* sprite) +static void SpriteCB_DeoxysRockFragment(struct Sprite* sprite) { + // 1 case for each fragment, fly off in 4 different directions switch (sprite->data[0]) { case 0: @@ -3659,7 +3822,7 @@ static void sub_80B9DB8(struct Sprite* sprite) sprite->pos1.y += 12; break; } - if ((u16)(sprite->pos1.x + 4) > 0xF8 || sprite->pos1.y < -4 || sprite->pos1.y > 0xA4) + if ((u16)(sprite->pos1.x + 4) > 248 || sprite->pos1.y < -4 || sprite->pos1.y > 164) DestroySprite(sprite); } diff --git a/src/field_effect_helpers.c b/src/field_effect_helpers.c index d6bffd206..e3ca54f16 100755 --- a/src/field_effect_helpers.c +++ b/src/field_effect_helpers.c @@ -817,19 +817,19 @@ u32 FldEff_Unknown19(void) return 0; } -u32 FldEff_UnusedGrass(void) +u32 FldEff_UnusedGrass2(void) { u8 spriteId; struct Sprite *sprite; sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8); - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_UNUSED_GRASS], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_UNUSED_GRASS_2], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); if (spriteId != MAX_SPRITES) { sprite = &gSprites[spriteId]; sprite->coordOffsetEnabled = TRUE; sprite->oam.priority = gFieldEffectArguments[3]; - sprite->data[0] = FLDEFF_UNUSED_GRASS; + sprite->data[0] = FLDEFF_UNUSED_GRASS_2; } return 0; } @@ -851,19 +851,19 @@ u32 FldEff_Unknown21(void) return 0; } -u32 FldEff_Unknown22(void) +u32 FldEff_WaterSurfacing(void) { u8 spriteId; struct Sprite *sprite; sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8); - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_20], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_WATER_SURFACING], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); if (spriteId != MAX_SPRITES) { sprite = &gSprites[spriteId]; sprite->coordOffsetEnabled = TRUE; sprite->oam.priority = gFieldEffectArguments[3]; - sprite->data[0] = FLDEFF_UNKNOWN_22; + sprite->data[0] = FLDEFF_WATER_SURFACING; } return 0; } @@ -960,33 +960,34 @@ u32 FldEff_SurfBlob(void) return spriteId; } -void sub_81555AC(u8 spriteId, u8 value) +// States for bobbing up and down while surfing +void SetSurfBobState(u8 spriteId, u8 value) { gSprites[spriteId].data[0] = (gSprites[spriteId].data[0] & ~0xF) | (value & 0xF); } -void sub_81555D8(u8 spriteId, u8 value) +void SetSurfBobWhileFlyingOutState(u8 spriteId, u8 value) { gSprites[spriteId].data[0] = (gSprites[spriteId].data[0] & ~0xF0) | ((value & 0xF) << 4); } -void sub_8155604(u8 spriteId, u8 value, s16 data1) +void SetSurfBobWhileFishingState(u8 spriteId, u8 value, s16 data1) { gSprites[spriteId].data[0] = (gSprites[spriteId].data[0] & ~0xF00) | ((value & 0xF) << 8); gSprites[spriteId].data[1] = data1; } -static u8 sub_8155638(struct Sprite *sprite) +static u8 GetSurfBobState(struct Sprite *sprite) { return sprite->data[0] & 0xF; } -static u8 sub_8155640(struct Sprite *sprite) +static u8 GetSurfBobWhileFlyingOutState(struct Sprite *sprite) { return (sprite->data[0] & 0xF0) >> 4; } -static u8 sub_815564C(struct Sprite *sprite) +static u8 GetSurfBobWhileFishingState(struct Sprite *sprite) { return (sprite->data[0] & 0xF00) >> 8; } @@ -1018,7 +1019,7 @@ static void SynchroniseSurfAnim(struct ObjectEvent *objectEvent, struct Sprite * [DIR_NORTHEAST] = 1, }; - if (sub_8155640(sprite) == 0) + if (GetSurfBobWhileFlyingOutState(sprite) == 0) StartSpriteAnimIfDifferent(sprite, surfBlobDirectionAnims[objectEvent->movementDirection]); } @@ -1049,8 +1050,8 @@ void sub_81556E8(struct ObjectEvent *objectEvent, struct Sprite *sprite) static void CreateBobbingEffect(struct ObjectEvent *objectEvent, struct Sprite *linkedSprite, struct Sprite *sprite) { u16 unk_085CDC6A[] = {3, 7}; - u8 v0 = sub_8155638(sprite); - if (v0 != 0) + u8 bobState = GetSurfBobState(sprite); + if (bobState != 0) { if (((u16)(++ sprite->data[4]) & unk_085CDC6A[sprite->data[5]]) == 0) { @@ -1060,9 +1061,9 @@ static void CreateBobbingEffect(struct ObjectEvent *objectEvent, struct Sprite * { sprite->data[3] = -sprite->data[3]; } - if (v0 != 2) + if (bobState != 2) { - if (sub_815564C(sprite) == 0) + if (GetSurfBobWhileFishingState(sprite) == 0) linkedSprite->pos2.y = sprite->pos2.y; else linkedSprite->pos2.y = sprite->data[1] + sprite->pos2.y; @@ -1358,61 +1359,72 @@ void UpdateSparkleFieldEffect(struct Sprite *sprite) FieldEffectStop(sprite, FLDEFF_SPARKLE); } -void sub_8155EA0(struct Sprite *sprite) +#define sTimer data[0] +#define sState data[2] +#define sStartY data[4] +#define sCounter data[5] +#define sAnimCounter data[6] +#define sAnimState data[7] + +// Same as InitSpriteForFigure8Anim +static void InitRayquazaForFigure8Anim(struct Sprite *sprite) { - sprite->data[6] = 0; - sprite->data[7] = 0; + sprite->sAnimCounter = 0; + sprite->sAnimState = 0; } -bool8 sub_8155EA8(struct Sprite *sprite) +// Only different from AnimateSpriteInFigure8 by the addition of SetGpuReg to move the spotlight +static bool8 AnimateRayquazaInFigure8(struct Sprite *sprite) { - bool8 returnBool = FALSE; + bool8 finished = FALSE; - switch (sprite->data[7]) + switch (sprite->sAnimState) { - case 0: - sprite->pos2.x += sub_809773C(sprite->data[6]); - sprite->pos2.y += sub_8097728(sprite->data[6]); - break; - case 1: - sprite->pos2.x -= sub_809773C(0x47 - sprite->data[6]); - sprite->pos2.y += sub_8097728(0x47 - sprite->data[6]); - break; - case 2: - sprite->pos2.x -= sub_809773C(sprite->data[6]); - sprite->pos2.y += sub_8097728(sprite->data[6]); - break; - case 3: - sprite->pos2.x += sub_809773C(0x47 - sprite->data[6]); - sprite->pos2.y += sub_8097728(0x47 - sprite->data[6]); - break; + case 0: + sprite->pos2.x += GetFigure8XOffset(sprite->sAnimCounter); + sprite->pos2.y += GetFigure8YOffset(sprite->sAnimCounter); + break; + case 1: + sprite->pos2.x -= GetFigure8XOffset((FIGURE_8_LENGTH - 1) - sprite->sAnimCounter); + sprite->pos2.y += GetFigure8YOffset((FIGURE_8_LENGTH - 1) - sprite->sAnimCounter); + break; + case 2: + sprite->pos2.x -= GetFigure8XOffset(sprite->sAnimCounter); + sprite->pos2.y += GetFigure8YOffset(sprite->sAnimCounter); + break; + case 3: + sprite->pos2.x += GetFigure8XOffset((FIGURE_8_LENGTH - 1) - sprite->sAnimCounter); + sprite->pos2.y += GetFigure8YOffset((FIGURE_8_LENGTH - 1) - sprite->sAnimCounter); + break; } + // Update spotlight to sweep left and right with Rayquaza SetGpuReg(REG_OFFSET_BG0HOFS, -sprite->pos2.x); - if (++sprite->data[6] == 72) + + if (++sprite->sAnimCounter == FIGURE_8_LENGTH) { - sprite->data[6] = 0; - sprite->data[7]++; + sprite->sAnimCounter = 0; + sprite->sAnimState++; } - if (sprite->data[7] == 4) + if (sprite->sAnimState == 4) { sprite->pos2.y = 0; sprite->pos2.x = 0; - returnBool = TRUE; + finished = TRUE; } - return returnBool; + return finished; } -void sub_8155F80(struct Sprite *sprite) +void UpdateRayquazaSpotlightEffect(struct Sprite *sprite) { u8 i, j; - switch (sprite->data[2]) + switch (sprite->sState) { case 0: - SetGpuReg(REG_OFFSET_BG0VOFS, 0x78 - (sprite->data[0] / 3)); - if (sprite->data[0] == 0x60) + SetGpuReg(REG_OFFSET_BG0VOFS, 120 - (sprite->sTimer / 3)); + if (sprite->sTimer == 96) { for (i = 0; i < 3; i++) { @@ -1422,42 +1434,42 @@ void sub_8155F80(struct Sprite *sprite) } } } - if (sprite->data[0] > 0x137) + if (sprite->sTimer > 311) { - sprite->data[2] = 1; - sprite->data[0] = 0; + sprite->sState = 1; + sprite->sTimer = 0; } break; case 1: - sprite->pos1.y = (gSineTable[sprite->data[0] / 3] >> 2) + sprite->data[4]; - if (sprite->data[0] == 0xBD) + sprite->pos1.y = (gSineTable[sprite->sTimer / 3] >> 2) + sprite->sStartY; + if (sprite->sTimer == 189) { - sprite->data[2] = 2; - sprite->data[5] = 0; - sprite->data[0] = 0; + sprite->sState = 2; + sprite->sCounter = 0; + sprite->sTimer = 0; } break; case 2: - if (sprite->data[0] == 0x3C) + if (sprite->sTimer == 60) { - sprite->data[5]++; - sprite->data[0] = 0; + sprite->sCounter++; + sprite->sTimer = 0; } - if (sprite->data[5] == 7) + if (sprite->sCounter == 7) { - sprite->data[5] = 0; - sprite->data[2] = 3; + sprite->sCounter = 0; + sprite->sState = 3; } break; case 3: if (sprite->pos2.y == 0) { - sprite->data[0] = 0; - sprite->data[2]++; + sprite->sTimer = 0; + sprite->sState++; } - if (sprite->data[0] == 5) + if (sprite->sTimer == 5) { - sprite->data[0] = 0; + sprite->sTimer = 0; if (sprite->pos2.y > 0) sprite->pos2.y--; else @@ -1465,38 +1477,38 @@ void sub_8155F80(struct Sprite *sprite) } break; case 4: - if (sprite->data[0] == 0x3C) + if (sprite->sTimer == 60) { - sprite->data[2] = 5; - sprite->data[0] = 0; - sprite->data[5] = 0; + sprite->sState = 5; + sprite->sTimer = 0; + sprite->sCounter = 0; } break; case 5: - sub_8155EA0(sprite); - sprite->data[2] = 6; - sprite->data[0] = 0; + InitRayquazaForFigure8Anim(sprite); + sprite->sState = 6; + sprite->sTimer = 0; break; case 6: - if (sub_8155EA8(sprite)) + if (AnimateRayquazaInFigure8(sprite)) { - sprite->data[0] = 0; - if (++sprite->data[5] <= 2) + sprite->sTimer = 0; + if (++sprite->sCounter <= 2) { - sub_8155EA0(sprite); + InitRayquazaForFigure8Anim(sprite); } else { - sprite->data[5] = 0; - sprite->data[2] = 7; + sprite->sCounter = 0; + sprite->sState = 7; } } break; case 7: - if (sprite->data[0] == 0x1E) + if (sprite->sTimer == 30) { - sprite->data[2] = 8; - sprite->data[0] = 0; + sprite->sState = 8; + sprite->sTimer = 0; } break; case 8: @@ -1508,11 +1520,11 @@ void sub_8155F80(struct Sprite *sprite) } } SetGpuReg(REG_OFFSET_BG0VOFS, 0); - FieldEffectStop(sprite, FLDEFF_RAYQUAZA); + FieldEffectStop(sprite, FLDEFF_RAYQUAZA_SPOTLIGHT); break; } - if (sprite->data[2] == 1) + if (sprite->sState == 1) { if ((sprite->data[1] & 7) == 0) sprite->pos2.y += sprite->data[3]; @@ -1521,10 +1533,17 @@ void sub_8155F80(struct Sprite *sprite) sprite->data[1]++; } - sprite->data[0]++; + sprite->sTimer++; } -void sub_8156194(struct Sprite *sprite) +#undef sTimer +#undef sState +#undef sStartY +#undef sCounter +#undef sAnimCounter +#undef sAnimState + +void UpdateJumpImpactEffect(struct Sprite *sprite) { if (sprite->animEnded) { diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c index c482f39d6..41ddfc17d 100644 --- a/src/field_player_avatar.c +++ b/src/field_player_avatar.c @@ -320,7 +320,7 @@ static u8 ObjectEventCB2_NoMovement2(void) return 0; } -void player_step(u8 direction, u16 newKeys, u16 heldKeys) +void PlayerStep(u8 direction, u16 newKeys, u16 heldKeys) { struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; @@ -869,7 +869,7 @@ static void PlayerAvatarTransition_Surfing(struct ObjectEvent *objEvent) gFieldEffectArguments[2] = gPlayerAvatar.objectEventId; spriteId = FieldEffectStart(FLDEFF_SURF_BLOB); objEvent->fieldEffectSpriteId = spriteId; - sub_81555AC(spriteId, 1); + SetSurfBobState(spriteId, 1); } static void PlayerAvatarTransition_Underwater(struct ObjectEvent *objEvent) @@ -885,7 +885,7 @@ static void PlayerAvatarTransition_ReturnToField(struct ObjectEvent *objEvent) gPlayerAvatar.flags |= PLAYER_AVATAR_FLAG_5; } -void sub_808B578(void) +void UpdatePlayerAvatarTransitionState(void) { gPlayerAvatar.tileTransitionState = T_NOT_MOVING; if (PlayerIsAnimActive()) @@ -1650,7 +1650,7 @@ static void Task_StopSurfingInit(u8 taskId) if (!ObjectEventClearHeldMovementIfFinished(playerObjEvent)) return; } - sub_81555AC(playerObjEvent->fieldEffectSpriteId, 2); + SetSurfBobState(playerObjEvent->fieldEffectSpriteId, 2); ObjectEventSetHeldMovement(playerObjEvent, GetJumpSpecialMovementAction((u8)gTasks[taskId].data[0])); gTasks[taskId].func = Task_WaitStopSurfing; } @@ -1934,7 +1934,7 @@ static bool8 Fishing11(struct Task *task) ObjectEventSetGraphicsId(playerObjEvent, task->tPlayerGfxId); ObjectEventTurn(playerObjEvent, playerObjEvent->movementDirection); if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING) - sub_8155604(gObjectEvents[gPlayerAvatar.objectEventId].fieldEffectSpriteId, 0, 0); + SetSurfBobWhileFishingState(gObjectEvents[gPlayerAvatar.objectEventId].fieldEffectSpriteId, 0, 0); gSprites[gPlayerAvatar.spriteId].pos2.x = 0; gSprites[gPlayerAvatar.spriteId].pos2.y = 0; ClearDialogWindowAndFrame(0, TRUE); @@ -1994,7 +1994,7 @@ static bool8 Fishing15(struct Task *task) ObjectEventSetGraphicsId(playerObjEvent, task->tPlayerGfxId); ObjectEventTurn(playerObjEvent, playerObjEvent->movementDirection); if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING) - sub_8155604(gObjectEvents[gPlayerAvatar.objectEventId].fieldEffectSpriteId, 0, 0); + SetSurfBobWhileFishingState(gObjectEvents[gPlayerAvatar.objectEventId].fieldEffectSpriteId, 0, 0); gSprites[gPlayerAvatar.spriteId].pos2.x = 0; gSprites[gPlayerAvatar.spriteId].pos2.y = 0; task->tStep++; @@ -2053,7 +2053,7 @@ static void AlignFishingAnimationFrames(void) if (animType == 10 || animType == 11) playerSprite->pos2.y = 8; if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING) - sub_8155604(gObjectEvents[gPlayerAvatar.objectEventId].fieldEffectSpriteId, 1, playerSprite->pos2.y); + SetSurfBobWhileFishingState(gObjectEvents[gPlayerAvatar.objectEventId].fieldEffectSpriteId, 1, playerSprite->pos2.y); } void sub_808D074(u8 a0) diff --git a/src/field_screen_effect.c b/src/field_screen_effect.c index 971e58cf4..57dc27ed9 100644 --- a/src/field_screen_effect.c +++ b/src/field_screen_effect.c @@ -290,7 +290,7 @@ void FieldCB_WarpExitFadeFromWhite(void) void FieldCB_WarpExitFadeFromBlack(void) { - if (!sub_81D6534()) // sub_81D6534 always returns false + if (!OnTrainerHillEReaderChallengeFloor()) // always false Overworld_PlaySpecialMapMusic(); FadeInFromBlack(); SetUpWarpExitTask(); diff --git a/src/fieldmap.c b/src/fieldmap.c index a046bf4fa..5eb00ad27 100644 --- a/src/fieldmap.c +++ b/src/fieldmap.c @@ -44,7 +44,7 @@ static void InitBackupMapLayoutConnections(struct MapHeader *mapHeader); static void LoadSavedMapView(void); static bool8 SkipCopyingMetatileFromSavedMap(u16* mapMetatilePtr, u16 mapWidth, u8 yMode); -struct MapHeader const *const mapconnection_get_mapheader(struct MapConnection *connection) +struct MapHeader const *const GetMapHeaderFromConnection(struct MapConnection *connection) { return Overworld_GetMapHeaderByGroupAndId(connection->mapGroup, connection->mapNum); } @@ -124,7 +124,7 @@ static void InitBackupMapLayoutConnections(struct MapHeader *mapHeader) gMapConnectionFlags = sDummyConnectionFlags; for (i = 0; i < count; i++, connection++) { - struct MapHeader const *cMap = mapconnection_get_mapheader(connection); + struct MapHeader const *cMap = GetMapHeaderFromConnection(connection); u32 offset = connection->offset; switch (connection->direction) { @@ -734,7 +734,7 @@ int CanCameraMoveInDirection(int direction) void sub_80887F8(struct MapConnection *connection, int direction, int x, int y) { struct MapHeader const *mapHeader; - mapHeader = mapconnection_get_mapheader(connection); + mapHeader = GetMapHeaderFromConnection(connection); switch (direction) { case CONNECTION_EAST: @@ -805,7 +805,7 @@ struct MapConnection *sub_8088950(u8 direction, int x, int y) bool8 sub_80889A8(u8 direction, int x, int y, struct MapConnection *connection) { struct MapHeader const *mapHeader; - mapHeader = mapconnection_get_mapheader(connection); + mapHeader = GetMapHeaderFromConnection(connection); switch (direction) { case CONNECTION_SOUTH: @@ -846,7 +846,7 @@ int sub_8088A38(int x, int width) int sub_8088A4C(struct MapConnection *connection, int x, int y) { struct MapHeader const *mapHeader; - mapHeader = mapconnection_get_mapheader(connection); + mapHeader = GetMapHeaderFromConnection(connection); switch (connection->direction) { case CONNECTION_SOUTH: @@ -893,7 +893,7 @@ struct MapConnection *GetConnectionAtCoords(s16 x, s16 y) return NULL; } -void sub_8088B3C(u16 x, u16 y) +void SetCameraFocusCoords(u16 x, u16 y) { gSaveBlock1Ptr->pos.x = x - 7; gSaveBlock1Ptr->pos.y = y - 7; @@ -905,7 +905,8 @@ void GetCameraFocusCoords(u16 *x, u16 *y) *y = gSaveBlock1Ptr->pos.y + 7; } -void SetPlayerCoords(u16 x, u16 y) +// Unused +static void SetCameraCoords(u16 x, u16 y) { gSaveBlock1Ptr->pos.x = x; gSaveBlock1Ptr->pos.y = y; diff --git a/src/fldeff_cut.c b/src/fldeff_cut.c index f5e06e8f6..2c9151598 100644 --- a/src/fldeff_cut.c +++ b/src/fldeff_cut.c @@ -122,12 +122,12 @@ static const struct SpriteFrameImage sSpriteImageTable_CutGrass[] = {gFieldEffectPic_CutGrass, 0x20}, }; -const struct SpritePalette gFieldEffectObjectPaletteInfo6 = {gFieldEffectObjectPalette6, 0x1000}; +const struct SpritePalette gFieldEffectObjectPaletteInfo6 = {gFieldEffectObjectPalette6, FLDEFF_PAL_TAG_0}; static const struct SpriteTemplate sSpriteTemplate_CutGrass = { .tileTag = 0xFFFF, - .paletteTag = 0x1000, + .paletteTag = FLDEFF_PAL_TAG_0, .oam = &sOamData_CutGrass, .anims = sSpriteAnimTable_CutGrass, .images = sSpriteImageTable_CutGrass, diff --git a/src/fldeff_misc.c b/src/fldeff_misc.c index f197b7b33..bb5bd65d7 100644 --- a/src/fldeff_misc.c +++ b/src/fldeff_misc.c @@ -209,7 +209,7 @@ static const struct SpriteFrameImage gUnknown_858E5D8[] = static const struct SpriteTemplate gUnknown_0858E600 = { .tileTag = 0xFFFF, - .paletteTag = 0x1003, + .paletteTag = FLDEFF_PAL_TAG_3, .oam = &gOamData_858E4D8, .anims = gSpriteAnimTable_858E570, .images = gUnknown_858E588, @@ -220,7 +220,7 @@ static const struct SpriteTemplate gUnknown_0858E600 = static const struct SpriteTemplate gUnknown_0858E618 = { .tileTag = 0xFFFF, - .paletteTag = 0x1008, + .paletteTag = FLDEFF_PAL_TAG_8, .oam = &gOamData_858E4D8, .anims = gSpriteAnimTable_858E574, .images = gUnknown_858E5B0, @@ -231,7 +231,7 @@ static const struct SpriteTemplate gUnknown_0858E618 = static const struct SpriteTemplate gUnknown_0858E630 = { .tileTag = 0xFFFF, - .paletteTag = 0x1008, + .paletteTag = FLDEFF_PAL_TAG_8, .oam = &gOamData_858E4D8, .anims = gSpriteAnimTable_858E584, .images = gUnknown_858E5D8, @@ -239,8 +239,8 @@ static const struct SpriteTemplate gUnknown_0858E630 = .callback = ShrubEntranceSpriteCallback1, }; -const struct SpritePalette gFieldEffectObjectPaletteInfo7 = {gFieldEffectObjectPalette7, 0x1003}; -const struct SpritePalette gFieldEffectObjectPaletteInfo8 = {gFieldEffectObjectPalette8, 0x1008}; +const struct SpritePalette gFieldEffectObjectPaletteInfo7 = {gFieldEffectObjectPalette7, FLDEFF_PAL_TAG_3}; +const struct SpritePalette gFieldEffectObjectPaletteInfo8 = {gFieldEffectObjectPalette8, FLDEFF_PAL_TAG_8}; static const struct OamData gOamData_858E658 = { @@ -277,7 +277,7 @@ static const struct SpriteFrameImage gUnknown_0858E674[] = static const struct SpriteTemplate gUnknown_0858E68C = { .tileTag = 0xFFFF, - .paletteTag = 0x100E, + .paletteTag = FLDEFF_PAL_TAG_14, .oam = &gOamData_858E658, .anims = gSpriteAnimTable_858E670, .images = gUnknown_0858E674, @@ -286,7 +286,7 @@ static const struct SpriteTemplate gUnknown_0858E68C = }; // This uses one of the secret base palettes, so there is no "graphics/field_effects/palettes/09.pal" file. -const struct SpritePalette gFieldEffectObjectPaletteInfo9 = {gTilesetPalettes_SecretBase[5], 0x100E}; +const struct SpritePalette gFieldEffectObjectPaletteInfo9 = {gTilesetPalettes_SecretBase[5], FLDEFF_PAL_TAG_14}; static const u8 gSpriteImage_858E6AC[] = INCBIN_U8("graphics/unknown/858E84C/0.4bpp"); static const u8 gSpriteImage_858E72C[] = INCBIN_U8("graphics/unknown/858E84C/1.4bpp"); @@ -300,7 +300,7 @@ static const struct SpriteFrameImage gUnknown_0858E84C[] = {gSpriteImage_858E7AC, sizeof(gSpriteImage_858E7AC)}, }; -static const struct SpritePalette gUnknown_0858E864 = {gUnknown_0858E82C, 0x1000}; +static const struct SpritePalette gUnknown_0858E864 = {gUnknown_0858E82C, FLDEFF_PAL_TAG_0}; static const union AnimCmd gSpriteAnim_858E86C[] = { @@ -318,7 +318,7 @@ static const union AnimCmd *const gSpriteAnimTable_858E87C[] = static const struct SpriteTemplate gUnknown_0858E880 = { .tileTag = 0xFFFF, - .paletteTag = 0x1000, + .paletteTag = FLDEFF_PAL_TAG_0, .oam = &gObjectEventBaseOam_32x8, .anims = gSpriteAnimTable_858E87C, .images = gUnknown_0858E84C, diff --git a/src/item_use.c b/src/item_use.c index ff689a19a..a90321a3b 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -399,7 +399,7 @@ static bool8 IsHiddenItemPresentInConnection(struct MapConnection *connection, i u32 localOffset; s32 localLength; - struct MapHeader const *const mapHeader = mapconnection_get_mapheader(connection); + struct MapHeader const *const mapHeader = GetMapHeaderFromConnection(connection); switch (connection->direction) { diff --git a/src/overworld.c b/src/overworld.c index 530699f83..bfe692988 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -96,24 +96,24 @@ static void VBlankCB_Field(void); static void SpriteCB_LinkPlayer(struct Sprite *sprite); static void ChooseAmbientCrySpecies(void); static void DoMapLoadLoop(u8 *state); +static bool32 LoadMapInStepsLocal(u8 *state, bool32); static bool32 LoadMapInStepsLink(u8 *state); static bool32 ReturnToFieldLocal(u8 *state); -static bool32 LoadMapInStepsLocal(u8 *state, bool32); static bool32 ReturnToFieldLink(u8 *state); -static void mli4_mapscripts_and_other(void); +static void InitObjectEventsLink(void); +static void InitObjectEventsLocal(void); static void InitOverworldGraphicsRegisters(void); static u8 GetSpriteForLinkedPlayer(u8); static u16 KeyInterCB_SendNothing(u32 a1); -static void sub_80867C8(void); +static void ResetMirageTowerAndSaveBlockPtrs(void); static void sub_80867D8(void); -static void sub_8086AE4(void); -static void sub_80869DC(void); -static void sub_8086B14(void); +static void OffsetCameraFocusByLinkPlayerId(void); +static void SpawnLinkPlayers(void); static void SetCameraToTrackGuestPlayer(void); -static void sub_8086988(bool32 arg0); +static void ResumeMap(bool32 arg0); static void SetCameraToTrackPlayer(void); static void sub_8086A68(void); -static void sub_8086860(void); +static void InitViewGraphics(void); static void SetCameraToTrackGuestPlayer_2(void); static void CreateLinkPlayerSprites(void); static void ClearAllPlayerKeys(void); @@ -520,7 +520,7 @@ void Overworld_SetObjEventTemplateMovementType(u8 localId, u8 movementType) } } -static void mapdata_load_assets_to_gpu_and_full_redraw(void) +static void InitMapView(void) { ResetFieldCamera(); CopyMapTilesetsToVram(gMapHeader.mapLayout); @@ -939,7 +939,7 @@ static u8 GetAdjustedInitialDirection(struct InitialPlayerAvatarState *playerStr else if (MetatileBehavior_IsEastArrowWarp(metatileBehavior) == TRUE) return DIR_WEST; else if ((playerStruct->transitionFlags == PLAYER_AVATAR_FLAG_UNDERWATER && transitionFlags == PLAYER_AVATAR_FLAG_SURFING) - || (playerStruct->transitionFlags == PLAYER_AVATAR_FLAG_SURFING && transitionFlags == PLAYER_AVATAR_FLAG_UNDERWATER )) + || (playerStruct->transitionFlags == PLAYER_AVATAR_FLAG_SURFING && transitionFlags == PLAYER_AVATAR_FLAG_UNDERWATER)) return playerStruct->direction; else if (MetatileBehavior_IsLadder(metatileBehavior) == TRUE) return playerStruct->direction; @@ -1421,7 +1421,7 @@ static void DoCB1_Overworld(u16 newKeys, u16 heldKeys) { struct FieldInput inputStruct; - sub_808B578(); + UpdatePlayerAvatarTransitionState(); FieldClearPlayerInput(&inputStruct); FieldGetPlayerInput(&inputStruct, newKeys, heldKeys); if (!ScriptContext2_IsEnabled()) @@ -1433,7 +1433,7 @@ static void DoCB1_Overworld(u16 newKeys, u16 heldKeys) } else { - player_step(inputStruct.dpadDirection, newKeys, heldKeys); + PlayerStep(inputStruct.dpadDirection, newKeys, heldKeys); } } } @@ -1723,12 +1723,12 @@ void CB2_ContinueSavedGame(void) ClearContinueGameWarpStatus(); SetWarpDestinationToContinueGameWarp(); WarpIntoMap(); - sub_80EDB44(); + TryPutTodaysRivalTrainerOnAir(); SetMainCallback2(CB2_LoadMap); } else { - sub_80EDB44(); + TryPutTodaysRivalTrainerOnAir(); gFieldCallback = sub_8086204; SetMainCallback1(CB1_Overworld); CB2_ReturnToField(); @@ -1797,7 +1797,7 @@ static bool32 LoadMapInStepsLink(u8 *state) InitOverworldBgs(); ScriptContext1_Init(); ScriptContext2_Disable(); - sub_80867C8(); + ResetMirageTowerAndSaveBlockPtrs(); sub_80867D8(); (*state)++; break; @@ -1806,13 +1806,13 @@ static bool32 LoadMapInStepsLink(u8 *state) (*state)++; break; case 2: - sub_8086988(TRUE); + ResumeMap(TRUE); (*state)++; break; case 3: - sub_8086AE4(); - sub_80869DC(); - sub_8086B14(); + OffsetCameraFocusByLinkPlayerId(); + InitObjectEventsLink(); + SpawnLinkPlayers(); SetCameraToTrackGuestPlayer(); (*state)++; break; @@ -1878,16 +1878,16 @@ static bool32 LoadMapInStepsLocal(u8 *state, bool32 a2) (*state)++; break; case 1: - sub_80867C8(); + ResetMirageTowerAndSaveBlockPtrs(); sub_80867D8(); (*state)++; break; case 2: - sub_8086988(a2); + ResumeMap(a2); (*state)++; break; case 3: - mli4_mapscripts_and_other(); + InitObjectEventsLocal(); SetCameraToTrackPlayer(); (*state)++; break; @@ -1945,16 +1945,16 @@ static bool32 ReturnToFieldLocal(u8 *state) switch (*state) { case 0: - sub_80867C8(); + ResetMirageTowerAndSaveBlockPtrs(); sub_80867D8(); - sub_8086988(FALSE); + ResumeMap(FALSE); sub_8086A68(); SetCameraToTrackPlayer(); (*state)++; break; case 1: - sub_8086860(); - sub_81D64C0(); + InitViewGraphics(); + TryLoadTrainerHillEReaderPalette(); (*state)++; break; case 2: @@ -1974,12 +1974,12 @@ static bool32 ReturnToFieldLink(u8 *state) { case 0: FieldClearVBlankHBlankCallbacks(); - sub_80867C8(); + ResetMirageTowerAndSaveBlockPtrs(); sub_80867D8(); (*state)++; break; case 1: - sub_8086988(TRUE); + ResumeMap(TRUE); (*state)++; break; case 2: @@ -2050,7 +2050,7 @@ static void DoMapLoadLoop(u8 *state) while (!LoadMapInStepsLocal(state, FALSE)); } -static void sub_80867C8(void) +static void ResetMirageTowerAndSaveBlockPtrs(void) { ClearMirageTowerPulseBlend(); MoveSaveBlocks_ResetHeap(); @@ -2067,12 +2067,12 @@ static void sub_80867D8(void) LoadOam(); } -static void sub_8086860(void) +static void InitViewGraphics(void) { InitCurrentFlashLevelScanlineEffect(); InitOverworldGraphicsRegisters(); InitTextBoxGfxAndPrinters(); - mapdata_load_assets_to_gpu_and_full_redraw(); + InitMapView(); } static void InitOverworldGraphicsRegisters(void) @@ -2110,7 +2110,7 @@ static void InitOverworldGraphicsRegisters(void) InitFieldMessageBox(); } -static void sub_8086988(bool32 a1) +static void ResumeMap(bool32 a1) { ResetTasks(); ResetSpriteData(); @@ -2133,7 +2133,7 @@ static void sub_8086988(bool32 a1) TryStartMirageTowerPulseBlendEffect(); } -static void sub_80869DC(void) +static void InitObjectEventsLink(void) { gTotalCameraPixelOffsetX = 0; gTotalCameraPixelOffsetY = 0; @@ -2142,7 +2142,7 @@ static void sub_80869DC(void) TryRunOnWarpIntoMapScript(); } -static void mli4_mapscripts_and_other(void) +static void InitObjectEventsLocal(void) { s16 x, y; struct InitialPlayerAvatarState *player; @@ -2183,17 +2183,17 @@ static void SetCameraToTrackGuestPlayer_2(void) InitCameraUpdateCallback(GetSpriteForLinkedPlayer(gLocalLinkPlayerId)); } -static void sub_8086AE4(void) +static void OffsetCameraFocusByLinkPlayerId(void) { u16 x, y; GetCameraFocusCoords(&x, &y); - // This is a hack of some kind; it's undone in sub_8086B14, which is called + // This is a hack of some kind; it's undone in SpawnLinkPlayers, which is called // soon after this function. - sub_8088B3C(x + gLocalLinkPlayerId, y); + SetCameraFocusCoords(x + gLocalLinkPlayerId, y); } -static void sub_8086B14(void) +static void SpawnLinkPlayers(void) { u16 i; u16 x, y; diff --git a/src/trainer_hill.c b/src/trainer_hill.c index d6cb49837..c5aea14d9 100644 --- a/src/trainer_hill.c +++ b/src/trainer_hill.c @@ -64,7 +64,7 @@ static void TrainerHillSetPlayerLost(void); static void TrainerHillGetChallengeStatus(void); static void BufferChallengeTime(void); static void GetAllFloorsUsed(void); -static void ClearVarResult(void); +static void GetInEReaderMode(void); static void IsTrainerHillChallengeActive(void); static void ShowTrainerHillPostBattleText(void); static void SetAllTrainerFlags(void); @@ -202,7 +202,7 @@ static const u16 *const *const sPrizeListSets[] = sPrizeLists2 }; -static const u16 sUnknown_0862A5D4[] = INCBIN_U16("graphics/pokenav/862A5D4.gbapal"); +static const u16 sEReader_Pal[] = INCBIN_U16("graphics/misc/trainer_hill_ereader.gbapal"); static const u8 sRecordWinColors[] = {TEXT_COLOR_TRANSPARENT, TEXT_COLOR_DARK_GREY, TEXT_COLOR_LIGHT_GREY}; static const struct TrHillTag *const sDataPerTag[] = @@ -233,7 +233,7 @@ static void (* const sHillFunctions[])(void) = [TRAINER_HILL_FUNC_GET_CHALLENGE_STATUS] = TrainerHillGetChallengeStatus, [TRAINER_HILL_FUNC_GET_CHALLENGE_TIME] = BufferChallengeTime, [TRAINER_HILL_FUNC_GET_ALL_FLOORS_USED] = GetAllFloorsUsed, - [TRAINER_HILL_FUNC_CLEAR_RESULT] = ClearVarResult, + [TRAINER_HILL_FUNC_GET_IN_EREADER_MODE] = GetInEReaderMode, [TRAINER_HILL_FUNC_IN_CHALLENGE] = IsTrainerHillChallengeActive, [TRAINER_HILL_FUNC_POST_BATTLE_TEXT] = ShowTrainerHillPostBattleText, [TRAINER_HILL_FUNC_SET_ALL_TRAINER_FLAGS] = SetAllTrainerFlags, @@ -546,10 +546,11 @@ static void GetAllFloorsUsed(void) } // May have been dummied. Every time this is called a conditional for var result occurs afterwards -static void ClearVarResult(void) +// Relation to E-Reader is an assumption, most dummied Trainer Hill code seems to be JP E-Reader mode related +static void GetInEReaderMode(void) { SetUpDataStruct(); - gSpecialVar_Result = 0; + gSpecialVar_Result = FALSE; FreeDataStruct(); } @@ -997,11 +998,11 @@ static void SetAllTrainerFlags(void) gSaveBlock2Ptr->frontier.trainerFlags = 0xFF; } -// Palette never loaded, sub_81D6534 always FALSE -void sub_81D64C0(void) +// Palette never loaded, OnTrainerHillEReaderChallengeFloor always FALSE +void TryLoadTrainerHillEReaderPalette(void) { - if (sub_81D6534() == TRUE) - LoadPalette(sUnknown_0862A5D4, 0x70, 0x20); + if (OnTrainerHillEReaderChallengeFloor() == TRUE) + LoadPalette(sEReader_Pal, 0x70, 0x20); } static void GetGameSaved(void) @@ -1020,13 +1021,13 @@ static void ClearGameSaved(void) } // Always FALSE -bool32 sub_81D6534(void) +bool32 OnTrainerHillEReaderChallengeFloor(void) { if (!InTrainerHillChallenge() || GetCurrentTrainerHillMapId() == TRAINER_HILL_ENTRANCE) return FALSE; - ClearVarResult(); - if (gSpecialVar_Result == 0) + GetInEReaderMode(); + if (gSpecialVar_Result == FALSE) return FALSE; else return TRUE; diff --git a/src/trainer_see.c b/src/trainer_see.c index 68a16e208..4f4aaea08 100644 --- a/src/trainer_see.c +++ b/src/trainer_see.c @@ -559,7 +559,7 @@ static bool8 PopOutOfAshHiddenTrainer(u8 taskId, struct Task *task, struct Objec gFieldEffectArguments[1] = trainerObj->currentCoords.y; gFieldEffectArguments[2] = gSprites[trainerObj->spriteId].subpriority - 1; gFieldEffectArguments[3] = 2; - task->tOutOfAshSpriteId = FieldEffectStart(FLDEFF_POP_OUT_OF_ASH); + task->tOutOfAshSpriteId = FieldEffectStart(FLDEFF_ASH_PUFF); task->tFuncId++; } return FALSE; @@ -586,7 +586,7 @@ static bool8 JumpInPlaceHiddenTrainer(u8 taskId, struct Task *task, struct Objec static bool8 WaitRevealHiddenTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj) { - if (!FieldEffectActiveListContains(FLDEFF_POP_OUT_OF_ASH)) + if (!FieldEffectActiveListContains(FLDEFF_ASH_PUFF)) task->tFuncId = 3; return FALSE; @@ -610,7 +610,7 @@ static void sub_80B44C8(u8 taskId) task->data[7]++; } sTrainerSeeFuncList2[task->data[0]](taskId, task, objEvent); - if (task->data[0] == 3 && !FieldEffectActiveListContains(FLDEFF_POP_OUT_OF_ASH)) + if (task->data[0] == 3 && !FieldEffectActiveListContains(FLDEFF_ASH_PUFF)) { SetTrainerMovementType(objEvent, GetTrainerFacingDirectionMovementType(objEvent->facingDirection)); TryOverrideTemplateCoordsForObjectEvent(objEvent, GetTrainerFacingDirectionMovementType(objEvent->facingDirection)); diff --git a/src/tv.c b/src/tv.c index eaf30f82b..17a02be6b 100644 --- a/src/tv.c +++ b/src/tv.c @@ -1930,7 +1930,7 @@ void sub_80EDA80(void) } } -void sub_80EDB44(void) +void TryPutTodaysRivalTrainerOnAir(void) { TVShow *show; u32 i; From eb80012757b664a474f3c745115aa4f109b69443 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Mon, 29 Jun 2020 11:41:09 -0400 Subject: [PATCH 3/9] Document more misc field effects --- data/field_effect_scripts.s | 20 +- data/scripts/field_move_scripts.inc | 6 +- .../palettes/record_mix_lights.pal} | 0 .../field_effects/pics/record_mix_lights.png | Bin 0 -> 199 bytes graphics/field_effects/pics/sand_pillar.png | Bin 0 -> 673 bytes .../pics/sand_pillar}/0.png | Bin .../pics/sand_pillar}/1.png | Bin .../pics/sand_pillar}/2.png | Bin .../field_effects/pics/secret_power_cave.png | Bin 0 -> 356 bytes .../field_effects/pics/secret_power_shrub.png | Bin 0 -> 270 bytes .../field_effects/pics/secret_power_tree.png | Bin 0 -> 304 bytes graphics/unknown/858E588/0.png | Bin 145 -> 0 bytes graphics/unknown/858E588/1.png | Bin 149 -> 0 bytes graphics/unknown/858E588/2.png | Bin 138 -> 0 bytes graphics/unknown/858E588/3.png | Bin 133 -> 0 bytes graphics/unknown/858E588/4.png | Bin 114 -> 0 bytes graphics/unknown/858E5B0/0.png | Bin 89 -> 0 bytes graphics/unknown/858E5B0/1.png | Bin 109 -> 0 bytes graphics/unknown/858E5B0/2.png | Bin 119 -> 0 bytes graphics/unknown/858E5B0/3.png | Bin 123 -> 0 bytes graphics/unknown/858E5B0/4.png | Bin 129 -> 0 bytes graphics/unknown/858E5B0/5.png | Bin 126 -> 0 bytes graphics/unknown/858E5D8/0.png | Bin 87 -> 0 bytes graphics/unknown/858E5D8/1.png | Bin 116 -> 0 bytes graphics/unknown/858E5D8/2.png | Bin 131 -> 0 bytes graphics/unknown/858E5D8/3.png | Bin 115 -> 0 bytes graphics/unknown/858E5D8/4.png | Bin 92 -> 0 bytes graphics/unknown/858E84C/0.png | Bin 103 -> 0 bytes graphics/unknown/858E84C/1.png | Bin 107 -> 0 bytes graphics/unknown/858E84C/2.png | Bin 107 -> 0 bytes include/event_scripts.h | 2 +- include/fldeff_misc.h | 22 +- spritesheet_rules.mk | 15 + src/field_effect.c | 52 +- src/fieldmap.c | 2 +- src/fldeff_cut.c | 158 +++--- src/fldeff_misc.c | 515 +++++++++--------- src/fldeff_rocksmash.c | 46 +- src/hall_of_fame.c | 8 +- src/pokemon_storage_system.c | 12 +- src/record_mixing.c | 4 +- 41 files changed, 446 insertions(+), 416 deletions(-) rename graphics/{unknown/unknown_58E82C.pal => field_effects/palettes/record_mix_lights.pal} (100%) create mode 100644 graphics/field_effects/pics/record_mix_lights.png create mode 100644 graphics/field_effects/pics/sand_pillar.png rename graphics/{unknown/858E674 => field_effects/pics/sand_pillar}/0.png (100%) rename graphics/{unknown/858E674 => field_effects/pics/sand_pillar}/1.png (100%) rename graphics/{unknown/858E674 => field_effects/pics/sand_pillar}/2.png (100%) create mode 100644 graphics/field_effects/pics/secret_power_cave.png create mode 100644 graphics/field_effects/pics/secret_power_shrub.png create mode 100644 graphics/field_effects/pics/secret_power_tree.png delete mode 100644 graphics/unknown/858E588/0.png delete mode 100644 graphics/unknown/858E588/1.png delete mode 100644 graphics/unknown/858E588/2.png delete mode 100644 graphics/unknown/858E588/3.png delete mode 100644 graphics/unknown/858E588/4.png delete mode 100644 graphics/unknown/858E5B0/0.png delete mode 100644 graphics/unknown/858E5B0/1.png delete mode 100644 graphics/unknown/858E5B0/2.png delete mode 100644 graphics/unknown/858E5B0/3.png delete mode 100644 graphics/unknown/858E5B0/4.png delete mode 100644 graphics/unknown/858E5B0/5.png delete mode 100644 graphics/unknown/858E5D8/0.png delete mode 100644 graphics/unknown/858E5D8/1.png delete mode 100644 graphics/unknown/858E5D8/2.png delete mode 100644 graphics/unknown/858E5D8/3.png delete mode 100644 graphics/unknown/858E5D8/4.png delete mode 100644 graphics/unknown/858E84C/0.png delete mode 100644 graphics/unknown/858E84C/1.png delete mode 100644 graphics/unknown/858E84C/2.png diff --git a/data/field_effect_scripts.s b/data/field_effect_scripts.s index 6850154d3..23b184122 100644 --- a/data/field_effect_scripts.s +++ b/data/field_effect_scripts.s @@ -52,8 +52,8 @@ gFieldEffectScriptPointers:: @ 82DB9D4 .4byte gFieldEffectScript_UseDive @ FLDEFF_USE_DIVE .4byte gFieldEffectScript_Pokeball @ FLDEFF_POKEBALL .4byte gFieldEffectScript_HeartIcon @ FLDEFF_HEART_ICON - .4byte gFieldEffectScript_Unknown47 @ FLDEFF_NOP_47 - .4byte gFieldEffectScript_Unknown48 @ FLDEFF_NOP_48 + .4byte gFieldEffectScript_Nop47 @ FLDEFF_NOP_47 + .4byte gFieldEffectScript_Nop48 @ FLDEFF_NOP_48 .4byte gFieldEffectScript_AshPuff @ FLDEFF_ASH_PUFF .4byte gFieldEffectScript_AshLaunch @ FLDEFF_ASH_LAUNCH .4byte gFieldEffectScript_SweetScent @ FLDEFF_SWEET_SCENT @@ -263,12 +263,12 @@ gFieldEffectScript_HeartIcon:: @ 82DBC56 field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_HeartIcon field_eff_end -gFieldEffectScript_Unknown47:: @ 82DBC60 - field_eff_callnative FldEff_NopA6FC +gFieldEffectScript_Nop47:: @ 82DBC60 + field_eff_callnative FldEff_Nop47 field_eff_end -gFieldEffectScript_Unknown48:: @ 82DBC66 - field_eff_callnative FldEff_NopA700 +gFieldEffectScript_Nop48:: @ 82DBC66 + field_eff_callnative FldEff_Nop48 field_eff_end gFieldEffectScript_AshPuff:: @ 82DBC6C @@ -284,7 +284,7 @@ gFieldEffectScript_SweetScent:: @ 82DBC80 field_eff_end gFieldEffectScript_SandPillar:: @ 82DBC86 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo9, FldEff_SandPillar + field_eff_loadfadedpal_callnative gSpritePalette_SandPillar, FldEff_SandPillar field_eff_end gFieldEffectScript_Bubbles:: @ 82DBC90 @@ -296,15 +296,15 @@ gFieldEffectScript_Sparkle:: @ 82DBC9A field_eff_end gFieldEffectScript_ShowSecretPowerCave:: @ 82DBCA4 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo7, FldEff_SecretPowerCave + field_eff_loadfadedpal_callnative gSpritePalette_SecretPower_Cave, FldEff_SecretPowerCave field_eff_end gFieldEffectScript_ShowSecretPowerTree:: @ 82DBCAE - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo8, FldEff_SecretPowerTree + field_eff_loadfadedpal_callnative gSpritePalette_SecretPower_Plant, FldEff_SecretPowerTree field_eff_end gFieldEffectScript_ShowSecretPowerShrub:: @ 82DBCB8 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo8, FldEff_SecretPowerShrub + field_eff_loadfadedpal_callnative gSpritePalette_SecretPower_Plant, FldEff_SecretPowerShrub field_eff_end gFieldEffectScript_ShowCutGrass:: @ 82DBCC2 diff --git a/data/scripts/field_move_scripts.inc b/data/scripts/field_move_scripts.inc index 56e3297b6..c5647daa4 100644 --- a/data/scripts/field_move_scripts.inc +++ b/data/scripts/field_move_scripts.inc @@ -77,7 +77,7 @@ EventScript_RockSmash:: @ 82907A6 goto EventScript_SmashRock end -EventScript_FldEffRockSmash:: @ 82907F0 +EventScript_RockSmashFromPartyMenu:: @ 82907F0 lockall dofieldeffect FLDEFF_USE_ROCK_SMASH waitstate @@ -89,10 +89,10 @@ EventScript_SmashRock:: @ 82907FB waitmovement 0 removeobject VAR_LAST_TALKED specialvar VAR_RESULT, TryUpdateRusturfTunnelState - compare VAR_RESULT, 1 + compare VAR_RESULT, TRUE goto_if_eq EventScript_EndSmash special RockSmashWildEncounter - compare VAR_RESULT, 0 + compare VAR_RESULT, FALSE goto_if_eq EventScript_EndSmash waitstate releaseall diff --git a/graphics/unknown/unknown_58E82C.pal b/graphics/field_effects/palettes/record_mix_lights.pal similarity index 100% rename from graphics/unknown/unknown_58E82C.pal rename to graphics/field_effects/palettes/record_mix_lights.pal diff --git a/graphics/field_effects/pics/record_mix_lights.png b/graphics/field_effects/pics/record_mix_lights.png new file mode 100644 index 0000000000000000000000000000000000000000..b6d3d65376b42abc4ca368667ec6377615c8c2c2 GIT binary patch literal 199 zcmeAS@N?(olHy`uVBq!ia0vp^2|&!j!VDz82tKy~QU(D&A+A9BKMel|u?T=uvo2)= zl>~XZIEF|}-P+&HdBA|fB|eCKg3kkvZ6yo~f4{#{+&WE0<~e&M$M2_%%jP_pF;`Dq zxk~-^BZUni#kJ0Jm|pCNn`~{CVK?= zGB8xBF)%c=FfjZA3N^f7U?>G@e3ih!U^Rn*LA+qju0R{0glK?Ih-=W6pe;+1ii?Y{ z9_^me>=+aj^#A|=(qczXpaRAuZ+92A#Izl?Kn{C}r>`sf6E<04YeviG-hn_Nf#gKL zG7t^K3P217sRx*^0=4FPx;TbtoL@W9vFNq|kE>(%O>U;m+t-xDi&!y4Hvc|zW8eSK zUyhcKPx?$d+9o7t_kmOB@BN5#_RI9u{~CMznrDAf>Dzbp1z9!>XYU_STl6+yN#nj2 z`Lvj6T`9|UUh@8>cxDgNl5{)UleZ?sXLIzus`+B2dq#WQZd+rwX!-Bb{l`5gdsh5u)zV*^e{^>B>&i{Xepz4qwZnSd4fDEN=WYc|=A4?N z6JSuLTsv>Wu16vauWL1*-Q8j$U#2TG+vr+PSnJM~x4uVH_*-W<{uJBA7;)v;2klw) zjkXMTRvzOqyjFKu|8SW`4!^6g^Y6Oksh8L;B>#B$>MxuAj_cJs9z}R=ITU_=#WDS~ z9q!B4pJo0!%h=|sPr=0p&pzw6^xA*ilJN0gzu@}GMaMQ@w*MjL`?fsAbptR4R7+eV zN>UO_QmvAUQh^kMk%5tcu7R1Zk!6UXrIoRnm5H&ofq|8Q!Q#VG?kE~^^HVa@DsgML TG;h&wP#k-@`njxgN@xNAt-cCp literal 0 HcmV?d00001 diff --git a/graphics/unknown/858E674/0.png b/graphics/field_effects/pics/sand_pillar/0.png similarity index 100% rename from graphics/unknown/858E674/0.png rename to graphics/field_effects/pics/sand_pillar/0.png diff --git a/graphics/unknown/858E674/1.png b/graphics/field_effects/pics/sand_pillar/1.png similarity index 100% rename from graphics/unknown/858E674/1.png rename to graphics/field_effects/pics/sand_pillar/1.png diff --git a/graphics/unknown/858E674/2.png b/graphics/field_effects/pics/sand_pillar/2.png similarity index 100% rename from graphics/unknown/858E674/2.png rename to graphics/field_effects/pics/sand_pillar/2.png diff --git a/graphics/field_effects/pics/secret_power_cave.png b/graphics/field_effects/pics/secret_power_cave.png new file mode 100644 index 0000000000000000000000000000000000000000..445b275f300cd86e19bc0a5281d80d5f2c7bec4e GIT binary patch literal 356 zcmeAS@N?(olHy`uVBq!ia0vp^0YEIk!VDyf)1Q6Bpyk-LdwgKLN{OVhyd!HEnBaWeJvTZ`HYXpEcrJ+H&)hmH&H_V$J&sAMaKD{kr?p zq*p)A?b;s1&rxwRs#vrszS+*_pu(PwPTLM`ILBLb_53yC^w%q+7HOTIVkrE?NO05D z8Hc-VLmXI+IP|yVn10QE+q*I(YQ+_)J%VD|X0@01%}(}}6%<}Ob*8|iP;VaBG*Qm}UzSiEz=;*rcKg=IiRIl}sZp;CNjHj!g%Q~loCIFCyn<4-J literal 0 HcmV?d00001 diff --git a/graphics/field_effects/pics/secret_power_shrub.png b/graphics/field_effects/pics/secret_power_shrub.png new file mode 100644 index 0000000000000000000000000000000000000000..322643372a4ec02c4b0804a1fa6561ada6cf6b76 GIT binary patch literal 270 zcmV+p0rCEcP)YrKHLi?DJl76xx?X$uPC?oY5lejmRA{7Y&n>#YG- zr{!Q_+Ig31*68umulaPy?x=ilTE328F!PBlM%M~bBN)jJ)JEu5N&@Gc{Vo@;lmrNz zGf~vy{3|6HEyurS9=x<{h0*f}WHy@Wm|9BYqcQ)hreuWbA){N~#zPTa^?nO`FZpK> UAvOx@od5s;07*qoM6N<$g6!9EEdT%j literal 0 HcmV?d00001 diff --git a/graphics/field_effects/pics/secret_power_tree.png b/graphics/field_effects/pics/secret_power_tree.png new file mode 100644 index 0000000000000000000000000000000000000000..8797417842783731f93bccd3156fdc2b4aa28c68 GIT binary patch literal 304 zcmV-00nh%4P)7s{egOP-q1F5Rs#ZHlGLzzi16Vy30PryLP{Ic3SS;;UGl0z?Jxi>W zrKEY{1rlpk;&8s9bpoC!&4b#y9#&PR`E7zSz{LP$>PtTXCn>bmmH9FKa*B4hjZh5o zN};=X96@oLOG`C73&m>y5tdvb?*1!WG2Q*&*d;$mlOO255tn8F0000}T8YKf!gSbLpe63Mb23PM_HN(C(#q>dwqKzmrZTYdLaRxQq*g_L?0D s+^Tt1F+<=oZ!6E6-8WT#eQ(-d!N9pE=5V`D#6^%@p00i_>zopr0DJg08vpW6usqBG_N?~Pd@tEzHP xA}O(*tNf$Ej>5%86DPZv;6;cBD>&=$T=H6+yPn2;OXk;vd$@?2>`ffIQ;+s diff --git a/graphics/unknown/858E588/2.png b/graphics/unknown/858E588/2.png deleted file mode 100644 index c006bb660962272d5b22f42aaf35aa9157e5ed8d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 138 zcmeAS@N?(olHy`uVBq!ia0vp^0wBx+BpCi@`0fExfu1goAsjPnPZ{zx81OJ3_`@>M zZh=tZ`3rA;{x_fWW|@Pzip|^{;jkC-eV4AL)K8qh*=_~n6<*_3%N02u^Vm*xW*DjG lxo=SM{1A7iRcO!7<#9Z-lQyN~%l-yg;_2$=vd$@?2>^v&F$e$v diff --git a/graphics/unknown/858E588/3.png b/graphics/unknown/858E588/3.png deleted file mode 100644 index 67a3cf76900d5b9e3969ee2e94e7bc197a356a74..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 133 zcmeAS@N?(olHy`uVBq!ia0vp^0wBx+BpCi@`0fExKAtX)AsjQ4fAF*NEHQdxxYX`{ zd0VH%-}DcA`KRux{{CL{|NifdJ=WFlE$;8Fp8xR7JLBcK@8<12{NeYRyLXqLe`k62 i!_8kk-`?Fl^^GBPX5oRhO&8XK%=dKlb6Mw<&;$UcMLY@s diff --git a/graphics/unknown/858E588/4.png b/graphics/unknown/858E588/4.png deleted file mode 100644 index e2a5aec4fbc57c3fa1c826d5ba60d8d4b1af9856..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 114 zcmeAS@N?(olHy`uVBq!ia0vp^0wBx+BpCi@`0fExmYyz-AsjQ;c3k9SP~v4-nZ!(IX@j%n97R5#--8VE MboFyt=akR{01b^LMF0Q* diff --git a/graphics/unknown/858E5B0/0.png b/graphics/unknown/858E5B0/0.png deleted file mode 100644 index afd104d7ca67c876327122032566e81dfd84e429..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 89 zcmeAS@N?(olHy`uVBq!ia0vp^0wBx+BpCi@`0fEx3Z5>GAsjQ4fAF*H{{H{}d4?tR l?|1X2zG*dj5R~A+&c^VqtajP_^v4b$J)W+9F6*2Ung9T}8?68U diff --git a/graphics/unknown/858E5B0/1.png b/graphics/unknown/858E5B0/1.png deleted file mode 100644 index 026b9b7afe1b01bd05528f1e44a04cf054c50148..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 109 zcmeAS@N?(olHy`uVBq!ia0vp^0wBx+BpCi@`0fExCY~;iAsjQ4fBgUd|NVW3CdQ8P z_iYAs^KbGezOno(f9l46dEY1Btyj#tU;h2@7U!i34K{2H758hnO5PV}gUs=C^>bP0 Hl+XkKa49HV diff --git a/graphics/unknown/858E5B0/2.png b/graphics/unknown/858E5B0/2.png deleted file mode 100644 index 360e2ab63e655b5c4e37d564eca2f5b58dc37dd3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 119 zcmeAS@N?(olHy`uVBq!ia0vp^0wBx+BpCi@`0fExcAhSdAsjQ4fBgUd|NVW3CdQ8P z_w5FC^Z)gqvtXY3Yd`xjhSQA_|G&R;PyVxyJM~R9Z|LUlW R`TQD?iJq>0F6*2UngCA@E}8%U diff --git a/graphics/unknown/858E5B0/3.png b/graphics/unknown/858E5B0/3.png deleted file mode 100644 index 88672c182463cab3c4f460b6a28e713ee5e5f9ce..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 123 zcmeAS@N?(olHy`uVBq!ia0vp^0wBx+BpCi@`0fExPM$7~AsjPpPoLyvP~>5D_?54@ zCWs+`@s?PI0)O$%CyBi|s*D{G6U}@w{6x%t9@JkXbgfWe?t$k`oX+v~jK1IH)ZC_3 UNq&;ZNdTGZ>FVdQ&MBb@0E0{Kb)%E-UJ*m;Ea6{vytzVwS0)s<68T@ Yj1vFKtVI7${sS`D)78&qol`;+0QOKSs{jB1 diff --git a/graphics/unknown/858E5D8/0.png b/graphics/unknown/858E5D8/0.png deleted file mode 100644 index 110b1dd0a50dd8335d7b088e22c7641a824a2945..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 87 zcmeAS@N?(olHy`uVBq!ia0vp^0wBx+BpCi@`0fExa-J@ZAsjQ4fAF*Nv`Fk<(3Af& j!0lF*hH|&WTNfh+?H#qLmmRGHK{`BL{an^LB{Ts5Q!*D0 diff --git a/graphics/unknown/858E5D8/1.png b/graphics/unknown/858E5D8/1.png deleted file mode 100644 index f50079de7f4ea6efe4bf84cac1e8ce51e9cfd692..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 116 zcmeAS@N?(olHy`uVBq!ia0vp^0wBx+BpCi@`0fEx)}AhoAsjQ4fAF*N{E(=>?<`sW z?%reLu37T+ z|NXZ7X*H+qnWtI()_VK@|8|FC^Q%w)`@fs{>euHs9gLTl!+0(+r!{<;Q_FAq^SteZ eS=KMI6c`vf{i<#qH}^^bneOT8=d#Wzp$Py2XE5^s diff --git a/graphics/unknown/858E5D8/3.png b/graphics/unknown/858E5D8/3.png deleted file mode 100644 index 0ea6e43c96ecf571dcd7d06edad1637404b02236..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 115 zcmeAS@N?(olHy`uVBq!ia0vp^0wBx+BpCi@`0fExR-P`7AsjQ4fAF*N+>reL&RH`5 zyt8Ebf}q!lS^FA88kb&bSS8`GC-rB#Ls0(t|EJhjTQY~W9_A8ZV>tPw+U@^;``;kb NJYD@<);T3K0RU#NCp-WE diff --git a/graphics/unknown/858E5D8/4.png b/graphics/unknown/858E5D8/4.png deleted file mode 100644 index 4b4e300bb70c593b700504e5e6c1aa568f6c7092..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 92 zcmeAS@N?(olHy`uVBq!ia0vp^0wBx+BpCi@`0fEx%APKcAsjQ4fAF*Nm?Zw$&78W& owqL3Ao9&d3&*dTnUAR_oFdUYs^VeEhXAjcm>FVdQ&MBb@0MtAf@Bjb+ diff --git a/graphics/unknown/858E84C/0.png b/graphics/unknown/858E84C/0.png deleted file mode 100644 index 4673403e0349211ac4ae5d8064b66a773f39caa8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 103 zcmeAS@N?(olHy`uVBq!ia0vp^3P8-k0wfqJZYgTMd(|31I}fA?J;CnkpO=(@nk8a){x6Fgo0T-G@yGywoa CVI}JT diff --git a/graphics/unknown/858E84C/1.png b/graphics/unknown/858E84C/1.png deleted file mode 100644 index c55f2146d54f5e0f5b8a1c6aa12b914a0fd92f77..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 107 zcmeAS@N?(olHy`uVBq!ia0vp^3P8-k0wfqJ4V+hC0B8&@i*FfbHJ)V^C@CtwaT#naW#Wt~$( F699bhE2;nh diff --git a/graphics/unknown/858E84C/2.png b/graphics/unknown/858E84C/2.png deleted file mode 100644 index 4f03b50ae96a69b3c5fe1401e33c4f7edd93aad3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 107 zcmeAS@N?(olHy`uVBq!ia0vp^3P8-k0wfqJ4V+hC0data[11] = REG_WININ; task->data[12] = REG_WINOUT; StoreWordInTwoHalfwords(&task->data[13], (u32)gMain.vblankCallback); - task->tWinHoriz = WIN_RANGE(240, 241); - task->tWinVert = WIN_RANGE(80, 81); + task->tWinHoriz = WIN_RANGE(DISPLAY_WIDTH, DISPLAY_WIDTH + 1); + task->tWinVert = WIN_RANGE(DISPLAY_HEIGHT / 2, DISPLAY_HEIGHT / 2 + 1); task->tWinIn = WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR; task->tWinOut = WINOUT_WIN01_BG1 | WINOUT_WIN01_BG2 | WINOUT_WIN01_BG3 | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR; SetGpuReg(REG_OFFSET_WIN0H, task->tWinHoriz); @@ -2637,15 +2637,15 @@ static void FieldMoveShowMonOutdoorsEffect_CreateBanner(struct Task *task) if (horiz < 0) horiz = 0; - if (vertHi < 40) - vertHi = 40; + if (vertHi < DISPLAY_HEIGHT / 4) + vertHi = DISPLAY_HEIGHT / 4; - if (vertLo > 120) - vertLo = 120; + if (vertLo > DISPLAY_WIDTH / 2) + vertLo = DISPLAY_WIDTH / 2; task->tWinHoriz = (horiz << 8) | (task->tWinHoriz & 0xff); task->tWinVert = (vertHi << 8) | vertLo; - if (horiz == 0 && vertHi == 40 && vertLo == 120) + if (horiz == 0 && vertHi == DISPLAY_HEIGHT / 4 && vertLo == DISPLAY_WIDTH / 2) { gSprites[task->tMonSpriteId].callback = SpriteCB_FieldMoveMonSlideOnscreen; task->tState++; @@ -2670,15 +2670,15 @@ static void FieldMoveShowMonOutdoorsEffect_ShrinkBanner(struct Task *task) vertHi += 6; vertLo -= 6; - if (vertHi > 80) - vertHi = 80; + if (vertHi > DISPLAY_HEIGHT / 2) + vertHi = DISPLAY_HEIGHT / 2; - if (vertLo < 81) - vertLo = 81; + if (vertLo < DISPLAY_HEIGHT / 2 + 1) + vertLo = DISPLAY_HEIGHT / 2 + 1; task->tWinVert = (vertHi << 8) | vertLo; - if (vertHi == 80 && vertLo == 81) + if (vertHi == DISPLAY_HEIGHT / 2 && vertLo == DISPLAY_HEIGHT / 2 + 1) task->tState++; } @@ -2686,8 +2686,8 @@ static void FieldMoveShowMonOutdoorsEffect_RestoreBg(struct Task *task) { u16 bg0cnt = (REG_BG0CNT >> 8) << 11; CpuFill32(0, (void *)VRAM + bg0cnt, 0x800); - task->tWinHoriz = 241; - task->tWinVert = 161; + task->tWinHoriz = DISPLAY_WIDTH + 1; + task->tWinVert = DISPLAY_HEIGHT + 1; task->tWinIn = task->data[11]; task->tWinOut = task->data[12]; task->tState++; @@ -2787,8 +2787,8 @@ static void FieldMoveShowMonIndoorsEffect_SlideBannerOn(struct Task *task) { if (SlideIndoorBannerOnscreen(task)) { - SetGpuReg(REG_OFFSET_WIN1H, 0x00f0); - SetGpuReg(REG_OFFSET_WIN1V, 0x2878); + SetGpuReg(REG_OFFSET_WIN1H, WIN_RANGE(0, DISPLAY_WIDTH)); + SetGpuReg(REG_OFFSET_WIN1V, WIN_RANGE(DISPLAY_HEIGHT / 4, DISPLAY_HEIGHT - DISPLAY_HEIGHT / 4)); gSprites[task->tMonSpriteId].callback = SpriteCB_FieldMoveMonSlideOnscreen; task->tState++; } @@ -2807,8 +2807,8 @@ static void FieldMoveShowMonIndoorsEffect_RestoreBg(struct Task *task) AnimateIndoorShowMonBg(task); task->tBgOffsetIdx = task->tBgHoriz & 7; task->tBgOffset = 0; - SetGpuReg(REG_OFFSET_WIN1H, 0xffff); - SetGpuReg(REG_OFFSET_WIN1V, 0xffff); + SetGpuReg(REG_OFFSET_WIN1H, WIN_RANGE(0xFF, 0xFF)); + SetGpuReg(REG_OFFSET_WIN1V, WIN_RANGE(0xFF, 0xFF)); task->tState++; } @@ -2917,7 +2917,7 @@ static u8 InitFieldMoveMonSprite(u32 species, u32 otId, u32 personality) struct Sprite *sprite; v0 = (species & 0x80000000) >> 16; species &= 0x7fffffff; - monSprite = CreateMonSprite_FieldMove(species, otId, personality, 0x140, 0x50, 0); + monSprite = CreateMonSprite_FieldMove(species, otId, personality, 320, 80, 0); sprite = &gSprites[monSprite]; sprite->callback = SpriteCallbackDummy; sprite->oam.priority = 0; @@ -2928,9 +2928,9 @@ static u8 InitFieldMoveMonSprite(u32 species, u32 otId, u32 personality) static void SpriteCB_FieldMoveMonSlideOnscreen(struct Sprite *sprite) { - if ((sprite->pos1.x -= 20) <= 120) + if ((sprite->pos1.x -= 20) <= DISPLAY_WIDTH / 2) { - sprite->pos1.x = 120; + sprite->pos1.x = DISPLAY_WIDTH / 2; sprite->sOnscreenTimer = 30; sprite->callback = SpriteCB_FieldMoveMonWaitAfterCry; if (sprite->data[6]) @@ -2947,21 +2947,15 @@ static void SpriteCB_FieldMoveMonSlideOnscreen(struct Sprite *sprite) static void SpriteCB_FieldMoveMonWaitAfterCry(struct Sprite *sprite) { if ((--sprite->sOnscreenTimer) == 0) - { sprite->callback = SpriteCB_FieldMoveMonSlideOffscreen; - } } static void SpriteCB_FieldMoveMonSlideOffscreen(struct Sprite *sprite) { if (sprite->pos1.x < -64) - { sprite->sSlidOffscreen = TRUE; - } else - { sprite->pos1.x -= 20; - } } #undef tState @@ -3311,7 +3305,7 @@ static void StartFlyBirdSwoopDown(u8 spriteId) struct Sprite *sprite; sprite = &gSprites[spriteId]; sprite->callback = SpriteCB_FlyBirdSwoopDown; - sprite->pos1.x = 120; + sprite->pos1.x = DISPLAY_WIDTH / 2; sprite->pos1.y = 0; sprite->pos2.x = 0; sprite->pos2.y = 0; diff --git a/src/fieldmap.c b/src/fieldmap.c index 5eb00ad27..8e45add3f 100644 --- a/src/fieldmap.c +++ b/src/fieldmap.c @@ -939,7 +939,7 @@ static bool8 SkipCopyingMetatileFromSavedMap(u16* mapMetatilePtr, u16 mapWidth, else mapMetatilePtr += mapWidth; - if (sub_80FADE4(*mapMetatilePtr & METATILE_ID_MASK, yMode) == 1) + if (IsLargeBreakableDecoration(*mapMetatilePtr & METATILE_ID_MASK, yMode) == TRUE) return TRUE; return FALSE; } diff --git a/src/fldeff_cut.c b/src/fldeff_cut.c index 2c9151598..efd533d08 100644 --- a/src/fldeff_cut.c +++ b/src/fldeff_cut.c @@ -355,36 +355,36 @@ static void SetCutGrassMetatile(s16 x, s16 y) switch (metatileId) { - case METATILE_ID(Fortree, LongGrass_Root): - case METATILE_ID(General, LongGrass): - case METATILE_ID(General, TallGrass): - MapGridSetMetatileIdAt(x, y, METATILE_ID(General, Grass)); + case METATILE_Fortree_LongGrass_Root: + case METATILE_General_LongGrass: + case METATILE_General_TallGrass: + MapGridSetMetatileIdAt(x, y, METATILE_General_Grass); break; - case METATILE_ID(General, TallGrass_TreeLeft): - MapGridSetMetatileIdAt(x, y, METATILE_ID(General, Grass_TreeLeft)); + case METATILE_General_TallGrass_TreeLeft: + MapGridSetMetatileIdAt(x, y, METATILE_General_Grass_TreeLeft); break; - case METATILE_ID(General, TallGrass_TreeRight): - MapGridSetMetatileIdAt(x, y, METATILE_ID(General, Grass_TreeRight)); + case METATILE_General_TallGrass_TreeRight: + MapGridSetMetatileIdAt(x, y, METATILE_General_Grass_TreeRight); break; - case METATILE_ID(Fortree, SecretBase_LongGrass_BottomLeft): - MapGridSetMetatileIdAt(x, y, METATILE_ID(Fortree, SecretBase_LongGrass_TopLeft)); + case METATILE_Fortree_SecretBase_LongGrass_BottomLeft: + MapGridSetMetatileIdAt(x, y, METATILE_Fortree_SecretBase_LongGrass_TopLeft); break; - case METATILE_ID(Fortree, SecretBase_LongGrass_BottomMid): - MapGridSetMetatileIdAt(x, y, METATILE_ID(Fortree, SecretBase_LongGrass_TopMid)); + case METATILE_Fortree_SecretBase_LongGrass_BottomMid: + MapGridSetMetatileIdAt(x, y, METATILE_Fortree_SecretBase_LongGrass_TopMid); break; - case METATILE_ID(Fortree, SecretBase_LongGrass_BottomRight): - MapGridSetMetatileIdAt(x, y, METATILE_ID(Fortree, SecretBase_LongGrass_TopRight)); + case METATILE_Fortree_SecretBase_LongGrass_BottomRight: + MapGridSetMetatileIdAt(x, y, METATILE_Fortree_SecretBase_LongGrass_TopRight); break; - case METATILE_ID(Lavaridge, NormalGrass): - case METATILE_ID(Lavaridge, AshGrass): - MapGridSetMetatileIdAt(x, y, METATILE_ID(Lavaridge, LavaField)); + case METATILE_Lavaridge_NormalGrass: + case METATILE_Lavaridge_AshGrass: + MapGridSetMetatileIdAt(x, y, METATILE_Lavaridge_LavaField); break; - case METATILE_ID(Fallarbor, NormalGrass): - case METATILE_ID(Fallarbor, AshGrass): - MapGridSetMetatileIdAt(x, y, METATILE_ID(Fallarbor, AshField)); + case METATILE_Fallarbor_NormalGrass: + case METATILE_Fallarbor_AshGrass: + MapGridSetMetatileIdAt(x, y, METATILE_Fallarbor_AshField); break; - case METATILE_ID(General, TallGrass_TreeUp): - MapGridSetMetatileIdAt(x, y, METATILE_ID(General, Grass_TreeUp)); + case METATILE_General_TallGrass_TreeUp: + MapGridSetMetatileIdAt(x, y, METATILE_General_Grass_TreeUp); break; } } @@ -402,13 +402,13 @@ static u8 GetLongGrassCaseAt(s16 x, s16 y) { u16 metatileId = MapGridGetMetatileIdAt(x, y); - if (metatileId == METATILE_ID(General, Grass)) + if (metatileId == METATILE_General_Grass) return LONG_GRASS_FIELD; - else if (metatileId == METATILE_ID(Fortree, SecretBase_LongGrass_TopLeft)) + else if (metatileId == METATILE_Fortree_SecretBase_LongGrass_TopLeft) return LONG_GRASS_BASE_LEFT; - else if (metatileId == METATILE_ID(Fortree, SecretBase_LongGrass_TopMid)) + else if (metatileId == METATILE_Fortree_SecretBase_LongGrass_TopMid) return LONG_GRASS_BASE_CENTER; - else if (metatileId == METATILE_ID(Fortree, SecretBase_LongGrass_TopRight)) + else if (metatileId == METATILE_Fortree_SecretBase_LongGrass_TopRight) return LONG_GRASS_BASE_RIGHT; else return LONG_GRASS_NONE; @@ -422,34 +422,34 @@ static void SetCutGrassMetatiles(s16 x, s16 y) for (i = 0; i < sCutSquareSide; i++) { s16 currentX = x + i; - if (MapGridGetMetatileIdAt(currentX, y) == METATILE_ID(General, LongGrass)) + if (MapGridGetMetatileIdAt(currentX, y) == METATILE_General_LongGrass) { switch (GetLongGrassCaseAt(currentX, y + 1)) { case LONG_GRASS_FIELD: - MapGridSetMetatileIdAt(currentX, y + 1, METATILE_ID(Fortree, LongGrass_Root)); + MapGridSetMetatileIdAt(currentX, y + 1, METATILE_Fortree_LongGrass_Root); break; case LONG_GRASS_BASE_LEFT: - MapGridSetMetatileIdAt(currentX, y + 1, METATILE_ID(Fortree, SecretBase_LongGrass_BottomLeft)); + MapGridSetMetatileIdAt(currentX, y + 1, METATILE_Fortree_SecretBase_LongGrass_BottomLeft); break; case LONG_GRASS_BASE_CENTER: - MapGridSetMetatileIdAt(currentX, y + 1, METATILE_ID(Fortree, SecretBase_LongGrass_BottomMid)); + MapGridSetMetatileIdAt(currentX, y + 1, METATILE_Fortree_SecretBase_LongGrass_BottomMid); break; case LONG_GRASS_BASE_RIGHT: - MapGridSetMetatileIdAt(currentX, y + 1, METATILE_ID(Fortree, SecretBase_LongGrass_BottomRight)); + MapGridSetMetatileIdAt(currentX, y + 1, METATILE_Fortree_SecretBase_LongGrass_BottomRight); break; } } - if (MapGridGetMetatileIdAt(currentX, lowerY) == METATILE_ID(General, Grass)) + if (MapGridGetMetatileIdAt(currentX, lowerY) == METATILE_General_Grass) { - if (MapGridGetMetatileIdAt(currentX, lowerY + 1) == METATILE_ID(Fortree, LongGrass_Root)) - MapGridSetMetatileIdAt(currentX, lowerY + 1, METATILE_ID(General, Grass)); - if (MapGridGetMetatileIdAt(currentX, lowerY + 1) == METATILE_ID(Fortree, SecretBase_LongGrass_BottomLeft)) - MapGridSetMetatileIdAt(currentX, lowerY + 1, METATILE_ID(Fortree, SecretBase_LongGrass_TopLeft)); - if (MapGridGetMetatileIdAt(currentX, lowerY + 1) == METATILE_ID(Fortree, SecretBase_LongGrass_BottomMid)) - MapGridSetMetatileIdAt(currentX, lowerY + 1, METATILE_ID(Fortree, SecretBase_LongGrass_TopMid)); - if (MapGridGetMetatileIdAt(currentX, lowerY + 1) == METATILE_ID(Fortree, SecretBase_LongGrass_BottomRight)) - MapGridSetMetatileIdAt(currentX, lowerY + 1, METATILE_ID(Fortree, SecretBase_LongGrass_TopRight)); + if (MapGridGetMetatileIdAt(currentX, lowerY + 1) == METATILE_Fortree_LongGrass_Root) + MapGridSetMetatileIdAt(currentX, lowerY + 1, METATILE_General_Grass); + if (MapGridGetMetatileIdAt(currentX, lowerY + 1) == METATILE_Fortree_SecretBase_LongGrass_BottomLeft) + MapGridSetMetatileIdAt(currentX, lowerY + 1, METATILE_Fortree_SecretBase_LongGrass_TopLeft); + if (MapGridGetMetatileIdAt(currentX, lowerY + 1) == METATILE_Fortree_SecretBase_LongGrass_BottomMid) + MapGridSetMetatileIdAt(currentX, lowerY + 1, METATILE_Fortree_SecretBase_LongGrass_TopMid); + if (MapGridGetMetatileIdAt(currentX, lowerY + 1) == METATILE_Fortree_SecretBase_LongGrass_BottomRight) + MapGridSetMetatileIdAt(currentX, lowerY + 1, METATILE_Fortree_SecretBase_LongGrass_TopRight); } } @@ -486,62 +486,62 @@ static void HandleLongGrassOnHyper(u8 caseId, s16 x, s16 y) if (arr[0] == TRUE) { - if (MapGridGetMetatileIdAt(newX, y + 3) == METATILE_ID(Fortree, LongGrass_Root)) - MapGridSetMetatileIdAt(newX, y + 3, METATILE_ID(General, Grass)); - if (MapGridGetMetatileIdAt(newX, y + 3) == METATILE_ID(Fortree, SecretBase_LongGrass_BottomLeft)) - MapGridSetMetatileIdAt(newX, y + 3, METATILE_ID(Fortree, SecretBase_LongGrass_TopLeft)); - if (MapGridGetMetatileIdAt(newX, y + 3) == METATILE_ID(Fortree, SecretBase_LongGrass_BottomMid)) - MapGridSetMetatileIdAt(newX, y + 3, METATILE_ID(Fortree, SecretBase_LongGrass_TopMid)); - if (MapGridGetMetatileIdAt(newX, y + 3) == METATILE_ID(Fortree, SecretBase_LongGrass_BottomRight)) - MapGridSetMetatileIdAt(newX, y + 3, METATILE_ID(Fortree, SecretBase_LongGrass_TopRight)); + if (MapGridGetMetatileIdAt(newX, y + 3) == METATILE_Fortree_LongGrass_Root) + MapGridSetMetatileIdAt(newX, y + 3, METATILE_General_Grass); + if (MapGridGetMetatileIdAt(newX, y + 3) == METATILE_Fortree_SecretBase_LongGrass_BottomLeft) + MapGridSetMetatileIdAt(newX, y + 3, METATILE_Fortree_SecretBase_LongGrass_TopLeft); + if (MapGridGetMetatileIdAt(newX, y + 3) == METATILE_Fortree_SecretBase_LongGrass_BottomMid) + MapGridSetMetatileIdAt(newX, y + 3, METATILE_Fortree_SecretBase_LongGrass_TopMid); + if (MapGridGetMetatileIdAt(newX, y + 3) == METATILE_Fortree_SecretBase_LongGrass_BottomRight) + MapGridSetMetatileIdAt(newX, y + 3, METATILE_Fortree_SecretBase_LongGrass_TopRight); } if (arr[1] == TRUE) { - if (MapGridGetMetatileIdAt(newX, y + 2) == METATILE_ID(General, LongGrass)) + if (MapGridGetMetatileIdAt(newX, y + 2) == METATILE_General_LongGrass) { switch (GetLongGrassCaseAt(newX, y + 3)) { case LONG_GRASS_FIELD: - MapGridSetMetatileIdAt(newX, y + 3, METATILE_ID(Fortree, LongGrass_Root)); + MapGridSetMetatileIdAt(newX, y + 3, METATILE_Fortree_LongGrass_Root); break; case LONG_GRASS_BASE_LEFT: - MapGridSetMetatileIdAt(newX, y + 3, METATILE_ID(Fortree, SecretBase_LongGrass_BottomLeft)); + MapGridSetMetatileIdAt(newX, y + 3, METATILE_Fortree_SecretBase_LongGrass_BottomLeft); break; case LONG_GRASS_BASE_CENTER: - MapGridSetMetatileIdAt(newX, y + 3, METATILE_ID(Fortree, SecretBase_LongGrass_BottomMid)); + MapGridSetMetatileIdAt(newX, y + 3, METATILE_Fortree_SecretBase_LongGrass_BottomMid); break; case LONG_GRASS_BASE_RIGHT: - MapGridSetMetatileIdAt(newX, y + 3, METATILE_ID(Fortree, SecretBase_LongGrass_BottomRight)); + MapGridSetMetatileIdAt(newX, y + 3, METATILE_Fortree_SecretBase_LongGrass_BottomRight); break; } } - if (MapGridGetMetatileIdAt(newX, y + 4) == METATILE_ID(Fortree, LongGrass_Root)) - MapGridSetMetatileIdAt(newX, y + 4, METATILE_ID(General, Grass)); - if (MapGridGetMetatileIdAt(newX, y + 4) == METATILE_ID(Fortree, SecretBase_LongGrass_BottomLeft)) - MapGridSetMetatileIdAt(newX, y + 4, METATILE_ID(Fortree, SecretBase_LongGrass_TopLeft)); - if (MapGridGetMetatileIdAt(newX, y + 4) == METATILE_ID(Fortree, SecretBase_LongGrass_BottomMid)) - MapGridSetMetatileIdAt(newX, y + 4, METATILE_ID(Fortree, SecretBase_LongGrass_TopMid)); - if (MapGridGetMetatileIdAt(newX, y + 4) == METATILE_ID(Fortree, SecretBase_LongGrass_BottomRight)) - MapGridSetMetatileIdAt(newX, y + 4, METATILE_ID(Fortree, SecretBase_LongGrass_TopRight)); + if (MapGridGetMetatileIdAt(newX, y + 4) == METATILE_Fortree_LongGrass_Root) + MapGridSetMetatileIdAt(newX, y + 4, METATILE_General_Grass); + if (MapGridGetMetatileIdAt(newX, y + 4) == METATILE_Fortree_SecretBase_LongGrass_BottomLeft) + MapGridSetMetatileIdAt(newX, y + 4, METATILE_Fortree_SecretBase_LongGrass_TopLeft); + if (MapGridGetMetatileIdAt(newX, y + 4) == METATILE_Fortree_SecretBase_LongGrass_BottomMid) + MapGridSetMetatileIdAt(newX, y + 4, METATILE_Fortree_SecretBase_LongGrass_TopMid); + if (MapGridGetMetatileIdAt(newX, y + 4) == METATILE_Fortree_SecretBase_LongGrass_BottomRight) + MapGridSetMetatileIdAt(newX, y + 4, METATILE_Fortree_SecretBase_LongGrass_TopRight); } if (arr[2] == TRUE) { - if (MapGridGetMetatileIdAt(newX, y + 3) == METATILE_ID(General, LongGrass)) + if (MapGridGetMetatileIdAt(newX, y + 3) == METATILE_General_LongGrass) { switch (GetLongGrassCaseAt(newX, y + 4)) { case LONG_GRASS_FIELD: - MapGridSetMetatileIdAt(newX, y + 4, METATILE_ID(Fortree, LongGrass_Root)); + MapGridSetMetatileIdAt(newX, y + 4, METATILE_Fortree_LongGrass_Root); break; case LONG_GRASS_BASE_LEFT: - MapGridSetMetatileIdAt(newX, y + 4, METATILE_ID(Fortree, SecretBase_LongGrass_BottomLeft)); + MapGridSetMetatileIdAt(newX, y + 4, METATILE_Fortree_SecretBase_LongGrass_BottomLeft); break; case LONG_GRASS_BASE_CENTER: - MapGridSetMetatileIdAt(newX, y + 4, METATILE_ID(Fortree, SecretBase_LongGrass_BottomMid)); + MapGridSetMetatileIdAt(newX, y + 4, METATILE_Fortree_SecretBase_LongGrass_BottomMid); break; case LONG_GRASS_BASE_RIGHT: - MapGridSetMetatileIdAt(newX, y + 4, METATILE_ID(Fortree, SecretBase_LongGrass_BottomRight)); + MapGridSetMetatileIdAt(newX, y + 4, METATILE_Fortree_SecretBase_LongGrass_BottomRight); break; } } @@ -595,16 +595,16 @@ void FixLongGrassMetatilesWindowTop(s16 x, s16 y) switch (GetLongGrassCaseAt(x, y + 1)) { case LONG_GRASS_FIELD: - MapGridSetMetatileIdAt(x, y + 1, METATILE_ID(Fortree, LongGrass_Root)); + MapGridSetMetatileIdAt(x, y + 1, METATILE_Fortree_LongGrass_Root); break; case LONG_GRASS_BASE_LEFT: - MapGridSetMetatileIdAt(x, y + 1, METATILE_ID(Fortree, SecretBase_LongGrass_BottomLeft)); + MapGridSetMetatileIdAt(x, y + 1, METATILE_Fortree_SecretBase_LongGrass_BottomLeft); break; case LONG_GRASS_BASE_CENTER: - MapGridSetMetatileIdAt(x, y + 1, METATILE_ID(Fortree, SecretBase_LongGrass_BottomMid)); + MapGridSetMetatileIdAt(x, y + 1, METATILE_Fortree_SecretBase_LongGrass_BottomMid); break; case LONG_GRASS_BASE_RIGHT: - MapGridSetMetatileIdAt(x, y + 1, METATILE_ID(Fortree, SecretBase_LongGrass_BottomRight)); + MapGridSetMetatileIdAt(x, y + 1, METATILE_Fortree_SecretBase_LongGrass_BottomRight); break; } } @@ -612,7 +612,7 @@ void FixLongGrassMetatilesWindowTop(s16 x, s16 y) void FixLongGrassMetatilesWindowBottom(s16 x, s16 y) { - if (MapGridGetMetatileIdAt(x, y) == METATILE_ID(General, Grass)) + if (MapGridGetMetatileIdAt(x, y) == METATILE_General_Grass) { u8 metatileBehavior = MapGridGetMetatileBehaviorAt(x, y + 1); if (MetatileBehavior_IsLongGrassSouthEdge(metatileBehavior)) @@ -620,17 +620,17 @@ void FixLongGrassMetatilesWindowBottom(s16 x, s16 y) s32 metatileId = MapGridGetMetatileIdAt(x, y + 1); switch (metatileId) { - case METATILE_ID(Fortree, LongGrass_Root): - MapGridSetMetatileIdAt(x, y + 1, METATILE_ID(General, Grass)); + case METATILE_Fortree_LongGrass_Root: + MapGridSetMetatileIdAt(x, y + 1, METATILE_General_Grass); break; - case METATILE_ID(Fortree, SecretBase_LongGrass_BottomLeft): - MapGridSetMetatileIdAt(x, y + 1, METATILE_ID(Fortree, SecretBase_LongGrass_TopLeft)); + case METATILE_Fortree_SecretBase_LongGrass_BottomLeft: + MapGridSetMetatileIdAt(x, y + 1, METATILE_Fortree_SecretBase_LongGrass_TopLeft); break; - case METATILE_ID(Fortree, SecretBase_LongGrass_BottomMid): - MapGridSetMetatileIdAt(x, y + 1, METATILE_ID(Fortree, SecretBase_LongGrass_TopMid)); + case METATILE_Fortree_SecretBase_LongGrass_BottomMid: + MapGridSetMetatileIdAt(x, y + 1, METATILE_Fortree_SecretBase_LongGrass_TopMid); break; - case METATILE_ID(Fortree, SecretBase_LongGrass_BottomRight): - MapGridSetMetatileIdAt(x, y + 1, METATILE_ID(Fortree, SecretBase_LongGrass_TopRight)); + case METATILE_Fortree_SecretBase_LongGrass_BottomRight: + MapGridSetMetatileIdAt(x, y + 1, METATILE_Fortree_SecretBase_LongGrass_TopRight); break; } } diff --git a/src/fldeff_misc.c b/src/fldeff_misc.c index bb5bd65d7..50feaf368 100644 --- a/src/fldeff_misc.c +++ b/src/fldeff_misc.c @@ -28,68 +28,54 @@ EWRAM_DATA struct MapPosition gPlayerFacingPosition = {0}; -static void sub_80F9C90(u8); -static void sub_80F9DFC(u8); +static void Task_ComputerScreenOpenEffect(u8); +static void Task_ComputerScreenCloseEffect(u8); +static void CreateComputerScreenEffectTask(TaskFunc, u16, u16, u8); static void Task_SecretBasePCTurnOn(u8); static void Task_PopSecretBaseBalloon(u8); static void DoBalloonSoundEffect(s16); -static void Task_WateringBerryTreeAnim_1(u8); -static void Task_WateringBerryTreeAnim_2(u8); -static void Task_WateringBerryTreeAnim_3(u8); - -static void sub_80F9C44(TaskFunc, u16, u16, u8); +static void Task_WateringBerryTreeAnim_Start(u8); +static void Task_WateringBerryTreeAnim_Continue(u8); +static void Task_WateringBerryTreeAnim_End(u8); static void FieldCallback_SecretBaseCave(void); -static void CaveEntranceSpriteCallback1(struct Sprite *); -static void CaveEntranceSpriteCallback2(struct Sprite *); -static void CaveEntranceSpriteCallbackEnd(struct Sprite *); +static void SpriteCB_CaveEntranceInit(struct Sprite *); +static void SpriteCB_CaveEntranceOpen(struct Sprite *); +static void SpriteCB_CaveEntranceEnd(struct Sprite *); static void StartSecretBaseCaveFieldEffect(void); static void FieldCallback_SecretBaseTree(void); -static void TreeEntranceSpriteCallback1(struct Sprite *); -static void TreeEntranceSpriteCallback2(struct Sprite *); -static void TreeEntranceSpriteCallbackEnd(struct Sprite *); +static void SpriteCB_TreeEntranceInit(struct Sprite *); +static void SpriteCB_TreeEntranceOpen(struct Sprite *); +static void SpriteCB_TreeEntranceEnd(struct Sprite *); static void StartSecretBaseTreeFieldEffect(void); static void FieldCallback_SecretBaseShrub(void); -static void ShrubEntranceSpriteCallback1(struct Sprite *); -static void ShrubEntranceSpriteCallback2(struct Sprite *); -static void ShrubEntranceSpriteCallbackEnd(struct Sprite *); +static void SpriteCB_ShrubEntranceInit(struct Sprite *); +static void SpriteCB_ShrubEntranceOpen(struct Sprite *); +static void SpriteCB_ShrubEntranceEnd(struct Sprite *); static void StartSecretBaseShrubFieldEffect(void); -static void SpriteCB_SandPillar_0(struct Sprite *); -static void SpriteCB_SandPillar_1(struct Sprite *); -static void SpriteCB_SandPillar_2(struct Sprite *); +static void SpriteCB_SandPillar_BreakTop(struct Sprite *); +static void SpriteCB_SandPillar_BreakBase(struct Sprite *); +static void SpriteCB_SandPillar_End(struct Sprite *); -static const u8 gSpriteImage_858D978[] = INCBIN_U8("graphics/unknown/858E588/0.4bpp"); -static const u8 gSpriteImage_858D9F8[] = INCBIN_U8("graphics/unknown/858E588/1.4bpp"); -static const u8 gSpriteImage_858DA78[] = INCBIN_U8("graphics/unknown/858E588/2.4bpp"); -static const u8 gSpriteImage_858DAF8[] = INCBIN_U8("graphics/unknown/858E588/3.4bpp"); -static const u8 gSpriteImage_858DB78[] = INCBIN_U8("graphics/unknown/858E588/4.4bpp"); +static const u8 sSecretPowerCave_Gfx[] = INCBIN_U8("graphics/field_effects/pics/secret_power_cave.4bpp"); +static const u8 sFiller[32] = {0}; +static const u16 sSecretPowerCave_Pal[] = INCBIN_U16("graphics/field_effects/palettes/07.gbapal"); +static const u8 sSecretPowerShrub_Gfx[] = INCBIN_U8("graphics/field_effects/pics/secret_power_shrub.4bpp"); +static const u8 sSecretPowerTree_Gfx[] = INCBIN_U8("graphics/field_effects/pics/secret_power_tree.4bpp"); +static const u16 sSecretPowerPlant_Pal[] = INCBIN_U16("graphics/field_effects/palettes/08.gbapal"); -static const u8 gUnusedEmptySpace_858DBF8[32] = {0}; +// TODO: These should also be combined into a single image +static const u8 sSandPillar0_Gfx[] = INCBIN_U8("graphics/field_effects/pics/sand_pillar/0.4bpp"); +static const u8 sSandPillar1_Gfx[] = INCBIN_U8("graphics/field_effects/pics/sand_pillar/1.4bpp"); +static const u8 sSandPillar2_Gfx[] = INCBIN_U8("graphics/field_effects/pics/sand_pillar/2.4bpp"); -static const u16 gFieldEffectObjectPalette7[] = INCBIN_U16("graphics/field_effects/palettes/07.gbapal"); -static const u8 gSpriteImage_858DC38[] = INCBIN_U8("graphics/unknown/858E5D8/0.4bpp"); -static const u8 gSpriteImage_858DCB8[] = INCBIN_U8("graphics/unknown/858E5D8/1.4bpp"); -static const u8 gSpriteImage_858DD38[] = INCBIN_U8("graphics/unknown/858E5D8/2.4bpp"); -static const u8 gSpriteImage_858DDB8[] = INCBIN_U8("graphics/unknown/858E5D8/3.4bpp"); -static const u8 gSpriteImage_858DE38[] = INCBIN_U8("graphics/unknown/858E5D8/4.4bpp"); -static const u8 gSpriteImage_858DEB8[] = INCBIN_U8("graphics/unknown/858E5B0/0.4bpp"); -static const u8 gSpriteImage_858DF38[] = INCBIN_U8("graphics/unknown/858E5B0/1.4bpp"); -static const u8 gSpriteImage_858DFB8[] = INCBIN_U8("graphics/unknown/858E5B0/2.4bpp"); -static const u8 gSpriteImage_858E038[] = INCBIN_U8("graphics/unknown/858E5B0/3.4bpp"); -static const u8 gSpriteImage_858E0B8[] = INCBIN_U8("graphics/unknown/858E5B0/4.4bpp"); -static const u8 gSpriteImage_858E138[] = INCBIN_U8("graphics/unknown/858E5B0/5.4bpp"); -static const u16 gFieldEffectObjectPalette8[] = INCBIN_U16("graphics/field_effects/palettes/08.gbapal"); -static const u8 gSpriteImage_858E1D8[] = INCBIN_U8("graphics/unknown/858E674/0.4bpp"); -static const u8 gSpriteImage_858E2D8[] = INCBIN_U8("graphics/unknown/858E674/1.4bpp"); -static const u8 gSpriteImage_858E3D8[] = INCBIN_U8("graphics/unknown/858E674/2.4bpp"); - -static const struct OamData gOamData_858E4D8 = +static const struct OamData sOam_SecretPower = { .y = 0, .x = 0, @@ -101,7 +87,7 @@ static const struct OamData gOamData_858E4D8 = .priority = 2, }; -static const union AnimCmd gSpriteAnim_858E4E0[] = +static const union AnimCmd sAnim_SecretPowerCave[] = { ANIMCMD_FRAME(0, 8), ANIMCMD_FRAME(1, 8), @@ -111,7 +97,7 @@ static const union AnimCmd gSpriteAnim_858E4E0[] = ANIMCMD_END, }; -static const union AnimCmd gSpriteAnim_858E4F8[] = +static const union AnimCmd sAnim_VineDropLeft[] = { ANIMCMD_FRAME(0, 8), ANIMCMD_FRAME(1, 8), @@ -121,7 +107,7 @@ static const union AnimCmd gSpriteAnim_858E4F8[] = ANIMCMD_END, }; -static const union AnimCmd gSpriteAnim_858E510[] = +static const union AnimCmd sAnim_VineRiseLeft[] = { ANIMCMD_FRAME(4, 8), ANIMCMD_FRAME(3, 8), @@ -131,7 +117,7 @@ static const union AnimCmd gSpriteAnim_858E510[] = ANIMCMD_END, }; -static const union AnimCmd gSpriteAnim_858E528[] = +static const union AnimCmd sAnim_VineDropRight[] = { ANIMCMD_FRAME(0, 8, .hFlip = TRUE), ANIMCMD_FRAME(1, 8, .hFlip = TRUE), @@ -141,7 +127,7 @@ static const union AnimCmd gSpriteAnim_858E528[] = ANIMCMD_END, }; -static const union AnimCmd gSpriteAnim_858E540[] = +static const union AnimCmd sAnim_VineRiseRight[] = { ANIMCMD_FRAME(4, 8, .hFlip = TRUE), ANIMCMD_FRAME(3, 8, .hFlip = TRUE), @@ -151,7 +137,7 @@ static const union AnimCmd gSpriteAnim_858E540[] = ANIMCMD_END, }; -static const union AnimCmd gSpriteAnim_858E558[] = +static const union AnimCmd sAnim_SecretPowerShrub[] = { ANIMCMD_FRAME(0, 8), ANIMCMD_FRAME(1, 8), @@ -161,88 +147,89 @@ static const union AnimCmd gSpriteAnim_858E558[] = ANIMCMD_END, }; -static const union AnimCmd *const gSpriteAnimTable_858E570[] = +static const union AnimCmd *const sAnimTable_SecretPowerCave[] = { - gSpriteAnim_858E4E0, + sAnim_SecretPowerCave, }; -static const union AnimCmd *const gSpriteAnimTable_858E574[] = +static const union AnimCmd *const sAnimTable_SecretPowerTree[] = { - gSpriteAnim_858E4F8, - gSpriteAnim_858E510, - gSpriteAnim_858E528, - gSpriteAnim_858E540, + sAnim_VineDropLeft, + sAnim_VineRiseLeft, + sAnim_VineDropRight, + sAnim_VineRiseRight, }; -static const union AnimCmd *const gSpriteAnimTable_858E584[] = +static const union AnimCmd *const sAnimTable_SecretPowerShrub[] = { - gSpriteAnim_858E558, + sAnim_SecretPowerShrub, }; -static const struct SpriteFrameImage gUnknown_858E588[] = +static const struct SpriteFrameImage sPicTable_SecretPowerCave[] = { - {gSpriteImage_858D978, 0x80}, - {gSpriteImage_858D9F8, 0x80}, - {gSpriteImage_858DA78, 0x80}, - {gSpriteImage_858DAF8, 0x80}, - {gSpriteImage_858DB78, 0x80}, + overworld_frame(sSecretPowerCave_Gfx, 2, 2, 0), + overworld_frame(sSecretPowerCave_Gfx, 2, 2, 1), + overworld_frame(sSecretPowerCave_Gfx, 2, 2, 2), + overworld_frame(sSecretPowerCave_Gfx, 2, 2, 3), + overworld_frame(sSecretPowerCave_Gfx, 2, 2, 4), }; -static const struct SpriteFrameImage gUnknown_858E5B0[] = +static const struct SpriteFrameImage sPicTable_SecretPowerTree[] = { - {gSpriteImage_858DEB8, 0x80}, - {gSpriteImage_858DF38, 0x80}, - {gSpriteImage_858DFB8, 0x80}, - {gSpriteImage_858E038, 0x80}, - {gSpriteImage_858E0B8, 0x80}, + overworld_frame(sSecretPowerTree_Gfx, 2, 2, 0), + overworld_frame(sSecretPowerTree_Gfx, 2, 2, 1), + overworld_frame(sSecretPowerTree_Gfx, 2, 2, 2), + overworld_frame(sSecretPowerTree_Gfx, 2, 2, 3), + overworld_frame(sSecretPowerTree_Gfx, 2, 2, 4), + // 6th frame exists but isnt accessed, the tree vine metatile is used instead }; -static const struct SpriteFrameImage gUnknown_858E5D8[] = +static const struct SpriteFrameImage sPicTable_SecretPowerShrub[] = { - {gSpriteImage_858DC38, 0x80}, - {gSpriteImage_858DCB8, 0x80}, - {gSpriteImage_858DD38, 0x80}, - {gSpriteImage_858DDB8, 0x80}, - {gSpriteImage_858DE38, 0x80}, + overworld_frame(sSecretPowerShrub_Gfx, 2, 2, 0), + overworld_frame(sSecretPowerShrub_Gfx, 2, 2, 1), + overworld_frame(sSecretPowerShrub_Gfx, 2, 2, 2), + overworld_frame(sSecretPowerShrub_Gfx, 2, 2, 3), + overworld_frame(sSecretPowerShrub_Gfx, 2, 2, 4), }; -static const struct SpriteTemplate gUnknown_0858E600 = +static const struct SpriteTemplate sSpriteTemplate_SecretPowerCave = { .tileTag = 0xFFFF, .paletteTag = FLDEFF_PAL_TAG_3, - .oam = &gOamData_858E4D8, - .anims = gSpriteAnimTable_858E570, - .images = gUnknown_858E588, + .oam = &sOam_SecretPower, + .anims = sAnimTable_SecretPowerCave, + .images = sPicTable_SecretPowerCave, .affineAnims = gDummySpriteAffineAnimTable, - .callback = CaveEntranceSpriteCallback1, + .callback = SpriteCB_CaveEntranceInit, }; -static const struct SpriteTemplate gUnknown_0858E618 = +static const struct SpriteTemplate sSpriteTemplate_SecretPowerTree = { .tileTag = 0xFFFF, .paletteTag = FLDEFF_PAL_TAG_8, - .oam = &gOamData_858E4D8, - .anims = gSpriteAnimTable_858E574, - .images = gUnknown_858E5B0, + .oam = &sOam_SecretPower, + .anims = sAnimTable_SecretPowerTree, + .images = sPicTable_SecretPowerTree, .affineAnims = gDummySpriteAffineAnimTable, - .callback = TreeEntranceSpriteCallback1, + .callback = SpriteCB_TreeEntranceInit, }; -static const struct SpriteTemplate gUnknown_0858E630 = +static const struct SpriteTemplate sSpriteTemplate_SecretPowerShrub = { .tileTag = 0xFFFF, .paletteTag = FLDEFF_PAL_TAG_8, - .oam = &gOamData_858E4D8, - .anims = gSpriteAnimTable_858E584, - .images = gUnknown_858E5D8, + .oam = &sOam_SecretPower, + .anims = sAnimTable_SecretPowerShrub, + .images = sPicTable_SecretPowerShrub, .affineAnims = gDummySpriteAffineAnimTable, - .callback = ShrubEntranceSpriteCallback1, + .callback = SpriteCB_ShrubEntranceInit, }; -const struct SpritePalette gFieldEffectObjectPaletteInfo7 = {gFieldEffectObjectPalette7, FLDEFF_PAL_TAG_3}; -const struct SpritePalette gFieldEffectObjectPaletteInfo8 = {gFieldEffectObjectPalette8, FLDEFF_PAL_TAG_8}; +const struct SpritePalette gSpritePalette_SecretPower_Cave = {sSecretPowerCave_Pal, FLDEFF_PAL_TAG_3}; +const struct SpritePalette gSpritePalette_SecretPower_Plant = {sSecretPowerPlant_Pal, FLDEFF_PAL_TAG_8}; -static const struct OamData gOamData_858E658 = +static const struct OamData sOam_SandPillar = { .x = 0, .y = 0, @@ -254,7 +241,7 @@ static const struct OamData gOamData_858E658 = .priority = 2, }; -static const union AnimCmd gSpriteAnim_858E660[] = +static const union AnimCmd sAnim_SandPillar[] = { ANIMCMD_FRAME(0, 6), ANIMCMD_FRAME(1, 6), @@ -262,47 +249,45 @@ static const union AnimCmd gSpriteAnim_858E660[] = ANIMCMD_END, }; -static const union AnimCmd *const gSpriteAnimTable_858E670[] = +static const union AnimCmd *const sAnimTable_SandPillar[] = { - gSpriteAnim_858E660, + sAnim_SandPillar, }; -static const struct SpriteFrameImage gUnknown_0858E674[] = +static const struct SpriteFrameImage sPicTable_SandPillar[] = { - {gSpriteImage_858E1D8, 0x100}, - {gSpriteImage_858E2D8, 0x100}, - {gSpriteImage_858E3D8, 0x100}, + {sSandPillar0_Gfx, 0x100}, + {sSandPillar1_Gfx, 0x100}, + {sSandPillar2_Gfx, 0x100}, }; -static const struct SpriteTemplate gUnknown_0858E68C = +static const struct SpriteTemplate sSpriteTemplate_SandPillar = { .tileTag = 0xFFFF, .paletteTag = FLDEFF_PAL_TAG_14, - .oam = &gOamData_858E658, - .anims = gSpriteAnimTable_858E670, - .images = gUnknown_0858E674, + .oam = &sOam_SandPillar, + .anims = sAnimTable_SandPillar, + .images = sPicTable_SandPillar, .affineAnims = gDummySpriteAffineAnimTable, - .callback = SpriteCB_SandPillar_0, + .callback = SpriteCB_SandPillar_BreakTop, }; // This uses one of the secret base palettes, so there is no "graphics/field_effects/palettes/09.pal" file. -const struct SpritePalette gFieldEffectObjectPaletteInfo9 = {gTilesetPalettes_SecretBase[5], FLDEFF_PAL_TAG_14}; +const struct SpritePalette gSpritePalette_SandPillar = {gTilesetPalettes_SecretBase[5], FLDEFF_PAL_TAG_14}; -static const u8 gSpriteImage_858E6AC[] = INCBIN_U8("graphics/unknown/858E84C/0.4bpp"); -static const u8 gSpriteImage_858E72C[] = INCBIN_U8("graphics/unknown/858E84C/1.4bpp"); -static const u8 gSpriteImage_858E7AC[] = INCBIN_U8("graphics/unknown/858E84C/2.4bpp"); -static const u16 gUnknown_0858E82C[] = INCBIN_U16("graphics/unknown/unknown_58E82C.gbapal"); +static const u8 sRecordMixLights_Gfx[] = INCBIN_U8("graphics/field_effects/pics/record_mix_lights.4bpp"); +static const u16 sRecordMixLights_Pal[] = INCBIN_U16("graphics/field_effects/palettes/record_mix_lights.gbapal"); -static const struct SpriteFrameImage gUnknown_0858E84C[] = +static const struct SpriteFrameImage sPicTable_RecordMixLights[] = { - {gSpriteImage_858E6AC, sizeof(gSpriteImage_858E6AC)}, - {gSpriteImage_858E72C, sizeof(gSpriteImage_858E72C)}, - {gSpriteImage_858E7AC, sizeof(gSpriteImage_858E7AC)}, + overworld_frame(sRecordMixLights_Gfx, 4, 1, 0), + overworld_frame(sRecordMixLights_Gfx, 4, 1, 1), + overworld_frame(sRecordMixLights_Gfx, 4, 1, 2), }; -static const struct SpritePalette gUnknown_0858E864 = {gUnknown_0858E82C, FLDEFF_PAL_TAG_0}; +static const struct SpritePalette sSpritePalette_RecordMixLights = {sRecordMixLights_Pal, FLDEFF_PAL_TAG_0}; -static const union AnimCmd gSpriteAnim_858E86C[] = +static const union AnimCmd sAnim_RecordMixLights[] = { ANIMCMD_FRAME(0, 30), ANIMCMD_FRAME(1, 30), @@ -310,173 +295,182 @@ static const union AnimCmd gSpriteAnim_858E86C[] = ANIMCMD_JUMP(0), }; -static const union AnimCmd *const gSpriteAnimTable_858E87C[] = +static const union AnimCmd *const sAnimTable_RecordMixLights[] = { - gSpriteAnim_858E86C, + sAnim_RecordMixLights, }; -static const struct SpriteTemplate gUnknown_0858E880 = +static const struct SpriteTemplate sSpriteTemplate_RecordMixLights = { .tileTag = 0xFFFF, .paletteTag = FLDEFF_PAL_TAG_0, .oam = &gObjectEventBaseOam_32x8, - .anims = gSpriteAnimTable_858E87C, - .images = gUnknown_0858E84C, + .anims = sAnimTable_RecordMixLights, + .images = sPicTable_RecordMixLights, .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCallbackDummy, }; -void sub_80F9BCC(u16 a0, u16 a1, u8 a2) +// For accessing pokemon storage PC or the Hall of Fame PC +void ComputerScreenOpenEffect(u16 increment, u16 unused, u8 priority) { - sub_80F9C44(sub_80F9C90, a0, a1, a2); + CreateComputerScreenEffectTask(Task_ComputerScreenOpenEffect, increment, unused, priority); } -void sub_80F9BF4(u16 a0, u16 a1, u8 a2) +void ComputerScreenCloseEffect(u16 increment, u16 unused, u8 priority) { - sub_80F9C44(sub_80F9DFC, a0, a1, a2); + CreateComputerScreenEffectTask(Task_ComputerScreenCloseEffect, increment, unused, priority); } -bool8 sub_80F9C1C(void) +bool8 IsComputerScreenOpenEffectActive(void) { - return FuncIsActiveTask(sub_80F9C90); + return FuncIsActiveTask(Task_ComputerScreenOpenEffect); } -bool8 sub_80F9C30(void) +bool8 IsComputerScreenCloseEffectActive(void) { - return FuncIsActiveTask(sub_80F9DFC); + return FuncIsActiveTask(Task_ComputerScreenCloseEffect); } -static void sub_80F9C44(void (*taskfunc) (u8), u16 a1, u16 a2, u8 a3) -{ - u8 taskId = CreateTask(taskfunc, a3); +#define tState data[0] +#define tHorzIncrement data[1] +#define tVertIncrement data[2] +#define tWinLeft data[3] +#define tWinRight data[4] +#define tWinTop data[5] +#define tWinBottom data[6] +#define tBlendCnt data[7] +#define tBlendY data[8] - gTasks[taskId].data[0] = 0; - gTasks[taskId].data[1] = a1 == 0 ? 16 : a1; - gTasks[taskId].data[2] = a1 == 0 ? 20 : a1; +static void CreateComputerScreenEffectTask(void (*taskfunc) (u8), u16 increment, u16 unused, u8 priority) +{ + u8 taskId = CreateTask(taskfunc, priority); + + gTasks[taskId].tState = 0; + gTasks[taskId].tHorzIncrement = increment == 0 ? 16 : increment; + gTasks[taskId].tVertIncrement = increment == 0 ? 20 : increment; gTasks[taskId].func(taskId); } -static void sub_80F9C90(u8 taskId) +static void Task_ComputerScreenOpenEffect(u8 taskId) { struct Task *task = &gTasks[taskId]; - switch (task->data[0]) + switch (task->tState) { case 0: - task->data[3] = 0x78; - task->data[4] = 0x78; - task->data[5] = 0x50; - task->data[6] = 0x51; + task->tWinLeft = DISPLAY_WIDTH / 2; + task->tWinRight = DISPLAY_WIDTH / 2; + task->tWinTop = DISPLAY_HEIGHT / 2; + task->tWinBottom = DISPLAY_HEIGHT / 2 + 1; SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON); - SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(task->data[3], task->data[4])); - SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(task->data[5], task->data[6])); - SetGpuReg(REG_OFFSET_WININ, 0x3F); + SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(task->tWinLeft, task->tWinRight)); + SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(task->tWinTop, task->tWinBottom)); + SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR); SetGpuReg(REG_OFFSET_WINOUT, 0); break; case 1: - task->data[7] = GetGpuReg(REG_OFFSET_BLDCNT); - task->data[8] = GetGpuReg(REG_OFFSET_BLDY); + task->tBlendCnt = GetGpuReg(REG_OFFSET_BLDCNT); + task->tBlendY = GetGpuReg(REG_OFFSET_BLDY); SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_ALL | BLDCNT_EFFECT_LIGHTEN); - SetGpuReg(REG_OFFSET_BLDY, 0x10); + SetGpuReg(REG_OFFSET_BLDY, 16); break; case 2: - task->data[3] -= task->data[1]; - task->data[4] += task->data[1]; + task->tWinLeft -= task->tHorzIncrement; + task->tWinRight += task->tHorzIncrement; - if (task->data[3] < 1 || task->data[4] > 0xEF) + if (task->tWinLeft < 1 || task->tWinRight > DISPLAY_WIDTH - 1) { - task->data[3] = 0; - task->data[4] = 0xF0; + task->tWinLeft = 0; + task->tWinRight = DISPLAY_WIDTH; SetGpuReg(REG_OFFSET_BLDY, 0); - SetGpuReg(REG_OFFSET_BLDCNT, task->data[7]); + SetGpuReg(REG_OFFSET_BLDCNT, task->tBlendCnt); BlendPalettes(0xFFFFFFFF, 0, 0); gPlttBufferFaded[0] = 0; } - SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(task->data[3], task->data[4])); + SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(task->tWinLeft, task->tWinRight)); - if (task->data[3] != 0) + if (task->tWinLeft != 0) return; break; case 3: - task->data[5] -= task->data[2]; - task->data[6] += task->data[2]; + task->tWinTop -= task->tVertIncrement; + task->tWinBottom += task->tVertIncrement; - if (task->data[5] < 1 || task->data[6] > 0x9F) + if (task->tWinTop < 1 || task->tWinBottom > DISPLAY_HEIGHT - 1) { - task->data[5] = 0; - task->data[6] = 0xA0; + task->tWinTop = 0; + task->tWinBottom = DISPLAY_HEIGHT; ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON); } - SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(task->data[5], task->data[6])); + SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(task->tWinTop, task->tWinBottom)); - if (task->data[5] != 0) + if (task->tWinTop != 0) return; break; default: - SetGpuReg(REG_OFFSET_BLDCNT, task->data[7]); + SetGpuReg(REG_OFFSET_BLDCNT, task->tBlendCnt); DestroyTask(taskId); return; } - task->data[0]++; + task->tState++; } -static void sub_80F9DFC(u8 taskId) +static void Task_ComputerScreenCloseEffect(u8 taskId) { struct Task *task = &gTasks[taskId]; - int temp = task->data[0]; - - switch (temp) + switch (task->tState) { case 0: - gPlttBufferFaded[0] = temp; + gPlttBufferFaded[0] = 0; break; case 1: - task->data[3] = 0; - task->data[4] = 0xF0; - task->data[5] = 0; - task->data[6] = 0xA0; + task->tWinLeft = 0; + task->tWinRight = DISPLAY_WIDTH; + task->tWinTop = 0; + task->tWinBottom = DISPLAY_HEIGHT; SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON); - SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(task->data[3], task->data[4])); - SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(task->data[5], task->data[6])); - SetGpuReg(REG_OFFSET_WININ, 0x3F); + SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(task->tWinLeft, task->tWinRight)); + SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(task->tWinTop, task->tWinBottom)); + SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR); SetGpuReg(REG_OFFSET_WINOUT, 0); break; case 2: - task->data[5] += task->data[2]; - task->data[6] -= task->data[2]; + task->tWinTop += task->tVertIncrement; + task->tWinBottom -= task->tVertIncrement; - if (task->data[5] > 0x4F || task->data[6] < 0x52) + if (task->tWinTop >= DISPLAY_HEIGHT / 2 || task->tWinBottom <= DISPLAY_HEIGHT / 2 + 1) { - task->data[5] = 0x50; - task->data[6] = 0x51; + task->tWinTop = DISPLAY_HEIGHT / 2; + task->tWinBottom = DISPLAY_HEIGHT / 2 + 1; SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_ALL | BLDCNT_EFFECT_LIGHTEN); - SetGpuReg(REG_OFFSET_BLDY, 0x10); + SetGpuReg(REG_OFFSET_BLDY, 16); } - SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(task->data[5], task->data[6])); + SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(task->tWinTop, task->tWinBottom)); - if (task->data[5] != 0x50) + if (task->tWinTop != DISPLAY_HEIGHT / 2) return; break; case 3: - task->data[3] += task->data[1]; - task->data[4] -= task->data[1]; + task->tWinLeft += task->tHorzIncrement; + task->tWinRight -= task->tHorzIncrement; - if (task->data[3] > 0x77 || task->data[4] < 0x79) + if (task->tWinLeft >= DISPLAY_WIDTH / 2 || task->tWinRight <= DISPLAY_WIDTH / 2) { - task->data[3] = 0x78; - task->data[4] = 0x78; - BlendPalettes(-1, 0x10, 0); + task->tWinLeft = DISPLAY_WIDTH / 2; + task->tWinRight = DISPLAY_WIDTH / 2; + BlendPalettes(-1, 16, 0); gPlttBufferFaded[0] = 0; } - SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(task->data[3], task->data[4])); + SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(task->tWinLeft, task->tWinRight)); - if (task->data[3] != 0x78) + if (task->tWinLeft != DISPLAY_WIDTH / 2) return; break; default: @@ -486,9 +480,19 @@ static void sub_80F9DFC(u8 taskId) DestroyTask(taskId); return; } - task->data[0]++; + task->tState++; } +#undef tState +#undef tHorzIncrement +#undef tVertIncrement +#undef tWinLeft +#undef tWinRight +#undef tWinTop +#undef tWinBottom +#undef tBlendCnt +#undef tBlendY + static void SetCurrentSecretBase(void) { SetCurSecretBaseIdFromPosition(&gPlayerFacingPosition, gMapHeader.events); @@ -607,22 +611,22 @@ static void StartSecretBaseCaveFieldEffect(void) bool8 FldEff_SecretPowerCave(void) { AdjustSecretPowerSpritePixelOffsets(); - CreateSprite(&gUnknown_0858E600, + CreateSprite(&sSpriteTemplate_SecretPowerCave, gSprites[gPlayerAvatar.spriteId].oam.x + gFieldEffectArguments[5], gSprites[gPlayerAvatar.spriteId].oam.y + gFieldEffectArguments[6], 148); return FALSE; } -static void CaveEntranceSpriteCallback1(struct Sprite *sprite) +static void SpriteCB_CaveEntranceInit(struct Sprite *sprite) { PlaySE(SE_W088); sprite->data[0] = 0; - sprite->callback = CaveEntranceSpriteCallback2; + sprite->callback = SpriteCB_CaveEntranceOpen; } -static void CaveEntranceSpriteCallback2(struct Sprite *sprite) +static void SpriteCB_CaveEntranceOpen(struct Sprite *sprite) { if (sprite->data[0] < 40) { @@ -632,11 +636,11 @@ static void CaveEntranceSpriteCallback2(struct Sprite *sprite) else { sprite->data[0] = 0; - sprite->callback = CaveEntranceSpriteCallbackEnd; + sprite->callback = SpriteCB_CaveEntranceEnd; } } -static void CaveEntranceSpriteCallbackEnd(struct Sprite *sprite) +static void SpriteCB_CaveEntranceEnd(struct Sprite *sprite) { FieldEffectStop(sprite, FLDEFF_SECRET_POWER_CAVE); EnableBothScriptContexts(); @@ -676,7 +680,7 @@ bool8 FldEff_SecretPowerTree(void) AdjustSecretPowerSpritePixelOffsets(); - CreateSprite(&gUnknown_0858E618, + CreateSprite(&sSpriteTemplate_SecretPowerTree, gSprites[gPlayerAvatar.spriteId].oam.x + gFieldEffectArguments[5], gSprites[gPlayerAvatar.spriteId].oam.y + gFieldEffectArguments[6], 148); @@ -687,16 +691,16 @@ bool8 FldEff_SecretPowerTree(void) return FALSE; } -static void TreeEntranceSpriteCallback1(struct Sprite *sprite) +static void SpriteCB_TreeEntranceInit(struct Sprite *sprite) { PlaySE(SE_W010); sprite->animNum = gFieldEffectArguments[7]; sprite->data[0] = 0; - sprite->callback = TreeEntranceSpriteCallback2; + sprite->callback = SpriteCB_TreeEntranceOpen; } -static void TreeEntranceSpriteCallback2(struct Sprite *sprite) +static void SpriteCB_TreeEntranceOpen(struct Sprite *sprite) { sprite->data[0]++; @@ -706,11 +710,11 @@ static void TreeEntranceSpriteCallback2(struct Sprite *sprite) ToggleSecretBaseEntranceMetatile(); sprite->data[0] = 0; - sprite->callback = TreeEntranceSpriteCallbackEnd; + sprite->callback = SpriteCB_TreeEntranceEnd; } } -static void TreeEntranceSpriteCallbackEnd(struct Sprite *sprite) +static void SpriteCB_TreeEntranceEnd(struct Sprite *sprite) { FieldEffectStop(sprite, FLDEFF_SECRET_POWER_TREE); EnableBothScriptContexts(); @@ -742,7 +746,7 @@ bool8 FldEff_SecretPowerShrub(void) { AdjustSecretPowerSpritePixelOffsets(); - CreateSprite(&gUnknown_0858E630, + CreateSprite(&sSpriteTemplate_SecretPowerShrub, gSprites[gPlayerAvatar.spriteId].oam.x + gFieldEffectArguments[5], gSprites[gPlayerAvatar.spriteId].oam.y + gFieldEffectArguments[6], 148); @@ -750,15 +754,15 @@ bool8 FldEff_SecretPowerShrub(void) return FALSE; } -static void ShrubEntranceSpriteCallback1(struct Sprite *sprite) +static void SpriteCB_ShrubEntranceInit(struct Sprite *sprite) { PlaySE(SE_W077); sprite->data[0] = 0; - sprite->callback = ShrubEntranceSpriteCallback2; + sprite->callback = SpriteCB_ShrubEntranceOpen; } -static void ShrubEntranceSpriteCallback2(struct Sprite *sprite) +static void SpriteCB_ShrubEntranceOpen(struct Sprite *sprite) { if (sprite->data[0] < 40) { @@ -770,16 +774,20 @@ static void ShrubEntranceSpriteCallback2(struct Sprite *sprite) else { sprite->data[0] = 0; - sprite->callback = ShrubEntranceSpriteCallbackEnd; + sprite->callback = SpriteCB_ShrubEntranceEnd; } } -static void ShrubEntranceSpriteCallbackEnd(struct Sprite *sprite) +static void SpriteCB_ShrubEntranceEnd(struct Sprite *sprite) { FieldEffectStop(sprite, FLDEFF_SECRET_POWER_SHRUB); EnableBothScriptContexts(); } +#define tX data[0] +#define tY data[1] +#define tState data[2] + bool8 FldEff_SecretBasePCTurnOn(void) { s16 x, y; @@ -788,9 +796,9 @@ bool8 FldEff_SecretBasePCTurnOn(void) GetXYCoordsOneStepInFrontOfPlayer(&x, &y); taskId = CreateTask(Task_SecretBasePCTurnOn, 0); - gTasks[taskId].data[0] = x; - gTasks[taskId].data[1] = y; - gTasks[taskId].data[2] = 0; + gTasks[taskId].tX = x; + gTasks[taskId].tY = y; + gTasks[taskId].tState = 0; return FALSE; } @@ -799,30 +807,34 @@ static void Task_SecretBasePCTurnOn(u8 taskId) { s16 *data = gTasks[taskId].data; - switch (data[2]) + switch (tState) { case 4: case 12: - MapGridSetMetatileIdAt(data[0], data[1], METATILE_SecretBase_PC_On); - CurrentMapDrawMetatileAt(data[0], data[1]); + MapGridSetMetatileIdAt(tX, tY, METATILE_SecretBase_PC_On); + CurrentMapDrawMetatileAt(tX, tY); break; case 8: case 16: - MapGridSetMetatileIdAt(data[0], data[1], METATILE_SecretBase_PC); - CurrentMapDrawMetatileAt(data[0], data[1]); + MapGridSetMetatileIdAt(tX, tY, METATILE_SecretBase_PC); + CurrentMapDrawMetatileAt(tX, tY); break; case 20: - MapGridSetMetatileIdAt(data[0], data[1], METATILE_SecretBase_PC_On); - CurrentMapDrawMetatileAt(data[0], data[1]); + MapGridSetMetatileIdAt(tX, tY, METATILE_SecretBase_PC_On); + CurrentMapDrawMetatileAt(tX, tY); FieldEffectActiveListRemove(FLDEFF_PCTURN_ON); EnableBothScriptContexts(); DestroyTask(taskId); return; } - data[2]++; + tState++; } +#undef tX +#undef tY +#undef tState + void DoSecretBasePCTurnOffEffect(void) { s16 x, y; @@ -892,12 +904,12 @@ static void DoBalloonSoundEffect(s16 metatileId) } } -bool8 FldEff_NopA6FC(void) +bool8 FldEff_Nop47(void) { return FALSE; } -bool8 FldEff_NopA700(void) +bool8 FldEff_Nop48(void) { return FALSE; } @@ -1034,7 +1046,7 @@ bool8 FldEff_SandPillar(void) switch (GetPlayerFacingDirection()) { case DIR_SOUTH: - CreateSprite(&gUnknown_0858E68C, + CreateSprite(&sSpriteTemplate_SandPillar, gSprites[gPlayerAvatar.spriteId].oam.x + 8, gSprites[gPlayerAvatar.spriteId].oam.y + 32, 0); @@ -1042,7 +1054,7 @@ bool8 FldEff_SandPillar(void) break; case DIR_NORTH: - CreateSprite(&gUnknown_0858E68C, + CreateSprite(&sSpriteTemplate_SandPillar, gSprites[gPlayerAvatar.spriteId].oam.x + 8, gSprites[gPlayerAvatar.spriteId].oam.y, 148); @@ -1050,7 +1062,7 @@ bool8 FldEff_SandPillar(void) break; case DIR_WEST: - CreateSprite(&gUnknown_0858E68C, + CreateSprite(&sSpriteTemplate_SandPillar, gSprites[gPlayerAvatar.spriteId].oam.x - 8, gSprites[gPlayerAvatar.spriteId].oam.y + 16, 148); @@ -1058,7 +1070,7 @@ bool8 FldEff_SandPillar(void) break; case DIR_EAST: - CreateSprite(&gUnknown_0858E68C, + CreateSprite(&sSpriteTemplate_SandPillar, gSprites[gPlayerAvatar.spriteId].oam.x + 24, gSprites[gPlayerAvatar.spriteId].oam.y + 16, 148); @@ -1069,7 +1081,7 @@ bool8 FldEff_SandPillar(void) return FALSE; } -static void SpriteCB_SandPillar_0(struct Sprite *sprite) +static void SpriteCB_SandPillar_BreakTop(struct Sprite *sprite) { PlaySE(SE_W088); @@ -1083,10 +1095,10 @@ static void SpriteCB_SandPillar_0(struct Sprite *sprite) CurrentMapDrawMetatileAt(gFieldEffectArguments[5], gFieldEffectArguments[6]); sprite->data[0] = 0; - sprite->callback = SpriteCB_SandPillar_1; + sprite->callback = SpriteCB_SandPillar_BreakBase; } -static void SpriteCB_SandPillar_1(struct Sprite *sprite) +static void SpriteCB_SandPillar_BreakBase(struct Sprite *sprite) { if (sprite->data[0] < 18) { @@ -1097,11 +1109,11 @@ static void SpriteCB_SandPillar_1(struct Sprite *sprite) MapGridSetMetatileIdAt(gFieldEffectArguments[5], gFieldEffectArguments[6], METATILE_SecretBase_SandOrnament_BrokenBase | METATILE_COLLISION_MASK); CurrentMapDrawMetatileAt(gFieldEffectArguments[5], gFieldEffectArguments[6]); sprite->data[0] = 0; - sprite->callback = SpriteCB_SandPillar_2; + sprite->callback = SpriteCB_SandPillar_End; } } -static void SpriteCB_SandPillar_2(struct Sprite *sprite) +static void SpriteCB_SandPillar_End(struct Sprite *sprite) { FieldEffectStop(sprite, FLDEFF_SAND_PILLAR); EnableBothScriptContexts(); @@ -1167,12 +1179,13 @@ void InteractWithShieldOrTVDecoration(void) } } -bool8 sub_80FADE4(u16 metatileId, u8 arg1) +// As opposed to a small one (single metatile) like the balloons +bool8 IsLargeBreakableDecoration(u16 metatileId, bool8 checkBase) { if (!CurMapIsSecretBase()) return FALSE; - if (!arg1) + if (!checkBase) { if (metatileId == METATILE_SecretBase_SandOrnament_Top || metatileId == METATILE_SecretBase_SandOrnament_TopWall) return TRUE; @@ -1224,25 +1237,26 @@ bool32 FldEffPoison_IsActive(void) return FuncIsActiveTask(Task_FieldPoisonEffect); } -static void Task_WateringBerryTreeAnim_0(u8 taskId) +static void Task_WateringBerryTreeAnim(u8 taskId) { - gTasks[taskId].func = Task_WateringBerryTreeAnim_1; + gTasks[taskId].func = Task_WateringBerryTreeAnim_Start; } -static void Task_WateringBerryTreeAnim_1(u8 taskId) +static void Task_WateringBerryTreeAnim_Start(u8 taskId) { struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; if (!ObjectEventIsMovementOverridden(playerObjEvent) || ObjectEventClearHeldMovementIfFinished(playerObjEvent)) { + // Start watering SetPlayerAvatarWatering(GetPlayerFacingDirection()); ObjectEventSetHeldMovement(playerObjEvent, GetWalkInPlaceNormalMovementAction(GetPlayerFacingDirection())); - gTasks[taskId].func = Task_WateringBerryTreeAnim_2; + gTasks[taskId].func = Task_WateringBerryTreeAnim_Continue; } } -static void Task_WateringBerryTreeAnim_2(u8 taskId) +static void Task_WateringBerryTreeAnim_Continue(u8 taskId) { struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; @@ -1250,15 +1264,15 @@ static void Task_WateringBerryTreeAnim_2(u8 taskId) { s16 value = gTasks[taskId].data[1]++; + // Continue holding watering action 10 times, then end if (value < 10) ObjectEventSetHeldMovement(playerObjEvent, GetWalkInPlaceNormalMovementAction(GetPlayerFacingDirection())); - else - gTasks[taskId].func = Task_WateringBerryTreeAnim_3; + gTasks[taskId].func = Task_WateringBerryTreeAnim_End; } } -static void Task_WateringBerryTreeAnim_3(u8 taskId) +static void Task_WateringBerryTreeAnim_End(u8 taskId) { SetPlayerAvatarTransitionFlags(GetPlayerAvatarFlags()); DestroyTask(taskId); @@ -1267,16 +1281,17 @@ static void Task_WateringBerryTreeAnim_3(u8 taskId) void DoWateringBerryTreeAnim(void) { - CreateTask(Task_WateringBerryTreeAnim_0, 80); + CreateTask(Task_WateringBerryTreeAnim, 80); } -u8 CreateRecordMixingSprite(void) +// The lights that blink on the counter when mixing records in the cable club +u8 CreateRecordMixingLights(void) { u8 spriteId; - LoadSpritePalette(&gUnknown_0858E864); + LoadSpritePalette(&sSpritePalette_RecordMixLights); - spriteId = CreateSprite(&gUnknown_0858E880, 0, 0, 82); + spriteId = CreateSprite(&sSpriteTemplate_RecordMixLights, 0, 0, 82); if (spriteId == MAX_SPRITES) { @@ -1293,13 +1308,13 @@ u8 CreateRecordMixingSprite(void) return spriteId; } -void DestroyRecordMixingSprite(void) +void DestroyRecordMixingLights(void) { int i; for (i = 0; i < MAX_SPRITES; i++) { - if (gSprites[i].template == &gUnknown_0858E880) + if (gSprites[i].template == &sSpriteTemplate_RecordMixLights) { FreeSpritePalette(&gSprites[i]); DestroySprite(&gSprites[i]); diff --git a/src/fldeff_rocksmash.c b/src/fldeff_rocksmash.c index 4d7dcb66e..ec8e64012 100644 --- a/src/fldeff_rocksmash.c +++ b/src/fldeff_rocksmash.c @@ -20,13 +20,13 @@ #include "constants/songs.h" // static functions -static void Task_DoFieldMove_0(u8 taskId); -static void Task_DoFieldMove_1(u8 taskId); -static void Task_DoFieldMove_2(u8 taskId); -static void Task_DoFieldMove_3(u8 taskId); +static void Task_DoFieldMove_Init(u8 taskId); +static void Task_DoFieldMove_ShowMonAfterPose(u8 taskId); +static void Task_DoFieldMove_WaitForMon(u8 taskId); +static void Task_DoFieldMove_RunFunc(u8 taskId); static void FieldCallback_RockSmash(void); -static void sub_8135714(void); +static void FieldMove_RockSmash(void); // text bool8 CheckObjectGraphicsInFrontOfPlayer(u8 graphicsId) @@ -50,10 +50,10 @@ bool8 CheckObjectGraphicsInFrontOfPlayer(u8 graphicsId) u8 CreateFieldMoveTask(void) { GetXYCoordsOneStepInFrontOfPlayer(&gPlayerFacingPosition.x, &gPlayerFacingPosition.y); - return CreateTask(Task_DoFieldMove_0, 8); + return CreateTask(Task_DoFieldMove_Init, 8); } -static void Task_DoFieldMove_0(u8 taskId) +static void Task_DoFieldMove_Init(u8 taskId) { u8 objEventId; @@ -65,28 +65,30 @@ static void Task_DoFieldMove_0(u8 taskId) { if (gMapHeader.mapType == MAP_TYPE_UNDERWATER) { + // Skip field move pose underwater FieldEffectStart(FLDEFF_FIELD_MOVE_SHOW_MON_INIT); - gTasks[taskId].func = Task_DoFieldMove_2; + gTasks[taskId].func = Task_DoFieldMove_WaitForMon; } else { + // Do field move pose SetPlayerAvatarFieldMove(); ObjectEventSetHeldMovement(&gObjectEvents[objEventId], MOVEMENT_ACTION_START_ANIM_IN_DIRECTION); - gTasks[taskId].func = Task_DoFieldMove_1; + gTasks[taskId].func = Task_DoFieldMove_ShowMonAfterPose; } } } -static void Task_DoFieldMove_1(u8 taskId) +static void Task_DoFieldMove_ShowMonAfterPose(u8 taskId) { if (ObjectEventCheckHeldMovementStatus(&gObjectEvents[gPlayerAvatar.objectEventId]) == TRUE) { FieldEffectStart(FLDEFF_FIELD_MOVE_SHOW_MON_INIT); - gTasks[taskId].func = Task_DoFieldMove_2; + gTasks[taskId].func = Task_DoFieldMove_WaitForMon; } } -static void Task_DoFieldMove_2(u8 taskId) +static void Task_DoFieldMove_WaitForMon(u8 taskId) { if (!FieldEffectActiveListContains(FLDEFF_FIELD_MOVE_SHOW_MON)) { @@ -102,19 +104,22 @@ static void Task_DoFieldMove_2(u8 taskId) ObjectEventSetGraphicsId(&gObjectEvents[gPlayerAvatar.objectEventId], GetPlayerAvatarGraphicsIdByCurrentState()); StartSpriteAnim(&gSprites[gPlayerAvatar.spriteId], gFieldEffectArguments[2]); FieldEffectActiveListRemove(FLDEFF_FIELD_MOVE_SHOW_MON); - gTasks[taskId].func = Task_DoFieldMove_3; + gTasks[taskId].func = Task_DoFieldMove_RunFunc; } } -static void Task_DoFieldMove_3(u8 taskId) +static void Task_DoFieldMove_RunFunc(u8 taskId) { - void (*func)(void) = (void (*)(void))(((u16)gTasks[taskId].data[8] << 16) | (u16)gTasks[taskId].data[9]); + // The function for the field move to do is stored in halves across data[8] and data[9] + void (*fieldMoveFunc)(void) = (void (*)(void))(((u16)gTasks[taskId].data[8] << 16) | (u16)gTasks[taskId].data[9]); - func(); + fieldMoveFunc(); gPlayerAvatar.preventStep = FALSE; DestroyTask(taskId); } +// Called when Rock Smash is used from the party menu +// For interacting with a smashable rock in the field, see EventScript_RockSmash bool8 SetUpFieldMove_RockSmash(void) { // In Ruby and Sapphire, Regirock's tomb is opened by using Strength. In Emerald, @@ -141,20 +146,21 @@ bool8 SetUpFieldMove_RockSmash(void) static void FieldCallback_RockSmash(void) { gFieldEffectArguments[0] = GetCursorSelectionMonId(); - ScriptContext1_SetupScript(EventScript_FldEffRockSmash); + ScriptContext1_SetupScript(EventScript_RockSmashFromPartyMenu); } bool8 FldEff_UseRockSmash(void) { u8 taskId = CreateFieldMoveTask(); - gTasks[taskId].data[8] = (u32)sub_8135714 >> 16; - gTasks[taskId].data[9] = (u32)sub_8135714; + gTasks[taskId].data[8] = (u32)FieldMove_RockSmash >> 16; + gTasks[taskId].data[9] = (u32)FieldMove_RockSmash; IncrementGameStat(GAME_STAT_USED_ROCK_SMASH); return FALSE; } -static void sub_8135714(void) +// The actual rock smashing is handled by EventScript_SmashRock, so this function does very little +static void FieldMove_RockSmash(void) { PlaySE(SE_W088); FieldEffectActiveListRemove(FLDEFF_USE_ROCK_SMASH); diff --git a/src/hall_of_fame.c b/src/hall_of_fame.c index 5405b7c42..b4745ff4e 100644 --- a/src/hall_of_fame.c +++ b/src/hall_of_fame.c @@ -799,7 +799,7 @@ void CB2_DoHallOfFamePC(void) { struct HallofFameTeam *fameTeam = (struct HallofFameTeam*)(gDecompressionBuffer); fameTeam->mon[0] = sDummyFameMon; - sub_80F9BCC(0, 0, 0); + ComputerScreenOpenEffect(0, 0, 0); SetVBlankCallback(VBlankCB_HallOfFame); gMain.state++; } @@ -809,7 +809,7 @@ void CB2_DoHallOfFamePC(void) AnimateSprites(); BuildOamBuffer(); UpdatePaletteFade(); - if (!sub_80F9C1C()) + if (!IsComputerScreenOpenEffectActive()) gMain.state++; break; case 5: @@ -1023,13 +1023,13 @@ static void Task_HofPC_HandlePaletteOnExit(u8 taskId) CpuCopy16(gPlttBufferFaded, gPlttBufferUnfaded, 0x400); fameTeam = (struct HallofFameTeam*)(gDecompressionBuffer); fameTeam->mon[0] = sDummyFameMon; - sub_80F9BF4(0, 0, 0); + ComputerScreenCloseEffect(0, 0, 0); gTasks[taskId].func = Task_HofPC_HandleExit; } static void Task_HofPC_HandleExit(u8 taskId) { - if (!sub_80F9C30()) + if (!IsComputerScreenCloseEffectActive()) { u8 i; diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index 104f92c73..31cb47965 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -2360,11 +2360,11 @@ static void Cb_ShowPSS(u8 taskId) { case 0: PlaySE(SE_PC_LOGIN); - sub_80F9BCC(0x14, 0, 1); + ComputerScreenOpenEffect(20, 0, 1); sPSSData->state++; break; case 1: - if (!sub_80F9C1C()) + if (!IsComputerScreenOpenEffectActive()) SetPSSCallback(Cb_MainPSS); break; } @@ -3781,11 +3781,11 @@ static void Cb_OnCloseBoxPressed(u8 taskId) } break; case 3: - sub_80F9BF4(0x14, 0, 1); + ComputerScreenCloseEffect(20, 0, 1); sPSSData->state++; break; case 4: - if (!sub_80F9C30()) + if (!IsComputerScreenCloseEffectActive()) { sub_80CABE0(); gPlayerPartyCount = CalculatePlayerPartyCount(); @@ -3842,11 +3842,11 @@ static void Cb_OnBPressed(u8 taskId) } break; case 3: - sub_80F9BF4(0x14, 0, 0); + ComputerScreenCloseEffect(20, 0, 0); sPSSData->state++; break; case 4: - if (!sub_80F9C30()) + if (!IsComputerScreenCloseEffectActive()) { sub_80CABE0(); gPlayerPartyCount = CalculatePlayerPartyCount(); diff --git a/src/record_mixing.c b/src/record_mixing.c index 3a93d72f8..54b527216 100644 --- a/src/record_mixing.c +++ b/src/record_mixing.c @@ -327,7 +327,7 @@ static void Task_RecordMixing_Main(u8 taskId) VarSet(VAR_TEMP_0, 1); gUnknown_03001130 = FALSE; PrepareExchangePacket(); - CreateRecordMixingSprite(); + CreateRecordMixingLights(); tState = 1; data[10] = CreateTask(Task_MixingRecordsRecv, 80); tSndEffTaskId = CreateTask(Task_RecordMixing_SoundEffect, 81); @@ -337,7 +337,7 @@ static void Task_RecordMixing_Main(u8 taskId) { tState = 2; FlagSet(FLAG_SYS_MIX_RECORD); - DestroyRecordMixingSprite(); + DestroyRecordMixingLights(); DestroyTask(tSndEffTaskId); } break; From abdf7cbf02442fb3d5cfe9945a8e093b273317a9 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Mon, 29 Jun 2020 16:53:38 -0400 Subject: [PATCH 4/9] Label fishing effect functions --- include/constants/items.h | 5 ++ include/tv.h | 2 +- src/data/items.h | 6 +- src/field_effect_helpers.c | 2 +- src/field_player_avatar.c | 154 ++++++++++++++++++------------------- src/field_screen_effect.c | 6 +- src/tv.c | 14 +--- src/wild_encounter.c | 7 -- 8 files changed, 94 insertions(+), 102 deletions(-) diff --git a/include/constants/items.h b/include/constants/items.h index fafcac8b1..d795194cf 100644 --- a/include/constants/items.h +++ b/include/constants/items.h @@ -495,6 +495,11 @@ #define MAX_PC_ITEM_CAPACITY 999 #define MAX_BERRY_CAPACITY 999 +// Secondary IDs for rods +#define OLD_ROD 0 +#define GOOD_ROD 1 +#define SUPER_ROD 2 + // Check if the item is one that can be used on a Pokemon. #define ITEM_HAS_EFFECT(item) ((item) >= ITEM_POTION && (item) <= ITEM_0B2) diff --git a/include/tv.h b/include/tv.h index 7e286ff6e..e2c50cad2 100644 --- a/include/tv.h +++ b/include/tv.h @@ -35,7 +35,7 @@ void sub_80EDC60(const u16 *words); void sub_80EDA80(void); void ReceivePokeNewsData(void *src, u32 size, u8 masterIdx); void sub_80F0BB8(void); -void sub_80ED950(bool8 flag); +void RecordFishingAttemptForTV(bool8 caughtFish); void IncrementDailySlotsUses(void); void IncrementDailyRouletteUses(void); void IncrementDailyWildBattles(void); diff --git a/src/data/items.h b/src/data/items.h index 4d262e683..30beb5352 100644 --- a/src/data/items.h +++ b/src/data/items.h @@ -3426,7 +3426,7 @@ const struct Item gItems[] = .pocket = POCKET_KEY_ITEMS, .type = 2, .fieldUseFunc = ItemUseOutOfBattle_Rod, - .secondaryId = 0, + .secondaryId = OLD_ROD, }, [ITEM_GOOD_ROD] = @@ -3440,7 +3440,7 @@ const struct Item gItems[] = .pocket = POCKET_KEY_ITEMS, .type = 2, .fieldUseFunc = ItemUseOutOfBattle_Rod, - .secondaryId = 1, + .secondaryId = GOOD_ROD, }, [ITEM_SUPER_ROD] = @@ -3454,7 +3454,7 @@ const struct Item gItems[] = .pocket = POCKET_KEY_ITEMS, .type = 2, .fieldUseFunc = ItemUseOutOfBattle_Rod, - .secondaryId = 2, + .secondaryId = SUPER_ROD, }, [ITEM_SS_TICKET] = diff --git a/src/field_effect_helpers.c b/src/field_effect_helpers.c index e3ca54f16..9950978ad 100755 --- a/src/field_effect_helpers.c +++ b/src/field_effect_helpers.c @@ -1423,7 +1423,7 @@ void UpdateRayquazaSpotlightEffect(struct Sprite *sprite) switch (sprite->sState) { case 0: - SetGpuReg(REG_OFFSET_BG0VOFS, 120 - (sprite->sTimer / 3)); + SetGpuReg(REG_OFFSET_BG0VOFS, DISPLAY_WIDTH / 2 - (sprite->sTimer / 3)); if (sprite->sTimer == 96) { for (i = 0; i < 3; i++) diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c index 41ddfc17d..37342f02d 100644 --- a/src/field_player_avatar.c +++ b/src/field_player_avatar.c @@ -26,6 +26,7 @@ #include "constants/event_object_movement.h" #include "constants/field_effects.h" #include "constants/flags.h" +#include "constants/items.h" #include "constants/maps.h" #include "constants/moves.h" #include "constants/songs.h" @@ -121,22 +122,22 @@ static void Task_StopSurfingInit(u8 taskId); static void Task_WaitStopSurfing(u8 taskId); static void Task_Fishing(u8 taskId); -static u8 Fishing1(struct Task *task); -static u8 Fishing2(struct Task *task); -static u8 Fishing3(struct Task *task); -static u8 Fishing4(struct Task *task); -static u8 Fishing5(struct Task *task); -static u8 Fishing6(struct Task *task); -static u8 Fishing7(struct Task *task); -static u8 Fishing8(struct Task *task); -static u8 Fishing9(struct Task *task); -static u8 Fishing10(struct Task *task); -static u8 Fishing11(struct Task *task); -static u8 Fishing12(struct Task *task); -static u8 Fishing13(struct Task *task); -static u8 Fishing14(struct Task *task); -static u8 Fishing15(struct Task *task); -static u8 Fishing16(struct Task *task); +static u8 Fishing_Init(struct Task *task); +static u8 Fishing_GetRodOut(struct Task *task); +static u8 Fishing_WaitBeforeDots(struct Task *task); +static u8 Fishing_InitDots(struct Task *task); +static u8 Fishing_ShowDots(struct Task *task); +static u8 Fishing_CheckForBite(struct Task *task); +static u8 Fishing_GotBite(struct Task *task); +static u8 Fishing_WaitForA(struct Task *task); +static u8 Fishing_CheckMoreDots(struct Task *task); +static u8 Fishing_MonOnHook(struct Task *task); +static u8 Fishing_StartEncounter(struct Task *task); +static u8 Fishing_NotEvenNibble(struct Task *task); +static u8 Fishing_GotAway(struct Task *task); +static u8 Fishing_NoMon(struct Task *task); +static u8 Fishing_PutRodAway(struct Task *task); +static u8 Fishing_EndNoMon(struct Task *task); static void AlignFishingAnimationFrames(void); static u8 sub_808D38C(struct ObjectEvent *object, s16 *a1); @@ -1670,26 +1671,6 @@ static void Task_WaitStopSurfing(u8 taskId) } } -static bool8 (*const sFishingStateFuncs[])(struct Task *) = -{ - Fishing1, - Fishing2, - Fishing3, - Fishing4, - Fishing5, - Fishing6, - Fishing7, - Fishing8, - Fishing9, - Fishing10, - Fishing11, - Fishing12, - Fishing13, - Fishing14, - Fishing15, - Fishing16, -}; - #define tStep data[0] #define tFrameCounter data[1] #define tNumDots data[2] @@ -1699,6 +1680,7 @@ static bool8 (*const sFishingStateFuncs[])(struct Task *) = #define tPlayerGfxId data[14] #define tFishingRod data[15] +// Some states are jumped to directly, labeled below #define FISHING_START_ROUND 3 #define FISHING_GOT_BITE 6 #define FISHING_ON_HOOK 9 @@ -1706,6 +1688,26 @@ static bool8 (*const sFishingStateFuncs[])(struct Task *) = #define FISHING_GOT_AWAY 12 #define FISHING_SHOW_RESULT 13 +static bool8 (*const sFishingStateFuncs[])(struct Task *) = +{ + Fishing_Init, + Fishing_GetRodOut, + Fishing_WaitBeforeDots, + Fishing_InitDots, // FISHING_START_ROUND + Fishing_ShowDots, + Fishing_CheckForBite, + Fishing_GotBite, // FISHING_GOT_BITE + Fishing_WaitForA, + Fishing_CheckMoreDots, + Fishing_MonOnHook, // FISHING_ON_HOOK + Fishing_StartEncounter, + Fishing_NotEvenNibble, // FISHING_NO_BITE + Fishing_GotAway, // FISHING_GOT_AWAY + Fishing_NoMon, // FISHING_SHOW_RESULT + Fishing_PutRodAway, + Fishing_EndNoMon, +}; + void StartFishing(u8 rod) { u8 taskId = CreateTask(Task_Fishing, 0xFF); @@ -1720,7 +1722,7 @@ static void Task_Fishing(u8 taskId) ; } -static bool8 Fishing1(struct Task *task) +static bool8 Fishing_Init(struct Task *task) { ScriptContext2_Enable(); gPlayerAvatar.preventStep = TRUE; @@ -1728,14 +1730,22 @@ static bool8 Fishing1(struct Task *task) return FALSE; } -static bool8 Fishing2(struct Task *task) +static bool8 Fishing_GetRodOut(struct Task *task) { struct ObjectEvent *playerObjEvent; - const s16 arr1[] = {1, 1, 1}; - const s16 arr2[] = {1, 3, 6}; + const s16 minRounds1[] = { + [OLD_ROD] = 1, + [GOOD_ROD] = 1, + [SUPER_ROD] = 1 + }; + const s16 minRounds2[] = { + [OLD_ROD] = 1, + [GOOD_ROD] = 3, + [SUPER_ROD] = 6 + }; task->tRoundsPlayed = 0; - task->tMinRoundsRequired = arr1[task->tFishingRod] + (Random() % arr2[task->tFishingRod]); + task->tMinRoundsRequired = minRounds1[task->tFishingRod] + (Random() % minRounds2[task->tFishingRod]); task->tPlayerGfxId = gObjectEvents[gPlayerAvatar.objectEventId].graphicsId; playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; ObjectEventClearHeldMovementIfActive(playerObjEvent); @@ -1745,7 +1755,7 @@ static bool8 Fishing2(struct Task *task) return FALSE; } -static bool8 Fishing3(struct Task *task) +static bool8 Fishing_WaitBeforeDots(struct Task *task) { AlignFishingAnimationFrames(); @@ -1756,7 +1766,7 @@ static bool8 Fishing3(struct Task *task) return FALSE; } -static bool8 Fishing4(struct Task *task) +static bool8 Fishing_InitDots(struct Task *task) { u32 randVal; @@ -1774,8 +1784,7 @@ static bool8 Fishing4(struct Task *task) return TRUE; } -// Play a round of the dot game -static bool8 Fishing5(struct Task *task) +static bool8 Fishing_ShowDots(struct Task *task) { const u8 dot[] = _("·"); @@ -1810,8 +1819,7 @@ static bool8 Fishing5(struct Task *task) } } -// Determine if fish bites -static bool8 Fishing6(struct Task *task) +static bool8 Fishing_CheckForBite(struct Task *task) { bool8 bite; @@ -1831,34 +1839,25 @@ static bool8 Fishing6(struct Task *task) if (ability == ABILITY_SUCTION_CUPS || ability == ABILITY_STICKY_HOLD) { if (Random() % 100 > 14) - { bite = TRUE; - } } } if (!bite) { if (Random() & 1) - { task->tStep = FISHING_NO_BITE; - } else - { bite = TRUE; - } } if (bite == TRUE) - { StartSpriteAnim(&gSprites[gPlayerAvatar.spriteId], GetFishingBiteDirectionAnimNum(GetPlayerFacingDirection())); - } } return TRUE; } -// Oh! A Bite! -static bool8 Fishing7(struct Task *task) +static bool8 Fishing_GotBite(struct Task *task) { AlignFishingAnimationFrames(); AddTextPrinterParameterized(0, 1, gText_OhABite, 0, 17, 0, NULL); @@ -1868,9 +1867,13 @@ static bool8 Fishing7(struct Task *task) } // We have a bite. Now, wait for the player to press A, or the timer to expire. -static bool8 Fishing8(struct Task *task) +static bool8 Fishing_WaitForA(struct Task *task) { - const s16 reelTimeouts[3] = {36, 33, 30}; + const s16 reelTimeouts[3] = { + [OLD_ROD] = 36, + [GOOD_ROD] = 33, + [SUPER_ROD] = 30 + }; AlignFishingAnimationFrames(); task->tFrameCounter++; @@ -1882,13 +1885,13 @@ static bool8 Fishing8(struct Task *task) } // Determine if we're going to play the dot game again -static bool8 Fishing9(struct Task *task) +static bool8 Fishing_CheckMoreDots(struct Task *task) { - const s16 arr[][2] = + const s16 moreDotsChance[][2] = { - {0, 0}, - {40, 10}, - {70, 30} + [OLD_ROD] = {0, 0}, + [GOOD_ROD] = {40, 10}, + [SUPER_ROD] = {70, 30} }; AlignFishingAnimationFrames(); @@ -1902,13 +1905,13 @@ static bool8 Fishing9(struct Task *task) // probability of having to play another round s16 probability = Random() % 100; - if (arr[task->tFishingRod][task->tRoundsPlayed] > probability) + if (moreDotsChance[task->tFishingRod][task->tRoundsPlayed] > probability) task->tStep = FISHING_START_ROUND; } return FALSE; } -static bool8 Fishing10(struct Task *task) +static bool8 Fishing_MonOnHook(struct Task *task) { AlignFishingAnimationFrames(); FillWindowPixelBuffer(0, PIXEL_FILL(1)); @@ -1918,7 +1921,7 @@ static bool8 Fishing10(struct Task *task) return FALSE; } -static bool8 Fishing11(struct Task *task) +static bool8 Fishing_StartEncounter(struct Task *task) { if (task->tFrameCounter == 0) AlignFishingAnimationFrames(); @@ -1948,14 +1951,13 @@ static bool8 Fishing11(struct Task *task) gPlayerAvatar.preventStep = FALSE; ScriptContext2_Disable(); FishingWildEncounter(task->tFishingRod); - sub_80ED950(1); + RecordFishingAttemptForTV(TRUE); DestroyTask(FindTaskIdByFunc(Task_Fishing)); } return FALSE; } -// Not even a nibble -static bool8 Fishing12(struct Task *task) +static bool8 Fishing_NotEvenNibble(struct Task *task) { AlignFishingAnimationFrames(); StartSpriteAnim(&gSprites[gPlayerAvatar.spriteId], GetFishingNoCatchDirectionAnimNum(GetPlayerFacingDirection())); @@ -1965,8 +1967,7 @@ static bool8 Fishing12(struct Task *task) return TRUE; } -// It got away -static bool8 Fishing13(struct Task *task) +static bool8 Fishing_GotAway(struct Task *task) { AlignFishingAnimationFrames(); StartSpriteAnim(&gSprites[gPlayerAvatar.spriteId], GetFishingNoCatchDirectionAnimNum(GetPlayerFacingDirection())); @@ -1976,15 +1977,14 @@ static bool8 Fishing13(struct Task *task) return TRUE; } -// Wait one second -static bool8 Fishing14(struct Task *task) +static bool8 Fishing_NoMon(struct Task *task) { AlignFishingAnimationFrames(); task->tStep++; return FALSE; } -static bool8 Fishing15(struct Task *task) +static bool8 Fishing_PutRodAway(struct Task *task) { AlignFishingAnimationFrames(); if (gSprites[gPlayerAvatar.spriteId].animEnded) @@ -2002,7 +2002,7 @@ static bool8 Fishing15(struct Task *task) return FALSE; } -static bool8 Fishing16(struct Task *task) +static bool8 Fishing_EndNoMon(struct Task *task) { RunTextPrinters(); if (!IsTextPrinterActive(0)) @@ -2011,7 +2011,7 @@ static bool8 Fishing16(struct Task *task) ScriptContext2_Disable(); UnfreezeObjectEvents(); ClearDialogWindowAndFrame(0, TRUE); - sub_80ED950(0); + RecordFishingAttemptForTV(FALSE); DestroyTask(FindTaskIdByFunc(Task_Fishing)); } return FALSE; diff --git a/src/field_screen_effect.c b/src/field_screen_effect.c index 57dc27ed9..9bdf98d68 100644 --- a/src/field_screen_effect.c +++ b/src/field_screen_effect.c @@ -979,7 +979,7 @@ void AnimateFlash(u8 flashLevel) u8 value = 0; if (!flashLevel) value = 1; - sub_80AFFDC(120, 80, sFlashLevelPixelRadii[curFlashLevel], sFlashLevelPixelRadii[flashLevel], value, 1); + sub_80AFFDC(DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, sFlashLevelPixelRadii[curFlashLevel], sFlashLevelPixelRadii[flashLevel], value, 1); sub_80AFFB8(); ScriptContext2_Enable(); } @@ -988,14 +988,14 @@ void WriteFlashScanlineEffectBuffer(u8 flashLevel) { if (flashLevel) { - SetFlashScanlineEffectWindowBoundaries(&gScanlineEffectRegBuffers[0][0], 120, 80, sFlashLevelPixelRadii[flashLevel]); + SetFlashScanlineEffectWindowBoundaries(&gScanlineEffectRegBuffers[0][0], DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, sFlashLevelPixelRadii[flashLevel]); CpuFastSet(&gScanlineEffectRegBuffers[0], &gScanlineEffectRegBuffers[1], 480); } } void WriteBattlePyramidViewScanlineEffectBuffer(void) { - SetFlashScanlineEffectWindowBoundaries(&gScanlineEffectRegBuffers[0][0], 120, 80, gSaveBlock2Ptr->frontier.pyramidLightRadius); + SetFlashScanlineEffectWindowBoundaries(&gScanlineEffectRegBuffers[0][0], DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, gSaveBlock2Ptr->frontier.pyramidLightRadius); CpuFastSet(&gScanlineEffectRegBuffers[0], &gScanlineEffectRegBuffers[1], 480); } diff --git a/src/tv.c b/src/tv.c index 17a02be6b..d48d48bb3 100644 --- a/src/tv.c +++ b/src/tv.c @@ -1836,31 +1836,25 @@ static void TryEndMassOutbreak(u16 days) gSaveBlock1Ptr->outbreakDaysLeft -= days; } -void sub_80ED950(bool8 flag) +void RecordFishingAttemptForTV(bool8 caughtFish) { - if (flag) + if (caughtFish) { if (sPokemonAnglerAttemptCounters >> 8 > 4) - { PutFishingAdviceShowOnTheAir(); - } + sPokemonAnglerAttemptCounters &= 0xFF; if (sPokemonAnglerAttemptCounters != 0xFF) - { sPokemonAnglerAttemptCounters += 0x01; - } } else { if ((u8)sPokemonAnglerAttemptCounters > 4) - { PutFishingAdviceShowOnTheAir(); - } + sPokemonAnglerAttemptCounters &= 0xFF00; if (sPokemonAnglerAttemptCounters >> 8 != 0xFF) - { sPokemonAnglerAttemptCounters += 0x0100; - } } } diff --git a/src/wild_encounter.c b/src/wild_encounter.c index 7d20b2476..e486cd2f8 100644 --- a/src/wild_encounter.c +++ b/src/wild_encounter.c @@ -185,13 +185,6 @@ static u8 ChooseWildMonIndex_WaterRock(void) return 4; } -enum -{ - OLD_ROD, - GOOD_ROD, - SUPER_ROD -}; - static u8 ChooseWildMonIndex_Fishing(u8 rod) { u8 wildMonIndex = 0; From c84f98a7ff229ab8b09053fae8d66506764ce099 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Mon, 29 Jun 2020 17:24:17 -0400 Subject: [PATCH 5/9] Document misc field control --- include/field_screen_effect.h | 2 +- src/field_control_avatar.c | 2 +- src/field_screen_effect.c | 15 ++++++++------- src/scrcmd.c | 3 ++- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/include/field_screen_effect.h b/include/field_screen_effect.h index de472da3c..951bf0788 100644 --- a/include/field_screen_effect.h +++ b/include/field_screen_effect.h @@ -28,7 +28,7 @@ void DoFallWarp(void); void DoEscalatorWarp(u8 metatileBehavior); void DoLavaridgeGymB1FWarp(void); void DoLavaridgeGym1FWarp(void); -void DoTeleportWarp(void); +void DoTeleportTileWarp(void); void DoMossdeepGymWarp(void); void DoPortholeWarp(void); void DoCableClubWarp(void); diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 5a47f1354..3684b53e6 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -725,7 +725,7 @@ static bool8 TryStartWarpEventScript(struct MapPosition *position, u16 metatileB } if (MetatileBehavior_IsAquaHideoutWarp(metatileBehavior) == TRUE) { - DoTeleportWarp(); + DoTeleportTileWarp(); return TRUE; } if (MetatileBehavior_IsWarpOrBridge(metatileBehavior) == TRUE) diff --git a/src/field_screen_effect.c b/src/field_screen_effect.c index 9bdf98d68..e14efce67 100644 --- a/src/field_screen_effect.c +++ b/src/field_screen_effect.c @@ -44,7 +44,7 @@ static void sub_808115C(u8); static void FillPalBufferWhite(void); static void Task_ExitDoor(u8); static bool32 WaitForWeatherFadeIn(void); -static void task0A_mpl_807E31C(u8 taskId); +static void Task_TeleportTileWarpExit(u8 taskId); static void Task_WarpAndLoadMap(u8 taskId); static void Task_DoDoorWarp(u8 taskId); static void Task_EnableScriptAfterMusicFade(u8 taskId); @@ -297,12 +297,12 @@ void FieldCB_WarpExitFadeFromBlack(void) ScriptContext2_Enable(); } -static void FieldCB_TeleportWarpExit(void) +static void FieldCB_TeleportTileWarpExit(void) { Overworld_PlaySpecialMapMusic(); WarpFadeInScreen(); PlaySE(SE_TK_WARPOUT); - CreateTask(task0A_mpl_807E31C, 10); + CreateTask(Task_TeleportTileWarpExit, 10); ScriptContext2_Enable(); } @@ -545,14 +545,15 @@ void DoLavaridgeGym1FWarp(void) StartLavaridgeGym1FWarp(10); } -void DoTeleportWarp(void) +// Warp from a teleporting tile, e.g. in Aqua Hideout (For the move Teleport see FldEff_TeleportWarpOut) +void DoTeleportTileWarp(void) { ScriptContext2_Enable(); TryFadeOutOldMapMusic(); WarpFadeOutScreen(); PlaySE(SE_TK_WARPIN); CreateTask(Task_WarpAndLoadMap, 10); - gFieldCallback = FieldCB_TeleportWarpExit; + gFieldCallback = FieldCB_TeleportTileWarpExit; } void DoMossdeepGymWarp(void) @@ -999,7 +1000,7 @@ void WriteBattlePyramidViewScanlineEffectBuffer(void) CpuFastSet(&gScanlineEffectRegBuffers[0], &gScanlineEffectRegBuffers[1], 480); } -static void task0A_mpl_807E31C(u8 taskId) +static void Task_TeleportTileWarpExit(u8 taskId) { switch (gTasks[taskId].data[0]) { @@ -1056,7 +1057,7 @@ void sub_80B0244(void) { ScriptContext2_Enable(); CreateTask(Task_WarpAndLoadMap, 10); - gFieldCallback = FieldCB_TeleportWarpExit; + gFieldCallback = FieldCB_TeleportTileWarpExit; } void sub_80B0268(void) diff --git a/src/scrcmd.c b/src/scrcmd.c index 9e62c45c5..3b5003c3b 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -801,6 +801,7 @@ bool8 ScrCmd_warphole(struct ScriptContext *ctx) return TRUE; } +// RS mossdeep gym warp, unused in Emerald bool8 ScrCmd_warpteleport(struct ScriptContext *ctx) { u8 mapGroup = ScriptReadByte(ctx); @@ -810,7 +811,7 @@ bool8 ScrCmd_warpteleport(struct ScriptContext *ctx) u16 y = VarGet(ScriptReadHalfword(ctx)); SetWarpDestination(mapGroup, mapNum, warpId, x, y); - DoTeleportWarp(); + DoTeleportTileWarp(); ResetInitialPlayerAvatarState(); return TRUE; } From 8589e138a82b74bbfdaec6008cb389e5d5e8cce8 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 2 Jul 2020 00:17:14 -0400 Subject: [PATCH 6/9] Eliminate METATILE_ID() macro --- src/braille_puzzles.c | 36 +++--- src/field_effect.c | 4 +- src/field_special_scene.c | 12 +- src/field_specials.c | 236 +++++++++++++++++++------------------- src/field_tasks.c | 62 +++++----- src/fldeff_escalator.c | 42 +++---- src/mirage_tower.c | 36 +++--- 7 files changed, 214 insertions(+), 214 deletions(-) diff --git a/src/braille_puzzles.c b/src/braille_puzzles.c index 3802b9eca..a3862c716 100644 --- a/src/braille_puzzles.c +++ b/src/braille_puzzles.c @@ -87,12 +87,12 @@ bool8 ShouldDoBrailleDigEffect(void) void DoBrailleDigEffect(void) { - MapGridSetMetatileIdAt(16, 8, METATILE_ID(Cave, SealedChamberEntrance_TopLeft)); - MapGridSetMetatileIdAt(17, 8, METATILE_ID(Cave, SealedChamberEntrance_TopMid)); - MapGridSetMetatileIdAt(18, 8, METATILE_ID(Cave, SealedChamberEntrance_TopRight)); - MapGridSetMetatileIdAt(16, 9, METATILE_ID(Cave, SealedChamberEntrance_BottomLeft) | METATILE_COLLISION_MASK); - MapGridSetMetatileIdAt(17, 9, METATILE_ID(Cave, SealedChamberEntrance_BottomMid)); - MapGridSetMetatileIdAt(18, 9, METATILE_ID(Cave, SealedChamberEntrance_BottomRight) | METATILE_COLLISION_MASK); + MapGridSetMetatileIdAt(16, 8, METATILE_Cave_SealedChamberEntrance_TopLeft); + MapGridSetMetatileIdAt(17, 8, METATILE_Cave_SealedChamberEntrance_TopMid); + MapGridSetMetatileIdAt(18, 8, METATILE_Cave_SealedChamberEntrance_TopRight); + MapGridSetMetatileIdAt(16, 9, METATILE_Cave_SealedChamberEntrance_BottomLeft | METATILE_COLLISION_MASK); + MapGridSetMetatileIdAt(17, 9, METATILE_Cave_SealedChamberEntrance_BottomMid); + MapGridSetMetatileIdAt(18, 9, METATILE_Cave_SealedChamberEntrance_BottomRight | METATILE_COLLISION_MASK); DrawWholeMapView(); PlaySE(SE_BAN); FlagSet(FLAG_SYS_BRAILLE_DIG); @@ -280,12 +280,12 @@ void UseRegirockHm_Callback(void) void DoBrailleRegirockEffect(void) { - MapGridSetMetatileIdAt(14, 26, METATILE_ID(Cave, SealedChamberEntrance_TopLeft)); - MapGridSetMetatileIdAt(15, 26, METATILE_ID(Cave, SealedChamberEntrance_TopMid)); - MapGridSetMetatileIdAt(16, 26, METATILE_ID(Cave, SealedChamberEntrance_TopRight)); - MapGridSetMetatileIdAt(14, 27, METATILE_ID(Cave, SealedChamberEntrance_BottomLeft) | METATILE_COLLISION_MASK); - MapGridSetMetatileIdAt(15, 27, METATILE_ID(Cave, SealedChamberEntrance_BottomMid)); - MapGridSetMetatileIdAt(16, 27, METATILE_ID(Cave, SealedChamberEntrance_BottomRight) | METATILE_COLLISION_MASK); + MapGridSetMetatileIdAt(14, 26, METATILE_Cave_SealedChamberEntrance_TopLeft); + MapGridSetMetatileIdAt(15, 26, METATILE_Cave_SealedChamberEntrance_TopMid); + MapGridSetMetatileIdAt(16, 26, METATILE_Cave_SealedChamberEntrance_TopRight); + MapGridSetMetatileIdAt(14, 27, METATILE_Cave_SealedChamberEntrance_BottomLeft | METATILE_COLLISION_MASK); + MapGridSetMetatileIdAt(15, 27, METATILE_Cave_SealedChamberEntrance_BottomMid); + MapGridSetMetatileIdAt(16, 27, METATILE_Cave_SealedChamberEntrance_BottomRight | METATILE_COLLISION_MASK); DrawWholeMapView(); PlaySE(SE_BAN); FlagSet(FLAG_SYS_REGIROCK_PUZZLE_COMPLETED); @@ -319,12 +319,12 @@ void UseRegisteelHm_Callback(void) void DoBrailleRegisteelEffect(void) { - MapGridSetMetatileIdAt(14, 26, METATILE_ID(Cave, SealedChamberEntrance_TopLeft)); - MapGridSetMetatileIdAt(15, 26, METATILE_ID(Cave, SealedChamberEntrance_TopMid)); - MapGridSetMetatileIdAt(16, 26, METATILE_ID(Cave, SealedChamberEntrance_TopRight)); - MapGridSetMetatileIdAt(14, 27, METATILE_ID(Cave, SealedChamberEntrance_BottomLeft) | METATILE_COLLISION_MASK); - MapGridSetMetatileIdAt(15, 27, METATILE_ID(Cave, SealedChamberEntrance_BottomMid)); - MapGridSetMetatileIdAt(16, 27, METATILE_ID(Cave, SealedChamberEntrance_BottomRight) | METATILE_COLLISION_MASK); + MapGridSetMetatileIdAt(14, 26, METATILE_Cave_SealedChamberEntrance_TopLeft); + MapGridSetMetatileIdAt(15, 26, METATILE_Cave_SealedChamberEntrance_TopMid); + MapGridSetMetatileIdAt(16, 26, METATILE_Cave_SealedChamberEntrance_TopRight); + MapGridSetMetatileIdAt(14, 27, METATILE_Cave_SealedChamberEntrance_BottomLeft | METATILE_COLLISION_MASK); + MapGridSetMetatileIdAt(15, 27, METATILE_Cave_SealedChamberEntrance_BottomMid); + MapGridSetMetatileIdAt(16, 27, METATILE_Cave_SealedChamberEntrance_BottomRight | METATILE_COLLISION_MASK); DrawWholeMapView(); PlaySE(SE_BAN); FlagSet(FLAG_SYS_REGISTEEL_PUZZLE_COMPLETED); diff --git a/src/field_effect.c b/src/field_effect.c index b681fc70e..c2302eed9 100644 --- a/src/field_effect.c +++ b/src/field_effect.c @@ -3816,7 +3816,7 @@ static void SpriteCB_DeoxysRockFragment(struct Sprite* sprite) sprite->pos1.y += 12; break; } - if ((u16)(sprite->pos1.x + 4) > 248 || sprite->pos1.y < -4 || sprite->pos1.y > 164) + if ((u16)(sprite->pos1.x + 4) > DISPLAY_WIDTH + 8 || sprite->pos1.y < -4 || sprite->pos1.y > DISPLAY_HEIGHT + 4) DestroySprite(sprite); } @@ -3834,7 +3834,7 @@ bool8 FldEff_MoveDeoxysRock(struct Sprite* sprite) xPos = (gFieldEffectArguments[3] - xPos) * 16; yPos = (gFieldEffectArguments[4] - yPos) * 16; ShiftObjectEventCoords(object, gFieldEffectArguments[3] + 7, gFieldEffectArguments[4] + 7); - taskId = CreateTask(Task_MoveDeoxysRock, 0x50); + taskId = CreateTask(Task_MoveDeoxysRock, 80); gTasks[taskId].data[1] = object->spriteId; gTasks[taskId].data[2] = gSprites[object->spriteId].pos1.x + xPos; gTasks[taskId].data[3] = gSprites[object->spriteId].pos1.y + yPos; diff --git a/src/field_special_scene.c b/src/field_special_scene.c index 540bcd1d4..e19e31361 100644 --- a/src/field_special_scene.c +++ b/src/field_special_scene.c @@ -216,9 +216,9 @@ void Task_HandleTruckSequence(u8 taskId) data[1]++; if (data[1] == 120) { - MapGridSetMetatileIdAt(11, 8, METATILE_ID(InsideOfTruck, ExitLight_Top)); - MapGridSetMetatileIdAt(11, 9, METATILE_ID(InsideOfTruck, ExitLight_Mid)); - MapGridSetMetatileIdAt(11, 10, METATILE_ID(InsideOfTruck, ExitLight_Bottom)); + MapGridSetMetatileIdAt(11, 8, METATILE_InsideOfTruck_ExitLight_Top); + MapGridSetMetatileIdAt(11, 9, METATILE_InsideOfTruck_ExitLight_Mid); + MapGridSetMetatileIdAt(11, 10, METATILE_InsideOfTruck_ExitLight_Bottom); DrawWholeMapView(); PlaySE(SE_TRACK_DOOR); DestroyTask(taskId); @@ -230,9 +230,9 @@ void Task_HandleTruckSequence(u8 taskId) void ExecuteTruckSequence(void) { - MapGridSetMetatileIdAt(11, 8, METATILE_ID(InsideOfTruck, DoorClosedFloor_Top)); - MapGridSetMetatileIdAt(11, 9, METATILE_ID(InsideOfTruck, DoorClosedFloor_Mid)); - MapGridSetMetatileIdAt(11, 10, METATILE_ID(InsideOfTruck, DoorClosedFloor_Bottom)); + MapGridSetMetatileIdAt(11, 8, METATILE_InsideOfTruck_DoorClosedFloor_Top); + MapGridSetMetatileIdAt(11, 9, METATILE_InsideOfTruck_DoorClosedFloor_Mid); + MapGridSetMetatileIdAt(11, 10, METATILE_InsideOfTruck_DoorClosedFloor_Bottom); DrawWholeMapView(); ScriptContext2_Enable(); CpuFastFill(0, gPlttBufferFaded, 0x400); diff --git a/src/field_specials.c b/src/field_specials.c index 818cd70db..e1d336d21 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -656,9 +656,9 @@ void MauvilleGymPressSwitch(void) for (i = 0; i < ARRAY_COUNT(sMauvilleGymSwitchCoords); i++) { if (i == gSpecialVar_0x8004) - MapGridSetMetatileIdAt(sMauvilleGymSwitchCoords[i].x, sMauvilleGymSwitchCoords[i].y, METATILE_ID(MauvilleGym, PressedSwitch)); + MapGridSetMetatileIdAt(sMauvilleGymSwitchCoords[i].x, sMauvilleGymSwitchCoords[i].y, METATILE_MauvilleGym_PressedSwitch); else - MapGridSetMetatileIdAt(sMauvilleGymSwitchCoords[i].x, sMauvilleGymSwitchCoords[i].y, METATILE_ID(MauvilleGym, RaisedSwitch)); + MapGridSetMetatileIdAt(sMauvilleGymSwitchCoords[i].x, sMauvilleGymSwitchCoords[i].y, METATILE_MauvilleGym_RaisedSwitch); } } @@ -673,83 +673,83 @@ void MauvilleGymSetDefaultBarriers(void) { switch (MapGridGetMetatileIdAt(x, y)) { - case METATILE_ID(MauvilleGym, GreenBeamH1_On): - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, GreenBeamH1_Off)); + case METATILE_MauvilleGym_GreenBeamH1_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH1_Off); break; - case METATILE_ID(MauvilleGym, GreenBeamH2_On): - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, GreenBeamH2_Off)); + case METATILE_MauvilleGym_GreenBeamH2_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH2_Off); break; - case METATILE_ID(MauvilleGym, GreenBeamH3_On): - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, GreenBeamH3_Off)); + case METATILE_MauvilleGym_GreenBeamH3_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH3_Off); break; - case METATILE_ID(MauvilleGym, GreenBeamH4_On): - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, GreenBeamH4_Off)); + case METATILE_MauvilleGym_GreenBeamH4_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH4_Off); break; - case METATILE_ID(MauvilleGym, GreenBeamH1_Off): - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, GreenBeamH1_On)); + case METATILE_MauvilleGym_GreenBeamH1_Off: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH1_On); break; - case METATILE_ID(MauvilleGym, GreenBeamH2_Off): - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, GreenBeamH2_On)); + case METATILE_MauvilleGym_GreenBeamH2_Off: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH2_On); break; - case METATILE_ID(MauvilleGym, GreenBeamH3_Off): - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, GreenBeamH3_On) | METATILE_COLLISION_MASK); + case METATILE_MauvilleGym_GreenBeamH3_Off: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH3_On | METATILE_COLLISION_MASK); break; - case METATILE_ID(MauvilleGym, GreenBeamH4_Off): - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, GreenBeamH4_On) | METATILE_COLLISION_MASK); + case METATILE_MauvilleGym_GreenBeamH4_Off: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH4_On | METATILE_COLLISION_MASK); break; - case METATILE_ID(MauvilleGym, RedBeamH1_On): - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, RedBeamH1_Off)); + case METATILE_MauvilleGym_RedBeamH1_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH1_Off); break; - case METATILE_ID(MauvilleGym, RedBeamH2_On): - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, RedBeamH2_Off)); + case METATILE_MauvilleGym_RedBeamH2_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH2_Off); break; - case METATILE_ID(MauvilleGym, RedBeamH3_On): - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, RedBeamH3_Off)); + case METATILE_MauvilleGym_RedBeamH3_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH3_Off); break; - case METATILE_ID(MauvilleGym, RedBeamH4_On): - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, RedBeamH4_Off)); + case METATILE_MauvilleGym_RedBeamH4_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH4_Off); break; - case METATILE_ID(MauvilleGym, RedBeamH1_Off): - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, RedBeamH1_On)); + case METATILE_MauvilleGym_RedBeamH1_Off: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH1_On); break; - case METATILE_ID(MauvilleGym, RedBeamH2_Off): - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, RedBeamH2_On)); + case METATILE_MauvilleGym_RedBeamH2_Off: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH2_On); break; - case METATILE_ID(MauvilleGym, RedBeamH3_Off): - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, RedBeamH3_On) | METATILE_COLLISION_MASK); + case METATILE_MauvilleGym_RedBeamH3_Off: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH3_On | METATILE_COLLISION_MASK); break; - case METATILE_ID(MauvilleGym, RedBeamH4_Off): - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, RedBeamH4_On) | METATILE_COLLISION_MASK); + case METATILE_MauvilleGym_RedBeamH4_Off: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH4_On | METATILE_COLLISION_MASK); break; - case METATILE_ID(MauvilleGym, GreenBeamV1_On): - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, PoleBottom_On) | METATILE_COLLISION_MASK); + case METATILE_MauvilleGym_GreenBeamV1_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleBottom_On | METATILE_COLLISION_MASK); break; - case METATILE_ID(MauvilleGym, GreenBeamV2_On): - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, FloorTile)); + case METATILE_MauvilleGym_GreenBeamV2_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_FloorTile); break; - case METATILE_ID(MauvilleGym, RedBeamV1_On): - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, PoleBottom_Off) | METATILE_COLLISION_MASK); + case METATILE_MauvilleGym_RedBeamV1_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleBottom_Off | METATILE_COLLISION_MASK); break; - case METATILE_ID(MauvilleGym, RedBeamV2_On): - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, FloorTile)); + case METATILE_MauvilleGym_RedBeamV2_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_FloorTile); break; - case METATILE_ID(MauvilleGym, PoleBottom_On): - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, GreenBeamV1_On) | METATILE_COLLISION_MASK); + case METATILE_MauvilleGym_PoleBottom_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamV1_On | METATILE_COLLISION_MASK); break; - case METATILE_ID(MauvilleGym, FloorTile): - if (MapGridGetMetatileIdAt(x, y - 1) == METATILE_ID(MauvilleGym, GreenBeamV1_On)) - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, GreenBeamV2_On) | METATILE_COLLISION_MASK); + case METATILE_MauvilleGym_FloorTile: + if (MapGridGetMetatileIdAt(x, y - 1) == METATILE_MauvilleGym_GreenBeamV1_On) + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamV2_On | METATILE_COLLISION_MASK); else - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, RedBeamV2_On) | METATILE_COLLISION_MASK); + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamV2_On | METATILE_COLLISION_MASK); break; - case METATILE_ID(MauvilleGym, PoleBottom_Off): - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, RedBeamV1_On) | METATILE_COLLISION_MASK); + case METATILE_MauvilleGym_PoleBottom_Off: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamV1_On | METATILE_COLLISION_MASK); break; - case METATILE_ID(MauvilleGym, PoleTop_Off): - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, PoleTop_On) | METATILE_COLLISION_MASK); + case METATILE_MauvilleGym_PoleTop_Off: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleTop_On | METATILE_COLLISION_MASK); break; - case METATILE_ID(MauvilleGym, PoleTop_On): - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, PoleTop_Off)); + case METATILE_MauvilleGym_PoleTop_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleTop_Off); break; } } @@ -763,7 +763,7 @@ void MauvilleGymDeactivatePuzzle(void) const struct UCoords8 *switchCoords = sMauvilleGymSwitchCoords; for (i = ARRAY_COUNT(sMauvilleGymSwitchCoords) - 1; i >= 0; i--) { - MapGridSetMetatileIdAt(switchCoords->x, switchCoords->y, METATILE_ID(MauvilleGym, PressedSwitch)); + MapGridSetMetatileIdAt(switchCoords->x, switchCoords->y, METATILE_MauvilleGym_PressedSwitch); switchCoords++; } for (y = 12; y < 24; y++) @@ -772,42 +772,42 @@ void MauvilleGymDeactivatePuzzle(void) { switch (MapGridGetMetatileIdAt(x, y)) { - case METATILE_ID(MauvilleGym, GreenBeamH1_On): - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, GreenBeamH1_Off)); + case METATILE_MauvilleGym_GreenBeamH1_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH1_Off); break; - case METATILE_ID(MauvilleGym, GreenBeamH2_On): - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, GreenBeamH2_Off)); + case METATILE_MauvilleGym_GreenBeamH2_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH2_Off); break; - case METATILE_ID(MauvilleGym, GreenBeamH3_On): - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, GreenBeamH3_Off)); + case METATILE_MauvilleGym_GreenBeamH3_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH3_Off); break; - case METATILE_ID(MauvilleGym, GreenBeamH4_On): - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, GreenBeamH4_Off)); + case METATILE_MauvilleGym_GreenBeamH4_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH4_Off); break; - case METATILE_ID(MauvilleGym, RedBeamH1_On): - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, RedBeamH1_Off)); + case METATILE_MauvilleGym_RedBeamH1_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH1_Off); break; - case METATILE_ID(MauvilleGym, RedBeamH2_On): - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, RedBeamH2_Off)); + case METATILE_MauvilleGym_RedBeamH2_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH2_Off); break; - case METATILE_ID(MauvilleGym, RedBeamH3_On): - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, RedBeamH3_Off)); + case METATILE_MauvilleGym_RedBeamH3_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH3_Off); break; - case METATILE_ID(MauvilleGym, RedBeamH4_On): - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, RedBeamH4_Off)); + case METATILE_MauvilleGym_RedBeamH4_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH4_Off); break; - case METATILE_ID(MauvilleGym, GreenBeamV1_On): - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, PoleBottom_On) | METATILE_COLLISION_MASK); + case METATILE_MauvilleGym_GreenBeamV1_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleBottom_On | METATILE_COLLISION_MASK); break; - case METATILE_ID(MauvilleGym, RedBeamV1_On): - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, PoleBottom_Off) | METATILE_COLLISION_MASK); + case METATILE_MauvilleGym_RedBeamV1_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleBottom_Off | METATILE_COLLISION_MASK); break; - case METATILE_ID(MauvilleGym, GreenBeamV2_On): - case METATILE_ID(MauvilleGym, RedBeamV2_On): - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, FloorTile)); + case METATILE_MauvilleGym_GreenBeamV2_On: + case METATILE_MauvilleGym_RedBeamV2_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_FloorTile); break; - case METATILE_ID(MauvilleGym, PoleTop_On): - MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, PoleTop_Off)); + case METATILE_MauvilleGym_PoleTop_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleTop_Off); break; } } @@ -817,11 +817,11 @@ void MauvilleGymDeactivatePuzzle(void) static const bool8 sSlidingDoorNextFrameDelay[] = {0, 1, 1, 1, 1}; static const u16 sPetalburgGymSlidingDoorMetatiles[] = { - METATILE_ID(PetalburgGym, SlidingDoor_Frame0), - METATILE_ID(PetalburgGym, SlidingDoor_Frame1), - METATILE_ID(PetalburgGym, SlidingDoor_Frame2), - METATILE_ID(PetalburgGym, SlidingDoor_Frame3), - METATILE_ID(PetalburgGym, SlidingDoor_Frame4), + METATILE_PetalburgGym_SlidingDoor_Frame0, + METATILE_PetalburgGym_SlidingDoor_Frame1, + METATILE_PetalburgGym_SlidingDoor_Frame2, + METATILE_PetalburgGym_SlidingDoor_Frame3, + METATILE_PetalburgGym_SlidingDoor_Frame4, }; void PetalburgGymSlideOpenRoomDoors(void) @@ -1096,30 +1096,30 @@ static void PCTurnOnEffect_1(s16 isPcTurnedOn, s8 dx, s8 dy) { if (gSpecialVar_0x8004 == PC_LOCATION_OTHER) { - tileId = METATILE_ID(Building, PC_Off); + tileId = METATILE_Building_PC_Off; } else if (gSpecialVar_0x8004 == PC_LOCATION_BRENDANS_HOUSE) { - tileId = METATILE_ID(BrendansMaysHouse, BrendanPC_Off); + tileId = METATILE_BrendansMaysHouse_BrendanPC_Off; } else if (gSpecialVar_0x8004 == PC_LOCATION_MAYS_HOUSE) { - tileId = METATILE_ID(BrendansMaysHouse, MayPC_Off); + tileId = METATILE_BrendansMaysHouse_MayPC_Off; } } else { if (gSpecialVar_0x8004 == PC_LOCATION_OTHER) { - tileId = METATILE_ID(Building, PC_On); + tileId = METATILE_Building_PC_On; } else if (gSpecialVar_0x8004 == PC_LOCATION_BRENDANS_HOUSE) { - tileId = METATILE_ID(BrendansMaysHouse, BrendanPC_On); + tileId = METATILE_BrendansMaysHouse_BrendanPC_On; } else if (gSpecialVar_0x8004 == PC_LOCATION_MAYS_HOUSE) { - tileId = METATILE_ID(BrendansMaysHouse, MayPC_On); + tileId = METATILE_BrendansMaysHouse_MayPC_On; } } MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + 7, gSaveBlock1Ptr->pos.y + dy + 7, tileId | METATILE_COLLISION_MASK); @@ -1153,15 +1153,15 @@ static void PCTurnOffEffect(void) } if (gSpecialVar_0x8004 == 0) { - tileId = METATILE_ID(Building, PC_Off); + tileId = METATILE_Building_PC_Off; } else if (gSpecialVar_0x8004 == 1) { - tileId = METATILE_ID(BrendansMaysHouse, BrendanPC_Off); + tileId = METATILE_BrendansMaysHouse_BrendanPC_Off; } else if (gSpecialVar_0x8004 == 2) { - tileId = METATILE_ID(BrendansMaysHouse, MayPC_Off); + tileId = METATILE_BrendansMaysHouse_MayPC_Off; } MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + 7, gSaveBlock1Ptr->pos.y + dy + 7, tileId | METATILE_COLLISION_MASK); DrawWholeMapView(); @@ -1196,13 +1196,13 @@ static void LotteryCornerComputerEffect(struct Task *task) task->data[3] = 0; if (task->data[4] != 0) { - MapGridSetMetatileIdAt(18, 8, METATILE_ID(Shop, Laptop1_Normal) | METATILE_COLLISION_MASK); - MapGridSetMetatileIdAt(18, 9, METATILE_ID(Shop, Laptop2_Normal) | METATILE_COLLISION_MASK); + MapGridSetMetatileIdAt(18, 8, METATILE_Shop_Laptop1_Normal | METATILE_COLLISION_MASK); + MapGridSetMetatileIdAt(18, 9, METATILE_Shop_Laptop2_Normal | METATILE_COLLISION_MASK); } else { - MapGridSetMetatileIdAt(18, 8, METATILE_ID(Shop, Laptop1_Flash) | METATILE_COLLISION_MASK); - MapGridSetMetatileIdAt(18, 9, METATILE_ID(Shop, Laptop2_Flash) | METATILE_COLLISION_MASK); + MapGridSetMetatileIdAt(18, 8, METATILE_Shop_Laptop1_Flash | METATILE_COLLISION_MASK); + MapGridSetMetatileIdAt(18, 9, METATILE_Shop_Laptop2_Flash | METATILE_COLLISION_MASK); } DrawWholeMapView(); task->data[4] ^= 1; @@ -1216,8 +1216,8 @@ static void LotteryCornerComputerEffect(struct Task *task) void EndLotteryCornerComputerEffect(void) { - MapGridSetMetatileIdAt(18, 8, METATILE_ID(Shop, Laptop1_Normal) | METATILE_COLLISION_MASK); - MapGridSetMetatileIdAt(18, 9, METATILE_ID(Shop, Laptop2_Normal) | METATILE_COLLISION_MASK); + MapGridSetMetatileIdAt(18, 8, METATILE_Shop_Laptop1_Normal | METATILE_COLLISION_MASK); + MapGridSetMetatileIdAt(18, 9, METATILE_Shop_Laptop2_Normal | METATILE_COLLISION_MASK); DrawWholeMapView(); } @@ -1751,38 +1751,38 @@ const u8 *const gDeptStoreFloorNames[] = static const u16 sElevatorWindowTiles_Ascending[][3] = { { - METATILE_ID(BattleFrontier, Elevator_Top0), - METATILE_ID(BattleFrontier, Elevator_Top1), - METATILE_ID(BattleFrontier, Elevator_Top2) + METATILE_BattleFrontier_Elevator_Top0, + METATILE_BattleFrontier_Elevator_Top1, + METATILE_BattleFrontier_Elevator_Top2 }, { - METATILE_ID(BattleFrontier, Elevator_Mid0), - METATILE_ID(BattleFrontier, Elevator_Mid1), - METATILE_ID(BattleFrontier, Elevator_Mid2) + METATILE_BattleFrontier_Elevator_Mid0, + METATILE_BattleFrontier_Elevator_Mid1, + METATILE_BattleFrontier_Elevator_Mid2 }, { - METATILE_ID(BattleFrontier, Elevator_Bottom0), - METATILE_ID(BattleFrontier, Elevator_Bottom1), - METATILE_ID(BattleFrontier, Elevator_Bottom2) + METATILE_BattleFrontier_Elevator_Bottom0, + METATILE_BattleFrontier_Elevator_Bottom1, + METATILE_BattleFrontier_Elevator_Bottom2 }, }; static const u16 sElevatorWindowTiles_Descending[][3] = { { - METATILE_ID(BattleFrontier, Elevator_Top0), - METATILE_ID(BattleFrontier, Elevator_Top2), - METATILE_ID(BattleFrontier, Elevator_Top1) + METATILE_BattleFrontier_Elevator_Top0, + METATILE_BattleFrontier_Elevator_Top2, + METATILE_BattleFrontier_Elevator_Top1 }, { - METATILE_ID(BattleFrontier, Elevator_Mid0), - METATILE_ID(BattleFrontier, Elevator_Mid2), - METATILE_ID(BattleFrontier, Elevator_Mid1) + METATILE_BattleFrontier_Elevator_Mid0, + METATILE_BattleFrontier_Elevator_Mid2, + METATILE_BattleFrontier_Elevator_Mid1 }, { - METATILE_ID(BattleFrontier, Elevator_Bottom0), - METATILE_ID(BattleFrontier, Elevator_Bottom2), - METATILE_ID(BattleFrontier, Elevator_Bottom1) + METATILE_BattleFrontier_Elevator_Bottom0, + METATILE_BattleFrontier_Elevator_Bottom2, + METATILE_BattleFrontier_Elevator_Bottom1 }, }; diff --git a/src/field_tasks.c b/src/field_tasks.c index 21b2732c3..de2884e49 100644 --- a/src/field_tasks.c +++ b/src/field_tasks.c @@ -52,26 +52,26 @@ static const TaskFunc sPerStepCallbacks[] = // they are in pairs but declared as 1D array static const struct PacifidlogMetatileOffsets sHalfSubmergedBridgeMetatileOffsets[] = { - { 0, 0, METATILE_ID(Pacifidlog, HalfSubmergedLogs_Vertical0)}, {0, 1, METATILE_ID(Pacifidlog, HalfSubmergedLogs_Vertical1)}, - { 0, -1, METATILE_ID(Pacifidlog, HalfSubmergedLogs_Vertical0)}, {0, 0, METATILE_ID(Pacifidlog, HalfSubmergedLogs_Vertical1)}, - { 0, 0, METATILE_ID(Pacifidlog, HalfSubmergedLogs_Horizontal0)}, {1, 0, METATILE_ID(Pacifidlog, HalfSubmergedLogs_Horizontal1)}, - {-1, 0, METATILE_ID(Pacifidlog, HalfSubmergedLogs_Horizontal0)}, {0, 0, METATILE_ID(Pacifidlog, HalfSubmergedLogs_Horizontal1)} + { 0, 0, METATILE_Pacifidlog_HalfSubmergedLogs_Vertical0}, {0, 1, METATILE_Pacifidlog_HalfSubmergedLogs_Vertical1}, + { 0, -1, METATILE_Pacifidlog_HalfSubmergedLogs_Vertical0}, {0, 0, METATILE_Pacifidlog_HalfSubmergedLogs_Vertical1}, + { 0, 0, METATILE_Pacifidlog_HalfSubmergedLogs_Horizontal0}, {1, 0, METATILE_Pacifidlog_HalfSubmergedLogs_Horizontal1}, + {-1, 0, METATILE_Pacifidlog_HalfSubmergedLogs_Horizontal0}, {0, 0, METATILE_Pacifidlog_HalfSubmergedLogs_Horizontal1} }; static const struct PacifidlogMetatileOffsets sFullySubmergedBridgeMetatileOffsets[] = { - { 0, 0, METATILE_ID(Pacifidlog, SubmergedLogs_Vertical0)}, {0, 1, METATILE_ID(Pacifidlog, SubmergedLogs_Vertical1)}, - { 0, -1, METATILE_ID(Pacifidlog, SubmergedLogs_Vertical0)}, {0, 0, METATILE_ID(Pacifidlog, SubmergedLogs_Vertical1)}, - { 0, 0, METATILE_ID(Pacifidlog, SubmergedLogs_Horizontal0)}, {1, 0, METATILE_ID(Pacifidlog, SubmergedLogs_Horizontal1)}, - {-1, 0, METATILE_ID(Pacifidlog, SubmergedLogs_Horizontal0)}, {0, 0, METATILE_ID(Pacifidlog, SubmergedLogs_Horizontal1)} + { 0, 0, METATILE_Pacifidlog_SubmergedLogs_Vertical0}, {0, 1, METATILE_Pacifidlog_SubmergedLogs_Vertical1}, + { 0, -1, METATILE_Pacifidlog_SubmergedLogs_Vertical0}, {0, 0, METATILE_Pacifidlog_SubmergedLogs_Vertical1}, + { 0, 0, METATILE_Pacifidlog_SubmergedLogs_Horizontal0}, {1, 0, METATILE_Pacifidlog_SubmergedLogs_Horizontal1}, + {-1, 0, METATILE_Pacifidlog_SubmergedLogs_Horizontal0}, {0, 0, METATILE_Pacifidlog_SubmergedLogs_Horizontal1} }; static const struct PacifidlogMetatileOffsets sFloatingBridgeMetatileOffsets[] = { - { 0, 0, METATILE_ID(Pacifidlog, FloatingLogs_Vertical0)}, {0, 1, METATILE_ID(Pacifidlog, FloatingLogs_Vertical1)}, - { 0, -1, METATILE_ID(Pacifidlog, FloatingLogs_Vertical0)}, {0, 0, METATILE_ID(Pacifidlog, FloatingLogs_Vertical1)}, - { 0, 0, METATILE_ID(Pacifidlog, FloatingLogs_Horizontal0)}, {1, 0, METATILE_ID(Pacifidlog, FloatingLogs_Horizontal1)}, - {-1, 0, METATILE_ID(Pacifidlog, FloatingLogs_Horizontal0)}, {0, 0, METATILE_ID(Pacifidlog, FloatingLogs_Horizontal1)} + { 0, 0, METATILE_Pacifidlog_FloatingLogs_Vertical0}, {0, 1, METATILE_Pacifidlog_FloatingLogs_Vertical1}, + { 0, -1, METATILE_Pacifidlog_FloatingLogs_Vertical0}, {0, 0, METATILE_Pacifidlog_FloatingLogs_Vertical1}, + { 0, 0, METATILE_Pacifidlog_FloatingLogs_Horizontal0}, {1, 0, METATILE_Pacifidlog_FloatingLogs_Horizontal1}, + {-1, 0, METATILE_Pacifidlog_FloatingLogs_Horizontal0}, {0, 0, METATILE_Pacifidlog_FloatingLogs_Horizontal1} }; // Each element corresponds to a y coordinate row in the sootopolis gym 1F map. @@ -106,10 +106,10 @@ static const u16 sSootopolisGymIceRowVars[] = }; static const u16 sMuddySlopeMetatiles[] = { - METATILE_ID(General, MuddySlope_Frame0), - METATILE_ID(General, MuddySlope_Frame3), - METATILE_ID(General, MuddySlope_Frame2), - METATILE_ID(General, MuddySlope_Frame1) + METATILE_General_MuddySlope_Frame0, + METATILE_General_MuddySlope_Frame3, + METATILE_General_MuddySlope_Frame2, + METATILE_General_MuddySlope_Frame1 }; static void Task_RunPerStepCallback(u8 taskId) @@ -381,11 +381,11 @@ static void SetLoweredForetreeBridgeMetatile(s16 x, s16 y) { switch (MapGridGetMetatileIdAt(x, y)) { - case METATILE_ID(Fortree, BridgeOverGrass_Raised): - MapGridSetMetatileIdAt(x, y, METATILE_ID(Fortree, BridgeOverGrass_Lowered)); + case METATILE_Fortree_BridgeOverGrass_Raised: + MapGridSetMetatileIdAt(x, y, METATILE_Fortree_BridgeOverGrass_Lowered); break; - case METATILE_ID(Fortree, BridgeOverTrees_Raised): - MapGridSetMetatileIdAt(x, y, METATILE_ID(Fortree, BridgeOverTrees_Lowered)); + case METATILE_Fortree_BridgeOverTrees_Raised: + MapGridSetMetatileIdAt(x, y, METATILE_Fortree_BridgeOverTrees_Lowered); break; } } @@ -398,11 +398,11 @@ static void SetNormalFortreeBridgeMetatile(s16 x, s16 y) { switch (MapGridGetMetatileIdAt(x, y)) { - case METATILE_ID(Fortree, BridgeOverGrass_Lowered): - MapGridSetMetatileIdAt(x, y, METATILE_ID(Fortree, BridgeOverGrass_Raised)); + case METATILE_Fortree_BridgeOverGrass_Lowered: + MapGridSetMetatileIdAt(x, y, METATILE_Fortree_BridgeOverGrass_Raised); break; - case METATILE_ID(Fortree, BridgeOverTrees_Lowered): - MapGridSetMetatileIdAt(x, y, METATILE_ID(Fortree, BridgeOverTrees_Raised)); + case METATILE_Fortree_BridgeOverTrees_Lowered: + MapGridSetMetatileIdAt(x, y, METATILE_Fortree_BridgeOverTrees_Raised); break; } } @@ -530,7 +530,7 @@ void SetSootopolisGymCrackedIceMetatiles(void) for (y = 0; y < height; y++) { if (IsIcePuzzleCoordVisited(x, y) == TRUE) - MapGridSetMetatileIdAt(x + 7, y + 7, METATILE_ID(SootopolisGym, Ice_Cracked)); + MapGridSetMetatileIdAt(x + 7, y + 7, METATILE_SootopolisGym_Ice_Cracked); } } } @@ -585,7 +585,7 @@ static void SootopolisGymIcePerStepCallback(u8 taskId) x = data[4]; y = data[5]; PlaySE(SE_RU_BARI); - MapGridSetMetatileIdAt(x, y, METATILE_ID(SootopolisGym, Ice_Cracked)); + MapGridSetMetatileIdAt(x, y, METATILE_SootopolisGym_Ice_Cracked); CurrentMapDrawMetatileAt(x, y); MarkIcePuzzleCoordVisited(x - 7, y - 7); data[1] = 1; @@ -601,7 +601,7 @@ static void SootopolisGymIcePerStepCallback(u8 taskId) x = data[4]; y = data[5]; PlaySE(SE_RU_GASYAN); - MapGridSetMetatileIdAt(x, y, METATILE_ID(SootopolisGym, Ice_Broken)); + MapGridSetMetatileIdAt(x, y, METATILE_SootopolisGym_Ice_Broken); CurrentMapDrawMetatileAt(x, y); data[1] = 1; } @@ -621,10 +621,10 @@ static void AshGrassPerStepCallback(u8 taskId) data[2] = y; if (MetatileBehavior_IsAshGrass(MapGridGetMetatileBehaviorAt(x, y))) { - if (MapGridGetMetatileIdAt(x, y) == METATILE_ID(Fallarbor, AshGrass)) - StartAshFieldEffect(x, y, METATILE_ID(Fallarbor, NormalGrass), 4); + if (MapGridGetMetatileIdAt(x, y) == METATILE_Fallarbor_AshGrass) + StartAshFieldEffect(x, y, METATILE_Fallarbor_NormalGrass, 4); else - StartAshFieldEffect(x, y, METATILE_ID(Lavaridge, NormalGrass), 4); + StartAshFieldEffect(x, y, METATILE_Lavaridge_NormalGrass, 4); if (CheckBagHasItem(ITEM_SOOT_SACK, 1)) { @@ -693,7 +693,7 @@ static void SetMuddySlopeMetatile(s16 *data, s16 x, s16 y) MapGridSetMetatileIdAt(x, y, tile); CurrentMapDrawMetatileAt(x, y); - MapGridSetMetatileIdAt(x, y, METATILE_ID(General, MuddySlope_Frame0)); + MapGridSetMetatileIdAt(x, y, METATILE_General_MuddySlope_Frame0); } static void Task_MuddySlope(u8 taskId) diff --git a/src/fldeff_escalator.c b/src/fldeff_escalator.c index d1f262b5c..13edda57d 100644 --- a/src/fldeff_escalator.c +++ b/src/fldeff_escalator.c @@ -17,45 +17,45 @@ static void Task_DrawTeleporterCable(u8 taskId); #define LAST_ESCALATOR_STAGE (ESCALATOR_STAGES - 1) static const u16 sElevatorMetatiles_1F_0[ESCALATOR_STAGES] = { - METATILE_ID(PokemonCenter, Elevator1F_Tile0_Frame2), - METATILE_ID(PokemonCenter, Elevator1F_Tile0_Frame1), - METATILE_ID(PokemonCenter, Elevator1F_Tile0_Frame0) + METATILE_PokemonCenter_Elevator1F_Tile0_Frame2, + METATILE_PokemonCenter_Elevator1F_Tile0_Frame1, + METATILE_PokemonCenter_Elevator1F_Tile0_Frame0 }; static const u16 sElevatorMetatiles_1F_1[ESCALATOR_STAGES] = { - METATILE_ID(PokemonCenter, Elevator1F_Tile1_Frame2), - METATILE_ID(PokemonCenter, Elevator1F_Tile1_Frame1), - METATILE_ID(PokemonCenter, Elevator1F_Tile1_Frame0) + METATILE_PokemonCenter_Elevator1F_Tile1_Frame2, + METATILE_PokemonCenter_Elevator1F_Tile1_Frame1, + METATILE_PokemonCenter_Elevator1F_Tile1_Frame0 }; static const u16 sElevatorMetatiles_1F_2[ESCALATOR_STAGES] = { - METATILE_ID(PokemonCenter, Elevator1F_Tile2_Frame2), - METATILE_ID(PokemonCenter, Elevator1F_Tile2_Frame1), - METATILE_ID(PokemonCenter, Elevator1F_Tile2_Frame0) + METATILE_PokemonCenter_Elevator1F_Tile2_Frame2, + METATILE_PokemonCenter_Elevator1F_Tile2_Frame1, + METATILE_PokemonCenter_Elevator1F_Tile2_Frame0 }; static const u16 sElevatorMetatiles_1F_3[ESCALATOR_STAGES] = { - METATILE_ID(PokemonCenter, Elevator1F_Tile3_Frame2), - METATILE_ID(PokemonCenter, Elevator1F_Tile3_Frame1), - METATILE_ID(PokemonCenter, Elevator1F_Tile3_Frame0) + METATILE_PokemonCenter_Elevator1F_Tile3_Frame2, + METATILE_PokemonCenter_Elevator1F_Tile3_Frame1, + METATILE_PokemonCenter_Elevator1F_Tile3_Frame0 }; static const u16 sElevatorMetatiles_2F_0[ESCALATOR_STAGES] = { - METATILE_ID(PokemonCenter, Elevator2F_Tile0_Frame0), - METATILE_ID(PokemonCenter, Elevator2F_Tile0_Frame1), - METATILE_ID(PokemonCenter, Elevator2F_Tile0_Frame2) + METATILE_PokemonCenter_Elevator2F_Tile0_Frame0, + METATILE_PokemonCenter_Elevator2F_Tile0_Frame1, + METATILE_PokemonCenter_Elevator2F_Tile0_Frame2 }; static const u16 sElevatorMetatiles_2F_1[ESCALATOR_STAGES] = { - METATILE_ID(PokemonCenter, Elevator2F_Tile1_Frame0), - METATILE_ID(PokemonCenter, Elevator2F_Tile1_Frame1), - METATILE_ID(PokemonCenter, Elevator2F_Tile1_Frame2) + METATILE_PokemonCenter_Elevator2F_Tile1_Frame0, + METATILE_PokemonCenter_Elevator2F_Tile1_Frame1, + METATILE_PokemonCenter_Elevator2F_Tile1_Frame2 }; static const u16 sElevatorMetatiles_2F_2[ESCALATOR_STAGES] = { - METATILE_ID(PokemonCenter, Elevator2F_Tile2_Frame0), - METATILE_ID(PokemonCenter, Elevator2F_Tile2_Frame1), - METATILE_ID(PokemonCenter, Elevator2F_Tile2_Frame2) + METATILE_PokemonCenter_Elevator2F_Tile2_Frame0, + METATILE_PokemonCenter_Elevator2F_Tile2_Frame1, + METATILE_PokemonCenter_Elevator2F_Tile2_Frame2 }; #define tState data[0] diff --git a/src/mirage_tower.c b/src/mirage_tower.c index 2a6d6d6c4..f61f7b988 100644 --- a/src/mirage_tower.c +++ b/src/mirage_tower.c @@ -110,24 +110,24 @@ const struct SpriteSheet gMirageTowerCeilingCrumbleSpriteSheets[] = static const struct MetatileCoords sInvisibleMirageTowerMetatiles[] = { - {18, 53, METATILE_ID(Mauville, DeepSand_Center)}, - {19, 53, METATILE_ID(Mauville, DeepSand_Center)}, - {20, 53, METATILE_ID(Mauville, DeepSand_Center)}, - {18, 54, METATILE_ID(Mauville, DeepSand_Center)}, - {19, 54, METATILE_ID(Mauville, DeepSand_Center)}, - {20, 54, METATILE_ID(Mauville, DeepSand_Center)}, - {18, 55, METATILE_ID(Mauville, DeepSand_Center)}, - {19, 55, METATILE_ID(Mauville, DeepSand_Center)}, - {20, 55, METATILE_ID(Mauville, DeepSand_Center)}, - {18, 56, METATILE_ID(Mauville, DeepSand_Center)}, - {19, 56, METATILE_ID(Mauville, DeepSand_Center)}, - {20, 56, METATILE_ID(Mauville, DeepSand_Center)}, - {18, 57, METATILE_ID(Mauville, DeepSand_BottomMid)}, - {19, 57, METATILE_ID(Mauville, DeepSand_BottomMid)}, - {20, 57, METATILE_ID(Mauville, DeepSand_BottomMid)}, - {18, 58, METATILE_ID(General, SandPit_Center)}, - {19, 58, METATILE_ID(General, SandPit_Center)}, - {20, 58, METATILE_ID(General, SandPit_Center)}, + {18, 53, METATILE_Mauville_DeepSand_Center}, + {19, 53, METATILE_Mauville_DeepSand_Center}, + {20, 53, METATILE_Mauville_DeepSand_Center}, + {18, 54, METATILE_Mauville_DeepSand_Center}, + {19, 54, METATILE_Mauville_DeepSand_Center}, + {20, 54, METATILE_Mauville_DeepSand_Center}, + {18, 55, METATILE_Mauville_DeepSand_Center}, + {19, 55, METATILE_Mauville_DeepSand_Center}, + {20, 55, METATILE_Mauville_DeepSand_Center}, + {18, 56, METATILE_Mauville_DeepSand_Center}, + {19, 56, METATILE_Mauville_DeepSand_Center}, + {20, 56, METATILE_Mauville_DeepSand_Center}, + {18, 57, METATILE_Mauville_DeepSand_BottomMid}, + {19, 57, METATILE_Mauville_DeepSand_BottomMid}, + {20, 57, METATILE_Mauville_DeepSand_BottomMid}, + {18, 58, METATILE_General_SandPit_Center}, + {19, 58, METATILE_General_SandPit_Center}, + {20, 58, METATILE_General_SandPit_Center}, }; static const union AnimCmd gSpriteAnim_8617DEC[] = From 1ce929157f6e6825b54ce39d73a41374534998c6 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 2 Jul 2020 04:59:52 -0400 Subject: [PATCH 7/9] Clean up field effect doc --- data/field_effect_scripts.s | 74 +++++++------- data/scripts/field_move_scripts.inc | 11 +- data/scripts/flash.inc | 2 +- .../palettes/{02.pal => ash.pal} | 0 .../palettes/{06.pal => cut_grass.pal} | 0 .../palettes/{00.pal => general_0.pal} | 0 .../palettes/{01.pal => general_1.pal} | 0 .../palettes/{05.pal => hof_monitor.pal} | 0 .../palettes/{10.pal => pokeball.pal} | 0 .../palettes/{04.pal => pokeball_glow.pal} | 0 .../{07.pal => secret_power_cave.pal} | 0 .../{08.pal => secret_power_plant.pal} | 0 .../palettes/{03.pal => small_sparkle.pal} | 0 graphics/field_effects/pics/sand_pillar.png | Bin 673 -> 0 bytes .../pics/{unknown_19.png => unused_sand.png} | Bin include/battle_transition.h | 2 +- include/constants/field_effects.h | 34 +++---- include/event_object_movement.h | 2 +- include/event_scripts.h | 7 +- include/fldeff.h | 13 +-- spritesheet_rules.mk | 5 +- src/battle_transition.c | 26 ++--- .../field_effect_object_template_pointers.h | 8 +- src/data/field_effects/field_effect_objects.h | 95 +++++++++--------- .../object_events/object_event_graphics.h | 14 +-- src/event_object_movement.c | 2 +- src/faraway_island.c | 6 +- src/field_effect.c | 48 ++++----- src/field_effect_helpers.c | 18 ++-- src/field_screen_effect.c | 2 - src/field_special_scene.c | 24 ++--- src/fldeff_cut.c | 10 +- src/fldeff_dig.c | 14 +-- src/fldeff_flash.c | 2 +- src/fldeff_misc.c | 31 +++--- src/fldeff_rocksmash.c | 2 +- src/fldeff_strength.c | 19 ++-- 37 files changed, 226 insertions(+), 245 deletions(-) rename graphics/field_effects/palettes/{02.pal => ash.pal} (100%) rename graphics/field_effects/palettes/{06.pal => cut_grass.pal} (100%) rename graphics/field_effects/palettes/{00.pal => general_0.pal} (100%) rename graphics/field_effects/palettes/{01.pal => general_1.pal} (100%) rename graphics/field_effects/palettes/{05.pal => hof_monitor.pal} (100%) rename graphics/field_effects/palettes/{10.pal => pokeball.pal} (100%) rename graphics/field_effects/palettes/{04.pal => pokeball_glow.pal} (100%) rename graphics/field_effects/palettes/{07.pal => secret_power_cave.pal} (100%) rename graphics/field_effects/palettes/{08.pal => secret_power_plant.pal} (100%) rename graphics/field_effects/palettes/{03.pal => small_sparkle.pal} (100%) delete mode 100644 graphics/field_effects/pics/sand_pillar.png rename graphics/field_effects/pics/{unknown_19.png => unused_sand.png} (100%) diff --git a/data/field_effect_scripts.s b/data/field_effect_scripts.s index 23b184122..5c637615d 100644 --- a/data/field_effect_scripts.s +++ b/data/field_effect_scripts.s @@ -24,9 +24,9 @@ gFieldEffectScriptPointers:: @ 82DB9D4 .4byte gFieldEffectScript_JumpSmallSplash @ FLDEFF_JUMP_SMALL_SPLASH .4byte gFieldEffectScript_LongGrass @ FLDEFF_LONG_GRASS .4byte gFieldEffectScript_JumpLongGrass @ FLDEFF_JUMP_LONG_GRASS - .4byte gFieldEffectScript_Unknown19 @ FLDEFF_UNKNOWN_19 + .4byte gFieldEffectScript_UnusedGrass @ FLDEFF_UNUSED_GRASS .4byte gFieldEffectScript_UnusedGrass2 @ FLDEFF_UNUSED_GRASS_2 - .4byte gFieldEffectScript_Unknown21 @ FLDEFF_UNKNOWN_21 + .4byte gFieldEffectScript_UnusedSand @ FLDEFF_UNUSED_SAND .4byte gFieldEffectScript_WaterSurfacing @ FLDEFF_WATER_SURFACING .4byte gFieldEffectScript_BerryTreeGrowthSparkle @ FLDEFF_BERRY_TREE_GROWTH_SPARKLE .4byte gFieldEffectScript_DeepSandFootprints @ FLDEFF_DEEP_SAND_FOOTPRINTS @@ -90,11 +90,11 @@ gFieldEffectScript_Shadow:: @ 82DBAF2 field_eff_end gFieldEffectScript_TallGrass:: @ 82DBAF8 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo1, FldEff_TallGrass + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect1, FldEff_TallGrass field_eff_end gFieldEffectScript_Ripple:: @ 82DBB02 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo1, FldEff_Ripple + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect1, FldEff_Ripple field_eff_end gFieldEffectScript_FieldMoveShowMon:: @ 82DBB0C @@ -102,7 +102,7 @@ gFieldEffectScript_FieldMoveShowMon:: @ 82DBB0C field_eff_end gFieldEffectScript_Ash:: @ 82DBB12 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo1, FldEff_Ash + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect1, FldEff_Ash field_eff_end gFieldEffectScript_SurfBlob:: @ 82DBB1C @@ -114,7 +114,7 @@ gFieldEffectScript_UseSurf:: @ 82DBB22 field_eff_end gFieldEffectScript_GroundImpactDust:: @ 82DBB28 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_Dust + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_Dust field_eff_end gFieldEffectScript_UseSecretPowerCave:: @ 82DBB32 @@ -122,47 +122,47 @@ gFieldEffectScript_UseSecretPowerCave:: @ 82DBB32 field_eff_end gFieldEffectScript_JumpTallGrass:: @ 82DBB38 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo1, FldEff_JumpTallGrass + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect1, FldEff_JumpTallGrass field_eff_end gFieldEffectScript_SandFootprints:: @ 82DBB42 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_SandFootprints + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_SandFootprints field_eff_end gFieldEffectScript_JumpBigSplash:: @ 82DBB4C - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_JumpBigSplash + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_JumpBigSplash field_eff_end gFieldEffectScript_Splash:: @ 82DBB56 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_Splash + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_Splash field_eff_end gFieldEffectScript_JumpSmallSplash:: @ 82DBB60 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_JumpSmallSplash + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_JumpSmallSplash field_eff_end gFieldEffectScript_LongGrass:: @ 82DBB6A - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo1, FldEff_LongGrass + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect1, FldEff_LongGrass field_eff_end gFieldEffectScript_JumpLongGrass:: @ 82DBB74 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo1, FldEff_JumpLongGrass + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect1, FldEff_JumpLongGrass field_eff_end -gFieldEffectScript_Unknown19:: @ 82DBB7E - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo1, FldEff_Unknown19 +gFieldEffectScript_UnusedGrass:: @ 82DBB7E + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect1, FldEff_UnusedGrass field_eff_end gFieldEffectScript_UnusedGrass2:: @ 82DBB88 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo1, FldEff_UnusedGrass2 + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect1, FldEff_UnusedGrass2 field_eff_end -gFieldEffectScript_Unknown21:: @ 82DBB92 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_Unknown21 +gFieldEffectScript_UnusedSand:: @ 82DBB92 + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_UnusedSand field_eff_end gFieldEffectScript_WaterSurfacing:: @ 82DBB9C - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_WaterSurfacing + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_WaterSurfacing field_eff_end gFieldEffectScript_BerryTreeGrowthSparkle:: @ 82DBBA6 @@ -170,12 +170,12 @@ gFieldEffectScript_BerryTreeGrowthSparkle:: @ 82DBBA6 field_eff_end gFieldEffectScript_DeepSandFootprints:: @ 82DBBAC - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_DeepSandFootprints + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_DeepSandFootprints field_eff_end gFieldEffectScript_PokeCenterHeal:: @ 82DBBB6 - field_eff_loadfadedpal gFieldEffectObjectPaletteInfo4 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_PokecenterHeal + field_eff_loadfadedpal gSpritePalette_PokeballGlow + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_PokecenterHeal field_eff_end gFieldEffectScript_UseSecretPowerTree:: @ 82DBBC5 @@ -211,11 +211,11 @@ gFieldEffectScript_QuestionMarkIcon:: @ 82DBBEF field_eff_end gFieldEffectScript_FeetInFlowingWater:: @ 82DBBF5 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_FeetInFlowingWater + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_FeetInFlowingWater field_eff_end gFieldEffectScript_BikeTireTracks:: @ 82DBBFF - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_BikeTireTracks + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_BikeTireTracks field_eff_end gFieldEffectScript_SandDisguisePlaceholder:: @ 82DBC09 @@ -227,7 +227,7 @@ gFieldEffectScript_UseRockSmash:: @ 82DBC0F field_eff_end gFieldEffectScript_UseStrength:: @ 82DBC15 - field_eff_callnative sub_8145E2C + field_eff_callnative FldEff_UseStrength field_eff_end gFieldEffectScript_UseDig:: @ 82DBC1B @@ -235,15 +235,15 @@ gFieldEffectScript_UseDig:: @ 82DBC1B field_eff_end gFieldEffectScript_SandPile:: @ 82DBC21 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_SandPile + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_SandPile field_eff_end gFieldEffectScript_ShortGrass:: @ 82DBC2B - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo1, FldEff_ShortGrass + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect1, FldEff_ShortGrass field_eff_end gFieldEffectScript_HotSpringsWater:: @ 82DBC35 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo1, FldEff_HotSpringsWater + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect1, FldEff_HotSpringsWater field_eff_end gFieldEffectScript_UseWaterfall:: @ 82DBC3F @@ -255,12 +255,12 @@ gFieldEffectScript_UseDive:: @ 82DBC45 field_eff_end gFieldEffectScript_Pokeball:: @ 82DBC4B - field_eff_loadpal gFieldEffectObjectPaletteInfo10 + field_eff_loadpal gSpritePalette_Pokeball field_eff_callnative FldEff_Pokeball field_eff_end gFieldEffectScript_HeartIcon:: @ 82DBC56 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_HeartIcon + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_HeartIcon field_eff_end gFieldEffectScript_Nop47:: @ 82DBC60 @@ -272,11 +272,11 @@ gFieldEffectScript_Nop48:: @ 82DBC66 field_eff_end gFieldEffectScript_AshPuff:: @ 82DBC6C - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo2, FldEff_AshPuff + field_eff_loadfadedpal_callnative gSpritePalette_Ash, FldEff_AshPuff field_eff_end gFieldEffectScript_AshLaunch:: @ 82DBC76 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo2, FldEff_AshLaunch + field_eff_loadfadedpal_callnative gSpritePalette_Ash, FldEff_AshLaunch field_eff_end gFieldEffectScript_SweetScent:: @ 82DBC80 @@ -288,11 +288,11 @@ gFieldEffectScript_SandPillar:: @ 82DBC86 field_eff_end gFieldEffectScript_Bubbles:: @ 82DBC90 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_Bubbles + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_Bubbles field_eff_end gFieldEffectScript_Sparkle:: @ 82DBC9A - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo3, FldEff_Sparkle + field_eff_loadfadedpal_callnative gSpritePalette_SmallSparkle, FldEff_Sparkle field_eff_end gFieldEffectScript_ShowSecretPowerCave:: @ 82DBCA4 @@ -308,7 +308,7 @@ gFieldEffectScript_ShowSecretPowerShrub:: @ 82DBCB8 field_eff_end gFieldEffectScript_ShowCutGrass:: @ 82DBCC2 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo6, FldEff_CutGrass + field_eff_loadfadedpal_callnative gSpritePalette_CutGrass, FldEff_CutGrass field_eff_end gFieldEffectScript_FieldMoveShowMonInit:: @ 82DBCCC @@ -324,8 +324,8 @@ gFieldEffectScript_SecretBaseBootPC:: @ 82DBCD8 field_eff_end gFieldEffectScript_HallOfFameRecord:: @ 82DBCDE - field_eff_loadfadedpal gFieldEffectObjectPaletteInfo4 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo5, FldEff_HallOfFameRecord + field_eff_loadfadedpal gSpritePalette_PokeballGlow + field_eff_loadfadedpal_callnative gSpritePalette_HofMonitor, FldEff_HallOfFameRecord field_eff_end gFieldEffectScript_UseTeleport:: @ 82DBCED diff --git a/data/scripts/field_move_scripts.inc b/data/scripts/field_move_scripts.inc index c5647daa4..2d689348b 100644 --- a/data/scripts/field_move_scripts.inc +++ b/data/scripts/field_move_scripts.inc @@ -1,4 +1,4 @@ - +@ Interact with cuttable tree EventScript_CutTree:: @ 82906BB lockall goto_if_unset FLAG_BADGE01_GET, EventScript_CheckTreeCantCut @@ -18,7 +18,8 @@ EventScript_CutTree:: @ 82906BB goto EventScript_CutTreeDown end -EventScript_FldEffCut:: @ 8290705 +@ Use cut from party menu +EventScript_UseCut:: @ 8290705 lockall dofieldeffect FLDEFF_USE_CUT_ON_TREE waitstate @@ -58,6 +59,7 @@ Text_CantCut: @ 829077D .string "This tree looks like it can be\n" .string "CUT down!$" +@ Interact with smashable rock EventScript_RockSmash:: @ 82907A6 lockall goto_if_unset FLAG_BADGE03_GET, EventScript_CantSmashRock @@ -77,7 +79,8 @@ EventScript_RockSmash:: @ 82907A6 goto EventScript_SmashRock end -EventScript_RockSmashFromPartyMenu:: @ 82907F0 +@ Use rock smash from party menu +EventScript_UseRockSmash:: @ 82907F0 lockall dofieldeffect FLDEFF_USE_ROCK_SMASH waitstate @@ -141,7 +144,7 @@ EventScript_StrengthBoulder:: @ 82908BA goto EventScript_ActivateStrength end -EventScript_FldEffStrength:: @ 82908FD +EventScript_UseStrength:: @ 82908FD lockall dofieldeffect FLDEFF_USE_STRENGTH waitstate diff --git a/data/scripts/flash.inc b/data/scripts/flash.inc index 916b50719..bb4ae84eb 100644 --- a/data/scripts/flash.inc +++ b/data/scripts/flash.inc @@ -1,4 +1,4 @@ -EventScript_FldEffFlash:: @ 82926F8 +EventScript_UseFlash:: @ 82926F8 animateflash 1 setflashradius 1 end diff --git a/graphics/field_effects/palettes/02.pal b/graphics/field_effects/palettes/ash.pal similarity index 100% rename from graphics/field_effects/palettes/02.pal rename to graphics/field_effects/palettes/ash.pal diff --git a/graphics/field_effects/palettes/06.pal b/graphics/field_effects/palettes/cut_grass.pal similarity index 100% rename from graphics/field_effects/palettes/06.pal rename to graphics/field_effects/palettes/cut_grass.pal diff --git a/graphics/field_effects/palettes/00.pal b/graphics/field_effects/palettes/general_0.pal similarity index 100% rename from graphics/field_effects/palettes/00.pal rename to graphics/field_effects/palettes/general_0.pal diff --git a/graphics/field_effects/palettes/01.pal b/graphics/field_effects/palettes/general_1.pal similarity index 100% rename from graphics/field_effects/palettes/01.pal rename to graphics/field_effects/palettes/general_1.pal diff --git a/graphics/field_effects/palettes/05.pal b/graphics/field_effects/palettes/hof_monitor.pal similarity index 100% rename from graphics/field_effects/palettes/05.pal rename to graphics/field_effects/palettes/hof_monitor.pal diff --git a/graphics/field_effects/palettes/10.pal b/graphics/field_effects/palettes/pokeball.pal similarity index 100% rename from graphics/field_effects/palettes/10.pal rename to graphics/field_effects/palettes/pokeball.pal diff --git a/graphics/field_effects/palettes/04.pal b/graphics/field_effects/palettes/pokeball_glow.pal similarity index 100% rename from graphics/field_effects/palettes/04.pal rename to graphics/field_effects/palettes/pokeball_glow.pal diff --git a/graphics/field_effects/palettes/07.pal b/graphics/field_effects/palettes/secret_power_cave.pal similarity index 100% rename from graphics/field_effects/palettes/07.pal rename to graphics/field_effects/palettes/secret_power_cave.pal diff --git a/graphics/field_effects/palettes/08.pal b/graphics/field_effects/palettes/secret_power_plant.pal similarity index 100% rename from graphics/field_effects/palettes/08.pal rename to graphics/field_effects/palettes/secret_power_plant.pal diff --git a/graphics/field_effects/palettes/03.pal b/graphics/field_effects/palettes/small_sparkle.pal similarity index 100% rename from graphics/field_effects/palettes/03.pal rename to graphics/field_effects/palettes/small_sparkle.pal diff --git a/graphics/field_effects/pics/sand_pillar.png b/graphics/field_effects/pics/sand_pillar.png deleted file mode 100644 index 1f56c00fcc0ad4b9f36fc9ce748127eba55972ce..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 673 zcmeAS@N?(olHy`uVBq!ia0vp^20*O9!VDyr{d%Skq*&4&eH|GXHuiJ>Nn`~{CVK?= zGB8xBF)%c=FfjZA3N^f7U?>G@e3ih!U^Rn*LA+qju0R{0glK?Ih-=W6pe;+1ii?Y{ z9_^me>=+aj^#A|=(qczXpaRAuZ+92A#Izl?Kn{C}r>`sf6E<04YeviG-hn_Nf#gKL zG7t^K3P217sRx*^0=4FPx;TbtoL@W9vFNq|kE>(%O>U;m+t-xDi&!y4Hvc|zW8eSK zUyhcKPx?$d+9o7t_kmOB@BN5#_RI9u{~CMznrDAf>Dzbp1z9!>XYU_STl6+yN#nj2 z`Lvj6T`9|UUh@8>cxDgNl5{)UleZ?sXLIzus`+B2dq#WQZd+rwX!-Bb{l`5gdsh5u)zV*^e{^>B>&i{Xepz4qwZnSd4fDEN=WYc|=A4?N z6JSuLTsv>Wu16vauWL1*-Q8j$U#2TG+vr+PSnJM~x4uVH_*-W<{uJBA7;)v;2klw) zjkXMTRvzOqyjFKu|8SW`4!^6g^Y6Oksh8L;B>#B$>MxuAj_cJs9z}R=ITU_=#WDS~ z9q!B4pJo0!%h=|sPr=0p&pzw6^xA*ilJN0gzu@}GMaMQ@w*MjL`?fsAbptR4R7+eV zN>UO_QmvAUQh^kMk%5tcu7R1Zk!6UXrIoRnm5H&ofq|8Q!Q#VG?kE~^^HVa@DsgML TG;h&wP#k-@`njxgN@xNAt-cCp diff --git a/graphics/field_effects/pics/unknown_19.png b/graphics/field_effects/pics/unused_sand.png similarity index 100% rename from graphics/field_effects/pics/unknown_19.png rename to graphics/field_effects/pics/unused_sand.png diff --git a/include/battle_transition.h b/include/battle_transition.h index 0f583b101..b2e5efdc9 100644 --- a/include/battle_transition.h +++ b/include/battle_transition.h @@ -9,7 +9,7 @@ bool8 FldEff_Pokeball(void); void TransitionPhase1_Task_RunFuncs(u8 taskId); void GetBg0TilesDst(u16 **tilemap, u16 **tileset); -extern const struct SpritePalette gFieldEffectObjectPaletteInfo10; +extern const struct SpritePalette gSpritePalette_Pokeball; enum // TRANSITION_MUGSHOT { diff --git a/include/constants/field_effects.h b/include/constants/field_effects.h index 7032bc826..dc1085f7c 100644 --- a/include/constants/field_effects.h +++ b/include/constants/field_effects.h @@ -20,9 +20,9 @@ #define FLDEFF_JUMP_SMALL_SPLASH 16 #define FLDEFF_LONG_GRASS 17 #define FLDEFF_JUMP_LONG_GRASS 18 -#define FLDEFF_UNKNOWN_19 19 +#define FLDEFF_UNUSED_GRASS 19 #define FLDEFF_UNUSED_GRASS_2 20 -#define FLDEFF_UNKNOWN_21 21 +#define FLDEFF_UNUSED_SAND 21 #define FLDEFF_WATER_SURFACING 22 #define FLDEFF_BERRY_TREE_GROWTH_SPARKLE 23 #define FLDEFF_DEEP_SAND_FOOTPRINTS 24 @@ -86,9 +86,9 @@ #define FLDEFFOBJ_JUMP_SMALL_SPLASH 14 #define FLDEFFOBJ_LONG_GRASS 15 #define FLDEFFOBJ_JUMP_LONG_GRASS 16 -#define FLDEFFOBJ_17 17 +#define FLDEFFOBJ_UNUSED_GRASS 17 #define FLDEFFOBJ_UNUSED_GRASS_2 18 -#define FLDEFFOBJ_19 19 +#define FLDEFFOBJ_UNUSED_SAND 19 #define FLDEFFOBJ_WATER_SURFACING 20 #define FLDEFFOBJ_REFLECTION_DISTORTION 21 #define FLDEFFOBJ_SPARKLE 22 @@ -107,19 +107,17 @@ #define FLDEFFOBJ_SMALL_SPARKLE 35 #define FLDEFFOBJ_RAYQUAZA 36 -#define FLDEFF_PAL_TAG_0 0x1000 -#define FLDEFF_PAL_TAG_3 0x1003 -#define FLDEFF_PAL_TAG_4 0x1004 -#define FLDEFF_PAL_TAG_5 0x1005 -#define FLDEFF_PAL_TAG_6 0x1006 -#define FLDEFF_PAL_TAG_7 0x1007 -#define FLDEFF_PAL_TAG_8 0x1008 -#define FLDEFF_PAL_TAG_9 0x1009 -#define FLDEFF_PAL_TAG_10 0x100A -#define FLDEFF_PAL_TAG_13 0x100D -#define FLDEFF_PAL_TAG_14 0x100E -#define FLDEFF_PAL_TAG_15 0x100F -#define FLDEFF_PAL_TAG_16 0x1010 -#define FLDEFF_PAL_TAG_17 0x1011 +#define FLDEFF_PAL_TAG_CUT_GRASS 0x1000 +#define FLDEFF_PAL_TAG_SECRET_POWER_TREE 0x1003 +#define FLDEFF_PAL_TAG_GENERAL_0 0x1004 +#define FLDEFF_PAL_TAG_GENERAL_1 0x1005 +#define FLDEFF_PAL_TAG_POKEBALL_GLOW 0x1007 +#define FLDEFF_PAL_TAG_SECRET_POWER_PLANT 0x1008 +#define FLDEFF_PAL_TAG_POKEBALL 0x1009 +#define FLDEFF_PAL_TAG_ASH 0x100D +#define FLDEFF_PAL_TAG_SAND_PILLAR 0x100E +#define FLDEFF_PAL_TAG_SMALL_SPARKLE 0x100F +#define FLDEFF_PAL_TAG_HOF_MONITOR 0x1010 +#define FLDEFF_PAL_TAG_UNKNOWN 0x1011 #endif // GUARD_FIELD_EFFECT_CONSTANTS_H diff --git a/include/event_object_movement.h b/include/event_object_movement.h index fa7cedff0..28443864d 100644 --- a/include/event_object_movement.h +++ b/include/event_object_movement.h @@ -100,7 +100,7 @@ void ObjectEventTurnByLocalIdAndMap(u8, u8, u8, u8); const struct ObjectEventGraphicsInfo *GetObjectEventGraphicsInfo(u8 graphicsId); void npc_by_local_id_and_map_set_field_1_bit_x20(u8, u8, u8, u8); void FreeAndReserveObjectSpritePalettes(void); -void sub_808E82C(u8, u8, u8, s16, s16); +void SetObjectEventSpritePosByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup, s16 x, s16 y); void sub_808E7E4(u8, u8, u8); void sub_808E78C(u8, u8, u8, u8); void sub_808E75C(s16, s16); diff --git a/include/event_scripts.h b/include/event_scripts.h index 8495b7ee1..3c4380108 100644 --- a/include/event_scripts.h +++ b/include/event_scripts.h @@ -372,10 +372,11 @@ extern const u8 SecretBase_Text_Trainer8Defeated[]; extern const u8 SecretBase_Text_Trainer9Defeated[]; //field effects -extern const u8 EventScript_FldEffStrength[]; +extern const u8 EventScript_UseStrength[]; extern const u8 EventScript_FailSweetScent[]; -extern const u8 EventScript_FldEffFlash[]; -extern const u8 EventScript_RockSmashFromPartyMenu[]; +extern const u8 EventScript_UseFlash[]; +extern const u8 EventScript_UseCut[]; +extern const u8 EventScript_UseRockSmash[]; //player pc extern const u8 LittlerootTown_BrendansHouse_2F_EventScript_TurnOffPlayerPC[]; diff --git a/include/fldeff.h b/include/fldeff.h index 99bcdafaf..597ce6f47 100644 --- a/include/fldeff.h +++ b/include/fldeff.h @@ -9,18 +9,9 @@ bool8 FldEff_CutGrass(void); void FixLongGrassMetatilesWindowTop(s16 x, s16 y); void FixLongGrassMetatilesWindowBottom(s16 x, s16 y); -extern const struct SpritePalette gFieldEffectObjectPaletteInfo6; +extern const struct SpritePalette gSpritePalette_CutGrass; extern struct MapPosition gPlayerFacingPosition; -// groundshake -bool8 sub_81BE66C(void); -void sub_81BE6AC(void); -void sub_81BE6B8(void); -void sub_81BE72C(void); -void sub_81BE79C(void); -void sub_81BE7F4(void); -void sub_81BE994(void); - // escalator void StartEscalator(bool8 var); void StopEscalator(void); @@ -39,7 +30,7 @@ bool8 GetMapPairFadeFromType(u8 a1, u8 a2); // strength bool8 SetUpFieldMove_Strength(void); -bool8 sub_8145E2C(void); +bool8 FldEff_UseStrength(void); // sweet scent bool8 SetUpFieldMove_SweetScent(void); diff --git a/spritesheet_rules.mk b/spritesheet_rules.mk index 1c858899c..ae7971960 100644 --- a/spritesheet_rules.mk +++ b/spritesheet_rules.mk @@ -645,7 +645,7 @@ $(FLDEFFGFXDIR)/unknown_17.4bpp: %.4bpp: %.png $(FLDEFFGFXDIR)/unused_grass_2.4bpp: %.4bpp: %.png $(GFX) $< $@ -mwidth 2 -mheight 2 -$(FLDEFFGFXDIR)/unknown_19.4bpp: %.4bpp: %.png +$(FLDEFFGFXDIR)/unused_sand.4bpp: %.4bpp: %.png $(GFX) $< $@ -mwidth 2 -mheight 2 $(FLDEFFGFXDIR)/water_surfacing.4bpp: %.4bpp: %.png @@ -672,8 +672,5 @@ $(FLDEFFGFXDIR)/secret_power_shrub.4bpp: %.4bpp: %.png $(FLDEFFGFXDIR)/secret_power_tree.4bpp: %.4bpp: %.png $(GFX) $< $@ -mwidth 2 -mheight 2 -$(FLDEFFGFXDIR)/sand_pillar.4bpp: %.4bpp: %.png - $(GFX) $< $@ -mwidth 2 -mheight 4 - $(FLDEFFGFXDIR)/record_mix_lights.4bpp: %.4bpp: %.png $(GFX) $< $@ -mwidth 4 -mheight 1 diff --git a/src/battle_transition.c b/src/battle_transition.c index 3e8dbb4e0..8655c9e0e 100644 --- a/src/battle_transition.c +++ b/src/battle_transition.c @@ -749,7 +749,7 @@ static const union AffineAnimCmd *const sSpriteAffineAnimTable_Pokeball[] = static const struct SpriteTemplate sSpriteTemplate_Pokeball = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_9, + .paletteTag = FLDEFF_PAL_TAG_POKEBALL, .oam = &gObjectEventBaseOam_32x32, .anims = sSpriteAnimTable_Pokeball, .images = sSpriteImage_Pokeball, @@ -798,7 +798,7 @@ static const union AnimCmd *const sSpriteAnimTable_UnusedBrendanLass[] = static const struct SpriteTemplate sSpriteTemplate_UnusedBrendan = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_10, + .paletteTag = 0x100A, .oam = &sOam_UnusedBrendanLass, .anims = sSpriteAnimTable_UnusedBrendanLass, .images = sImageTable_UnusedBrendan, @@ -809,7 +809,7 @@ static const struct SpriteTemplate sSpriteTemplate_UnusedBrendan = static const struct SpriteTemplate sSpriteTemplate_UnusedLass = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_10, + .paletteTag = 0x100A, .oam = &sOam_UnusedBrendanLass, .anims = sSpriteAnimTable_UnusedBrendanLass, .images = sImageTable_UnusedLass, @@ -817,12 +817,9 @@ static const struct SpriteTemplate sSpriteTemplate_UnusedLass = .callback = SpriteCb_TrainerPic }; -static const u16 gFieldEffectObjectPalette10[] = INCBIN_U16("graphics/field_effects/palettes/10.gbapal"); +static const u16 sFieldEffectPal_Pokeball[] = INCBIN_U16("graphics/field_effects/palettes/pokeball.gbapal"); -const struct SpritePalette gFieldEffectObjectPaletteInfo10 = -{ - gFieldEffectObjectPalette10, FLDEFF_PAL_TAG_9 -}; +const struct SpritePalette gSpritePalette_Pokeball = {sFieldEffectPal_Pokeball, FLDEFF_PAL_TAG_POKEBALL}; static const u16 sMugshotPal_Sidney[] = INCBIN_U16("graphics/battle_transitions/sidney_bg.gbapal"); static const u16 sMugshotPal_Phoebe[] = INCBIN_U16("graphics/battle_transitions/phoebe_bg.gbapal"); @@ -848,10 +845,7 @@ static const u16 *const sPlayerMugshotsPals[GENDER_COUNT] = }; static const u16 sUnusedTrainerPalette[] = INCBIN_U16("graphics/battle_transitions/unused_trainer.gbapal"); -static const struct SpritePalette sSpritePalette_UnusedTrainer = -{ - sUnusedTrainerPalette, FLDEFF_PAL_TAG_10 -}; +static const struct SpritePalette sSpritePalette_UnusedTrainer = {sUnusedTrainerPalette, 0x100A}; static const u16 sBigPokeball_Tilemap[] = INCBIN_U16("graphics/battle_transitions/big_pokeball_map.bin"); static const u16 sMugshotsTilemap[] = INCBIN_U16("graphics/battle_transitions/elite_four_bg_map.bin"); @@ -1323,7 +1317,7 @@ static bool8 Phase2_BigPokeball_Func1(struct Task *task) GetBg0TilesDst(&tilemap, &tileset); CpuFill16(0, tilemap, 0x800); CpuCopy16(sBigPokeball_Tileset, tileset, 0x580); - LoadPalette(gFieldEffectObjectPalette10, 0xF0, 0x20); + LoadPalette(sFieldEffectPal_Pokeball, 0xF0, 0x20); task->tState++; return FALSE; @@ -1629,7 +1623,7 @@ static bool8 Phase2_PokeballsTrail_Func1(struct Task *task) GetBg0TilesDst(&tilemap, &tileset); CpuSet(sPokeballTrail_Tileset, tileset, 0x20); CpuFill32(0, tilemap, 0x800); - LoadPalette(gFieldEffectObjectPalette10, 0xF0, 0x20); + LoadPalette(sFieldEffectPal_Pokeball, 0xF0, 0x20); task->tState++; return FALSE; @@ -2919,7 +2913,7 @@ static bool8 Phase2_RectangularSpiral_Func1(struct Task *task) CpuCopy16(sShrinkingBoxTileset, tileset, 0x20); CpuCopy16(sShrinkingBoxTileset + 0x70, tileset + 0x20, 0x20); CpuFill16(0xF000, tilemap, 0x800); - LoadPalette(gFieldEffectObjectPalette10, 0xF0, 0x20); + LoadPalette(sFieldEffectPal_Pokeball, 0xF0, 0x20); task->tData3 = 1; task->tState++; @@ -3428,7 +3422,7 @@ static bool8 Phase2_GridSquares_Func1(struct Task *task) GetBg0TilesDst(&tilemap, &tileset); CpuSet(sShrinkingBoxTileset, tileset, 0x10); CpuFill16(0xF000, tilemap, 0x800); - LoadPalette(gFieldEffectObjectPalette10, 0xF0, 0x20); + LoadPalette(sFieldEffectPal_Pokeball, 0xF0, 0x20); task->tState++; return FALSE; diff --git a/src/data/field_effects/field_effect_object_template_pointers.h b/src/data/field_effects/field_effect_object_template_pointers.h index e455daf73..41d6271bf 100755 --- a/src/data/field_effects/field_effect_object_template_pointers.h +++ b/src/data/field_effects/field_effect_object_template_pointers.h @@ -15,9 +15,9 @@ const struct SpriteTemplate gFieldEffectObjectTemplate_Splash; const struct SpriteTemplate gFieldEffectObjectTemplate_JumpSmallSplash; const struct SpriteTemplate gFieldEffectObjectTemplate_LongGrass; const struct SpriteTemplate gFieldEffectObjectTemplate_JumpLongGrass; -const struct SpriteTemplate gFieldEffectObjectTemplate_Unknown17; +const struct SpriteTemplate gFieldEffectObjectTemplate_UnusedGrass; const struct SpriteTemplate gFieldEffectObjectTemplate_UnusedGrass2; -const struct SpriteTemplate gFieldEffectObjectTemplate_Unknown19; +const struct SpriteTemplate gFieldEffectObjectTemplate_UnusedSand; const struct SpriteTemplate gFieldEffectObjectTemplate_WaterSurfacing; const struct SpriteTemplate gFieldEffectObjectTemplate_ReflectionDistortion; const struct SpriteTemplate gFieldEffectObjectTemplate_Sparkle; @@ -54,9 +54,9 @@ const struct SpriteTemplate *const gFieldEffectObjectTemplatePointers[] = { [FLDEFFOBJ_JUMP_SMALL_SPLASH] = &gFieldEffectObjectTemplate_JumpSmallSplash, [FLDEFFOBJ_LONG_GRASS] = &gFieldEffectObjectTemplate_LongGrass, [FLDEFFOBJ_JUMP_LONG_GRASS] = &gFieldEffectObjectTemplate_JumpLongGrass, - [FLDEFFOBJ_17] = &gFieldEffectObjectTemplate_Unknown17, + [FLDEFFOBJ_UNUSED_GRASS] = &gFieldEffectObjectTemplate_UnusedGrass, [FLDEFFOBJ_UNUSED_GRASS_2] = &gFieldEffectObjectTemplate_UnusedGrass2, - [FLDEFFOBJ_19] = &gFieldEffectObjectTemplate_Unknown19, + [FLDEFFOBJ_UNUSED_SAND] = &gFieldEffectObjectTemplate_UnusedSand, [FLDEFFOBJ_WATER_SURFACING] = &gFieldEffectObjectTemplate_WaterSurfacing, [FLDEFFOBJ_REFLECTION_DISTORTION] = &gFieldEffectObjectTemplate_ReflectionDistortion, [FLDEFFOBJ_SPARKLE] = &gFieldEffectObjectTemplate_Sparkle, diff --git a/src/data/field_effects/field_effect_objects.h b/src/data/field_effects/field_effect_objects.h index 071beeecd..1626b9f32 100755 --- a/src/data/field_effects/field_effect_objects.h +++ b/src/data/field_effects/field_effect_objects.h @@ -1,6 +1,5 @@ -const struct SpritePalette gFieldEffectObjectPaletteInfo0 = {gFieldEffectObjectPalette0, FLDEFF_PAL_TAG_4}; - -const struct SpritePalette gFieldEffectObjectPaletteInfo1 = {gFieldEffectObjectPalette1, FLDEFF_PAL_TAG_5}; +const struct SpritePalette gSpritePalette_GeneralFieldEffect0 = {gFieldEffectObjectPalette0, FLDEFF_PAL_TAG_GENERAL_0}; +const struct SpritePalette gSpritePalette_GeneralFieldEffect1 = {gFieldEffectObjectPalette1, FLDEFF_PAL_TAG_GENERAL_1}; static const union AnimCmd sAnim_Shadow[] = { @@ -94,7 +93,7 @@ static const union AnimCmd *const sAnimTable_TallGrass[] = const struct SpriteTemplate gFieldEffectObjectTemplate_TallGrass = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_5, + .paletteTag = FLDEFF_PAL_TAG_GENERAL_1, .oam = &gObjectEventBaseOam_16x16, .anims = sAnimTable_TallGrass, .images = sPicTable_TallGrass, @@ -130,7 +129,7 @@ static const union AnimCmd *const sAnimTable_Ripple[] = const struct SpriteTemplate gFieldEffectObjectTemplate_Ripple = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_5, + .paletteTag = FLDEFF_PAL_TAG_GENERAL_1, .oam = &gObjectEventBaseOam_16x16, .anims = sAnimTable_Ripple, .images = sPicTable_Ripple, @@ -163,7 +162,7 @@ static const union AnimCmd *const sAnimTable_Ash[] = const struct SpriteTemplate gFieldEffectObjectTemplate_Ash = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_5, + .paletteTag = FLDEFF_PAL_TAG_GENERAL_1, .oam = &gObjectEventBaseOam_16x16, .anims = sAnimTable_Ash, .images = sPicTable_Ash, @@ -297,7 +296,7 @@ static const union AnimCmd *const sAnimTable_GroundImpactDust[] = const struct SpriteTemplate gFieldEffectObjectTemplate_GroundImpactDust = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_4, + .paletteTag = FLDEFF_PAL_TAG_GENERAL_0, .oam = &gObjectEventBaseOam_16x8, .anims = sAnimTable_GroundImpactDust, .images = sPicTable_GroundImpactDust, @@ -328,7 +327,7 @@ static const union AnimCmd *const sAnimTable_JumpTallGrass[] = const struct SpriteTemplate gFieldEffectObjectTemplate_JumpTallGrass = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_5, + .paletteTag = FLDEFF_PAL_TAG_GENERAL_1, .oam = &gObjectEventBaseOam_16x8, .anims = sAnimTable_JumpTallGrass, .images = sPicTable_JumpTallGrass, @@ -376,7 +375,7 @@ static const union AnimCmd *const sAnimTable_SandFootprints[] = const struct SpriteTemplate gFieldEffectObjectTemplate_SandFootprints = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_4, + .paletteTag = FLDEFF_PAL_TAG_GENERAL_0, .oam = &gObjectEventBaseOam_16x16, .anims = sAnimTable_SandFootprints, .images = sPicTable_SandFootprints, @@ -424,7 +423,7 @@ static const union AnimCmd *const sAnimTable_DeepSandFootprints[] = const struct SpriteTemplate gFieldEffectObjectTemplate_DeepSandFootprints = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_4, + .paletteTag = FLDEFF_PAL_TAG_GENERAL_0, .oam = &gObjectEventBaseOam_16x16, .anims = sAnimTable_DeepSandFootprints, .images = sPicTable_DeepSandFootprints, @@ -502,7 +501,7 @@ static const union AnimCmd *const sAnimTable_BikeTireTracks[] = const struct SpriteTemplate gFieldEffectObjectTemplate_BikeTireTracks = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_4, + .paletteTag = FLDEFF_PAL_TAG_GENERAL_0, .oam = &gObjectEventBaseOam_16x16, .anims = sAnimTable_BikeTireTracks, .images = sPicTable_BikeTireTracks, @@ -533,7 +532,7 @@ static const union AnimCmd *const sAnimTable_JumpBigSplash[] = const struct SpriteTemplate gFieldEffectObjectTemplate_JumpBigSplash = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_4, + .paletteTag = FLDEFF_PAL_TAG_GENERAL_0, .oam = &gObjectEventBaseOam_16x16, .anims = sAnimTable_JumpBigSplash, .images = sPicTable_JumpBigSplash, @@ -574,7 +573,7 @@ static const union AnimCmd *const sAnimTable_Splash[] = const struct SpriteTemplate gFieldEffectObjectTemplate_Splash = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_4, + .paletteTag = FLDEFF_PAL_TAG_GENERAL_0, .oam = &gObjectEventBaseOam_16x8, .anims = sAnimTable_Splash, .images = sPicTable_Splash, @@ -603,7 +602,7 @@ static const union AnimCmd *const sAnimTable_JumpSmallSplash[] = const struct SpriteTemplate gFieldEffectObjectTemplate_JumpSmallSplash = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_4, + .paletteTag = FLDEFF_PAL_TAG_GENERAL_0, .oam = &gObjectEventBaseOam_16x8, .anims = sAnimTable_JumpSmallSplash, .images = sPicTable_JumpSmallSplash, @@ -637,7 +636,7 @@ static const union AnimCmd *const sAnimTable_LongGrass[] = const struct SpriteTemplate gFieldEffectObjectTemplate_LongGrass = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_5, + .paletteTag = FLDEFF_PAL_TAG_GENERAL_1, .oam = &gObjectEventBaseOam_16x16, .anims = sAnimTable_LongGrass, .images = sPicTable_LongGrass, @@ -672,7 +671,7 @@ static const union AnimCmd *const sAnimTable_JumpLongGrass[] = const struct SpriteTemplate gFieldEffectObjectTemplate_JumpLongGrass = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_5, + .paletteTag = FLDEFF_PAL_TAG_GENERAL_1, .oam = &gObjectEventBaseOam_16x16, .anims = sAnimTable_JumpLongGrass, .images = sPicTable_JumpLongGrass, @@ -680,7 +679,7 @@ const struct SpriteTemplate gFieldEffectObjectTemplate_JumpLongGrass = { .callback = UpdateJumpImpactEffect, }; -static const struct SpriteFrameImage sPicTable_Unknown17[] = { +static const struct SpriteFrameImage sPicTable_UnusedGrass[] = { overworld_frame(gFieldEffectObjectPic_JumpLongGrass, 2, 2, 6), overworld_frame(gFieldEffectObjectPic_Unknown17, 2, 2, 0), overworld_frame(gFieldEffectObjectPic_Unknown17, 2, 2, 1), @@ -692,7 +691,7 @@ static const struct SpriteFrameImage sPicTable_Unknown17[] = { overworld_frame(gFieldEffectObjectPic_Unknown17, 2, 2, 7), }; -static const union AnimCmd sAnim_Unknown17[] = +static const union AnimCmd sAnim_UnusedGrass[] = { ANIMCMD_FRAME(0, 10), ANIMCMD_FRAME(1, 4), @@ -706,17 +705,17 @@ static const union AnimCmd sAnim_Unknown17[] = ANIMCMD_JUMP(7), }; -static const union AnimCmd *const sAnimTable_Unknown17[] = +static const union AnimCmd *const sAnimTable_UnusedGrass[] = { - sAnim_Unknown17, + sAnim_UnusedGrass, }; -const struct SpriteTemplate gFieldEffectObjectTemplate_Unknown17 = { +const struct SpriteTemplate gFieldEffectObjectTemplate_UnusedGrass = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_5, + .paletteTag = FLDEFF_PAL_TAG_GENERAL_1, .oam = &gObjectEventBaseOam_16x16, - .anims = sAnimTable_Unknown17, - .images = sPicTable_Unknown17, + .anims = sAnimTable_UnusedGrass, + .images = sPicTable_UnusedGrass, .affineAnims = gDummySpriteAffineAnimTable, .callback = WaitFieldEffectSpriteAnim, }; @@ -746,7 +745,7 @@ static const union AnimCmd *const sAnimTable_UnusedGrass2[] = const struct SpriteTemplate gFieldEffectObjectTemplate_UnusedGrass2 = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_5, + .paletteTag = FLDEFF_PAL_TAG_GENERAL_1, .oam = &gObjectEventBaseOam_16x16, .anims = sAnimTable_UnusedGrass2, .images = sPicTable_UnusedGrass2, @@ -754,14 +753,14 @@ const struct SpriteTemplate gFieldEffectObjectTemplate_UnusedGrass2 = { .callback = WaitFieldEffectSpriteAnim, }; -static const struct SpriteFrameImage sPicTable_Unknown19[] = { - overworld_frame(gFieldEffectObjectPic_Unknown19, 2, 2, 0), - overworld_frame(gFieldEffectObjectPic_Unknown19, 2, 2, 1), - overworld_frame(gFieldEffectObjectPic_Unknown19, 2, 2, 2), - overworld_frame(gFieldEffectObjectPic_Unknown19, 2, 2, 3), +static const struct SpriteFrameImage sPicTable_UnusedSand[] = { + overworld_frame(gFieldEffectObjectPic_UnusedSand, 2, 2, 0), + overworld_frame(gFieldEffectObjectPic_UnusedSand, 2, 2, 1), + overworld_frame(gFieldEffectObjectPic_UnusedSand, 2, 2, 2), + overworld_frame(gFieldEffectObjectPic_UnusedSand, 2, 2, 3), }; -static const union AnimCmd sAnim_Unknown19[] = +static const union AnimCmd sAnim_UnusedSand[] = { ANIMCMD_FRAME(0, 4), ANIMCMD_FRAME(1, 4), @@ -770,17 +769,17 @@ static const union AnimCmd sAnim_Unknown19[] = ANIMCMD_JUMP(0), }; -static const union AnimCmd *const sAnimTable_Unknown19[] = +static const union AnimCmd *const sAnimTable_UnusedSand[] = { - sAnim_Unknown19, + sAnim_UnusedSand, }; -const struct SpriteTemplate gFieldEffectObjectTemplate_Unknown19 = { +const struct SpriteTemplate gFieldEffectObjectTemplate_UnusedSand = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_4, + .paletteTag = FLDEFF_PAL_TAG_GENERAL_0, .oam = &gObjectEventBaseOam_16x16, - .anims = sAnimTable_Unknown19, - .images = sPicTable_Unknown19, + .anims = sAnimTable_UnusedSand, + .images = sPicTable_UnusedSand, .affineAnims = gDummySpriteAffineAnimTable, .callback = WaitFieldEffectSpriteAnim, }; @@ -806,7 +805,7 @@ static const union AnimCmd *const sAnimTable_SandPile[] = const struct SpriteTemplate gFieldEffectObjectTemplate_SandPile = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_4, + .paletteTag = FLDEFF_PAL_TAG_GENERAL_0, .oam = &gObjectEventBaseOam_16x8, .anims = sAnimTable_SandPile, .images = sPicTable_SandPile, @@ -839,7 +838,7 @@ static const union AnimCmd *const sAnimTable_WaterSurfacing[] = const struct SpriteTemplate gFieldEffectObjectTemplate_WaterSurfacing = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_4, + .paletteTag = FLDEFF_PAL_TAG_GENERAL_0, .oam = &gObjectEventBaseOam_16x16, .anims = sAnimTable_WaterSurfacing, .images = sPicTable_WaterSurfacing, @@ -1092,7 +1091,7 @@ static const union AnimCmd *const sAnimTable_ShortGrass[] = const struct SpriteTemplate gFieldEffectObjectTemplate_ShortGrass = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_5, + .paletteTag = FLDEFF_PAL_TAG_GENERAL_1, .oam = &gObjectEventBaseOam_16x16, .anims = sAnimTable_ShortGrass, .images = sPicTable_ShortGrass, @@ -1117,7 +1116,7 @@ static const union AnimCmd *const sAnimTable_HotSpringsWater[] = const struct SpriteTemplate gFieldEffectObjectTemplate_HotSpringsWater = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_5, + .paletteTag = FLDEFF_PAL_TAG_GENERAL_1, .oam = &gObjectEventBaseOam_16x16, .anims = sAnimTable_HotSpringsWater, .images = sPicTable_HotSpringsWater, @@ -1151,7 +1150,7 @@ static const union AnimCmd *const sAnimTable_AshPuff[] = const struct SpriteTemplate gFieldEffectObjectTemplate_AshPuff = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_13, + .paletteTag = FLDEFF_PAL_TAG_ASH, .oam = &gObjectEventBaseOam_16x16, .anims = sAnimTable_AshPuff, .images = sPicTable_AshPuff, @@ -1159,7 +1158,7 @@ const struct SpriteTemplate gFieldEffectObjectTemplate_AshPuff = .callback = SpriteCB_AshPuff }; -const struct SpritePalette gFieldEffectObjectPaletteInfo2 = {gFieldEffectObjectPalette2, FLDEFF_PAL_TAG_13}; +const struct SpritePalette gSpritePalette_Ash = {gFieldEffectPal_Ash, FLDEFF_PAL_TAG_ASH}; static const struct SpriteFrameImage sPicTable_AshLaunch[] = { overworld_frame(gFieldEffectObjectPic_AshLaunch, 2, 2, 0), @@ -1187,7 +1186,7 @@ static const union AnimCmd *const sAnimTable_AshLaunch[] = const struct SpriteTemplate gFieldEffectObjectTemplate_AshLaunch = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_13, + .paletteTag = FLDEFF_PAL_TAG_ASH, .oam = &gObjectEventBaseOam_16x16, .anims = sAnimTable_AshLaunch, .images = sPicTable_AshLaunch, @@ -1226,7 +1225,7 @@ static const union AnimCmd *const sAnimTable_Bubbles[] = const struct SpriteTemplate gFieldEffectObjectTemplate_Bubbles = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_4, + .paletteTag = FLDEFF_PAL_TAG_GENERAL_0, .oam = &gObjectEventBaseOam_16x32, .anims = sAnimTable_Bubbles, .images = sPicTable_Bubbles, @@ -1254,7 +1253,7 @@ static const union AnimCmd *const sAnimTable_SmallSparkle[] = const struct SpriteTemplate gFieldEffectObjectTemplate_SmallSparkle = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_15, + .paletteTag = FLDEFF_PAL_TAG_SMALL_SPARKLE, .oam = &gObjectEventBaseOam_16x16, .anims = sAnimTable_SmallSparkle, .images = sPicTable_SmallSparkle, @@ -1262,7 +1261,7 @@ const struct SpriteTemplate gFieldEffectObjectTemplate_SmallSparkle = { .callback = UpdateSparkleFieldEffect, }; -const struct SpritePalette gFieldEffectObjectPaletteInfo3 = {gFieldEffectObjectPalette3, FLDEFF_PAL_TAG_15}; +const struct SpritePalette gSpritePalette_SmallSparkle = {gFieldEffectPal_SmallSparkle, FLDEFF_PAL_TAG_SMALL_SPARKLE}; static const union AnimCmd sAnim_Rayquaza[] = { ANIMCMD_FRAME(0, 1), @@ -1287,4 +1286,4 @@ const struct SpriteTemplate gFieldEffectObjectTemplate_Rayquaza = { .callback = UpdateRayquazaSpotlightEffect, }; -const struct SpritePalette gFieldEffectObjectPaletteInfoUnused = {gObjectEventPalette2, FLDEFF_PAL_TAG_17}; +static const struct SpritePalette sSpritePalette_Unused = {gObjectEventPalette2, FLDEFF_PAL_TAG_UNKNOWN}; diff --git a/src/data/object_events/object_event_graphics.h b/src/data/object_events/object_event_graphics.h index 87c0fa8a3..50fc6715c 100755 --- a/src/data/object_events/object_event_graphics.h +++ b/src/data/object_events/object_event_graphics.h @@ -293,15 +293,15 @@ const u32 gFieldEffectObjectPic_ShadowSmall[] = INCBIN_U32("graphics/field_effec const u32 gFieldEffectObjectPic_ShadowMedium[] = INCBIN_U32("graphics/field_effects/pics/shadow_medium.4bpp"); const u32 gFieldEffectObjectPic_ShadowLarge[] = INCBIN_U32("graphics/field_effects/pics/shadow_large.4bpp"); const u32 gFieldEffectObjectPic_ShadowExtraLarge[] = INCBIN_U32("graphics/field_effects/pics/shadow_extra_large.4bpp"); -const u32 filler_8368A08[0x48] = {}; +static const u32 sFiller[0x48] = {}; const u8 gFieldEffectPic_CutGrass[] = INCBIN_U8("graphics/field_effects/pics/cut_grass.4bpp"); const u32 gFieldEffectPic_CutGrass_Copy[] = INCBIN_U32("graphics/field_effects/pics/cut_grass.4bpp"); -const u16 gFieldEffectObjectPalette6[] = INCBIN_U16("graphics/field_effects/palettes/06.gbapal"); +const u16 gFieldEffectPal_CutGrass[] = INCBIN_U16("graphics/field_effects/palettes/cut_grass.gbapal"); const u32 gFieldEffectObjectPic_Ripple[] = INCBIN_U32("graphics/field_effects/pics/ripple.4bpp"); const u32 gFieldEffectObjectPic_Ash[] = INCBIN_U32("graphics/field_effects/pics/ash.4bpp"); const u32 gFieldEffectObjectPic_Arrow[] = INCBIN_U32("graphics/field_effects/pics/arrow.4bpp"); -const u16 gFieldEffectObjectPalette0[] = INCBIN_U16("graphics/field_effects/palettes/00.gbapal"); -const u16 gFieldEffectObjectPalette1[] = INCBIN_U16("graphics/field_effects/palettes/01.gbapal"); +const u16 gFieldEffectObjectPalette0[] = INCBIN_U16("graphics/field_effects/palettes/general_0.gbapal"); +const u16 gFieldEffectObjectPalette1[] = INCBIN_U16("graphics/field_effects/palettes/general_1.gbapal"); const u32 gFieldEffectObjectPic_GroundImpactDust[] = INCBIN_U32("graphics/field_effects/pics/ground_impact_dust.4bpp"); const u32 gFieldEffectObjectPic_JumpTallGrass[] = INCBIN_U32("graphics/field_effects/pics/jump_tall_grass.4bpp"); const u32 gUnusedGrass3[] = INCBIN_U32("graphics/field_effects/pics/unused_grass_3.4bpp"); @@ -314,7 +314,7 @@ const u32 gFieldEffectObjectPic_ShortGrass[] = INCBIN_U32("graphics/field_effect const u32 gFieldEffectObjectPic_SandFootprints[] = INCBIN_U32("graphics/field_effects/pics/sand_footprints.4bpp"); const u32 gFieldEffectObjectPic_DeepSandFootprints[] = INCBIN_U32("graphics/field_effects/pics/deep_sand_footprints.4bpp"); const u32 gFieldEffectObjectPic_BikeTireTracks[] = INCBIN_U32("graphics/field_effects/pics/bike_tire_tracks.4bpp"); -const u32 gFieldEffectObjectPic_Unknown19[] = INCBIN_U32("graphics/field_effects/pics/unknown_19.4bpp"); +const u32 gFieldEffectObjectPic_UnusedSand[] = INCBIN_U32("graphics/field_effects/pics/unused_sand.4bpp"); const u32 gFieldEffectObjectPic_SandPile[] = INCBIN_U32("graphics/field_effects/pics/sand_pile.4bpp"); const u32 gFieldEffectObjectPic_JumpBigSplash[] = INCBIN_U32("graphics/field_effects/pics/jump_big_splash.4bpp"); const u32 gFieldEffectObjectPic_Splash[] = INCBIN_U32("graphics/field_effects/pics/splash.4bpp"); @@ -324,12 +324,12 @@ const u32 gFieldEffectObjectPic_TreeDisguise[] = INCBIN_U32("graphics/field_effe const u32 gFieldEffectObjectPic_MountainDisguise[] = INCBIN_U32("graphics/field_effects/pics/mountain_disguise.4bpp"); const u32 gFieldEffectObjectPic_SandDisguisePlaceholder[] = INCBIN_U32("graphics/field_effects/pics/sand_disguise_placeholder.4bpp"); const u32 gFieldEffectObjectPic_HotSpringsWater[] = INCBIN_U32("graphics/field_effects/pics/hot_springs_water.4bpp"); -const u16 gFieldEffectObjectPalette2[] = INCBIN_U16("graphics/field_effects/palettes/02.gbapal"); +const u16 gFieldEffectPal_Ash[] = INCBIN_U16("graphics/field_effects/palettes/ash.gbapal"); const u32 gFieldEffectObjectPic_AshPuff[] = INCBIN_U32("graphics/field_effects/pics/ash_puff.4bpp"); const u32 gFieldEffectObjectPic_AshLaunch[] = INCBIN_U32("graphics/field_effects/pics/ash_launch.4bpp"); const u32 gFieldEffectObjectPic_Bubbles[] = INCBIN_U32("graphics/field_effects/pics/bubbles.4bpp"); const u32 gFieldEffectObjectPic_SmallSparkle[] = INCBIN_U32("graphics/field_effects/pics/small_sparkle.4bpp"); -const u16 gFieldEffectObjectPalette3[] = INCBIN_U16("graphics/field_effects/palettes/03.gbapal"); +const u16 gFieldEffectPal_SmallSparkle[] = INCBIN_U16("graphics/field_effects/palettes/small_sparkle.gbapal"); const u32 gFieldEffectObjectPic_Bird[] = INCBIN_U32("graphics/field_effects/pics/bird.4bpp"); const u32 gObjectEventPic_Juan[] = INCBIN_U32("graphics/object_events/pics/people/gym_leaders/juan.4bpp"); const u32 gObjectEventPic_Scott[] = INCBIN_U32("graphics/object_events/pics/people/scott.4bpp"); diff --git a/src/event_object_movement.c b/src/event_object_movement.c index c6aa3d9ef..5e1de36a0 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -1948,7 +1948,7 @@ void sub_808E7E4(u8 localId, u8 mapNum, u8 mapGroup) } } -void sub_808E82C(u8 localId, u8 mapNum, u8 mapGroup, s16 x, s16 y) +void SetObjectEventSpritePosByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup, s16 x, s16 y) { u8 objectEventId; struct Sprite *sprite; diff --git a/src/faraway_island.c b/src/faraway_island.c index 4233c43d8..d66a7c41e 100755 --- a/src/faraway_island.c +++ b/src/faraway_island.c @@ -26,7 +26,7 @@ static s16 sPlayerToMewDeltaX; static s16 sPlayerToMewDeltaY; static u8 sMewDirectionCandidates[4]; -extern const struct SpritePalette gFieldEffectObjectPaletteInfo1; +extern const struct SpritePalette gSpritePalette_GeneralFieldEffect1; extern const struct SpriteTemplate *const gFieldEffectObjectTemplatePointers[]; static const s16 sFarawayIslandRockCoords[4][2] = @@ -374,8 +374,8 @@ void sub_81D4A90(void) if (gSpecialVar_Facing != DIR_NORTH) gSprites[mew->spriteId].subpriority = 1; - LoadSpritePalette(&gFieldEffectObjectPaletteInfo1); - UpdateSpritePaletteWithWeather(IndexOfSpritePaletteTag(gFieldEffectObjectPaletteInfo1.tag)); + LoadSpritePalette(&gSpritePalette_GeneralFieldEffect1); + UpdateSpritePaletteWithWeather(IndexOfSpritePaletteTag(gSpritePalette_GeneralFieldEffect1.tag)); x = mew->currentCoords.x; y = mew->currentCoords.y; diff --git a/src/field_effect.c b/src/field_effect.c index c2302eed9..699db4c99 100644 --- a/src/field_effect.c +++ b/src/field_effect.c @@ -246,12 +246,12 @@ static const u32 sNewGameBirch_Gfx[] = INCBIN_U32("graphics/birch_speech/birch.4 static const u32 sUnusedBirchBeauty[] = INCBIN_U32("graphics/unused/intro_birch_beauty.4bpp"); static const u16 sNewGameBirch_Pal[16] = INCBIN_U16("graphics/birch_speech/birch.gbapal"); static const u32 sPokeballGlow_Gfx[] = INCBIN_U32("graphics/misc/pokeball_glow.4bpp"); -static const u16 sFieldEffectObjectPalette4[16] = INCBIN_U16("graphics/field_effects/palettes/04.gbapal"); +static const u16 sPokeballGlow_Pal[16] = INCBIN_U16("graphics/field_effects/palettes/pokeball_glow.gbapal"); static const u32 sPokecenterMonitor0_Gfx[] = INCBIN_U32("graphics/misc/pokecenter_monitor/0.4bpp"); static const u32 sPokecenterMonitor1_Gfx[] = INCBIN_U32("graphics/misc/pokecenter_monitor/1.4bpp"); static const u32 sHofMonitorBig_Gfx[] = INCBIN_U32("graphics/misc/hof_monitor_big.4bpp"); static const u8 sHofMonitorSmall_Gfx[] = INCBIN_U8("graphics/misc/hof_monitor_small.4bpp"); -static const u16 sFieldEffectObjectPalette5[16] = INCBIN_U16("graphics/field_effects/palettes/05.gbapal"); +static const u16 sHofMonitor_Pal[16] = INCBIN_U16("graphics/field_effects/palettes/hof_monitor.gbapal"); // Graphics for the lights streaking past your Pokemon when it uses a field move. static const u32 sFieldMoveStreaksOutdoors_Gfx[] = INCBIN_U32("graphics/misc/field_move_streaks.4bpp"); @@ -332,7 +332,7 @@ static const struct SpriteFrameImage sPicTable_NewGameBirch[] = static const struct SpritePalette sSpritePalette_NewGameBirch = { .data = sNewGameBirch_Pal, - .tag = FLDEFF_PAL_TAG_6 + .tag = 0x1006 }; static const union AnimCmd sAnim_NewGameBirch[] = @@ -349,7 +349,7 @@ static const union AnimCmd *const sAnimTable_NewGameBirch[] = static const struct SpriteTemplate sSpriteTemplate_NewGameBirch = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_6, + .paletteTag = 0x1006, .oam = &sOam_64x64, .anims = sAnimTable_NewGameBirch, .images = sPicTable_NewGameBirch, @@ -357,16 +357,16 @@ static const struct SpriteTemplate sSpriteTemplate_NewGameBirch = .callback = SpriteCallbackDummy }; -const struct SpritePalette gFieldEffectObjectPaletteInfo4 = +const struct SpritePalette gSpritePalette_PokeballGlow = { - .data = sFieldEffectObjectPalette4, - .tag = FLDEFF_PAL_TAG_7 + .data = sPokeballGlow_Pal, + .tag = FLDEFF_PAL_TAG_POKEBALL_GLOW }; -const struct SpritePalette gFieldEffectObjectPaletteInfo5 = +const struct SpritePalette gSpritePalette_HofMonitor = { - .data = sFieldEffectObjectPalette5, - .tag = FLDEFF_PAL_TAG_16 + .data = sHofMonitor_Pal, + .tag = FLDEFF_PAL_TAG_HOF_MONITOR }; static const struct OamData sOam_32x16 = @@ -513,7 +513,7 @@ static const union AnimCmd *const sAnimTable_HofMonitor[] = static const struct SpriteTemplate sSpriteTemplate_PokeballGlow = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_7, + .paletteTag = FLDEFF_PAL_TAG_POKEBALL_GLOW, .oam = &sOam_8x8, .anims = gSpriteAnimTable_855C2F8, .images = sPicTable_PokeballGlow, @@ -524,7 +524,7 @@ static const struct SpriteTemplate sSpriteTemplate_PokeballGlow = static const struct SpriteTemplate sSpriteTemplate_PokecenterMonitor = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_4, + .paletteTag = FLDEFF_PAL_TAG_GENERAL_0, .oam = &sOam_16x16, .anims = gSpriteAnimTable_855C2F8, .images = sPicTable_PokecenterMonitor, @@ -535,7 +535,7 @@ static const struct SpriteTemplate sSpriteTemplate_PokecenterMonitor = static const struct SpriteTemplate sSpriteTemplate_HofMonitorBig = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_16, + .paletteTag = FLDEFF_PAL_TAG_HOF_MONITOR, .oam = &sOam_16x16, .anims = sAnimTable_HofMonitor, .images = sPicTable_HofMonitorBig, @@ -546,7 +546,7 @@ static const struct SpriteTemplate sSpriteTemplate_HofMonitorBig = static const struct SpriteTemplate sSpriteTemplate_HofMonitorSmall = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_16, + .paletteTag = FLDEFF_PAL_TAG_HOF_MONITOR, .oam = &sOam_32x16, .anims = sAnimTable_HofMonitor, .images = sPicTable_HofMonitorSmall, @@ -1178,14 +1178,14 @@ static void PokeballGlowEffect_Flash1(struct Sprite *sprite) sprite->data[3]++; } phase = (sprite->sCounter + 3) & 3; - MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_7) << 4) + 0x108, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]); + MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_POKEBALL_GLOW) << 4) + 0x108, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]); phase = (sprite->sCounter + 2) & 3; - MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_7) << 4) + 0x106, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]); + MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_POKEBALL_GLOW) << 4) + 0x106, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]); phase = (sprite->sCounter + 1) & 3; - MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_7) << 4) + 0x102, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]); + MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_POKEBALL_GLOW) << 4) + 0x102, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]); phase = sprite->sCounter; - MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_7) << 4) + 0x105, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]); - MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_7) << 4) + 0x103, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]); + MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_POKEBALL_GLOW) << 4) + 0x105, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]); + MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_POKEBALL_GLOW) << 4) + 0x103, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]); if (sprite->data[3] > 2) { sprite->sState++; @@ -1209,11 +1209,11 @@ static void PokeballGlowEffect_Flash2(struct Sprite *sprite) } } phase = sprite->sCounter; - MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_7) << 4) + 0x108, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]); - MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_7) << 4) + 0x106, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]); - MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_7) << 4) + 0x102, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]); - MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_7) << 4) + 0x105, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]); - MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_7) << 4) + 0x103, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]); + MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_POKEBALL_GLOW) << 4) + 0x108, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]); + MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_POKEBALL_GLOW) << 4) + 0x106, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]); + MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_POKEBALL_GLOW) << 4) + 0x102, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]); + MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_POKEBALL_GLOW) << 4) + 0x105, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]); + MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_POKEBALL_GLOW) << 4) + 0x103, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]); } static void PokeballGlowEffect_WaitAfterFlash(struct Sprite *sprite) diff --git a/src/field_effect_helpers.c b/src/field_effect_helpers.c index 9950978ad..78948618f 100755 --- a/src/field_effect_helpers.c +++ b/src/field_effect_helpers.c @@ -348,7 +348,7 @@ u32 FldEff_JumpTallGrass(void) sprite->coordOffsetEnabled = TRUE; sprite->oam.priority = gFieldEffectArguments[3]; sprite->data[0] = gFieldEffectArguments[2]; - sprite->data[1] = 12; + sprite->data[1] = FLDEFF_JUMP_TALL_GRASS; } return 0; } @@ -451,7 +451,7 @@ u32 FldEff_JumpLongGrass(void) sprite->coordOffsetEnabled = TRUE; sprite->oam.priority = gFieldEffectArguments[3]; sprite->data[0] = gFieldEffectArguments[2]; - sprite->data[1] = 18; + sprite->data[1] = FLDEFF_JUMP_LONG_GRASS; } return 0; } @@ -800,19 +800,19 @@ void UpdateHotSpringsWaterFieldEffect(struct Sprite *sprite) } } -u32 FldEff_Unknown19(void) +u32 FldEff_UnusedGrass(void) { u8 spriteId; struct Sprite *sprite; sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8); - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_17], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_UNUSED_GRASS], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); if (spriteId != MAX_SPRITES) { sprite = &gSprites[spriteId]; sprite->coordOffsetEnabled = TRUE; sprite->oam.priority = gFieldEffectArguments[3]; - sprite->data[0] = FLDEFF_UNKNOWN_19; + sprite->data[0] = FLDEFF_UNUSED_GRASS; } return 0; } @@ -834,19 +834,19 @@ u32 FldEff_UnusedGrass2(void) return 0; } -u32 FldEff_Unknown21(void) +u32 FldEff_UnusedSand(void) { u8 spriteId; struct Sprite *sprite; sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8); - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_19], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_UNUSED_SAND], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); if (spriteId != MAX_SPRITES) { sprite = &gSprites[spriteId]; sprite->coordOffsetEnabled = TRUE; sprite->oam.priority = gFieldEffectArguments[3]; - sprite->data[0] = FLDEFF_UNKNOWN_21; + sprite->data[0] = FLDEFF_UNUSED_SAND; } return 0; } @@ -1115,7 +1115,7 @@ u32 FldEff_Dust(void) sprite->coordOffsetEnabled = TRUE; sprite->oam.priority = gFieldEffectArguments[3]; sprite->data[0] = gFieldEffectArguments[2]; - sprite->data[1] = 10; + sprite->data[1] = FLDEFF_DUST; } return 0; } diff --git a/src/field_screen_effect.c b/src/field_screen_effect.c index e14efce67..7727f4ac1 100644 --- a/src/field_screen_effect.c +++ b/src/field_screen_effect.c @@ -36,11 +36,9 @@ #include "fldeff.h" // This file's functions. -static void sub_8080B9C(u8); static void Task_ExitNonAnimDoor(u8); static void Task_ExitNonDoor(u8); static void Task_DoContestHallWarp(u8); -static void sub_808115C(u8); static void FillPalBufferWhite(void); static void Task_ExitDoor(u8); static bool32 WaitForWeatherFadeIn(void); diff --git a/src/field_special_scene.c b/src/field_special_scene.c index e19e31361..df45af097 100644 --- a/src/field_special_scene.c +++ b/src/field_special_scene.c @@ -74,11 +74,11 @@ void Task_Truck1(u8 taskId) s16 box1, box2, box3; box1 = GetTruckBoxMovement(data[0] + 30) * 4; // top box. - sub_808E82C(1, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, 3 - cameraXpan, box1 + 3); + SetObjectEventSpritePosByLocalIdAndMap(1, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, 3 - cameraXpan, box1 + 3); box2 = GetTruckBoxMovement(data[0]) * 2; // bottom left box. - sub_808E82C(2, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, -cameraXpan, box2 - 3); + SetObjectEventSpritePosByLocalIdAndMap(2, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, -cameraXpan, box2 - 3); box3 = GetTruckBoxMovement(data[0]) * 4; // bottom right box. - sub_808E82C(3, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, -3 - cameraXpan, box3); + SetObjectEventSpritePosByLocalIdAndMap(3, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, -3 - cameraXpan, box3); if (++data[0] == SECONDS(500)) // this will never run data[0] = 0; // reset the timer if it gets stuck. @@ -117,11 +117,11 @@ void Task_Truck2(u8 taskId) cameraYpan = GetTruckCameraBobbingY(data[2]); SetCameraPanning(cameraXpan, cameraYpan); box1 = GetTruckBoxMovement(data[2] + 30) * 4; - sub_808E82C(1, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, 3 - cameraXpan, box1 + 3); + SetObjectEventSpritePosByLocalIdAndMap(1, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, 3 - cameraXpan, box1 + 3); box2 = GetTruckBoxMovement(data[2]) * 2; - sub_808E82C(2, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, -cameraXpan, box2 - 3); + SetObjectEventSpritePosByLocalIdAndMap(2, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, -cameraXpan, box2 - 3); box3 = GetTruckBoxMovement(data[2]) * 4; - sub_808E82C(3, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, -3 - cameraXpan, box3); + SetObjectEventSpritePosByLocalIdAndMap(3, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, -3 - cameraXpan, box3); } } @@ -148,9 +148,9 @@ static void Task_Truck3(u8 taskId) cameraXpan = gTruckCamera_HorizontalTable[data[1]]; cameraYpan = 0; SetCameraPanning(cameraXpan, 0); - sub_808E82C(1, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, 3 - cameraXpan, cameraYpan + 3); - sub_808E82C(2, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, -cameraXpan, cameraYpan - 3); - sub_808E82C(3, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, -3 - cameraXpan, cameraYpan); + SetObjectEventSpritePosByLocalIdAndMap(1, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, 3 - cameraXpan, cameraYpan + 3); + SetObjectEventSpritePosByLocalIdAndMap(2, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, -cameraXpan, cameraYpan - 3); + SetObjectEventSpritePosByLocalIdAndMap(3, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, -3 - cameraXpan, cameraYpan); } } @@ -243,9 +243,9 @@ void EndTruckSequence(u8 taskId) { if (!FuncIsActiveTask(Task_HandleTruckSequence)) { - sub_808E82C(1, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, 3, 3); - sub_808E82C(2, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, 0, -3); - sub_808E82C(3, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, -3, 0); + SetObjectEventSpritePosByLocalIdAndMap(1, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, 3, 3); + SetObjectEventSpritePosByLocalIdAndMap(2, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, 0, -3); + SetObjectEventSpritePosByLocalIdAndMap(3, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, -3, 0); } } diff --git a/src/fldeff_cut.c b/src/fldeff_cut.c index efd533d08..34868342f 100644 --- a/src/fldeff_cut.c +++ b/src/fldeff_cut.c @@ -1,6 +1,7 @@ #include "global.h" #include "event_object_lock.h" #include "event_object_movement.h" +#include "event_scripts.h" #include "faraway_island.h" #include "field_camera.h" #include "field_effect.h" @@ -24,11 +25,10 @@ extern struct MapPosition gPlayerFacingPosition; -extern const u8 EventScript_FldEffCut[]; extern const u8 FarawayIsland_Interior_EventScript_HideMewWhenGrassCut[]; extern const u8 gFieldEffectPic_CutGrass[]; -extern const u16 gFieldEffectObjectPalette6[]; +extern const u16 gFieldEffectPal_CutGrass[]; // cut 'square' defines #define CUT_NORMAL_SIDE 3 @@ -122,12 +122,12 @@ static const struct SpriteFrameImage sSpriteImageTable_CutGrass[] = {gFieldEffectPic_CutGrass, 0x20}, }; -const struct SpritePalette gFieldEffectObjectPaletteInfo6 = {gFieldEffectObjectPalette6, FLDEFF_PAL_TAG_0}; +const struct SpritePalette gSpritePalette_CutGrass = {gFieldEffectPal_CutGrass, FLDEFF_PAL_TAG_CUT_GRASS}; static const struct SpriteTemplate sSpriteTemplate_CutGrass = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_0, + .paletteTag = FLDEFF_PAL_TAG_CUT_GRASS, .oam = &sOamData_CutGrass, .anims = sSpriteAnimTable_CutGrass, .images = sSpriteImageTable_CutGrass, @@ -292,7 +292,7 @@ bool8 FldEff_UseCutOnGrass(void) static void FieldCallback_CutTree(void) { gFieldEffectArguments[0] = GetCursorSelectionMonId(); - ScriptContext1_SetupScript(EventScript_FldEffCut); + ScriptContext1_SetupScript(EventScript_UseCut); } bool8 FldEff_UseCutOnTree(void) diff --git a/src/fldeff_dig.c b/src/fldeff_dig.c index 322758a42..c3ab989cd 100644 --- a/src/fldeff_dig.c +++ b/src/fldeff_dig.c @@ -10,8 +10,8 @@ #include "constants/field_effects.h" // static functions -static void hm2_dig(void); -static void sub_8135780(void); +static void FieldCallback_Dig(void); +static void StartDigFieldEffect(void); // text bool8 SetUpFieldMove_Dig(void) @@ -19,7 +19,7 @@ bool8 SetUpFieldMove_Dig(void) if (CanUseDigOrEscapeRopeOnCurMap() == TRUE) { gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu; - gPostMenuFieldCallback = hm2_dig; + gPostMenuFieldCallback = FieldCallback_Dig; return TRUE; } else @@ -28,7 +28,7 @@ bool8 SetUpFieldMove_Dig(void) } } -static void hm2_dig(void) +static void FieldCallback_Dig(void) { Overworld_ResetStateAfterDigEscRope(); FieldEffectStart(FLDEFF_USE_DIG); @@ -39,14 +39,14 @@ bool8 FldEff_UseDig(void) { u8 taskId = CreateFieldMoveTask(); - gTasks[taskId].data[8] = (u32)sub_8135780 >> 16; - gTasks[taskId].data[9] = (u32)sub_8135780; + gTasks[taskId].data[8] = (u32)StartDigFieldEffect >> 16; + gTasks[taskId].data[9] = (u32)StartDigFieldEffect; if (!ShouldDoBrailleDigEffect()) SetPlayerAvatarTransitionFlags(PLAYER_AVATAR_FLAG_ON_FOOT); return FALSE; } -static void sub_8135780(void) +static void StartDigFieldEffect(void) { u8 taskId; diff --git a/src/fldeff_flash.c b/src/fldeff_flash.c index d10635a56..2d25928b8 100644 --- a/src/fldeff_flash.c +++ b/src/fldeff_flash.c @@ -106,7 +106,7 @@ static void FldEff_UseFlash(void) { PlaySE(SE_W115); FlagSet(FLAG_SYS_USE_FLASH); - ScriptContext1_SetupScript(EventScript_FldEffFlash); + ScriptContext1_SetupScript(EventScript_UseFlash); } static void CB2_ChangeMapMain(void) diff --git a/src/fldeff_misc.c b/src/fldeff_misc.c index 50feaf368..6160cae36 100644 --- a/src/fldeff_misc.c +++ b/src/fldeff_misc.c @@ -65,12 +65,12 @@ static void SpriteCB_SandPillar_End(struct Sprite *); static const u8 sSecretPowerCave_Gfx[] = INCBIN_U8("graphics/field_effects/pics/secret_power_cave.4bpp"); static const u8 sFiller[32] = {0}; -static const u16 sSecretPowerCave_Pal[] = INCBIN_U16("graphics/field_effects/palettes/07.gbapal"); +static const u16 sSecretPowerCave_Pal[] = INCBIN_U16("graphics/field_effects/palettes/secret_power_cave.gbapal"); static const u8 sSecretPowerShrub_Gfx[] = INCBIN_U8("graphics/field_effects/pics/secret_power_shrub.4bpp"); static const u8 sSecretPowerTree_Gfx[] = INCBIN_U8("graphics/field_effects/pics/secret_power_tree.4bpp"); -static const u16 sSecretPowerPlant_Pal[] = INCBIN_U16("graphics/field_effects/palettes/08.gbapal"); +static const u16 sSecretPowerPlant_Pal[] = INCBIN_U16("graphics/field_effects/palettes/secret_power_plant.gbapal"); -// TODO: These should also be combined into a single image +// TODO: These should also be combined into a single image, not matching for some reason static const u8 sSandPillar0_Gfx[] = INCBIN_U8("graphics/field_effects/pics/sand_pillar/0.4bpp"); static const u8 sSandPillar1_Gfx[] = INCBIN_U8("graphics/field_effects/pics/sand_pillar/1.4bpp"); static const u8 sSandPillar2_Gfx[] = INCBIN_U8("graphics/field_effects/pics/sand_pillar/2.4bpp"); @@ -196,7 +196,7 @@ static const struct SpriteFrameImage sPicTable_SecretPowerShrub[] = static const struct SpriteTemplate sSpriteTemplate_SecretPowerCave = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_3, + .paletteTag = FLDEFF_PAL_TAG_SECRET_POWER_TREE, .oam = &sOam_SecretPower, .anims = sAnimTable_SecretPowerCave, .images = sPicTable_SecretPowerCave, @@ -207,7 +207,7 @@ static const struct SpriteTemplate sSpriteTemplate_SecretPowerCave = static const struct SpriteTemplate sSpriteTemplate_SecretPowerTree = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_8, + .paletteTag = FLDEFF_PAL_TAG_SECRET_POWER_PLANT, .oam = &sOam_SecretPower, .anims = sAnimTable_SecretPowerTree, .images = sPicTable_SecretPowerTree, @@ -218,7 +218,7 @@ static const struct SpriteTemplate sSpriteTemplate_SecretPowerTree = static const struct SpriteTemplate sSpriteTemplate_SecretPowerShrub = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_8, + .paletteTag = FLDEFF_PAL_TAG_SECRET_POWER_PLANT, .oam = &sOam_SecretPower, .anims = sAnimTable_SecretPowerShrub, .images = sPicTable_SecretPowerShrub, @@ -226,8 +226,8 @@ static const struct SpriteTemplate sSpriteTemplate_SecretPowerShrub = .callback = SpriteCB_ShrubEntranceInit, }; -const struct SpritePalette gSpritePalette_SecretPower_Cave = {sSecretPowerCave_Pal, FLDEFF_PAL_TAG_3}; -const struct SpritePalette gSpritePalette_SecretPower_Plant = {sSecretPowerPlant_Pal, FLDEFF_PAL_TAG_8}; +const struct SpritePalette gSpritePalette_SecretPower_Cave = {sSecretPowerCave_Pal, FLDEFF_PAL_TAG_SECRET_POWER_TREE}; +const struct SpritePalette gSpritePalette_SecretPower_Plant = {sSecretPowerPlant_Pal, FLDEFF_PAL_TAG_SECRET_POWER_PLANT}; static const struct OamData sOam_SandPillar = { @@ -256,15 +256,15 @@ static const union AnimCmd *const sAnimTable_SandPillar[] = static const struct SpriteFrameImage sPicTable_SandPillar[] = { - {sSandPillar0_Gfx, 0x100}, - {sSandPillar1_Gfx, 0x100}, - {sSandPillar2_Gfx, 0x100}, + {sSandPillar0_Gfx, sizeof(sSandPillar0_Gfx)}, + {sSandPillar1_Gfx, sizeof(sSandPillar1_Gfx)}, + {sSandPillar2_Gfx, sizeof(sSandPillar2_Gfx)}, }; static const struct SpriteTemplate sSpriteTemplate_SandPillar = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_14, + .paletteTag = FLDEFF_PAL_TAG_SAND_PILLAR, .oam = &sOam_SandPillar, .anims = sAnimTable_SandPillar, .images = sPicTable_SandPillar, @@ -272,8 +272,7 @@ static const struct SpriteTemplate sSpriteTemplate_SandPillar = .callback = SpriteCB_SandPillar_BreakTop, }; -// This uses one of the secret base palettes, so there is no "graphics/field_effects/palettes/09.pal" file. -const struct SpritePalette gSpritePalette_SandPillar = {gTilesetPalettes_SecretBase[5], FLDEFF_PAL_TAG_14}; +const struct SpritePalette gSpritePalette_SandPillar = {gTilesetPalettes_SecretBase[5], FLDEFF_PAL_TAG_SAND_PILLAR}; static const u8 sRecordMixLights_Gfx[] = INCBIN_U8("graphics/field_effects/pics/record_mix_lights.4bpp"); static const u16 sRecordMixLights_Pal[] = INCBIN_U16("graphics/field_effects/palettes/record_mix_lights.gbapal"); @@ -285,7 +284,7 @@ static const struct SpriteFrameImage sPicTable_RecordMixLights[] = overworld_frame(sRecordMixLights_Gfx, 4, 1, 2), }; -static const struct SpritePalette sSpritePalette_RecordMixLights = {sRecordMixLights_Pal, FLDEFF_PAL_TAG_0}; +static const struct SpritePalette sSpritePalette_RecordMixLights = {sRecordMixLights_Pal, 0x1000}; static const union AnimCmd sAnim_RecordMixLights[] = { @@ -303,7 +302,7 @@ static const union AnimCmd *const sAnimTable_RecordMixLights[] = static const struct SpriteTemplate sSpriteTemplate_RecordMixLights = { .tileTag = 0xFFFF, - .paletteTag = FLDEFF_PAL_TAG_0, + .paletteTag = 0x1000, .oam = &gObjectEventBaseOam_32x8, .anims = sAnimTable_RecordMixLights, .images = sPicTable_RecordMixLights, diff --git a/src/fldeff_rocksmash.c b/src/fldeff_rocksmash.c index ec8e64012..0c35ec74e 100644 --- a/src/fldeff_rocksmash.c +++ b/src/fldeff_rocksmash.c @@ -146,7 +146,7 @@ bool8 SetUpFieldMove_RockSmash(void) static void FieldCallback_RockSmash(void) { gFieldEffectArguments[0] = GetCursorSelectionMonId(); - ScriptContext1_SetupScript(EventScript_RockSmashFromPartyMenu); + ScriptContext1_SetupScript(EventScript_UseRockSmash); } bool8 FldEff_UseRockSmash(void) diff --git a/src/fldeff_strength.c b/src/fldeff_strength.c index 800e45821..61960d0ff 100644 --- a/src/fldeff_strength.c +++ b/src/fldeff_strength.c @@ -11,8 +11,8 @@ #include "constants/field_effects.h" // static functions -static void FldEff_UseStrength(void); -static void sub_8145E74(void); +static void FieldCallback_Strength(void); +static void StartStrengthFieldEffect(void); // text bool8 SetUpFieldMove_Strength(void) @@ -21,28 +21,29 @@ bool8 SetUpFieldMove_Strength(void) { gSpecialVar_Result = GetCursorSelectionMonId(); gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu; - gPostMenuFieldCallback = FldEff_UseStrength; + gPostMenuFieldCallback = FieldCallback_Strength; return TRUE; } return FALSE; } -static void FldEff_UseStrength(void) +static void FieldCallback_Strength(void) { gFieldEffectArguments[0] = GetCursorSelectionMonId(); - ScriptContext1_SetupScript(EventScript_FldEffStrength); + ScriptContext1_SetupScript(EventScript_UseStrength); } -bool8 sub_8145E2C(void) +bool8 FldEff_UseStrength(void) { u8 taskId = CreateFieldMoveTask(); - gTasks[taskId].data[8] = (u32)sub_8145E74 >> 16; - gTasks[taskId].data[9] = (u32)sub_8145E74; + gTasks[taskId].data[8] = (u32)StartStrengthFieldEffect >> 16; + gTasks[taskId].data[9] = (u32)StartStrengthFieldEffect; GetMonNickname(&gPlayerParty[gFieldEffectArguments[0]], gStringVar1); return FALSE; } -static void sub_8145E74(void) +// Just passes control back to EventScript_UseStrength +static void StartStrengthFieldEffect(void) { FieldEffectActiveListRemove(FLDEFF_USE_STRENGTH); EnableBothScriptContexts(); From c0bc7e8f7b94ebab1e39b761aa194630e4c7bf6b Mon Sep 17 00:00:00 2001 From: GriffinR Date: Mon, 6 Jul 2020 16:02:49 -0400 Subject: [PATCH 8/9] Fix elevator metatile typo --- include/constants/metatile_labels.h | 50 ++++++++++----------- src/fldeff_escalator.c | 70 ++++++++++++++--------------- 2 files changed, 60 insertions(+), 60 deletions(-) diff --git a/include/constants/metatile_labels.h b/include/constants/metatile_labels.h index 586107687..f7405f46a 100644 --- a/include/constants/metatile_labels.h +++ b/include/constants/metatile_labels.h @@ -289,31 +289,31 @@ #define METATILE_EverGrande_Door_PokemonLeague 0x21D // gTileset_PokemonCenter -#define METATILE_PokemonCenter_Elevator1F_Tile0_Frame0 0x280 -#define METATILE_PokemonCenter_Elevator1F_Tile0_Frame1 0x282 -#define METATILE_PokemonCenter_Elevator1F_Tile0_Frame2 0x284 -#define METATILE_PokemonCenter_Elevator1F_Tile1_Frame0 0x281 -#define METATILE_PokemonCenter_Elevator1F_Tile1_Frame1 0x283 -#define METATILE_PokemonCenter_Elevator1F_Tile1_Frame2 0x285 -#define METATILE_PokemonCenter_Elevator1F_Tile2_Frame0 0x288 -#define METATILE_PokemonCenter_Elevator1F_Tile2_Frame1 0x28A -#define METATILE_PokemonCenter_Elevator1F_Tile2_Frame2 0x28C -#define METATILE_PokemonCenter_Elevator1F_Tile3_Frame0 0x289 -#define METATILE_PokemonCenter_Elevator1F_Tile3_Frame1 0x28B -#define METATILE_PokemonCenter_Elevator1F_Tile3_Frame2 0x28D -#define METATILE_PokemonCenter_Elevator2F_Tile0_Frame0 0x2A0 -#define METATILE_PokemonCenter_Elevator2F_Tile0_Frame1 0x2A2 -#define METATILE_PokemonCenter_Elevator2F_Tile0_Frame2 0x2A4 -#define METATILE_PokemonCenter_Elevator2F_Tile1_Frame0 0x2A1 -#define METATILE_PokemonCenter_Elevator2F_Tile1_Frame1 0x2A3 -#define METATILE_PokemonCenter_Elevator2F_Tile1_Frame2 0x2A5 -#define METATILE_PokemonCenter_Elevator2F_Tile2_Frame0 0x2A8 -#define METATILE_PokemonCenter_Elevator2F_Tile2_Frame1 0x2AA -#define METATILE_PokemonCenter_Elevator2F_Tile2_Frame2 0x2AC -#define METATILE_PokemonCenter_Floor_ShadowTop_Alt 0x2DC -#define METATILE_PokemonCenter_Floor_Plain_Alt 0x2E4 -#define METATILE_PokemonCenter_Floor_ShadowTop 0x21E -#define METATILE_PokemonCenter_CounterBarrier 0x25D +#define METATILE_PokemonCenter_Escalator1F_Tile0_Frame0 0x280 +#define METATILE_PokemonCenter_Escalator1F_Tile0_Frame1 0x282 +#define METATILE_PokemonCenter_Escalator1F_Tile0_Frame2 0x284 +#define METATILE_PokemonCenter_Escalator1F_Tile1_Frame0 0x281 +#define METATILE_PokemonCenter_Escalator1F_Tile1_Frame1 0x283 +#define METATILE_PokemonCenter_Escalator1F_Tile1_Frame2 0x285 +#define METATILE_PokemonCenter_Escalator1F_Tile2_Frame0 0x288 +#define METATILE_PokemonCenter_Escalator1F_Tile2_Frame1 0x28A +#define METATILE_PokemonCenter_Escalator1F_Tile2_Frame2 0x28C +#define METATILE_PokemonCenter_Escalator1F_Tile3_Frame0 0x289 +#define METATILE_PokemonCenter_Escalator1F_Tile3_Frame1 0x28B +#define METATILE_PokemonCenter_Escalator1F_Tile3_Frame2 0x28D +#define METATILE_PokemonCenter_Escalator2F_Tile0_Frame0 0x2A0 +#define METATILE_PokemonCenter_Escalator2F_Tile0_Frame1 0x2A2 +#define METATILE_PokemonCenter_Escalator2F_Tile0_Frame2 0x2A4 +#define METATILE_PokemonCenter_Escalator2F_Tile1_Frame0 0x2A1 +#define METATILE_PokemonCenter_Escalator2F_Tile1_Frame1 0x2A3 +#define METATILE_PokemonCenter_Escalator2F_Tile1_Frame2 0x2A5 +#define METATILE_PokemonCenter_Escalator2F_Tile2_Frame0 0x2A8 +#define METATILE_PokemonCenter_Escalator2F_Tile2_Frame1 0x2AA +#define METATILE_PokemonCenter_Escalator2F_Tile2_Frame2 0x2AC +#define METATILE_PokemonCenter_Floor_ShadowTop_Alt 0x2DC +#define METATILE_PokemonCenter_Floor_Plain_Alt 0x2E4 +#define METATILE_PokemonCenter_Floor_ShadowTop 0x21E +#define METATILE_PokemonCenter_CounterBarrier 0x25D // gTileset_InsideOfTruck #define METATILE_InsideOfTruck_ExitLight_Top 0x208 diff --git a/src/fldeff_escalator.c b/src/fldeff_escalator.c index 13edda57d..7a96eaa82 100644 --- a/src/fldeff_escalator.c +++ b/src/fldeff_escalator.c @@ -16,46 +16,46 @@ static void Task_DrawTeleporterCable(u8 taskId); #define ESCALATOR_STAGES 3 #define LAST_ESCALATOR_STAGE (ESCALATOR_STAGES - 1) -static const u16 sElevatorMetatiles_1F_0[ESCALATOR_STAGES] = { - METATILE_PokemonCenter_Elevator1F_Tile0_Frame2, - METATILE_PokemonCenter_Elevator1F_Tile0_Frame1, - METATILE_PokemonCenter_Elevator1F_Tile0_Frame0 +static const u16 sEscalatorMetatiles_1F_0[ESCALATOR_STAGES] = { + METATILE_PokemonCenter_Escalator1F_Tile0_Frame2, + METATILE_PokemonCenter_Escalator1F_Tile0_Frame1, + METATILE_PokemonCenter_Escalator1F_Tile0_Frame0 }; -static const u16 sElevatorMetatiles_1F_1[ESCALATOR_STAGES] = { - METATILE_PokemonCenter_Elevator1F_Tile1_Frame2, - METATILE_PokemonCenter_Elevator1F_Tile1_Frame1, - METATILE_PokemonCenter_Elevator1F_Tile1_Frame0 +static const u16 sEscalatorMetatiles_1F_1[ESCALATOR_STAGES] = { + METATILE_PokemonCenter_Escalator1F_Tile1_Frame2, + METATILE_PokemonCenter_Escalator1F_Tile1_Frame1, + METATILE_PokemonCenter_Escalator1F_Tile1_Frame0 }; -static const u16 sElevatorMetatiles_1F_2[ESCALATOR_STAGES] = { - METATILE_PokemonCenter_Elevator1F_Tile2_Frame2, - METATILE_PokemonCenter_Elevator1F_Tile2_Frame1, - METATILE_PokemonCenter_Elevator1F_Tile2_Frame0 +static const u16 sEscalatorMetatiles_1F_2[ESCALATOR_STAGES] = { + METATILE_PokemonCenter_Escalator1F_Tile2_Frame2, + METATILE_PokemonCenter_Escalator1F_Tile2_Frame1, + METATILE_PokemonCenter_Escalator1F_Tile2_Frame0 }; -static const u16 sElevatorMetatiles_1F_3[ESCALATOR_STAGES] = { - METATILE_PokemonCenter_Elevator1F_Tile3_Frame2, - METATILE_PokemonCenter_Elevator1F_Tile3_Frame1, - METATILE_PokemonCenter_Elevator1F_Tile3_Frame0 +static const u16 sEscalatorMetatiles_1F_3[ESCALATOR_STAGES] = { + METATILE_PokemonCenter_Escalator1F_Tile3_Frame2, + METATILE_PokemonCenter_Escalator1F_Tile3_Frame1, + METATILE_PokemonCenter_Escalator1F_Tile3_Frame0 }; -static const u16 sElevatorMetatiles_2F_0[ESCALATOR_STAGES] = { - METATILE_PokemonCenter_Elevator2F_Tile0_Frame0, - METATILE_PokemonCenter_Elevator2F_Tile0_Frame1, - METATILE_PokemonCenter_Elevator2F_Tile0_Frame2 +static const u16 sEscalatorMetatiles_2F_0[ESCALATOR_STAGES] = { + METATILE_PokemonCenter_Escalator2F_Tile0_Frame0, + METATILE_PokemonCenter_Escalator2F_Tile0_Frame1, + METATILE_PokemonCenter_Escalator2F_Tile0_Frame2 }; -static const u16 sElevatorMetatiles_2F_1[ESCALATOR_STAGES] = { - METATILE_PokemonCenter_Elevator2F_Tile1_Frame0, - METATILE_PokemonCenter_Elevator2F_Tile1_Frame1, - METATILE_PokemonCenter_Elevator2F_Tile1_Frame2 +static const u16 sEscalatorMetatiles_2F_1[ESCALATOR_STAGES] = { + METATILE_PokemonCenter_Escalator2F_Tile1_Frame0, + METATILE_PokemonCenter_Escalator2F_Tile1_Frame1, + METATILE_PokemonCenter_Escalator2F_Tile1_Frame2 }; -static const u16 sElevatorMetatiles_2F_2[ESCALATOR_STAGES] = { - METATILE_PokemonCenter_Elevator2F_Tile2_Frame0, - METATILE_PokemonCenter_Elevator2F_Tile2_Frame1, - METATILE_PokemonCenter_Elevator2F_Tile2_Frame2 +static const u16 sEscalatorMetatiles_2F_2[ESCALATOR_STAGES] = { + METATILE_PokemonCenter_Escalator2F_Tile2_Frame0, + METATILE_PokemonCenter_Escalator2F_Tile2_Frame1, + METATILE_PokemonCenter_Escalator2F_Tile2_Frame2 }; #define tState data[0] @@ -122,25 +122,25 @@ static void Task_DrawEscalator(u8 taskId) switch (tState) { case 0: - SetEscalatorMetatile(taskId, sElevatorMetatiles_1F_0, 0); + SetEscalatorMetatile(taskId, sEscalatorMetatiles_1F_0, 0); break; case 1: - SetEscalatorMetatile(taskId, sElevatorMetatiles_1F_1, 0); + SetEscalatorMetatile(taskId, sEscalatorMetatiles_1F_1, 0); break; case 2: - SetEscalatorMetatile(taskId, sElevatorMetatiles_1F_2, METATILE_COLLISION_MASK); + SetEscalatorMetatile(taskId, sEscalatorMetatiles_1F_2, METATILE_COLLISION_MASK); break; case 3: - SetEscalatorMetatile(taskId, sElevatorMetatiles_1F_3, 0); + SetEscalatorMetatile(taskId, sEscalatorMetatiles_1F_3, 0); break; case 4: - SetEscalatorMetatile(taskId, sElevatorMetatiles_2F_0, METATILE_COLLISION_MASK); + SetEscalatorMetatile(taskId, sEscalatorMetatiles_2F_0, METATILE_COLLISION_MASK); break; case 5: - SetEscalatorMetatile(taskId, sElevatorMetatiles_2F_1, 0); + SetEscalatorMetatile(taskId, sEscalatorMetatiles_2F_1, 0); break; case 6: - SetEscalatorMetatile(taskId, sElevatorMetatiles_2F_2, 0); + SetEscalatorMetatile(taskId, sEscalatorMetatiles_2F_2, 0); break; } From 60ca1aa3fd4beaf7a4be7a61727ca832a4c489ef Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 23 Jul 2020 05:05:03 -0400 Subject: [PATCH 9/9] Restore tabs in field_effect_scripts.s --- data/field_effect_scripts.s | 416 ++++++++++++++++++------------------ 1 file changed, 208 insertions(+), 208 deletions(-) diff --git a/data/field_effect_scripts.s b/data/field_effect_scripts.s index 5c637615d..c57f19a04 100644 --- a/data/field_effect_scripts.s +++ b/data/field_effect_scripts.s @@ -1,345 +1,345 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" + .include "asm/macros.inc" + .include "constants/constants.inc" - .section script_data, "aw", %progbits + .section script_data, "aw", %progbits - .align 2 + .align 2 gFieldEffectScriptPointers:: @ 82DB9D4 - .4byte gFieldEffectScript_ExclamationMarkIcon1 @ FLDEFF_EXCLAMATION_MARK_ICON - .4byte gFieldEffectScript_UseCutOnTallGrass @ FLDEFF_USE_CUT_ON_GRASS - .4byte gFieldEffectScript_UseCutOnTree @ FLDEFF_USE_CUT_ON_TREE - .4byte gFieldEffectScript_Shadow @ FLDEFF_SHADOW - .4byte gFieldEffectScript_TallGrass @ FLDEFF_TALL_GRASS - .4byte gFieldEffectScript_Ripple @ FLDEFF_RIPPLE - .4byte gFieldEffectScript_FieldMoveShowMon @ FLDEFF_FIELD_MOVE_SHOW_MON - .4byte gFieldEffectScript_Ash @ FLDEFF_ASH - .4byte gFieldEffectScript_SurfBlob @ FLDEFF_SURF_BLOB - .4byte gFieldEffectScript_UseSurf @ FLDEFF_USE_SURF - .4byte gFieldEffectScript_GroundImpactDust @ FLDEFF_DUST - .4byte gFieldEffectScript_UseSecretPowerCave @ FLDEFF_USE_SECRET_POWER_CAVE - .4byte gFieldEffectScript_JumpTallGrass @ FLDEFF_JUMP_TALL_GRASS - .4byte gFieldEffectScript_SandFootprints @ FLDEFF_SAND_FOOTPRINTS - .4byte gFieldEffectScript_JumpBigSplash @ FLDEFF_JUMP_BIG_SPLASH - .4byte gFieldEffectScript_Splash @ FLDEFF_SPLASH - .4byte gFieldEffectScript_JumpSmallSplash @ FLDEFF_JUMP_SMALL_SPLASH - .4byte gFieldEffectScript_LongGrass @ FLDEFF_LONG_GRASS - .4byte gFieldEffectScript_JumpLongGrass @ FLDEFF_JUMP_LONG_GRASS - .4byte gFieldEffectScript_UnusedGrass @ FLDEFF_UNUSED_GRASS - .4byte gFieldEffectScript_UnusedGrass2 @ FLDEFF_UNUSED_GRASS_2 - .4byte gFieldEffectScript_UnusedSand @ FLDEFF_UNUSED_SAND - .4byte gFieldEffectScript_WaterSurfacing @ FLDEFF_WATER_SURFACING - .4byte gFieldEffectScript_BerryTreeGrowthSparkle @ FLDEFF_BERRY_TREE_GROWTH_SPARKLE - .4byte gFieldEffectScript_DeepSandFootprints @ FLDEFF_DEEP_SAND_FOOTPRINTS - .4byte gFieldEffectScript_PokeCenterHeal @ FLDEFF_POKECENTER_HEAL - .4byte gFieldEffectScript_UseSecretPowerTree @ FLDEFF_USE_SECRET_POWER_TREE - .4byte gFieldEffectScript_UseSecretPowerShrub @ FLDEFF_USE_SECRET_POWER_SHRUB - .4byte gFieldEffectScript_TreeDisguise @ FLDEFF_TREE_DISGUISE - .4byte gFieldEffectScript_MountainDisguise @ FLDEFF_MOUNTAIN_DISGUISE - .4byte gFieldEffectScript_NPCUseFly @ FLDEFF_NPCFLY_OUT - .4byte gFieldEffectScript_UseFly @ FLDEFF_USE_FLY - .4byte gFieldEffectScript_FlyIn @ FLDEFF_FLY_IN - .4byte gFieldEffectScript_QuestionMarkIcon @ FLDEFF_QUESTION_MARK_ICON - .4byte gFieldEffectScript_FeetInFlowingWater @ FLDEFF_FEET_IN_FLOWING_WATER - .4byte gFieldEffectScript_BikeTireTracks @ FLDEFF_BIKE_TIRE_TRACKS - .4byte gFieldEffectScript_SandDisguisePlaceholder @ FLDEFF_SAND_DISGUISE - .4byte gFieldEffectScript_UseRockSmash @ FLDEFF_USE_ROCK_SMASH - .4byte gFieldEffectScript_UseDig @ FLDEFF_USE_DIG - .4byte gFieldEffectScript_SandPile @ FLDEFF_SAND_PILE - .4byte gFieldEffectScript_UseStrength @ FLDEFF_USE_STRENGTH - .4byte gFieldEffectScript_ShortGrass @ FLDEFF_SHORT_GRASS - .4byte gFieldEffectScript_HotSpringsWater @ FLDEFF_HOT_SPRINGS_WATER - .4byte gFieldEffectScript_UseWaterfall @ FLDEFF_USE_WATERFALL - .4byte gFieldEffectScript_UseDive @ FLDEFF_USE_DIVE - .4byte gFieldEffectScript_Pokeball @ FLDEFF_POKEBALL - .4byte gFieldEffectScript_HeartIcon @ FLDEFF_HEART_ICON - .4byte gFieldEffectScript_Nop47 @ FLDEFF_NOP_47 - .4byte gFieldEffectScript_Nop48 @ FLDEFF_NOP_48 - .4byte gFieldEffectScript_AshPuff @ FLDEFF_ASH_PUFF - .4byte gFieldEffectScript_AshLaunch @ FLDEFF_ASH_LAUNCH - .4byte gFieldEffectScript_SweetScent @ FLDEFF_SWEET_SCENT - .4byte gFieldEffectScript_SandPillar @ FLDEFF_SAND_PILLAR - .4byte gFieldEffectScript_Bubbles @ FLDEFF_BUBBLES - .4byte gFieldEffectScript_Sparkle @ FLDEFF_SPARKLE - .4byte gFieldEffectScript_ShowSecretPowerCave @ FLDEFF_SECRET_POWER_CAVE - .4byte gFieldEffectScript_ShowSecretPowerTree @ FLDEFF_SECRET_POWER_TREE - .4byte gFieldEffectScript_ShowSecretPowerShrub @ FLDEFF_SECRET_POWER_SHRUB - .4byte gFieldEffectScript_ShowCutGrass @ FLDEFF_CUT_GRASS - .4byte gFieldEffectScript_FieldMoveShowMonInit @ FLDEFF_FIELD_MOVE_SHOW_MON_INIT - .4byte gFieldEffectScript_UsePuzzleEffect @ FLDEFF_USE_TOMB_PUZZLE_EFFECT - .4byte gFieldEffectScript_SecretBaseBootPC @ FLDEFF_PCTURN_ON - .4byte gFieldEffectScript_HallOfFameRecord @ FLDEFF_HALL_OF_FAME_RECORD - .4byte gFieldEffectScript_UseTeleport @ FLDEFF_USE_TELEPORT - .4byte gFieldEffectScript_RayquazaSpotlight @ FLDEFF_RAYQUAZA_SPOTLIGHT - .4byte gFieldEffectScript_DestroyDeoxysRock @ FLDEFF_DESTROY_DEOXYS_ROCK - .4byte gFieldEffectScript_MoveDeoxysRock @ FLDEFF_MOVE_DEOXYS_ROCK + .4byte gFieldEffectScript_ExclamationMarkIcon1 @ FLDEFF_EXCLAMATION_MARK_ICON + .4byte gFieldEffectScript_UseCutOnTallGrass @ FLDEFF_USE_CUT_ON_GRASS + .4byte gFieldEffectScript_UseCutOnTree @ FLDEFF_USE_CUT_ON_TREE + .4byte gFieldEffectScript_Shadow @ FLDEFF_SHADOW + .4byte gFieldEffectScript_TallGrass @ FLDEFF_TALL_GRASS + .4byte gFieldEffectScript_Ripple @ FLDEFF_RIPPLE + .4byte gFieldEffectScript_FieldMoveShowMon @ FLDEFF_FIELD_MOVE_SHOW_MON + .4byte gFieldEffectScript_Ash @ FLDEFF_ASH + .4byte gFieldEffectScript_SurfBlob @ FLDEFF_SURF_BLOB + .4byte gFieldEffectScript_UseSurf @ FLDEFF_USE_SURF + .4byte gFieldEffectScript_GroundImpactDust @ FLDEFF_DUST + .4byte gFieldEffectScript_UseSecretPowerCave @ FLDEFF_USE_SECRET_POWER_CAVE + .4byte gFieldEffectScript_JumpTallGrass @ FLDEFF_JUMP_TALL_GRASS + .4byte gFieldEffectScript_SandFootprints @ FLDEFF_SAND_FOOTPRINTS + .4byte gFieldEffectScript_JumpBigSplash @ FLDEFF_JUMP_BIG_SPLASH + .4byte gFieldEffectScript_Splash @ FLDEFF_SPLASH + .4byte gFieldEffectScript_JumpSmallSplash @ FLDEFF_JUMP_SMALL_SPLASH + .4byte gFieldEffectScript_LongGrass @ FLDEFF_LONG_GRASS + .4byte gFieldEffectScript_JumpLongGrass @ FLDEFF_JUMP_LONG_GRASS + .4byte gFieldEffectScript_UnusedGrass @ FLDEFF_UNUSED_GRASS + .4byte gFieldEffectScript_UnusedGrass2 @ FLDEFF_UNUSED_GRASS_2 + .4byte gFieldEffectScript_UnusedSand @ FLDEFF_UNUSED_SAND + .4byte gFieldEffectScript_WaterSurfacing @ FLDEFF_WATER_SURFACING + .4byte gFieldEffectScript_BerryTreeGrowthSparkle @ FLDEFF_BERRY_TREE_GROWTH_SPARKLE + .4byte gFieldEffectScript_DeepSandFootprints @ FLDEFF_DEEP_SAND_FOOTPRINTS + .4byte gFieldEffectScript_PokeCenterHeal @ FLDEFF_POKECENTER_HEAL + .4byte gFieldEffectScript_UseSecretPowerTree @ FLDEFF_USE_SECRET_POWER_TREE + .4byte gFieldEffectScript_UseSecretPowerShrub @ FLDEFF_USE_SECRET_POWER_SHRUB + .4byte gFieldEffectScript_TreeDisguise @ FLDEFF_TREE_DISGUISE + .4byte gFieldEffectScript_MountainDisguise @ FLDEFF_MOUNTAIN_DISGUISE + .4byte gFieldEffectScript_NPCUseFly @ FLDEFF_NPCFLY_OUT + .4byte gFieldEffectScript_UseFly @ FLDEFF_USE_FLY + .4byte gFieldEffectScript_FlyIn @ FLDEFF_FLY_IN + .4byte gFieldEffectScript_QuestionMarkIcon @ FLDEFF_QUESTION_MARK_ICON + .4byte gFieldEffectScript_FeetInFlowingWater @ FLDEFF_FEET_IN_FLOWING_WATER + .4byte gFieldEffectScript_BikeTireTracks @ FLDEFF_BIKE_TIRE_TRACKS + .4byte gFieldEffectScript_SandDisguisePlaceholder @ FLDEFF_SAND_DISGUISE + .4byte gFieldEffectScript_UseRockSmash @ FLDEFF_USE_ROCK_SMASH + .4byte gFieldEffectScript_UseDig @ FLDEFF_USE_DIG + .4byte gFieldEffectScript_SandPile @ FLDEFF_SAND_PILE + .4byte gFieldEffectScript_UseStrength @ FLDEFF_USE_STRENGTH + .4byte gFieldEffectScript_ShortGrass @ FLDEFF_SHORT_GRASS + .4byte gFieldEffectScript_HotSpringsWater @ FLDEFF_HOT_SPRINGS_WATER + .4byte gFieldEffectScript_UseWaterfall @ FLDEFF_USE_WATERFALL + .4byte gFieldEffectScript_UseDive @ FLDEFF_USE_DIVE + .4byte gFieldEffectScript_Pokeball @ FLDEFF_POKEBALL + .4byte gFieldEffectScript_HeartIcon @ FLDEFF_HEART_ICON + .4byte gFieldEffectScript_Nop47 @ FLDEFF_NOP_47 + .4byte gFieldEffectScript_Nop48 @ FLDEFF_NOP_48 + .4byte gFieldEffectScript_AshPuff @ FLDEFF_ASH_PUFF + .4byte gFieldEffectScript_AshLaunch @ FLDEFF_ASH_LAUNCH + .4byte gFieldEffectScript_SweetScent @ FLDEFF_SWEET_SCENT + .4byte gFieldEffectScript_SandPillar @ FLDEFF_SAND_PILLAR + .4byte gFieldEffectScript_Bubbles @ FLDEFF_BUBBLES + .4byte gFieldEffectScript_Sparkle @ FLDEFF_SPARKLE + .4byte gFieldEffectScript_ShowSecretPowerCave @ FLDEFF_SECRET_POWER_CAVE + .4byte gFieldEffectScript_ShowSecretPowerTree @ FLDEFF_SECRET_POWER_TREE + .4byte gFieldEffectScript_ShowSecretPowerShrub @ FLDEFF_SECRET_POWER_SHRUB + .4byte gFieldEffectScript_ShowCutGrass @ FLDEFF_CUT_GRASS + .4byte gFieldEffectScript_FieldMoveShowMonInit @ FLDEFF_FIELD_MOVE_SHOW_MON_INIT + .4byte gFieldEffectScript_UsePuzzleEffect @ FLDEFF_USE_TOMB_PUZZLE_EFFECT + .4byte gFieldEffectScript_SecretBaseBootPC @ FLDEFF_PCTURN_ON + .4byte gFieldEffectScript_HallOfFameRecord @ FLDEFF_HALL_OF_FAME_RECORD + .4byte gFieldEffectScript_UseTeleport @ FLDEFF_USE_TELEPORT + .4byte gFieldEffectScript_RayquazaSpotlight @ FLDEFF_RAYQUAZA_SPOTLIGHT + .4byte gFieldEffectScript_DestroyDeoxysRock @ FLDEFF_DESTROY_DEOXYS_ROCK + .4byte gFieldEffectScript_MoveDeoxysRock @ FLDEFF_MOVE_DEOXYS_ROCK gFieldEffectScript_ExclamationMarkIcon1:: @ 82DBAE0 - field_eff_callnative FldEff_ExclamationMarkIcon - field_eff_end + field_eff_callnative FldEff_ExclamationMarkIcon + field_eff_end gFieldEffectScript_UseCutOnTallGrass:: @ 82DBAE6 - field_eff_callnative FldEff_UseCutOnGrass - field_eff_end + field_eff_callnative FldEff_UseCutOnGrass + field_eff_end gFieldEffectScript_UseCutOnTree:: @ 82DBAEC - field_eff_callnative FldEff_UseCutOnTree - field_eff_end + field_eff_callnative FldEff_UseCutOnTree + field_eff_end gFieldEffectScript_Shadow:: @ 82DBAF2 - field_eff_callnative FldEff_Shadow - field_eff_end + field_eff_callnative FldEff_Shadow + field_eff_end gFieldEffectScript_TallGrass:: @ 82DBAF8 - field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect1, FldEff_TallGrass - field_eff_end + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect1, FldEff_TallGrass + field_eff_end gFieldEffectScript_Ripple:: @ 82DBB02 - field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect1, FldEff_Ripple - field_eff_end + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect1, FldEff_Ripple + field_eff_end gFieldEffectScript_FieldMoveShowMon:: @ 82DBB0C - field_eff_callnative FldEff_FieldMoveShowMon - field_eff_end + field_eff_callnative FldEff_FieldMoveShowMon + field_eff_end gFieldEffectScript_Ash:: @ 82DBB12 - field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect1, FldEff_Ash - field_eff_end + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect1, FldEff_Ash + field_eff_end gFieldEffectScript_SurfBlob:: @ 82DBB1C - field_eff_callnative FldEff_SurfBlob - field_eff_end + field_eff_callnative FldEff_SurfBlob + field_eff_end gFieldEffectScript_UseSurf:: @ 82DBB22 - field_eff_callnative FldEff_UseSurf - field_eff_end + field_eff_callnative FldEff_UseSurf + field_eff_end gFieldEffectScript_GroundImpactDust:: @ 82DBB28 - field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_Dust - field_eff_end + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_Dust + field_eff_end gFieldEffectScript_UseSecretPowerCave:: @ 82DBB32 - field_eff_callnative FldEff_UseSecretPowerCave - field_eff_end + field_eff_callnative FldEff_UseSecretPowerCave + field_eff_end gFieldEffectScript_JumpTallGrass:: @ 82DBB38 - field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect1, FldEff_JumpTallGrass - field_eff_end + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect1, FldEff_JumpTallGrass + field_eff_end gFieldEffectScript_SandFootprints:: @ 82DBB42 - field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_SandFootprints - field_eff_end + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_SandFootprints + field_eff_end gFieldEffectScript_JumpBigSplash:: @ 82DBB4C - field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_JumpBigSplash - field_eff_end + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_JumpBigSplash + field_eff_end gFieldEffectScript_Splash:: @ 82DBB56 - field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_Splash - field_eff_end + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_Splash + field_eff_end gFieldEffectScript_JumpSmallSplash:: @ 82DBB60 - field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_JumpSmallSplash - field_eff_end + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_JumpSmallSplash + field_eff_end gFieldEffectScript_LongGrass:: @ 82DBB6A - field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect1, FldEff_LongGrass - field_eff_end + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect1, FldEff_LongGrass + field_eff_end gFieldEffectScript_JumpLongGrass:: @ 82DBB74 - field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect1, FldEff_JumpLongGrass - field_eff_end + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect1, FldEff_JumpLongGrass + field_eff_end gFieldEffectScript_UnusedGrass:: @ 82DBB7E - field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect1, FldEff_UnusedGrass - field_eff_end + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect1, FldEff_UnusedGrass + field_eff_end gFieldEffectScript_UnusedGrass2:: @ 82DBB88 - field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect1, FldEff_UnusedGrass2 - field_eff_end + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect1, FldEff_UnusedGrass2 + field_eff_end gFieldEffectScript_UnusedSand:: @ 82DBB92 - field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_UnusedSand - field_eff_end + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_UnusedSand + field_eff_end gFieldEffectScript_WaterSurfacing:: @ 82DBB9C - field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_WaterSurfacing - field_eff_end + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_WaterSurfacing + field_eff_end gFieldEffectScript_BerryTreeGrowthSparkle:: @ 82DBBA6 - field_eff_callnative FldEff_BerryTreeGrowthSparkle - field_eff_end + field_eff_callnative FldEff_BerryTreeGrowthSparkle + field_eff_end gFieldEffectScript_DeepSandFootprints:: @ 82DBBAC - field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_DeepSandFootprints - field_eff_end + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_DeepSandFootprints + field_eff_end gFieldEffectScript_PokeCenterHeal:: @ 82DBBB6 - field_eff_loadfadedpal gSpritePalette_PokeballGlow - field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_PokecenterHeal - field_eff_end + field_eff_loadfadedpal gSpritePalette_PokeballGlow + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_PokecenterHeal + field_eff_end gFieldEffectScript_UseSecretPowerTree:: @ 82DBBC5 - field_eff_callnative FldEff_UseSecretPowerTree - field_eff_end + field_eff_callnative FldEff_UseSecretPowerTree + field_eff_end gFieldEffectScript_UseSecretPowerShrub:: @ 82DBBCB - field_eff_callnative FldEff_UseSecretPowerShrub - field_eff_end + field_eff_callnative FldEff_UseSecretPowerShrub + field_eff_end gFieldEffectScript_TreeDisguise:: @ 82DBBD1 - field_eff_callnative ShowTreeDisguiseFieldEffect - field_eff_end + field_eff_callnative ShowTreeDisguiseFieldEffect + field_eff_end gFieldEffectScript_MountainDisguise:: @ 82DBBD7 - field_eff_callnative ShowMountainDisguiseFieldEffect - field_eff_end + field_eff_callnative ShowMountainDisguiseFieldEffect + field_eff_end gFieldEffectScript_NPCUseFly:: @ 82DBBDD - field_eff_callnative FldEff_NPCFlyOut - field_eff_end + field_eff_callnative FldEff_NPCFlyOut + field_eff_end gFieldEffectScript_UseFly:: @ 82DBBE3 - field_eff_callnative FldEff_UseFly - field_eff_end + field_eff_callnative FldEff_UseFly + field_eff_end gFieldEffectScript_FlyIn:: @ 82DBBE9 - field_eff_callnative FldEff_FlyIn - field_eff_end + field_eff_callnative FldEff_FlyIn + field_eff_end gFieldEffectScript_QuestionMarkIcon:: @ 82DBBEF - field_eff_callnative FldEff_QuestionMarkIcon - field_eff_end + field_eff_callnative FldEff_QuestionMarkIcon + field_eff_end gFieldEffectScript_FeetInFlowingWater:: @ 82DBBF5 - field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_FeetInFlowingWater - field_eff_end + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_FeetInFlowingWater + field_eff_end gFieldEffectScript_BikeTireTracks:: @ 82DBBFF - field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_BikeTireTracks - field_eff_end + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_BikeTireTracks + field_eff_end gFieldEffectScript_SandDisguisePlaceholder:: @ 82DBC09 - field_eff_callnative ShowSandDisguiseFieldEffect - field_eff_end + field_eff_callnative ShowSandDisguiseFieldEffect + field_eff_end gFieldEffectScript_UseRockSmash:: @ 82DBC0F - field_eff_callnative FldEff_UseRockSmash - field_eff_end + field_eff_callnative FldEff_UseRockSmash + field_eff_end gFieldEffectScript_UseStrength:: @ 82DBC15 - field_eff_callnative FldEff_UseStrength - field_eff_end + field_eff_callnative FldEff_UseStrength + field_eff_end gFieldEffectScript_UseDig:: @ 82DBC1B - field_eff_callnative FldEff_UseDig - field_eff_end + field_eff_callnative FldEff_UseDig + field_eff_end gFieldEffectScript_SandPile:: @ 82DBC21 - field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_SandPile - field_eff_end + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_SandPile + field_eff_end gFieldEffectScript_ShortGrass:: @ 82DBC2B - field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect1, FldEff_ShortGrass - field_eff_end + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect1, FldEff_ShortGrass + field_eff_end gFieldEffectScript_HotSpringsWater:: @ 82DBC35 - field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect1, FldEff_HotSpringsWater - field_eff_end + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect1, FldEff_HotSpringsWater + field_eff_end gFieldEffectScript_UseWaterfall:: @ 82DBC3F - field_eff_callnative FldEff_UseWaterfall - field_eff_end + field_eff_callnative FldEff_UseWaterfall + field_eff_end gFieldEffectScript_UseDive:: @ 82DBC45 - field_eff_callnative FldEff_UseDive - field_eff_end + field_eff_callnative FldEff_UseDive + field_eff_end gFieldEffectScript_Pokeball:: @ 82DBC4B - field_eff_loadpal gSpritePalette_Pokeball - field_eff_callnative FldEff_Pokeball - field_eff_end + field_eff_loadpal gSpritePalette_Pokeball + field_eff_callnative FldEff_Pokeball + field_eff_end gFieldEffectScript_HeartIcon:: @ 82DBC56 - field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_HeartIcon - field_eff_end + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_HeartIcon + field_eff_end gFieldEffectScript_Nop47:: @ 82DBC60 - field_eff_callnative FldEff_Nop47 - field_eff_end + field_eff_callnative FldEff_Nop47 + field_eff_end gFieldEffectScript_Nop48:: @ 82DBC66 - field_eff_callnative FldEff_Nop48 - field_eff_end + field_eff_callnative FldEff_Nop48 + field_eff_end gFieldEffectScript_AshPuff:: @ 82DBC6C - field_eff_loadfadedpal_callnative gSpritePalette_Ash, FldEff_AshPuff - field_eff_end + field_eff_loadfadedpal_callnative gSpritePalette_Ash, FldEff_AshPuff + field_eff_end gFieldEffectScript_AshLaunch:: @ 82DBC76 - field_eff_loadfadedpal_callnative gSpritePalette_Ash, FldEff_AshLaunch - field_eff_end + field_eff_loadfadedpal_callnative gSpritePalette_Ash, FldEff_AshLaunch + field_eff_end gFieldEffectScript_SweetScent:: @ 82DBC80 - field_eff_callnative FldEff_SweetScent - field_eff_end + field_eff_callnative FldEff_SweetScent + field_eff_end gFieldEffectScript_SandPillar:: @ 82DBC86 - field_eff_loadfadedpal_callnative gSpritePalette_SandPillar, FldEff_SandPillar - field_eff_end + field_eff_loadfadedpal_callnative gSpritePalette_SandPillar, FldEff_SandPillar + field_eff_end gFieldEffectScript_Bubbles:: @ 82DBC90 - field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_Bubbles - field_eff_end + field_eff_loadfadedpal_callnative gSpritePalette_GeneralFieldEffect0, FldEff_Bubbles + field_eff_end gFieldEffectScript_Sparkle:: @ 82DBC9A - field_eff_loadfadedpal_callnative gSpritePalette_SmallSparkle, FldEff_Sparkle - field_eff_end + field_eff_loadfadedpal_callnative gSpritePalette_SmallSparkle, FldEff_Sparkle + field_eff_end gFieldEffectScript_ShowSecretPowerCave:: @ 82DBCA4 - field_eff_loadfadedpal_callnative gSpritePalette_SecretPower_Cave, FldEff_SecretPowerCave - field_eff_end + field_eff_loadfadedpal_callnative gSpritePalette_SecretPower_Cave, FldEff_SecretPowerCave + field_eff_end gFieldEffectScript_ShowSecretPowerTree:: @ 82DBCAE - field_eff_loadfadedpal_callnative gSpritePalette_SecretPower_Plant, FldEff_SecretPowerTree - field_eff_end + field_eff_loadfadedpal_callnative gSpritePalette_SecretPower_Plant, FldEff_SecretPowerTree + field_eff_end gFieldEffectScript_ShowSecretPowerShrub:: @ 82DBCB8 - field_eff_loadfadedpal_callnative gSpritePalette_SecretPower_Plant, FldEff_SecretPowerShrub - field_eff_end + field_eff_loadfadedpal_callnative gSpritePalette_SecretPower_Plant, FldEff_SecretPowerShrub + field_eff_end gFieldEffectScript_ShowCutGrass:: @ 82DBCC2 - field_eff_loadfadedpal_callnative gSpritePalette_CutGrass, FldEff_CutGrass - field_eff_end + field_eff_loadfadedpal_callnative gSpritePalette_CutGrass, FldEff_CutGrass + field_eff_end gFieldEffectScript_FieldMoveShowMonInit:: @ 82DBCCC - field_eff_callnative FldEff_FieldMoveShowMonInit - field_eff_end + field_eff_callnative FldEff_FieldMoveShowMonInit + field_eff_end gFieldEffectScript_UsePuzzleEffect:: @ 82DBCD2 - field_eff_callnative FldEff_UsePuzzleEffect - field_eff_end + field_eff_callnative FldEff_UsePuzzleEffect + field_eff_end gFieldEffectScript_SecretBaseBootPC:: @ 82DBCD8 - field_eff_callnative FldEff_SecretBasePCTurnOn - field_eff_end + field_eff_callnative FldEff_SecretBasePCTurnOn + field_eff_end gFieldEffectScript_HallOfFameRecord:: @ 82DBCDE - field_eff_loadfadedpal gSpritePalette_PokeballGlow - field_eff_loadfadedpal_callnative gSpritePalette_HofMonitor, FldEff_HallOfFameRecord - field_eff_end + field_eff_loadfadedpal gSpritePalette_PokeballGlow + field_eff_loadfadedpal_callnative gSpritePalette_HofMonitor, FldEff_HallOfFameRecord + field_eff_end gFieldEffectScript_UseTeleport:: @ 82DBCED - field_eff_callnative FldEff_UseTeleport - field_eff_end + field_eff_callnative FldEff_UseTeleport + field_eff_end gFieldEffectScript_RayquazaSpotlight:: @ 82DBCF3 - field_eff_callnative FldEff_RayquazaSpotlight - field_eff_end + field_eff_callnative FldEff_RayquazaSpotlight + field_eff_end gFieldEffectScript_DestroyDeoxysRock:: @ 82DBCF9 - field_eff_callnative FldEff_DestroyDeoxysRock - field_eff_end + field_eff_callnative FldEff_DestroyDeoxysRock + field_eff_end gFieldEffectScript_MoveDeoxysRock:: @ 82DBCFF - field_eff_callnative FldEff_MoveDeoxysRock - field_eff_end + field_eff_callnative FldEff_MoveDeoxysRock + field_eff_end