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 65f4d97e2..000000000 Binary files a/graphics/field_effects/pics/unknown_18.png and /dev/null differ diff --git a/graphics/field_effects/pics/unused_grass.png b/graphics/field_effects/pics/unused_grass.png index ffd68ec1d..65f4d97e2 100644 Binary files a/graphics/field_effects/pics/unused_grass.png and b/graphics/field_effects/pics/unused_grass.png differ diff --git a/graphics/field_effects/pics/unused_grass_2.png b/graphics/field_effects/pics/unused_grass_2.png new file mode 100644 index 000000000..ffd68ec1d Binary files /dev/null and b/graphics/field_effects/pics/unused_grass_2.png differ diff --git a/include/constants/field_effects.h b/include/constants/field_effects.h index 00ca60457..cd7a43e86 100644 --- a/include/constants/field_effects.h +++ b/include/constants/field_effects.h @@ -21,7 +21,7 @@ #define FLDEFF_LONG_GRASS 17 #define FLDEFF_JUMP_LONG_GRASS 18 #define FLDEFF_UNKNOWN_19 19 -#define FLDEFF_UNKNOWN_20 20 +#define FLDEFF_UNUSED_GRASS 20 #define FLDEFF_UNKNOWN_21 21 #define FLDEFF_UNKNOWN_22 22 #define FLDEFF_BERRY_TREE_GROWTH_SPARKLE 23 @@ -66,7 +66,45 @@ #define FLDEFF_HALL_OF_FAME_RECORD 62 #define FLDEFF_USE_TELEPORT 63 #define FLDEFF_RAYQUAZA 64 -#define FLDEFF_65 65 +#define FLDEFF_DESTROY_DEOXYS_ROCK 65 #define FLDEFF_MOVE_DEOXYS_ROCK 66 -#endif +#define FLDEFFOBJ_SHADOW_S 0 +#define FLDEFFOBJ_SHADOW_M 1 +#define FLDEFFOBJ_SHADOW_L 2 +#define FLDEFFOBJ_SHADOW_XL 3 +#define FLDEFFOBJ_TALL_GRASS 4 +#define FLDEFFOBJ_RIPPLE 5 +#define FLDEFFOBJ_ASH 6 +#define FLDEFFOBJ_SURF_BLOB 7 +#define FLDEFFOBJ_ARROW 8 +#define FLDEFFOBJ_GROUND_IMPACT_DUST 9 +#define FLDEFFOBJ_JUMP_TALL_GRASS 10 +#define FLDEFFOBJ_SAND_FOOTPRINTS 11 +#define FLDEFFOBJ_JUMP_BIG_SPLASH 12 +#define FLDEFFOBJ_SPLASH 13 +#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 18 +#define FLDEFFOBJ_19 19 +#define FLDEFFOBJ_20 20 +#define FLDEFFOBJ_REFLECTION_DISTORTION 21 +#define FLDEFFOBJ_SPARKLE 22 +#define FLDEFFOBJ_DEEP_SAND_FOOTPRINTS 23 +#define FLDEFFOBJ_TREE_DISGUISE 24 +#define FLDEFFOBJ_MOUNTAIN_DISGUISE 25 +#define FLDEFFOBJ_BIRD 26 +#define FLDEFFOBJ_BIKE_TIRE_TRACKS 27 +#define FLDEFFOBJ_SAND_DISGUISE 28 +#define FLDEFFOBJ_SAND_PILE 29 +#define FLDEFFOBJ_SHORT_GRASS 30 +#define FLDEFFOBJ_HOT_SPRINGS_WATER 31 +#define FLDEFFOBJ_JUMP_OUT_OF_ASH 32 +#define FLDEFFOBJ_LAVARIDGE_GYM_WARP 33 +#define FLDEFFOBJ_BUBBLES 34 +#define FLDEFFOBJ_SMALL_SPARKLE 35 +#define FLDEFFOBJ_RAYQUAZA 36 + +#endif // GUARD_FIELD_EFFECT_CONSTANTS_H diff --git a/include/event_scripts.h b/include/event_scripts.h index d147dd4f1..dad746126 100644 --- a/include/event_scripts.h +++ b/include/event_scripts.h @@ -587,4 +587,26 @@ extern u8 BerryTree_EventScript_ItemUsePlantBerry[]; extern u8 BerryTree_EventScript_ItemUseWailmerPail[]; extern u8 BattleFrontier_OutsideEast_EventScript_WaterSudowoodo[]; +// overworld +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[]; + #endif // GUARD_EVENT_SCRIPTS_H diff --git a/include/field_camera.h b/include/field_camera.h index fecea244e..2bed02b20 100644 --- a/include/field_camera.h +++ b/include/field_camera.h @@ -23,7 +23,7 @@ void DrawWholeMapView(void); void CurrentMapDrawMetatileAt(int x, int y); void sub_8089C08(s16 *a0, s16 *a1); void DrawDoorMetatileAt(int x, int y, u16 *arr); -void move_tilemap_camera_to_upper_left_corner(void); +void ResetFieldCamera(void); void sub_8057A58(void); void ResetCameraUpdateInfo(void); u32 InitCameraUpdateCallback(u8 a); diff --git a/include/field_control_avatar.h b/include/field_control_avatar.h index f722a6063..17e5afb63 100644 --- a/include/field_control_avatar.h +++ b/include/field_control_avatar.h @@ -34,7 +34,7 @@ bool8 sub_8068870(u16 a); bool8 sub_8068894(void); bool8 sub_8068A64(struct MapPosition *, u16); u8 sub_8068F18(void); -bool8 dive_warp(struct MapPosition *position, u16 b); +bool8 TryDoDiveWarp(struct MapPosition *position, u16 b); int SetCableClubWarp(void); u8 TrySetDiveWarp(void); const u8 *GetInteractedLinkPlayerScript(struct MapPosition *position, u8 metatileBehavior, u8 direction); diff --git a/include/field_effect.h b/include/field_effect.h index 59f99ad93..42d007c37 100644 --- a/include/field_effect.h +++ b/include/field_effect.h @@ -16,7 +16,7 @@ void ReturnToFieldFromFlyMapSelect(void); u8 AddNewGameBirchObject(s16, s16, u8); void FieldEffectStop(struct Sprite *sprite, u8 id); u8 CreateTrainerSprite(u8 trainerSpriteID, s16 x, s16 y, u8 subpriority, u8 *buffer); -void CreateTeleportFieldEffectTask(void); +void FldEff_TeleportWarpOut(void); void FieldEffectActiveListRemove(u8 id); void MultiplyInvertedPaletteRGBComponents(u16, u8, u8, u8); void FieldEffectActiveListAdd(u8 id); @@ -39,10 +39,6 @@ void StartEscalatorWarp(u8 metatileBehavior, u8 priority); void StartLavaridgeGymB1FWarp(u8 priority); void StartLavaridgeGym1FWarp(u8 priority); -void sub_80B9C28(s16*, u8); -void sub_80B9C54(s16*, u8); -void sub_80B9CDC(s16*, u8); - void SpriteCB_PopOutOfAsh(struct Sprite*); void SpriteCB_LavaridgeGymWarp(struct Sprite*); diff --git a/include/field_player_avatar.h b/include/field_player_avatar.h index bcee339d5..51dabdca2 100644 --- a/include/field_player_avatar.h +++ b/include/field_player_avatar.h @@ -39,7 +39,7 @@ void sub_808BCF4(void); void sub_808D074(u8); void GetXYCoordsOneStepInFrontOfPlayer(s16 *xPtr, s16 *yPtr); u8 GetRivalAvatarGraphicsIdByStateIdAndGender(u8, u8); -void sub_808C114(void); +void SetPlayerAvatarFieldMove(void); u8 GetPlayerAvatarGraphicsIdByCurrentState(void); void SetPlayerAvatarStateMask(u8 a); u8 GetPlayerAvatarGraphicsIdByStateId(u8 a); @@ -47,7 +47,7 @@ u8 GetJumpSpecialMovementAction(u32); bool8 PartyHasMonWithSurf(void); bool8 IsPlayerFacingSurfableFishableWater(void); bool8 IsPlayerSurfingNorth(void); -void sub_808C228(u8 direction); +void SetPlayerAvatarWatering(u8 direction); u8 GetPlayerAvatarFlags(void); void sub_808B578(void); u8 GetFRLGAvatarGraphicsIdByGender(u8); diff --git a/include/field_screen_effect.h b/include/field_screen_effect.h index e05e30378..de472da3c 100644 --- a/include/field_screen_effect.h +++ b/include/field_screen_effect.h @@ -1,6 +1,8 @@ #ifndef GUARD_FIELD_SCREEN_EFFECT_H #define GUARD_FIELD_SCREEN_EFFECT_H +extern const s32 gMaxFlashLevel; + void WarpFadeInScreen(void); void WarpFadeOutScreen(void); void FadeInFromBlack(void); diff --git a/include/fieldmap.h b/include/fieldmap.h index dc81d1766..cf7d4befe 100644 --- a/include/fieldmap.h +++ b/include/fieldmap.h @@ -35,12 +35,12 @@ void InitMap(void); void InitMapFromSavedGame(void); void InitTrainerHillMap(void); void InitBattlePyramidMap(bool8 setPlayerPosition); -void copy_map_tileset1_tileset2_to_vram(struct MapLayout const *mapLayout); -void apply_map_tileset1_tileset2_palette(struct MapLayout const *mapLayout); -void apply_map_tileset2_palette(struct MapLayout const *mapLayout); -void copy_map_tileset2_to_vram_2(struct MapLayout const *mapLayout); -void copy_map_tileset1_to_vram(const struct MapLayout *); -void copy_map_tileset2_to_vram(const struct MapLayout *); +void CopyMapTilesetsToVram(struct MapLayout const *mapLayout); +void LoadMapTilesetPalettes(struct MapLayout const *mapLayout); +void LoadSecondaryTilesetPalette(struct MapLayout const *mapLayout); +void CopySecondaryTilesetToVramUsingHeap(struct MapLayout const *mapLayout); +void CopyPrimaryTilesetToVram(const struct MapLayout *); +void CopySecondaryTilesetToVram(const struct MapLayout *); struct MapHeader const *const mapconnection_get_mapheader(struct MapConnection *connection); struct MapConnection *GetConnectionAtCoords(s16 x, s16 y); diff --git a/include/fldeff.h b/include/fldeff.h index deb54372c..99bcdafaf 100644 --- a/include/fldeff.h +++ b/include/fldeff.h @@ -22,9 +22,9 @@ void sub_81BE7F4(void); void sub_81BE994(void); // escalator -void sub_80E1558(u8 var); -void sub_80E1570(void); -bool8 sub_80E1584(void); +void StartEscalator(bool8 var); +void StopEscalator(void); +bool8 IsEscalatorMoving(void); // soft-boiled bool8 SetUpFieldMove_SoftBoiled(void); @@ -55,7 +55,7 @@ bool8 FldEff_UseDig(void); // rock smash bool8 CheckObjectGraphicsInFrontOfPlayer(u8 graphicsId); -u8 oei_task_add(void); +u8 CreateFieldMoveTask(void); bool8 SetUpFieldMove_RockSmash(void); bool8 FldEff_UseRockSmash(void); diff --git a/include/global.fieldmap.h b/include/global.fieldmap.h index 59610f9ad..4598e87fa 100644 --- a/include/global.fieldmap.h +++ b/include/global.fieldmap.h @@ -247,14 +247,14 @@ enum { PLAYER_AVATAR_STATE_WATERING, }; -#define PLAYER_AVATAR_FLAG_ON_FOOT (1 << PLAYER_AVATAR_STATE_NORMAL) -#define PLAYER_AVATAR_FLAG_MACH_BIKE (1 << PLAYER_AVATAR_STATE_MACH_BIKE) -#define PLAYER_AVATAR_FLAG_ACRO_BIKE (1 << PLAYER_AVATAR_STATE_ACRO_BIKE) -#define PLAYER_AVATAR_FLAG_SURFING (1 << PLAYER_AVATAR_STATE_SURFING) -#define PLAYER_AVATAR_FLAG_UNDERWATER (1 << PLAYER_AVATAR_STATE_UNDERWATER) -#define PLAYER_AVATAR_FLAG_5 (1 << PLAYER_AVATAR_STATE_FIELD_MOVE) -#define PLAYER_AVATAR_FLAG_6 (1 << PLAYER_AVATAR_STATE_FISHING) -#define PLAYER_AVATAR_FLAG_DASH (1 << PLAYER_AVATAR_STATE_WATERING) +#define PLAYER_AVATAR_FLAG_ON_FOOT (1 << 0) +#define PLAYER_AVATAR_FLAG_MACH_BIKE (1 << 1) +#define PLAYER_AVATAR_FLAG_ACRO_BIKE (1 << 2) +#define PLAYER_AVATAR_FLAG_SURFING (1 << 3) +#define PLAYER_AVATAR_FLAG_UNDERWATER (1 << 4) +#define PLAYER_AVATAR_FLAG_5 (1 << 5) +#define PLAYER_AVATAR_FLAG_FORCED_MOVE (1 << 6) +#define PLAYER_AVATAR_FLAG_DASH (1 << 7) enum { diff --git a/include/menu.h b/include/menu.h index 1f4d63284..c4da09abb 100644 --- a/include/menu.h +++ b/include/menu.h @@ -30,7 +30,7 @@ extern const u16 gUnknown_0860F074[]; void FreeAllOverworldWindowBuffers(void); void InitStandardTextBoxWindows(void); -void sub_8197200(void); +void InitTextBoxGfxAndPrinters(void); u16 RunTextPrintersAndIsPrinter0Active(void); void LoadMessageBoxAndBorderGfx(void); void DrawDialogueFrame(u8 windowId, bool8 copyToVram); @@ -64,8 +64,8 @@ void CreateYesNoMenu(const struct WindowTemplate *windowTemplate, u16 borderFirs void DecompressAndLoadBgGfxUsingHeap(u8 bgId, const void *src, u32 size, u16 offset, u8 mode); s8 Menu_ProcessInputNoWrapClearOnChoose(void); s8 ProcessMenuInput_other(void); -void do_scheduled_bg_tilemap_copies_to_vram(void); -void clear_scheduled_bg_copies_to_vram(void); +void DoScheduledBgTilemapCopiesToVram(void); +void ClearScheduledBgCopiesToVram(void); void AddTextPrinterParameterized4(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, const u8 *color, s8 speed, const u8 *str); void DrawDialogFrameWithCustomTileAndPalette(u8 windowId, bool8 copyToVram, u16 a2, u8 a3); void sub_81995E4(u8 windowId, u8 optionsNo, const struct MenuAction *actions, const u8 *actionIds); diff --git a/include/overworld.h b/include/overworld.h index 78a5b4ad0..a2eac7e29 100644 --- a/include/overworld.h +++ b/include/overworld.h @@ -24,6 +24,8 @@ #define MOVEMENT_MODE_FROZEN 1 #define MOVEMENT_MODE_SCRIPTED 2 +#define SKIP_OBJECT_EVENT_LOAD 1 + struct InitialPlayerAvatarState { u8 transitionFlags; @@ -99,8 +101,7 @@ void SetDefaultFlashLevel(void); void Overworld_SetFlashLevel(s32 flashLevel); u8 Overworld_GetFlashLevel(void); void SetCurrentMapLayout(u16 mapLayoutId); -void sub_8085540(u8 var); -u8 sub_808554C(void); +void SetObjectEventLoadFlag(u8 var); u16 GetLocationMusic(struct WarpData *warp); u16 GetCurrLocationDefaultMusic(void); u16 GetWarpDestinationMusic(void); @@ -135,11 +136,9 @@ void SetUnusedCallback(void *a0); void CB2_NewGame(void); void CB2_WhiteOut(void); void CB2_LoadMap(void); -void sub_8086024(void); +void CB2_ReturnToFieldContestHall(void); void CB2_ReturnToFieldCableClub(void); void CB2_ReturnToField(void); -void CB2_ReturnToFieldLocal(void); -void CB2_ReturnToFieldLink(void); void CB2_ReturnToFieldFromMultiplayer(void); void CB2_ReturnToFieldWithOpenMenu(void); void CB2_ReturnToFieldContinueScript(void); diff --git a/ld_script.txt b/ld_script.txt index 74d9f6ae6..0277e5885 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -439,7 +439,7 @@ SECTIONS { gflib/window.o(.rodata); gflib/text.o(.rodata); gflib/sprite.o(.rodata); - data/io_reg.o(.rodata); + gflib/io_reg.o(.rodata); gflib/string_util.o(.rodata); src/link.o(.rodata); src/link.o(.rodata.str1.4); diff --git a/spritesheet_rules.mk b/spritesheet_rules.mk index 83a68b887..3ac906b1b 100644 --- a/spritesheet_rules.mk +++ b/spritesheet_rules.mk @@ -582,7 +582,7 @@ $(FLDEFFGFXDIR)/arrow.4bpp: %.4bpp: %.png $(FLDEFFGFXDIR)/ash.4bpp: %.4bpp: %.png $(GFX) $< $@ -mwidth 2 -mheight 2 -$(FLDEFFGFXDIR)/berry_tree_growth_sparkle.4bpp: %.4bpp: %.png +$(FLDEFFGFXDIR)/sparkle.4bpp: %.4bpp: %.png $(GFX) $< $@ -mwidth 2 -mheight 2 $(FLDEFFGFXDIR)/bike_hop_big_splash.4bpp: %.4bpp: %.png @@ -642,7 +642,7 @@ $(FLDEFFGFXDIR)/unknown_16.4bpp: %.4bpp: %.png $(FLDEFFGFXDIR)/unknown_17.4bpp: %.4bpp: %.png $(GFX) $< $@ -mwidth 2 -mheight 2 -$(FLDEFFGFXDIR)/unknown_18.4bpp: %.4bpp: %.png +$(FLDEFFGFXDIR)/unused_grass.4bpp: %.4bpp: %.png $(GFX) $< $@ -mwidth 2 -mheight 2 $(FLDEFFGFXDIR)/unknown_19.4bpp: %.4bpp: %.png @@ -651,14 +651,14 @@ $(FLDEFFGFXDIR)/unknown_19.4bpp: %.4bpp: %.png $(FLDEFFGFXDIR)/unknown_20.4bpp: %.4bpp: %.png $(GFX) $< $@ -mwidth 2 -mheight 2 -$(FLDEFFGFXDIR)/unknown_29.4bpp: %.4bpp: %.png +$(FLDEFFGFXDIR)/sand_pile.4bpp: %.4bpp: %.png $(GFX) $< $@ -mwidth 2 -mheight 1 $(FLDEFFGFXDIR)/lavaridge_gym_warp.4bpp: %.4bpp: %.png $(GFX) $< $@ -mwidth 2 -mheight 2 -$(FLDEFFGFXDIR)/unknown_35.4bpp: %.4bpp: %.png +$(FLDEFFGFXDIR)/small_sparkle.4bpp: %.4bpp: %.png $(GFX) $< $@ -mwidth 2 -mheight 2 -$(FLDEFFGFXDIR)/unused_grass.4bpp: %.4bpp: %.png +$(FLDEFFGFXDIR)/unused_grass_2.4bpp: %.4bpp: %.png $(GFX) $< $@ -mwidth 2 -mheight 2 diff --git a/src/battle_pyramid_bag.c b/src/battle_pyramid_bag.c index 5626dd7bc..33daed80c 100644 --- a/src/battle_pyramid_bag.c +++ b/src/battle_pyramid_bag.c @@ -402,7 +402,7 @@ static void sub_81C501C(void) RunTasks(); AnimateSprites(); BuildOamBuffer(); - do_scheduled_bg_tilemap_copies_to_vram(); + DoScheduledBgTilemapCopiesToVram(); UpdatePaletteFade(); } @@ -424,7 +424,7 @@ static bool8 sub_81C5078(void) { case 0: SetVBlankHBlankCallbacksToNull(); - clear_scheduled_bg_copies_to_vram(); + ClearScheduledBgCopiesToVram(); gMain.state++; break; case 1: diff --git a/src/berry_crush.c b/src/berry_crush.c index 48e4ac4c3..7da04ffb4 100755 --- a/src/berry_crush.c +++ b/src/berry_crush.c @@ -1076,7 +1076,7 @@ int sub_802104C(void) return 0; InitStandardTextBoxWindows(); - sub_8197200(); + InitTextBoxGfxAndPrinters(); sub_8022588(var0); sub_8022600(var0); gPaletteFade.bufferTransferDisabled = TRUE; diff --git a/src/berry_tag_screen.c b/src/berry_tag_screen.c index 38c2832ee..e5c89bdb7 100644 --- a/src/berry_tag_screen.c +++ b/src/berry_tag_screen.c @@ -186,7 +186,7 @@ static void CB2_BerryTagScreen(void) RunTasks(); AnimateSprites(); BuildOamBuffer(); - do_scheduled_bg_tilemap_copies_to_vram(); + DoScheduledBgTilemapCopiesToVram(); UpdatePaletteFade(); } @@ -217,7 +217,7 @@ static bool8 InitBerryTagScreen(void) case 0: SetVBlankHBlankCallbacksToNull(); ResetVramOamAndBgCntRegs(); - clear_scheduled_bg_copies_to_vram(); + ClearScheduledBgCopiesToVram(); gMain.state++; break; case 1: diff --git a/src/bike.c b/src/bike.c index cd24d2487..4d67cfdd5 100644 --- a/src/bike.c +++ b/src/bike.c @@ -836,7 +836,7 @@ static void Bike_UpdateDirTimerHistory(u8 dir) gPlayerAvatar.directionHistory = (gPlayerAvatar.directionHistory << 4) | (dir & 0xF); - for (i = 7; i != 0; i--) + for (i = ARRAY_COUNT(gPlayerAvatar.dirTimerHistory) - 1; i != 0; i--) gPlayerAvatar.dirTimerHistory[i] = gPlayerAvatar.dirTimerHistory[i - 1]; gPlayerAvatar.dirTimerHistory[0] = 1; } @@ -847,7 +847,7 @@ static void Bike_UpdateABStartSelectHistory(u8 input) gPlayerAvatar.abStartSelectHistory = (gPlayerAvatar.abStartSelectHistory << 4) | (input & 0xF); - for (i = 7; i != 0; i--) + for (i = ARRAY_COUNT(gPlayerAvatar.abStartSelectTimerHistory) - 1; i != 0; i--) gPlayerAvatar.abStartSelectTimerHistory[i] = gPlayerAvatar.abStartSelectTimerHistory[i - 1]; gPlayerAvatar.abStartSelectTimerHistory[0] = 1; } @@ -1001,10 +1001,10 @@ void BikeClearState(int newDirHistory, int newAbStartHistory) gPlayerAvatar.directionHistory = newDirHistory; gPlayerAvatar.abStartSelectHistory = newAbStartHistory; - for (i = 0; i < 8; i++) + for (i = 0; i < ARRAY_COUNT(gPlayerAvatar.dirTimerHistory); i++) gPlayerAvatar.dirTimerHistory[i] = 0; - for (i = 0; i < 8; i++) + for (i = 0; i < ARRAY_COUNT(gPlayerAvatar.abStartSelectTimerHistory); i++) gPlayerAvatar.abStartSelectTimerHistory[i] = 0; } diff --git a/src/braille_puzzles.c b/src/braille_puzzles.c index c00be82ad..3802b9eca 100644 --- a/src/braille_puzzles.c +++ b/src/braille_puzzles.c @@ -165,7 +165,7 @@ void DoBrailleRegisteelEffect(void) bool8 FldEff_UseFlyAncientTomb(void) { - u8 taskId = oei_task_add(); + u8 taskId = CreateFieldMoveTask(); gTasks[taskId].data[8] = (u32)UseRegisteelHm_Callback >> 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(); }