diff --git a/README.md b/README.md index ce0b6b4c73..7b49d19926 100644 --- a/README.md +++ b/README.md @@ -2,14 +2,27 @@ ## What is the pokeemerald Expansion? -The pokeemerald Expansion is a collection of feature branches that can be integrated into existing [pokeemerald](https://github.com/pret/pokeemerald) projects. +The Pokeemerald Expansion is a collection of feature branches that can be integrated into existing [pokeemerald](https://github.com/pret/pokeemerald) projects. -## What feature branches are included? +## What features are included? +- Upgraded battle engine. + - Fairy Type. + - Physical/Special/Status Category Split. + - New moves and abilities up to SwSh. + - Options to change behaviors and data by generation. + - Mega Evolution and Primal Reversion + - Z-Moves +- Pokémon Species from newer Generations (with the option to disable them if needed). + - Updates Hoenn's Regional Dex to match ORAS'. + - Updates National Dex incorporating all the new species. + - Option to change base stats by generation. + - New evolution methods. + - Hidden Abilities data (How to make them available is up to the user). +- Items from newer Generations and updated item effects for battle and field use. -- **[Battle Engine Upgrade](../tree/battle_engine):** Upgrades the battle engine in pokeemerald to newer Generation games' standards. It also adds newer moves and abilities. -- **[Pokémon Expansion](../tree/pokemon_expansion):** Adds Pokémon from newer Generations and makes them available in the National Dex. It also updates base stats and other Pokémon info. -- **[Item Expansion](../tree/item_expansion):** Adds items from newer Generations and also updates item effects for field use. -- **[master](../tree/master):** Combines the above branches into one single branch for the sake of convenience. Note that this branch is only updated once in a while, so you must merge manually if you want the latest features. +Certain mechanics, moves, abilities and species sprites are missing. For more information, see [the project's milestones](https://github.com/rh-hideout/pokeemerald-expansion/milestones). + +### [Documentation on features can be found here](https://github.com/rh-hideout/pokeemerald-expansion/wiki) ## Who maintains the project? @@ -17,9 +30,11 @@ The project was originally started by DizzyEgg alongside other contributors. The project has now gotten larger and DizzyEgg is now maintaining the project as part of the ROM Hacking Hideout community. Some members of this community are taking on larger roles to help maintain the project. +### Please consider crediting the entire [list of contributors](https://github.com/rh-hideout/pokeemerald-expansion/wiki/Credits) in your project, as they have all worked hard to develop this project :) + ## Can I contribute even if I'm not a member of ROM Hacking Hideout? -Yes! Contributions are welcome via Pull Requests and they will be reviewed by maintainers. Please note that PRs to master are not accepted, as master is only intended to be a merged branch. +Yes! Contributions are welcome via Pull Requests and they will be reviewed by maintainers. Don't feel discouraged if we take a bit to review your PR, we'll get to it. ## What is ROM Hacking Hideout? diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 50c5f7fd72..98a17712e2 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1186,11 +1186,11 @@ .byte 0xe5 .endm - .macro docastformchangeanimation + .macro doweatherformchangeanimation .byte 0xe6 .endm - .macro trycastformdatachange + .macro tryweatherformdatachange .byte 0xe7 .endm diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index bfd5af0539..6a46a2d55e 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -1,3 +1,4 @@ +#include "config.h" #include "constants/battle.h" #include "constants/battle_anim.h" #include "constants/rgb.h" @@ -779,6 +780,31 @@ gBattleAnims_Moves:: .4byte Move_GLACIAL_LANCE .4byte Move_ASTRAL_BARRAGE .4byte Move_EERIE_SPELL +@@@@LA MOVES + .4byte Move_DIRE_CLAW + .4byte Move_PSYSHIELD_BASH + .4byte Move_POWER_SHIFT + .4byte Move_STONE_AXE + .4byte Move_SPRINGTIDE_STORM + .4byte Move_MYSTICAL_POWER + .4byte Move_RAGING_FURY + .4byte Move_WAVE_CRASH + .4byte Move_CHLOROBLAST + .4byte Move_MOUNTAIN_GALE + .4byte Move_VICTORY_DANCE + .4byte Move_HEADLONG_RUSH + .4byte Move_BARB_BARRAGE + .4byte Move_ESPER_WING + .4byte Move_BITTER_MALICE + .4byte Move_SHELTER + .4byte Move_TRIPLE_ARROWS + .4byte Move_INFERNAL_PARADE + .4byte Move_CEASELESS_EDGE + .4byte Move_BLEAKWIND_STORM + .4byte Move_WILDBOLT_STORM + .4byte Move_SANDSEAR_STORM + .4byte Move_LUNAR_BLESSING + .4byte Move_TAKE_HEART @@@@ Z MOVES .4byte Move_BREAKNECK_BLITZ .4byte Move_ALL_OUT_PUMMELING @@ -833,7 +859,7 @@ gBattleAnims_StatusConditions:: .align 2 gBattleAnims_General:: - .4byte General_CastformChange @ B_ANIM_CASTFORM_CHANGE + .4byte General_WeatherFormChange @ B_ANIM_CASTFORM_CHANGE .4byte General_StatsChange @ B_ANIM_STATS_CHANGE .4byte General_SubstituteFade @ B_ANIM_SUBSTITUTE_FADE .4byte General_SubstituteAppear @ B_ANIM_SUBSTITUTE_APPEAR @@ -14270,55 +14296,51 @@ Move_POLTERGEIST:: end Move_CORROSIVE_GAS:: - end @to do: - Move_COACHING:: - end @to do: - Move_FLIP_TURN:: - end @to do: - Move_TRIPLE_AXEL:: - end @to do: - Move_DUAL_WINGBEAT:: - end @to do: - Move_SCORCHING_SANDS:: - end @to do: + end @to do Move_JUNGLE_HEALING:: goto Move_AROMATHERAPY Move_WICKED_BLOW:: - end @to do: - Move_SURGING_STRIKES:: - end @to do: - Move_THUNDER_CAGE:: - end @to do: - Move_DRAGON_ENERGY:: - end @to do: - Move_FREEZING_GLARE:: - end @to do: - Move_FIERY_WRATH:: - end @to do: - Move_THUNDEROUS_KICK:: - end @to do: - Move_GLACIAL_LANCE:: - end @to do: - Move_ASTRAL_BARRAGE:: - end @to do: - Move_EERIE_SPELL:: - end @to do: +Move_DIRE_CLAW:: +Move_PSYSHIELD_BASH:: +Move_POWER_SHIFT:: +Move_STONE_AXE:: +Move_SPRINGTIDE_STORM:: +Move_MYSTICAL_POWER:: +Move_RAGING_FURY:: +Move_WAVE_CRASH:: +Move_CHLOROBLAST:: +Move_MOUNTAIN_GALE:: +Move_VICTORY_DANCE:: +Move_HEADLONG_RUSH:: +Move_BARB_BARRAGE:: +Move_ESPER_WING:: +Move_BITTER_MALICE:: +Move_SHELTER:: +Move_TRIPLE_ARROWS:: +Move_INFERNAL_PARADE:: +Move_CEASELESS_EDGE:: +Move_BLEAKWIND_STORM:: +Move_WILDBOLT_STORM:: +Move_SANDSEAR_STORM:: +Move_LUNAR_BLESSING:: +Move_TAKE_HEART:: + end @to do @@@@@@@@@@@@@@@@@@@@@@@ GEN 1-3 @@@@@@@@@@@@@@@@@@@@@@@ Move_NONE: @@ -23549,26 +23571,25 @@ Move_SECRET_POWER: jumpargeq 0, BATTLE_TERRAIN_PUDDLE, Move_MUD_SHOT jumpargeq 0, BATTLE_TERRAIN_MARSH, Move_MUD_SHOT jumpargeq 0, BATTLE_TERRAIN_SWAMP, Move_MUD_SHOT -.if B_SECRET_POWER_ANIMATION >= GEN_7 - jumpargeq 0, BATTLE_TERRAIN_SNOW, Move_ICE_SHARD -.else - jumpargeq 0, BATTLE_TERRAIN_SNOW, Move_AVALANCHE -.endif jumpargeq 0, BATTLE_TERRAIN_ICE, Move_ICE_SHARD jumpargeq 0, BATTLE_TERRAIN_VOLCANO, Move_INCINERATE jumpargeq 0, BATTLE_TERRAIN_DISTORTION_WORLD, Move_POUND jumpargeq 0, BATTLE_TERRAIN_SPACE, Move_SWIFT jumpargeq 0, BATTLE_TERRAIN_ULTRA_SPACE, Move_PSYWAVE .if B_SECRET_POWER_ANIMATION >= GEN_7 + jumpargeq 0, BATTLE_TERRAIN_SNOW, Move_ICE_SHARD jumpargeq 0, BATTLE_TERRAIN_BUILDING, Move_SPIT_UP goto Move_SPIT_UP -.elseif B_SECRET_POWER_ANIMATION == GEN_6 +.elseif B_SECRET_POWER_ANIMATION >= GEN_6 + jumpargeq 0, BATTLE_TERRAIN_SNOW, Move_AVALANCHE jumpargeq 0, BATTLE_TERRAIN_BUILDING, Move_BODY_SLAM goto Move_BODY_SLAM -.elseif B_SECRET_POWER_ANIMATION == GEN_5 || B_SECRET_POWER_ANIMATION == GEN_4 +.elseif B_SECRET_POWER_ANIMATION >= GEN_4 + jumpargeq 0, BATTLE_TERRAIN_SNOW, Move_AVALANCHE jumpargeq 0, BATTLE_TERRAIN_BUILDING, Move_BODY_SLAM goto Move_MUD_SLAP .else + jumpargeq 0, BATTLE_TERRAIN_SNOW, Move_AVALANCHE jumpargeq 0, BATTLE_TERRAIN_BUILDING, Move_STRENGTH goto Move_SLAM .endif @@ -24226,11 +24247,11 @@ Status_Nightmare: Status_Powder: end -General_CastformChange: +General_WeatherFormChange: createvisualtask AnimTask_IsMonInvisible, 2 - jumpreteq TRUE, CastformChangeSkipAnim - goto CastformChangeContinue -CastformChangeContinue: + jumpreteq TRUE, WeatherFormChangeSkipAnim + goto WeatherFormChangeContinue +WeatherFormChangeContinue: monbg ANIM_ATTACKER playsewithpan SE_M_TELEPORT, SOUND_PAN_ATTACKER waitplaysewithpan SE_M_MINIMIZE, SOUND_PAN_ATTACKER, 48 @@ -24238,7 +24259,7 @@ CastformChangeContinue: waitforvisualfinish clearmonbg ANIM_ATTACKER end -CastformChangeSkipAnim: +WeatherFormChangeSkipAnim: createvisualtask AnimTask_CastformGfxDataChange, 2, 1 end diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 9ecc3b179f..31c284e7dc 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -1,3 +1,4 @@ +#include "config.h" #include "constants/global.h" #include "constants/battle.h" #include "constants/pokemon.h" @@ -2016,12 +2017,11 @@ BattleScript_EffectHitSwitchTarget: resultmessage waitmessage B_WAIT_TIME_LONG tryfaintmon BS_TARGET - moveendcase MOVEEND_MAGICIAN @ possibly others? + moveendall jumpifability BS_TARGET, ABILITY_SUCTION_CUPS, BattleScript_AbilityPreventsPhasingOut jumpifstatus3 BS_TARGET, STATUS3_ROOTED, BattleScript_PrintMonIsRooted tryhitswitchtarget BattleScript_EffectHitSwitchTargetMoveEnd BattleScript_EffectHitSwitchTargetMoveEnd: - moveendall end BattleScript_EffectClearSmog: @@ -6567,11 +6567,9 @@ BattleScript_LearnMoveReturn:: BattleScript_RainContinuesOrEnds:: printfromtable gRainContinuesStringIds waitmessage B_WAIT_TIME_LONG - jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_RAIN_STOPPED, BattleScript_RainEnds + jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_RAIN_STOPPED, BattleScript_RainContinuesOrEndsEnd playanimation BS_ATTACKER, B_ANIM_RAIN_CONTINUES - end2 -BattleScript_RainEnds:: - call BattleScript_WeatherFormChanges +BattleScript_RainContinuesOrEndsEnd:: end2 BattleScript_DamagingWeatherContinues:: @@ -6610,7 +6608,6 @@ BattleScript_DamagingWeatherContinuesEnd:: BattleScript_SandStormHailEnds:: printfromtable gSandStormHailEndStringIds waitmessage B_WAIT_TIME_LONG - call BattleScript_WeatherFormChanges end2 BattleScript_SunlightContinues:: @@ -6622,7 +6619,6 @@ BattleScript_SunlightContinues:: BattleScript_SunlightFaded:: printstring STRINGID_SUNLIGHTFADED waitmessage B_WAIT_TIME_LONG - call BattleScript_WeatherFormChanges end2 BattleScript_OverworldWeatherStarts:: @@ -7456,6 +7452,7 @@ BattleScript_MagicCoatBounce:: printfromtable gMagicCoatBounceStringIds waitmessage B_WAIT_TIME_LONG orword gHitMarker, HITMARKER_ATTACKSTRING_PRINTED | HITMARKER_NO_PPDEDUCT | HITMARKER_ALLOW_NO_PP + bicword gHitMarker, HITMARKER_NO_ATTACKSTRING setmagiccoattarget BS_ATTACKER return @@ -8227,19 +8224,30 @@ BattleScript_ShedSkinActivates:: BattleScript_WeatherFormChanges:: setbyte sBATTLER, 0 BattleScript_WeatherFormChangesLoop:: - trycastformdatachange + tryweatherformdatachange addbyte sBATTLER, 1 jumpifbytenotequal sBATTLER, gBattlersCount, BattleScript_WeatherFormChangesLoop return -BattleScript_CastformChange:: - call BattleScript_DoCastformChange +BattleScript_WeatherFormChange:: + call BattleScript_DoWeatherFormChange end3 -BattleScript_DoCastformChange:: +BattleScript_DoWeatherFormChange:: copybyte gBattlerAbility, sBATTLER +.if B_WEATHER_FORMS >= GEN_5 + jumpifspecies BS_SCRIPTING, SPECIES_CASTFORM, BattleScript_DoWeatherFormChange_ForecastCheck +BattleScript_DoWeatherFormChange_FlowerGiftCheck: + jumpifability BS_SCRIPTING, ABILITY_FLOWER_GIFT, BattleScript_DoWeatherFormChange_PopUp + goto BattleScript_DoWeatherFormChange_AfterPopUp +.endif +BattleScript_DoWeatherFormChange_ForecastCheck: + jumpifability BS_SCRIPTING, ABILITY_FORECAST, BattleScript_DoWeatherFormChange_PopUp + goto BattleScript_DoWeatherFormChange_AfterPopUp +BattleScript_DoWeatherFormChange_PopUp: call BattleScript_AbilityPopUp - docastformchangeanimation +BattleScript_DoWeatherFormChange_AfterPopUp: + doweatherformchangeanimation waitstate printstring STRINGID_PKMNTRANSFORMED waitmessage B_WAIT_TIME_LONG diff --git a/data/contest_ai_scripts.s b/data/contest_ai_scripts.s index ef4feb25ff..ecd3103ae2 100644 --- a/data/contest_ai_scripts.s +++ b/data/contest_ai_scripts.s @@ -435,11 +435,15 @@ AI_CGM_BetterWhenAudienceExcited: AI_CGM_BetterWhenAudienceExcited_1stUp: @ BUG: Should be if_appeal_num_eq 0 @ 1st up on 1st appeal excitement will always be 0 - if_appeal_num_not_eq 0, AI_CGM_BetterWhenAudienceExcited_Not1stAppeal +.ifdef BUGFIX + if_appeal_num_eq 0, AI_CGM_BetterWhenAudienceExcited_1stAppeal +.else + if_appeal_num_not_eq 0, AI_CGM_BetterWhenAudienceExcited_1stAppeal +.endif if_excitement_eq 4, AI_CGM_BetterWhenAudienceExcited_1AwayFromMax if_excitement_eq 3, AI_CGM_BetterWhenAudienceExcited_2AwayFromMax end -AI_CGM_BetterWhenAudienceExcited_Not1stAppeal: +AI_CGM_BetterWhenAudienceExcited_1stAppeal: if_random_less_than 125, AI_CGM_End score -15 end @@ -542,7 +546,11 @@ AI_CGM_TargetMonWithJudgesAttention: end AI_CGM_TargetMonWithJudgesAttention_CheckMon1: if_cannot_participate MON_1, AI_CGM_TargetMonWithJudgesAttention_CheckMon2 +.ifdef BUGFIX + if_not_used_combo_starter MON_1, AI_CGM_TargetMonWithJudgesAttention_CheckMon2 +.else if_used_combo_starter MON_1, AI_CGM_TargetMonWithJudgesAttention_CheckMon2 +.endif if_random_less_than 125, AI_CGM_TargetMonWithJudgesAttention_CheckMon2 score +2 if_not_completed_combo MON_1, AI_CGM_TargetMonWithJudgesAttention_CheckMon2 @@ -551,7 +559,11 @@ AI_CGM_TargetMonWithJudgesAttention_CheckMon1: AI_CGM_TargetMonWithJudgesAttention_CheckMon2: if_user_order_eq MON_2, AI_CGM_End if_cannot_participate MON_2, AI_CGM_TargetMonWithJudgesAttention_CheckMon3 +.ifdef BUGFIX + if_not_used_combo_starter MON_2, AI_CGM_TargetMonWithJudgesAttention_CheckMon3 +.else if_used_combo_starter MON_2, AI_CGM_TargetMonWithJudgesAttention_CheckMon3 +.endif if_random_less_than 125, AI_CGM_TargetMonWithJudgesAttention_CheckMon3 score +2 if_not_completed_combo MON_2, AI_CGM_TargetMonWithJudgesAttention_CheckMon3 @@ -560,7 +572,11 @@ AI_CGM_TargetMonWithJudgesAttention_CheckMon2: AI_CGM_TargetMonWithJudgesAttention_CheckMon3: if_user_order_eq MON_3, AI_CGM_End if_cannot_participate MON_3, AI_CGM_End +.ifdef BUGFIX + if_not_used_combo_starter MON_3, AI_CGM_End +.else if_used_combo_starter MON_3, AI_CGM_End +.endif if_random_less_than 125, AI_CGM_End score +2 if_not_completed_combo MON_3, AI_CGM_End diff --git a/data/event_scripts.s b/data/event_scripts.s index 7c3a2b23f9..848a831fea 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -577,6 +577,8 @@ gStdScripts_End:: .include "data/scripts/new_game.inc" .include "data/scripts/hall_of_fame.inc" + .include "data/scripts/debug.inc" + EventScript_WhiteOut:: call EverGrandeCity_HallOfFame_EventScript_ResetEliteFour goto EventScript_ResetMrBriney diff --git a/data/maps/AbandonedShip_HiddenFloorRooms/map.json b/data/maps/AbandonedShip_HiddenFloorRooms/map.json index 8b6e05f12f..0c6962688f 100644 --- a/data/maps/AbandonedShip_HiddenFloorRooms/map.json +++ b/data/maps/AbandonedShip_HiddenFloorRooms/map.json @@ -51,7 +51,7 @@ "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", "script": "AbandonedShip_HiddenFloorRooms_EventScript_ItemTM18", - "flag": "FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_1_TM_18" + "flag": "FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_1_TM18" }, { "graphics_id": "OBJ_EVENT_GFX_ITEM_BALL", diff --git a/data/maps/AbandonedShip_Room_B1F/map.json b/data/maps/AbandonedShip_Room_B1F/map.json index f5d14ac595..537f0ec645 100644 --- a/data/maps/AbandonedShip_Room_B1F/map.json +++ b/data/maps/AbandonedShip_Room_B1F/map.json @@ -25,7 +25,7 @@ "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", "script": "AbandonedShip_Room_B1F_EventScript_ItemTM13", - "flag": "FLAG_ITEM_ABANDONED_SHIP_ROOMS_B1F_TM_13" + "flag": "FLAG_ITEM_ABANDONED_SHIP_ROOMS_B1F_TM13" } ], "warp_events": [ diff --git a/data/maps/MeteorFalls_1F_1R/map.json b/data/maps/MeteorFalls_1F_1R/map.json index f177410e27..145289ce79 100644 --- a/data/maps/MeteorFalls_1F_1R/map.json +++ b/data/maps/MeteorFalls_1F_1R/map.json @@ -25,7 +25,7 @@ "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", "script": "MeteorFalls_1F_1R_EventScript_ItemTM23", - "flag": "FLAG_ITEM_METEOR_FALLS_1F_1R_TM_23" + "flag": "FLAG_ITEM_METEOR_FALLS_1F_1R_TM23" }, { "graphics_id": "OBJ_EVENT_GFX_ITEM_BALL", diff --git a/data/maps/MeteorFalls_B1F_2R/map.json b/data/maps/MeteorFalls_B1F_2R/map.json index 57276d86db..7fc43762f5 100644 --- a/data/maps/MeteorFalls_B1F_2R/map.json +++ b/data/maps/MeteorFalls_B1F_2R/map.json @@ -25,7 +25,7 @@ "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", "script": "MeteorFalls_B1F_2R_EventScript_ItemTM02", - "flag": "FLAG_ITEM_METEOR_FALLS_B1F_2R_TM_02" + "flag": "FLAG_ITEM_METEOR_FALLS_B1F_2R_TM02" } ], "warp_events": [ diff --git a/data/maps/MtPyre_6F/map.json b/data/maps/MtPyre_6F/map.json index dc2e7f9b00..88c091f3e3 100644 --- a/data/maps/MtPyre_6F/map.json +++ b/data/maps/MtPyre_6F/map.json @@ -38,7 +38,7 @@ "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", "script": "MtPyre_6F_EventScript_ItemTM30", - "flag": "FLAG_ITEM_MT_PYRE_6F_TM_30" + "flag": "FLAG_ITEM_MT_PYRE_6F_TM30" }, { "graphics_id": "OBJ_EVENT_GFX_PSYCHIC_M", diff --git a/data/maps/MtPyre_Exterior/map.json b/data/maps/MtPyre_Exterior/map.json index 58c865305f..2df79262c2 100644 --- a/data/maps/MtPyre_Exterior/map.json +++ b/data/maps/MtPyre_Exterior/map.json @@ -38,7 +38,7 @@ "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", "script": "MtPyre_Exterior_EventScript_ItemTM48", - "flag": "FLAG_ITEM_MT_PYRE_EXTERIOR_TM_48" + "flag": "FLAG_ITEM_MT_PYRE_EXTERIOR_TM48" } ], "warp_events": [ diff --git a/data/maps/Route111/map.json b/data/maps/Route111/map.json index 4621591e43..566e7c9629 100644 --- a/data/maps/Route111/map.json +++ b/data/maps/Route111/map.json @@ -262,7 +262,7 @@ "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", "script": "Route111_EventScript_ItemTM37", - "flag": "FLAG_ITEM_ROUTE_111_TM_37" + "flag": "FLAG_ITEM_ROUTE_111_TM37" }, { "graphics_id": "OBJ_EVENT_GFX_BERRY_TREE", diff --git a/data/maps/Route113/map.json b/data/maps/Route113/map.json index 422b88e6ef..783406346e 100644 --- a/data/maps/Route113/map.json +++ b/data/maps/Route113/map.json @@ -451,7 +451,7 @@ "y": 5, "elevation": 3, "item": "ITEM_TM32", - "flag": "FLAG_HIDDEN_ITEM_ROUTE_113_TM_32" + "flag": "FLAG_HIDDEN_ITEM_ROUTE_113_TM32" }, { "type": "hidden_item", diff --git a/data/maps/Route115/map.json b/data/maps/Route115/map.json index bbac132f52..a5e2b10f9e 100644 --- a/data/maps/Route115/map.json +++ b/data/maps/Route115/map.json @@ -166,7 +166,7 @@ "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", "script": "Route115_EventScript_ItemTM01", - "flag": "FLAG_ITEM_ROUTE_115_TM_01" + "flag": "FLAG_ITEM_ROUTE_115_TM01" }, { "graphics_id": "OBJ_EVENT_GFX_ITEM_BALL", diff --git a/data/maps/SafariZone_Northwest/map.json b/data/maps/SafariZone_Northwest/map.json index 1e27def2cd..20fffd0498 100644 --- a/data/maps/SafariZone_Northwest/map.json +++ b/data/maps/SafariZone_Northwest/map.json @@ -49,7 +49,7 @@ "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", "script": "SafariZone_Northwest_EventScript_ItemTM22", - "flag": "FLAG_ITEM_SAFARI_ZONE_NORTH_WEST_TM_22" + "flag": "FLAG_ITEM_SAFARI_ZONE_NORTH_WEST_TM22" } ], "warp_events": [], diff --git a/data/maps/ScorchedSlab/map.json b/data/maps/ScorchedSlab/map.json index e90f1f5c1f..cb97894903 100644 --- a/data/maps/ScorchedSlab/map.json +++ b/data/maps/ScorchedSlab/map.json @@ -25,7 +25,7 @@ "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", "script": "ScorchedSlab_EventScript_ItemTM11", - "flag": "FLAG_ITEM_SCORCHED_SLAB_TM_11" + "flag": "FLAG_ITEM_SCORCHED_SLAB_TM11" } ], "warp_events": [ diff --git a/data/maps/SeafloorCavern_Room9/map.json b/data/maps/SeafloorCavern_Room9/map.json index 0557b0c3eb..7942b3d1d4 100644 --- a/data/maps/SeafloorCavern_Room9/map.json +++ b/data/maps/SeafloorCavern_Room9/map.json @@ -90,7 +90,7 @@ "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", "script": "SeafloorCavern_Room9_EventScript_ItemTM26", - "flag": "FLAG_ITEM_SEAFLOOR_CAVERN_ROOM_9_TM_26" + "flag": "FLAG_ITEM_SEAFLOOR_CAVERN_ROOM_9_TM26" }, { "graphics_id": "OBJ_EVENT_GFX_KYOGRE_ASLEEP", diff --git a/data/maps/ShoalCave_LowTideIceRoom/map.json b/data/maps/ShoalCave_LowTideIceRoom/map.json index ea4f0cedf4..3195d408b3 100644 --- a/data/maps/ShoalCave_LowTideIceRoom/map.json +++ b/data/maps/ShoalCave_LowTideIceRoom/map.json @@ -25,7 +25,7 @@ "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", "script": "ShoalCave_LowTideIceRoom_EventScript_ItemTM07", - "flag": "FLAG_ITEM_SHOAL_CAVE_ICE_ROOM_TM_07" + "flag": "FLAG_ITEM_SHOAL_CAVE_ICE_ROOM_TM07" }, { "graphics_id": "OBJ_EVENT_GFX_ITEM_BALL", diff --git a/data/maps/VictoryRoad_B1F/map.json b/data/maps/VictoryRoad_B1F/map.json index 6e290ce6de..68b013ef46 100644 --- a/data/maps/VictoryRoad_B1F/map.json +++ b/data/maps/VictoryRoad_B1F/map.json @@ -246,7 +246,7 @@ "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", "script": "VictoryRoad_B1F_EventScript_ItemTM29", - "flag": "FLAG_ITEM_VICTORY_ROAD_B1F_TM_29" + "flag": "FLAG_ITEM_VICTORY_ROAD_B1F_TM29" }, { "graphics_id": "OBJ_EVENT_GFX_ITEM_BALL", diff --git a/data/scripts/debug.inc b/data/scripts/debug.inc new file mode 100644 index 0000000000..9463164ac2 --- /dev/null +++ b/data/scripts/debug.inc @@ -0,0 +1,79 @@ +Debug_ShowFieldMessageStringVar4:: + special ShowFieldMessageStringVar4 + waitmessage + waitbuttonpress + releaseall + end + +Debug_CheatStart:: + lockall + setflag FLAG_SYS_POKEMON_GET + setflag FLAG_RESCUED_BIRCH + setflag FLAG_HIDE_ROUTE_101_BIRCH_ZIGZAGOON_BATTLE + setflag FLAG_ADVENTURE_STARTED + clearflag FLAG_HIDE_LITTLEROOT_TOWN_BIRCHS_LAB_BIRCH + setflag FLAG_HIDE_ROUTE_101_BIRCH_STARTERS_BAG + setvar VAR_BIRCH_LAB_STATE, 2 + setvar VAR_ROUTE101_STATE, 3 + givemon SPECIES_TREECKO, 20, ITEM_NONE + givemon SPECIES_TORCHIC, 20, ITEM_NONE + givemon SPECIES_MUDKIP, 20, ITEM_NONE + setflag FLAG_SYS_POKEDEX_GET + special SetUnlockedPokedexFlags + setflag FLAG_RECEIVED_POKEDEX_FROM_BIRCH + setvar VAR_CABLE_CLUB_TUTORIAL_STATE, 1 + setflag FLAG_SYS_NATIONAL_DEX + special EnableNationalPokedex + setflag FLAG_RECEIVED_RUNNING_SHOES + setflag FLAG_SYS_B_DASH + setvar VAR_LITTLEROOT_TOWN_STATE, 4 @ 4: Received Running Shoes + setvar VAR_LITTLEROOT_INTRO_STATE, 7 @ 7: Told to go meet rival + setvar VAR_LITTLEROOT_HOUSES_STATE_BRENDAN, 2 @ 2: Met Rival's Mom (and is corresponding gender) + setvar VAR_LITTLEROOT_HOUSES_STATE_MAY, 2 @ 2: Met Rival's Mom (and is corresponding gender) + setvar VAR_LITTLEROOT_RIVAL_STATE, 4 @ 4: Received Pokedex + setflag FLAG_RECEIVED_BIKE + additem ITEM_ACRO_BIKE + setvar VAR_BRINEY_HOUSE_STATE, 1 + setvar VAR_ROUTE116_STATE, 2 + setflag FLAG_HIDE_ROUTE_116_MR_BRINEY + clearflag FLAG_HIDE_BRINEYS_HOUSE_MR_BRINEY + clearflag FLAG_HIDE_BRINEYS_HOUSE_PEEKO + release + end + +Debug_FlagsNotSetMessage:: + lockall + message Debug_FlagsNotSetMessage_Text + waitmessage + waitbuttonpress + releaseall + end + +Debug_FlagsNotSetMessage_Text: + .string "Feature unavailable!\n" + .string "Please define a usable flag in:\l" + .string "'include/constants/overworld{UNDERSCORE}config.h'!$" + +Debug_Script_1:: + end + +Debug_Script_2:: + end + +Debug_Script_3:: + end + +Debug_Script_4:: + end + +Debug_Script_5:: + end + +Debug_Script_6:: + end + +Debug_Script_7:: + end + +Debug_Script_8:: + end diff --git a/gflib/sprite.c b/gflib/sprite.c index 9fc597cc3b..cbcd6fb7c0 100644 --- a/gflib/sprite.c +++ b/gflib/sprite.c @@ -103,7 +103,7 @@ typedef void (*AffineAnimCmdFunc)(u8 matrixNum, struct Sprite *); #define DUMMY_OAM_DATA \ { \ .y = DISPLAY_HEIGHT, \ - .affineMode = 0, \ + .affineMode = ST_OAM_AFFINE_OFF, \ .objMode = 0, \ .mosaic = FALSE, \ .bpp = 0, \ diff --git a/graphics/battle_anims/backgrounds/new/aeroblast.pal b/graphics/battle_anims/backgrounds/aeroblast.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/aeroblast.pal rename to graphics/battle_anims/backgrounds/aeroblast.pal diff --git a/graphics/battle_anims/backgrounds/new/aeroblast_map.bin b/graphics/battle_anims/backgrounds/aeroblast_map.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/aeroblast_map.bin rename to graphics/battle_anims/backgrounds/aeroblast_map.bin diff --git a/graphics/battle_anims/backgrounds/new/aeroblast_tiles.png b/graphics/battle_anims/backgrounds/aeroblast_tiles.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/aeroblast_tiles.png rename to graphics/battle_anims/backgrounds/aeroblast_tiles.png diff --git a/graphics/battle_anims/backgrounds/new/aura_sphere.pal b/graphics/battle_anims/backgrounds/aura_sphere.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/aura_sphere.pal rename to graphics/battle_anims/backgrounds/aura_sphere.pal diff --git a/graphics/battle_anims/backgrounds/new/blackhole_eclipse.bin b/graphics/battle_anims/backgrounds/blackhole_eclipse.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/blackhole_eclipse.bin rename to graphics/battle_anims/backgrounds/blackhole_eclipse.bin diff --git a/graphics/battle_anims/backgrounds/new/blackhole_eclipse.png b/graphics/battle_anims/backgrounds/blackhole_eclipse.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/blackhole_eclipse.png rename to graphics/battle_anims/backgrounds/blackhole_eclipse.png diff --git a/graphics/battle_anims/backgrounds/new/bloom_doom.bin b/graphics/battle_anims/backgrounds/bloom_doom.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/bloom_doom.bin rename to graphics/battle_anims/backgrounds/bloom_doom.bin diff --git a/graphics/battle_anims/backgrounds/new/bloom_doom.pal b/graphics/battle_anims/backgrounds/bloom_doom.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/bloom_doom.pal rename to graphics/battle_anims/backgrounds/bloom_doom.pal diff --git a/graphics/battle_anims/backgrounds/new/bloom_doom.png b/graphics/battle_anims/backgrounds/bloom_doom.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/bloom_doom.png rename to graphics/battle_anims/backgrounds/bloom_doom.png diff --git a/graphics/battle_anims/backgrounds/new/bolt_strike.bin b/graphics/battle_anims/backgrounds/bolt_strike.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/bolt_strike.bin rename to graphics/battle_anims/backgrounds/bolt_strike.bin diff --git a/graphics/battle_anims/backgrounds/new/bolt_strike.pal b/graphics/battle_anims/backgrounds/bolt_strike.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/bolt_strike.pal rename to graphics/battle_anims/backgrounds/bolt_strike.pal diff --git a/graphics/battle_anims/backgrounds/new/bolt_strike.png b/graphics/battle_anims/backgrounds/bolt_strike.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/bolt_strike.png rename to graphics/battle_anims/backgrounds/bolt_strike.png diff --git a/graphics/battle_anims/backgrounds/new/clangorous_soulblaze.bin b/graphics/battle_anims/backgrounds/clangorous_soulblaze.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/clangorous_soulblaze.bin rename to graphics/battle_anims/backgrounds/clangorous_soulblaze.bin diff --git a/graphics/battle_anims/backgrounds/new/clangorous_soulblaze.pal b/graphics/battle_anims/backgrounds/clangorous_soulblaze.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/clangorous_soulblaze.pal rename to graphics/battle_anims/backgrounds/clangorous_soulblaze.pal diff --git a/graphics/battle_anims/backgrounds/new/clangorous_soulblaze.png b/graphics/battle_anims/backgrounds/clangorous_soulblaze.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/clangorous_soulblaze.png rename to graphics/battle_anims/backgrounds/clangorous_soulblaze.png diff --git a/graphics/battle_anims/backgrounds/new/dark_void.bin b/graphics/battle_anims/backgrounds/dark_void.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/dark_void.bin rename to graphics/battle_anims/backgrounds/dark_void.bin diff --git a/graphics/battle_anims/backgrounds/new/dark_void.pal b/graphics/battle_anims/backgrounds/dark_void.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/dark_void.pal rename to graphics/battle_anims/backgrounds/dark_void.pal diff --git a/graphics/battle_anims/backgrounds/new/dynamax_cannon.pal b/graphics/battle_anims/backgrounds/dynamax_cannon.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/dynamax_cannon.pal rename to graphics/battle_anims/backgrounds/dynamax_cannon.pal diff --git a/graphics/battle_anims/backgrounds/new/electric_terrain.bin b/graphics/battle_anims/backgrounds/electric_terrain.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/electric_terrain.bin rename to graphics/battle_anims/backgrounds/electric_terrain.bin diff --git a/graphics/battle_anims/backgrounds/new/electric_terrain.pal b/graphics/battle_anims/backgrounds/electric_terrain.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/electric_terrain.pal rename to graphics/battle_anims/backgrounds/electric_terrain.pal diff --git a/graphics/battle_anims/backgrounds/new/electric_terrain.png b/graphics/battle_anims/backgrounds/electric_terrain.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/electric_terrain.png rename to graphics/battle_anims/backgrounds/electric_terrain.png diff --git a/graphics/battle_anims/backgrounds/new/fire1.bin b/graphics/battle_anims/backgrounds/fire1.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/fire1.bin rename to graphics/battle_anims/backgrounds/fire1.bin diff --git a/graphics/battle_anims/backgrounds/new/fire1.pal b/graphics/battle_anims/backgrounds/fire1.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/fire1.pal rename to graphics/battle_anims/backgrounds/fire1.pal diff --git a/graphics/battle_anims/backgrounds/new/fire1.png b/graphics/battle_anims/backgrounds/fire1.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/fire1.png rename to graphics/battle_anims/backgrounds/fire1.png diff --git a/graphics/battle_anims/backgrounds/new/fire2.pal b/graphics/battle_anims/backgrounds/fire2.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/fire2.pal rename to graphics/battle_anims/backgrounds/fire2.pal diff --git a/graphics/battle_anims/backgrounds/new/focus_blast.bin b/graphics/battle_anims/backgrounds/focus_blast.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/focus_blast.bin rename to graphics/battle_anims/backgrounds/focus_blast.bin diff --git a/graphics/battle_anims/backgrounds/new/focus_blast.pal b/graphics/battle_anims/backgrounds/focus_blast.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/focus_blast.pal rename to graphics/battle_anims/backgrounds/focus_blast.pal diff --git a/graphics/battle_anims/backgrounds/new/focus_blast.png b/graphics/battle_anims/backgrounds/focus_blast.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/focus_blast.png rename to graphics/battle_anims/backgrounds/focus_blast.png diff --git a/graphics/battle_anims/backgrounds/new/garbage_falls.pal b/graphics/battle_anims/backgrounds/garbage_falls.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/garbage_falls.pal rename to graphics/battle_anims/backgrounds/garbage_falls.pal diff --git a/graphics/battle_anims/backgrounds/new/giga_impact.pal b/graphics/battle_anims/backgrounds/giga_impact.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/giga_impact.pal rename to graphics/battle_anims/backgrounds/giga_impact.pal diff --git a/graphics/battle_anims/backgrounds/new/giga_impact.png b/graphics/battle_anims/backgrounds/giga_impact.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/giga_impact.png rename to graphics/battle_anims/backgrounds/giga_impact.png diff --git a/graphics/battle_anims/backgrounds/new/giga_impact_contest.bin b/graphics/battle_anims/backgrounds/giga_impact_contest.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/giga_impact_contest.bin rename to graphics/battle_anims/backgrounds/giga_impact_contest.bin diff --git a/graphics/battle_anims/backgrounds/new/giga_impact_opponent.bin b/graphics/battle_anims/backgrounds/giga_impact_opponent.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/giga_impact_opponent.bin rename to graphics/battle_anims/backgrounds/giga_impact_opponent.bin diff --git a/graphics/battle_anims/backgrounds/new/giga_impact_player.bin b/graphics/battle_anims/backgrounds/giga_impact_player.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/giga_impact_player.bin rename to graphics/battle_anims/backgrounds/giga_impact_player.bin diff --git a/graphics/battle_anims/backgrounds/new/grassy_terrain.bin b/graphics/battle_anims/backgrounds/grassy_terrain.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/grassy_terrain.bin rename to graphics/battle_anims/backgrounds/grassy_terrain.bin diff --git a/graphics/battle_anims/backgrounds/new/grassy_terrain.pal b/graphics/battle_anims/backgrounds/grassy_terrain.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/grassy_terrain.pal rename to graphics/battle_anims/backgrounds/grassy_terrain.pal diff --git a/graphics/battle_anims/backgrounds/new/grassy_terrain.png b/graphics/battle_anims/backgrounds/grassy_terrain.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/grassy_terrain.png rename to graphics/battle_anims/backgrounds/grassy_terrain.png diff --git a/graphics/battle_anims/backgrounds/new/gunk_shot.pal b/graphics/battle_anims/backgrounds/gunk_shot.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/gunk_shot.pal rename to graphics/battle_anims/backgrounds/gunk_shot.pal diff --git a/graphics/battle_anims/backgrounds/new/hurricane.bin b/graphics/battle_anims/backgrounds/hurricane.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/hurricane.bin rename to graphics/battle_anims/backgrounds/hurricane.bin diff --git a/graphics/battle_anims/backgrounds/new/hurricane.pal b/graphics/battle_anims/backgrounds/hurricane.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/hurricane.pal rename to graphics/battle_anims/backgrounds/hurricane.pal diff --git a/graphics/battle_anims/backgrounds/new/hurricane.png b/graphics/battle_anims/backgrounds/hurricane.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/hurricane.png rename to graphics/battle_anims/backgrounds/hurricane.png diff --git a/graphics/battle_anims/backgrounds/new/hydro_cannon.bin b/graphics/battle_anims/backgrounds/hydro_cannon.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/hydro_cannon.bin rename to graphics/battle_anims/backgrounds/hydro_cannon.bin diff --git a/graphics/battle_anims/backgrounds/new/hydro_cannon.pal b/graphics/battle_anims/backgrounds/hydro_cannon.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/hydro_cannon.pal rename to graphics/battle_anims/backgrounds/hydro_cannon.pal diff --git a/graphics/battle_anims/backgrounds/new/hydro_cannon.png b/graphics/battle_anims/backgrounds/hydro_cannon.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/hydro_cannon.png rename to graphics/battle_anims/backgrounds/hydro_cannon.png diff --git a/graphics/battle_anims/backgrounds/new/hydro_pump.bin b/graphics/battle_anims/backgrounds/hydro_pump.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/hydro_pump.bin rename to graphics/battle_anims/backgrounds/hydro_pump.bin diff --git a/graphics/battle_anims/backgrounds/new/hydro_pump.pal b/graphics/battle_anims/backgrounds/hydro_pump.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/hydro_pump.pal rename to graphics/battle_anims/backgrounds/hydro_pump.pal diff --git a/graphics/battle_anims/backgrounds/new/hydro_pump.png b/graphics/battle_anims/backgrounds/hydro_pump.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/hydro_pump.png rename to graphics/battle_anims/backgrounds/hydro_pump.png diff --git a/graphics/battle_anims/backgrounds/new/hyper_beam.pal b/graphics/battle_anims/backgrounds/hyper_beam.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/hyper_beam.pal rename to graphics/battle_anims/backgrounds/hyper_beam.pal diff --git a/graphics/battle_anims/backgrounds/new/hyperspace_fury.pal b/graphics/battle_anims/backgrounds/hyperspace_fury.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/hyperspace_fury.pal rename to graphics/battle_anims/backgrounds/hyperspace_fury.pal diff --git a/graphics/battle_anims/backgrounds/new/inferno_overdrive.bin b/graphics/battle_anims/backgrounds/inferno_overdrive.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/inferno_overdrive.bin rename to graphics/battle_anims/backgrounds/inferno_overdrive.bin diff --git a/graphics/battle_anims/backgrounds/new/inferno_overdrive.pal b/graphics/battle_anims/backgrounds/inferno_overdrive.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/inferno_overdrive.pal rename to graphics/battle_anims/backgrounds/inferno_overdrive.pal diff --git a/graphics/battle_anims/backgrounds/new/inferno_overdrive.png b/graphics/battle_anims/backgrounds/inferno_overdrive.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/inferno_overdrive.png rename to graphics/battle_anims/backgrounds/inferno_overdrive.png diff --git a/graphics/battle_anims/backgrounds/new/leaf_storm.bin b/graphics/battle_anims/backgrounds/leaf_storm.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/leaf_storm.bin rename to graphics/battle_anims/backgrounds/leaf_storm.bin diff --git a/graphics/battle_anims/backgrounds/new/leaf_storm.pal b/graphics/battle_anims/backgrounds/leaf_storm.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/leaf_storm.pal rename to graphics/battle_anims/backgrounds/leaf_storm.pal diff --git a/graphics/battle_anims/backgrounds/new/leaf_storm.png b/graphics/battle_anims/backgrounds/leaf_storm.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/leaf_storm.png rename to graphics/battle_anims/backgrounds/leaf_storm.png diff --git a/graphics/battle_anims/backgrounds/new/magic_room.pal b/graphics/battle_anims/backgrounds/magic_room.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/magic_room.pal rename to graphics/battle_anims/backgrounds/magic_room.pal diff --git a/graphics/battle_anims/backgrounds/new/malicious_moonsault.bin b/graphics/battle_anims/backgrounds/malicious_moonsault.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/malicious_moonsault.bin rename to graphics/battle_anims/backgrounds/malicious_moonsault.bin diff --git a/graphics/battle_anims/backgrounds/new/malicious_moonsault.pal b/graphics/battle_anims/backgrounds/malicious_moonsault.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/malicious_moonsault.pal rename to graphics/battle_anims/backgrounds/malicious_moonsault.pal diff --git a/graphics/battle_anims/backgrounds/new/malicious_moonsault.png b/graphics/battle_anims/backgrounds/malicious_moonsault.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/malicious_moonsault.png rename to graphics/battle_anims/backgrounds/malicious_moonsault.png diff --git a/graphics/battle_anims/backgrounds/new/max_lightning.bin b/graphics/battle_anims/backgrounds/max_lightning.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/max_lightning.bin rename to graphics/battle_anims/backgrounds/max_lightning.bin diff --git a/graphics/battle_anims/backgrounds/new/max_lightning.pal b/graphics/battle_anims/backgrounds/max_lightning.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/max_lightning.pal rename to graphics/battle_anims/backgrounds/max_lightning.pal diff --git a/graphics/battle_anims/backgrounds/new/max_lightning.png b/graphics/battle_anims/backgrounds/max_lightning.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/max_lightning.png rename to graphics/battle_anims/backgrounds/max_lightning.png diff --git a/graphics/battle_anims/backgrounds/new/misty_terrain.bin b/graphics/battle_anims/backgrounds/misty_terrain.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/misty_terrain.bin rename to graphics/battle_anims/backgrounds/misty_terrain.bin diff --git a/graphics/battle_anims/backgrounds/new/misty_terrain.pal b/graphics/battle_anims/backgrounds/misty_terrain.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/misty_terrain.pal rename to graphics/battle_anims/backgrounds/misty_terrain.pal diff --git a/graphics/battle_anims/backgrounds/new/misty_terrain.png b/graphics/battle_anims/backgrounds/misty_terrain.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/misty_terrain.png rename to graphics/battle_anims/backgrounds/misty_terrain.png diff --git a/graphics/battle_anims/backgrounds/new/neverending_nightmare.bin b/graphics/battle_anims/backgrounds/neverending_nightmare.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/neverending_nightmare.bin rename to graphics/battle_anims/backgrounds/neverending_nightmare.bin diff --git a/graphics/battle_anims/backgrounds/new/neverending_nightmare.pal b/graphics/battle_anims/backgrounds/neverending_nightmare.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/neverending_nightmare.pal rename to graphics/battle_anims/backgrounds/neverending_nightmare.pal diff --git a/graphics/battle_anims/backgrounds/new/neverending_nightmare.png b/graphics/battle_anims/backgrounds/neverending_nightmare.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/neverending_nightmare.png rename to graphics/battle_anims/backgrounds/neverending_nightmare.png diff --git a/graphics/battle_anims/backgrounds/new/tectonic_rage.bin b/graphics/battle_anims/backgrounds/new/tectonic_rage.bin deleted file mode 100644 index 914a9deb9a..0000000000 Binary files a/graphics/battle_anims/backgrounds/new/tectonic_rage.bin and /dev/null differ diff --git a/graphics/battle_anims/backgrounds/new/nightmare.bin b/graphics/battle_anims/backgrounds/nightmare.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/nightmare.bin rename to graphics/battle_anims/backgrounds/nightmare.bin diff --git a/graphics/battle_anims/backgrounds/new/nightmare.pal b/graphics/battle_anims/backgrounds/nightmare.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/nightmare.pal rename to graphics/battle_anims/backgrounds/nightmare.pal diff --git a/graphics/battle_anims/backgrounds/new/nightmare.png b/graphics/battle_anims/backgrounds/nightmare.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/nightmare.png rename to graphics/battle_anims/backgrounds/nightmare.png diff --git a/graphics/battle_anims/backgrounds/new/poison_falls.pal b/graphics/battle_anims/backgrounds/poison_falls.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/poison_falls.pal rename to graphics/battle_anims/backgrounds/poison_falls.pal diff --git a/graphics/battle_anims/backgrounds/new/psychic.pal b/graphics/battle_anims/backgrounds/psychic_new.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/psychic.pal rename to graphics/battle_anims/backgrounds/psychic_new.pal diff --git a/graphics/battle_anims/backgrounds/new/psychic_terrain.bin b/graphics/battle_anims/backgrounds/psychic_terrain.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/psychic_terrain.bin rename to graphics/battle_anims/backgrounds/psychic_terrain.bin diff --git a/graphics/battle_anims/backgrounds/new/psychic_terrain.pal b/graphics/battle_anims/backgrounds/psychic_terrain.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/psychic_terrain.pal rename to graphics/battle_anims/backgrounds/psychic_terrain.pal diff --git a/graphics/battle_anims/backgrounds/new/psychic_terrain.png b/graphics/battle_anims/backgrounds/psychic_terrain.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/psychic_terrain.png rename to graphics/battle_anims/backgrounds/psychic_terrain.png diff --git a/graphics/battle_anims/backgrounds/new/rock_wrecker.pal b/graphics/battle_anims/backgrounds/rock_wrecker.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/rock_wrecker.pal rename to graphics/battle_anims/backgrounds/rock_wrecker.pal diff --git a/graphics/battle_anims/backgrounds/new/shattered_psyche.bin b/graphics/battle_anims/backgrounds/shattered_psyche.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/shattered_psyche.bin rename to graphics/battle_anims/backgrounds/shattered_psyche.bin diff --git a/graphics/battle_anims/backgrounds/new/shattered_psyche.pal b/graphics/battle_anims/backgrounds/shattered_psyche.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/shattered_psyche.pal rename to graphics/battle_anims/backgrounds/shattered_psyche.pal diff --git a/graphics/battle_anims/backgrounds/new/shattered_psyche.png b/graphics/battle_anims/backgrounds/shattered_psyche.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/shattered_psyche.png rename to graphics/battle_anims/backgrounds/shattered_psyche.png diff --git a/graphics/battle_anims/backgrounds/new/sky_afternoon.pal b/graphics/battle_anims/backgrounds/sky_afternoon.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/sky_afternoon.pal rename to graphics/battle_anims/backgrounds/sky_afternoon.pal diff --git a/graphics/battle_anims/backgrounds/new/sky_day.bin b/graphics/battle_anims/backgrounds/sky_day.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/sky_day.bin rename to graphics/battle_anims/backgrounds/sky_day.bin diff --git a/graphics/battle_anims/backgrounds/new/sky_day.pal b/graphics/battle_anims/backgrounds/sky_day.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/sky_day.pal rename to graphics/battle_anims/backgrounds/sky_day.pal diff --git a/graphics/battle_anims/backgrounds/new/sky_day.png b/graphics/battle_anims/backgrounds/sky_day.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/sky_day.png rename to graphics/battle_anims/backgrounds/sky_day.png diff --git a/graphics/battle_anims/backgrounds/new/sky_night.pal b/graphics/battle_anims/backgrounds/sky_night.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/sky_night.pal rename to graphics/battle_anims/backgrounds/sky_night.pal diff --git a/graphics/battle_anims/backgrounds/new/sludge_wave.pal b/graphics/battle_anims/backgrounds/sludge_wave.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/sludge_wave.pal rename to graphics/battle_anims/backgrounds/sludge_wave.pal diff --git a/graphics/battle_anims/backgrounds/new/snuggle_forever.bin b/graphics/battle_anims/backgrounds/snuggle_forever.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/snuggle_forever.bin rename to graphics/battle_anims/backgrounds/snuggle_forever.bin diff --git a/graphics/battle_anims/backgrounds/new/snuggle_forever.pal b/graphics/battle_anims/backgrounds/snuggle_forever.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/snuggle_forever.pal rename to graphics/battle_anims/backgrounds/snuggle_forever.pal diff --git a/graphics/battle_anims/backgrounds/new/snuggle_forever.png b/graphics/battle_anims/backgrounds/snuggle_forever.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/snuggle_forever.png rename to graphics/battle_anims/backgrounds/snuggle_forever.png diff --git a/graphics/battle_anims/backgrounds/new/soulstealing_7star_strike.bin b/graphics/battle_anims/backgrounds/soulstealing_7star_strike.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/soulstealing_7star_strike.bin rename to graphics/battle_anims/backgrounds/soulstealing_7star_strike.bin diff --git a/graphics/battle_anims/backgrounds/new/soulstealing_7star_strike.pal b/graphics/battle_anims/backgrounds/soulstealing_7star_strike.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/soulstealing_7star_strike.pal rename to graphics/battle_anims/backgrounds/soulstealing_7star_strike.pal diff --git a/graphics/battle_anims/backgrounds/new/soulstealing_7star_strike.png b/graphics/battle_anims/backgrounds/soulstealing_7star_strike.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/soulstealing_7star_strike.png rename to graphics/battle_anims/backgrounds/soulstealing_7star_strike.png diff --git a/graphics/battle_anims/backgrounds/new/spacial_rend.pal b/graphics/battle_anims/backgrounds/spacial_rend.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/spacial_rend.pal rename to graphics/battle_anims/backgrounds/spacial_rend.pal diff --git a/graphics/battle_anims/backgrounds/new/spacial_rend.png b/graphics/battle_anims/backgrounds/spacial_rend.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/spacial_rend.png rename to graphics/battle_anims/backgrounds/spacial_rend.png diff --git a/graphics/battle_anims/backgrounds/new/steel_beam_bg.pal b/graphics/battle_anims/backgrounds/steel_beam.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/steel_beam_bg.pal rename to graphics/battle_anims/backgrounds/steel_beam.pal diff --git a/graphics/battle_anims/backgrounds/new/tectonic_rage.pal b/graphics/battle_anims/backgrounds/tectonic_rage.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/tectonic_rage.pal rename to graphics/battle_anims/backgrounds/tectonic_rage.pal diff --git a/graphics/battle_anims/backgrounds/new/trick_room.bin b/graphics/battle_anims/backgrounds/trick_room.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/trick_room.bin rename to graphics/battle_anims/backgrounds/trick_room.bin diff --git a/graphics/battle_anims/backgrounds/new/trick_room.pal b/graphics/battle_anims/backgrounds/trick_room.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/trick_room.pal rename to graphics/battle_anims/backgrounds/trick_room.pal diff --git a/graphics/battle_anims/backgrounds/new/trick_room.png b/graphics/battle_anims/backgrounds/trick_room.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/trick_room.png rename to graphics/battle_anims/backgrounds/trick_room.png diff --git a/graphics/battle_anims/backgrounds/new/twinkle_tackle.bin b/graphics/battle_anims/backgrounds/twinkle_tackle.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/twinkle_tackle.bin rename to graphics/battle_anims/backgrounds/twinkle_tackle.bin diff --git a/graphics/battle_anims/backgrounds/new/twinkle_tackle.pal b/graphics/battle_anims/backgrounds/twinkle_tackle.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/twinkle_tackle.pal rename to graphics/battle_anims/backgrounds/twinkle_tackle.pal diff --git a/graphics/battle_anims/backgrounds/new/twinkle_tackle.png b/graphics/battle_anims/backgrounds/twinkle_tackle.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/twinkle_tackle.png rename to graphics/battle_anims/backgrounds/twinkle_tackle.png diff --git a/graphics/battle_anims/backgrounds/new/water_pulse.bin b/graphics/battle_anims/backgrounds/water_pulse.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/water_pulse.bin rename to graphics/battle_anims/backgrounds/water_pulse.bin diff --git a/graphics/battle_anims/backgrounds/new/water_pulse.pal b/graphics/battle_anims/backgrounds/water_pulse.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/water_pulse.pal rename to graphics/battle_anims/backgrounds/water_pulse.pal diff --git a/graphics/battle_anims/backgrounds/new/water_pulse.png b/graphics/battle_anims/backgrounds/water_pulse.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/water_pulse.png rename to graphics/battle_anims/backgrounds/water_pulse.png diff --git a/graphics/battle_anims/backgrounds/new/waterfall.bin b/graphics/battle_anims/backgrounds/waterfall.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/waterfall.bin rename to graphics/battle_anims/backgrounds/waterfall.bin diff --git a/graphics/battle_anims/backgrounds/new/waterfall.pal b/graphics/battle_anims/backgrounds/waterfall.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/waterfall.pal rename to graphics/battle_anims/backgrounds/waterfall.pal diff --git a/graphics/battle_anims/backgrounds/new/waterfall.png b/graphics/battle_anims/backgrounds/waterfall.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/waterfall.png rename to graphics/battle_anims/backgrounds/waterfall.png diff --git a/graphics/battle_anims/backgrounds/new/wonder_room.pal b/graphics/battle_anims/backgrounds/wonder_room.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/wonder_room.pal rename to graphics/battle_anims/backgrounds/wonder_room.pal diff --git a/graphics/battle_anims/backgrounds/new/zmove_activate.bin b/graphics/battle_anims/backgrounds/zmove_activate.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/zmove_activate.bin rename to graphics/battle_anims/backgrounds/zmove_activate.bin diff --git a/graphics/battle_anims/backgrounds/new/zmove_activate.pal b/graphics/battle_anims/backgrounds/zmove_activate.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/zmove_activate.pal rename to graphics/battle_anims/backgrounds/zmove_activate.pal diff --git a/graphics/battle_anims/backgrounds/new/zmove_activate.png b/graphics/battle_anims/backgrounds/zmove_activate.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/zmove_activate.png rename to graphics/battle_anims/backgrounds/zmove_activate.png diff --git a/graphics/battle_anims/backgrounds/new/zmove_mountain.bin b/graphics/battle_anims/backgrounds/zmove_mountain.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/zmove_mountain.bin rename to graphics/battle_anims/backgrounds/zmove_mountain.bin diff --git a/graphics/battle_anims/backgrounds/new/zmove_mountain.pal b/graphics/battle_anims/backgrounds/zmove_mountain.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/zmove_mountain.pal rename to graphics/battle_anims/backgrounds/zmove_mountain.pal diff --git a/graphics/battle_anims/backgrounds/new/zmove_mountain.png b/graphics/battle_anims/backgrounds/zmove_mountain.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/zmove_mountain.png rename to graphics/battle_anims/backgrounds/zmove_mountain.png diff --git a/graphics/battle_anims/sprites/new/acupressure_finger.png b/graphics/battle_anims/sprites/acupressure_finger.png similarity index 100% rename from graphics/battle_anims/sprites/new/acupressure_finger.png rename to graphics/battle_anims/sprites/acupressure_finger.png diff --git a/graphics/battle_anims/sprites/new/alpha_stone.png b/graphics/battle_anims/sprites/alpha_stone.png similarity index 100% rename from graphics/battle_anims/sprites/new/alpha_stone.png rename to graphics/battle_anims/sprites/alpha_stone.png diff --git a/graphics/battle_anims/sprites/new/anchor.png b/graphics/battle_anims/sprites/anchor.png similarity index 100% rename from graphics/battle_anims/sprites/new/anchor.png rename to graphics/battle_anims/sprites/anchor.png diff --git a/graphics/battle_anims/sprites/new/apple.png b/graphics/battle_anims/sprites/apple.png similarity index 100% rename from graphics/battle_anims/sprites/new/apple.png rename to graphics/battle_anims/sprites/apple.png diff --git a/graphics/battle_anims/sprites/new/arrows.png b/graphics/battle_anims/sprites/arrows.png similarity index 100% rename from graphics/battle_anims/sprites/new/arrows.png rename to graphics/battle_anims/sprites/arrows.png diff --git a/graphics/battle_anims/sprites/new/assurance_hand.png b/graphics/battle_anims/sprites/assurance_hand.png similarity index 100% rename from graphics/battle_anims/sprites/new/assurance_hand.png rename to graphics/battle_anims/sprites/assurance_hand.png diff --git a/graphics/battle_anims/sprites/new/aura_sphere.png b/graphics/battle_anims/sprites/aura_sphere.png similarity index 100% rename from graphics/battle_anims/sprites/new/aura_sphere.png rename to graphics/battle_anims/sprites/aura_sphere.png diff --git a/graphics/battle_anims/sprites/new/avalanche_rocks.pal b/graphics/battle_anims/sprites/avalanche_rocks.pal similarity index 100% rename from graphics/battle_anims/sprites/new/avalanche_rocks.pal rename to graphics/battle_anims/sprites/avalanche_rocks.pal diff --git a/graphics/battle_anims/sprites/new/baton_pass_ball.png b/graphics/battle_anims/sprites/baton_pass_ball.png similarity index 100% rename from graphics/battle_anims/sprites/new/baton_pass_ball.png rename to graphics/battle_anims/sprites/baton_pass_ball.png diff --git a/graphics/battle_anims/sprites/new/berry_eaten.png b/graphics/battle_anims/sprites/berry_eaten.png similarity index 100% rename from graphics/battle_anims/sprites/new/berry_eaten.png rename to graphics/battle_anims/sprites/berry_eaten.png diff --git a/graphics/battle_anims/sprites/new/berry_normal.png b/graphics/battle_anims/sprites/berry_normal.png similarity index 100% rename from graphics/battle_anims/sprites/new/berry_normal.png rename to graphics/battle_anims/sprites/berry_normal.png diff --git a/graphics/battle_anims/sprites/new/big_rock.png b/graphics/battle_anims/sprites/big_rock.png similarity index 100% rename from graphics/battle_anims/sprites/new/big_rock.png rename to graphics/battle_anims/sprites/big_rock.png diff --git a/graphics/battle_anims/sprites/new/blacephalon_head.png b/graphics/battle_anims/sprites/blacephalon_head.png similarity index 100% rename from graphics/battle_anims/sprites/new/blacephalon_head.png rename to graphics/battle_anims/sprites/blacephalon_head.png diff --git a/graphics/battle_anims/sprites/new/blue_flare.pal b/graphics/battle_anims/sprites/blue_flare.pal similarity index 100% rename from graphics/battle_anims/sprites/new/blue_flare.pal rename to graphics/battle_anims/sprites/blue_flare.pal diff --git a/graphics/battle_anims/sprites/new/branch.png b/graphics/battle_anims/sprites/branch.png similarity index 100% rename from graphics/battle_anims/sprites/new/branch.png rename to graphics/battle_anims/sprites/branch.png diff --git a/graphics/battle_anims/sprites/new/brine.png b/graphics/battle_anims/sprites/brine.png similarity index 100% rename from graphics/battle_anims/sprites/new/brine.png rename to graphics/battle_anims/sprites/brine.png diff --git a/graphics/battle_anims/sprites/new/cacoon.png b/graphics/battle_anims/sprites/cacoon.png similarity index 100% rename from graphics/battle_anims/sprites/new/cacoon.png rename to graphics/battle_anims/sprites/cacoon.png diff --git a/graphics/battle_anims/sprites/new/chain_link.png b/graphics/battle_anims/sprites/chain_link.png similarity index 100% rename from graphics/battle_anims/sprites/new/chain_link.png rename to graphics/battle_anims/sprites/chain_link.png diff --git a/graphics/battle_anims/sprites/new/chop.png b/graphics/battle_anims/sprites/chop.png similarity index 100% rename from graphics/battle_anims/sprites/new/chop.png rename to graphics/battle_anims/sprites/chop.png diff --git a/graphics/battle_anims/sprites/new/confide.png b/graphics/battle_anims/sprites/confide.png similarity index 100% rename from graphics/battle_anims/sprites/new/confide.png rename to graphics/battle_anims/sprites/confide.png diff --git a/graphics/battle_anims/sprites/new/crafty_shield.png b/graphics/battle_anims/sprites/crafty_shield.png similarity index 100% rename from graphics/battle_anims/sprites/new/crafty_shield.png rename to graphics/battle_anims/sprites/crafty_shield.png diff --git a/graphics/battle_anims/sprites/new/curse_nail.png b/graphics/battle_anims/sprites/curse_nail.png similarity index 100% rename from graphics/battle_anims/sprites/new/curse_nail.png rename to graphics/battle_anims/sprites/curse_nail.png diff --git a/graphics/battle_anims/sprites/new/draco_meteor.pal b/graphics/battle_anims/sprites/draco_meteor.pal similarity index 100% rename from graphics/battle_anims/sprites/new/draco_meteor.pal rename to graphics/battle_anims/sprites/draco_meteor.pal diff --git a/graphics/battle_anims/sprites/new/dragon_pulse_ring.png b/graphics/battle_anims/sprites/dragon_pulse_ring.png similarity index 100% rename from graphics/battle_anims/sprites/new/dragon_pulse_ring.png rename to graphics/battle_anims/sprites/dragon_pulse_ring.png diff --git a/graphics/battle_anims/sprites/new/dreepy_missile.png b/graphics/battle_anims/sprites/dreepy_missile.png similarity index 100% rename from graphics/battle_anims/sprites/new/dreepy_missile.png rename to graphics/battle_anims/sprites/dreepy_missile.png diff --git a/graphics/battle_anims/sprites/new/drill.png b/graphics/battle_anims/sprites/drill.png similarity index 100% rename from graphics/battle_anims/sprites/new/drill.png rename to graphics/battle_anims/sprites/drill.png diff --git a/graphics/battle_anims/sprites/new/embers.png b/graphics/battle_anims/sprites/embers.png similarity index 100% rename from graphics/battle_anims/sprites/new/embers.png rename to graphics/battle_anims/sprites/embers.png diff --git a/graphics/battle_anims/sprites/new/fairy_lock_chains.png b/graphics/battle_anims/sprites/fairy_lock_chains.png similarity index 100% rename from graphics/battle_anims/sprites/new/fairy_lock_chains.png rename to graphics/battle_anims/sprites/fairy_lock_chains.png diff --git a/graphics/battle_anims/sprites/new/fishies.png b/graphics/battle_anims/sprites/fishies.png similarity index 100% rename from graphics/battle_anims/sprites/new/fishies.png rename to graphics/battle_anims/sprites/fishies.png diff --git a/graphics/battle_anims/sprites/new/fly.png b/graphics/battle_anims/sprites/fly.png similarity index 100% rename from graphics/battle_anims/sprites/new/fly.png rename to graphics/battle_anims/sprites/fly.png diff --git a/graphics/battle_anims/sprites/new/fusion_flare.pal b/graphics/battle_anims/sprites/fusion_flare.pal similarity index 100% rename from graphics/battle_anims/sprites/new/fusion_flare.pal rename to graphics/battle_anims/sprites/fusion_flare.pal diff --git a/graphics/battle_anims/sprites/new/garbage_poison_column.pal b/graphics/battle_anims/sprites/garbage_poison_column.pal similarity index 100% rename from graphics/battle_anims/sprites/new/garbage_poison_column.pal rename to graphics/battle_anims/sprites/garbage_poison_column.pal diff --git a/graphics/battle_anims/sprites/new/gear.png b/graphics/battle_anims/sprites/gear.png similarity index 100% rename from graphics/battle_anims/sprites/new/gear.png rename to graphics/battle_anims/sprites/gear.png diff --git a/graphics/battle_anims/sprites/new/gigavolt_havoc_spear.png b/graphics/battle_anims/sprites/gigavolt_havoc_spear.png similarity index 100% rename from graphics/battle_anims/sprites/new/gigavolt_havoc_spear.png rename to graphics/battle_anims/sprites/gigavolt_havoc_spear.png diff --git a/graphics/battle_anims/sprites/new/golden_apple.png b/graphics/battle_anims/sprites/golden_apple.png similarity index 100% rename from graphics/battle_anims/sprites/new/golden_apple.png rename to graphics/battle_anims/sprites/golden_apple.png diff --git a/graphics/battle_anims/sprites/new/green_drake.pal b/graphics/battle_anims/sprites/green_drake.pal similarity index 100% rename from graphics/battle_anims/sprites/new/green_drake.pal rename to graphics/battle_anims/sprites/green_drake.pal diff --git a/graphics/battle_anims/sprites/new/green_star.png b/graphics/battle_anims/sprites/green_star_new.png similarity index 100% rename from graphics/battle_anims/sprites/new/green_star.png rename to graphics/battle_anims/sprites/green_star_new.png diff --git a/graphics/battle_anims/sprites/new/thrash.png b/graphics/battle_anims/sprites/hands_and_feet_new.png similarity index 100% rename from graphics/battle_anims/sprites/new/thrash.png rename to graphics/battle_anims/sprites/hands_and_feet_new.png diff --git a/graphics/battle_anims/sprites/new/heart_stamp.png b/graphics/battle_anims/sprites/heart_stamp.png similarity index 100% rename from graphics/battle_anims/sprites/new/heart_stamp.png rename to graphics/battle_anims/sprites/heart_stamp.png diff --git a/graphics/battle_anims/sprites/new/hexes.png b/graphics/battle_anims/sprites/hexes.png similarity index 100% rename from graphics/battle_anims/sprites/new/hexes.png rename to graphics/battle_anims/sprites/hexes.png diff --git a/graphics/battle_anims/sprites/new/hoopa_hand.png b/graphics/battle_anims/sprites/hoopa_hand.png similarity index 100% rename from graphics/battle_anims/sprites/new/hoopa_hand.png rename to graphics/battle_anims/sprites/hoopa_hand.png diff --git a/graphics/battle_anims/sprites/new/hoopa_ring.png b/graphics/battle_anims/sprites/hoopa_ring.png similarity index 100% rename from graphics/battle_anims/sprites/new/hoopa_ring.png rename to graphics/battle_anims/sprites/hoopa_ring.png diff --git a/graphics/battle_anims/sprites/new/horn.png b/graphics/battle_anims/sprites/horn_hit_new.png similarity index 100% rename from graphics/battle_anims/sprites/new/horn.png rename to graphics/battle_anims/sprites/horn_hit_new.png diff --git a/graphics/battle_anims/sprites/new/horn_leech.png b/graphics/battle_anims/sprites/horn_leech.png similarity index 100% rename from graphics/battle_anims/sprites/new/horn_leech.png rename to graphics/battle_anims/sprites/horn_leech.png diff --git a/graphics/battle_anims/sprites/new/horseshoe_fist.png b/graphics/battle_anims/sprites/horseshoe_fist.png similarity index 100% rename from graphics/battle_anims/sprites/new/horseshoe_fist.png rename to graphics/battle_anims/sprites/horseshoe_fist.png diff --git a/graphics/battle_anims/sprites/new/hydro_pump.png b/graphics/battle_anims/sprites/hydro_pump.png similarity index 100% rename from graphics/battle_anims/sprites/new/hydro_pump.png rename to graphics/battle_anims/sprites/hydro_pump.png diff --git a/graphics/battle_anims/sprites/new/ice_rock.png b/graphics/battle_anims/sprites/ice_rock.png similarity index 100% rename from graphics/battle_anims/sprites/new/ice_rock.png rename to graphics/battle_anims/sprites/ice_rock.png diff --git a/graphics/battle_anims/sprites/new/impact.pal b/graphics/battle_anims/sprites/impact_new.pal similarity index 100% rename from graphics/battle_anims/sprites/new/impact.pal rename to graphics/battle_anims/sprites/impact_new.pal diff --git a/graphics/battle_anims/sprites/new/large_spike.png b/graphics/battle_anims/sprites/large_spike.png similarity index 100% rename from graphics/battle_anims/sprites/new/large_spike.png rename to graphics/battle_anims/sprites/large_spike.png diff --git a/graphics/battle_anims/sprites/new/leaves.png b/graphics/battle_anims/sprites/leaves.png similarity index 100% rename from graphics/battle_anims/sprites/new/leaves.png rename to graphics/battle_anims/sprites/leaves.png diff --git a/graphics/battle_anims/sprites/new/leech_seed.png b/graphics/battle_anims/sprites/leech_seed.png similarity index 100% rename from graphics/battle_anims/sprites/new/leech_seed.png rename to graphics/battle_anims/sprites/leech_seed.png diff --git a/graphics/battle_anims/sprites/new/lightning_rain.png b/graphics/battle_anims/sprites/lightning_rain.png similarity index 100% rename from graphics/battle_anims/sprites/new/lightning_rain.png rename to graphics/battle_anims/sprites/lightning_rain.png diff --git a/graphics/battle_anims/sprites/new/mean_look.png b/graphics/battle_anims/sprites/mean_look.png similarity index 100% rename from graphics/battle_anims/sprites/new/mean_look.png rename to graphics/battle_anims/sprites/mean_look.png diff --git a/graphics/battle_anims/sprites/new/metal_bits.png b/graphics/battle_anims/sprites/metal_bits.png similarity index 100% rename from graphics/battle_anims/sprites/new/metal_bits.png rename to graphics/battle_anims/sprites/metal_bits.png diff --git a/graphics/battle_anims/sprites/new/mud_bomb.png b/graphics/battle_anims/sprites/mud_bomb.png similarity index 100% rename from graphics/battle_anims/sprites/new/mud_bomb.png rename to graphics/battle_anims/sprites/mud_bomb.png diff --git a/graphics/battle_anims/sprites/new/mushroom.png b/graphics/battle_anims/sprites/mushroom.png similarity index 100% rename from graphics/battle_anims/sprites/new/mushroom.png rename to graphics/battle_anims/sprites/mushroom.png diff --git a/graphics/battle_anims/sprites/new/natural_gift_ring.pal b/graphics/battle_anims/sprites/natural_gift_ring.pal similarity index 100% rename from graphics/battle_anims/sprites/new/natural_gift_ring.pal rename to graphics/battle_anims/sprites/natural_gift_ring.pal diff --git a/graphics/battle_anims/sprites/new/necrozma_star.png b/graphics/battle_anims/sprites/necrozma_star.png similarity index 100% rename from graphics/battle_anims/sprites/new/necrozma_star.png rename to graphics/battle_anims/sprites/necrozma_star.png diff --git a/graphics/battle_anims/sprites/new/ability_pop_up.png b/graphics/battle_anims/sprites/new/ability_pop_up.png deleted file mode 100644 index 12b976a49e..0000000000 Binary files a/graphics/battle_anims/sprites/new/ability_pop_up.png and /dev/null differ diff --git a/graphics/battle_anims/sprites/new/bee.png b/graphics/battle_anims/sprites/new/bee.png deleted file mode 100644 index 448935c10a..0000000000 Binary files a/graphics/battle_anims/sprites/new/bee.png and /dev/null differ diff --git a/graphics/battle_anims/sprites/new/energy_ball.png b/graphics/battle_anims/sprites/new/energy_ball.png deleted file mode 100644 index 361d7ff71a..0000000000 Binary files a/graphics/battle_anims/sprites/new/energy_ball.png and /dev/null differ diff --git a/graphics/battle_anims/sprites/new/flash_cannon_ball.png b/graphics/battle_anims/sprites/new/flash_cannon_ball.png deleted file mode 100644 index b08d1d39f4..0000000000 Binary files a/graphics/battle_anims/sprites/new/flash_cannon_ball.png and /dev/null differ diff --git a/graphics/battle_anims/sprites/new/poison_jab.png b/graphics/battle_anims/sprites/new/poison_jab.png deleted file mode 100644 index 02bbf1b857..0000000000 Binary files a/graphics/battle_anims/sprites/new/poison_jab.png and /dev/null differ diff --git a/graphics/battle_anims/sprites/new/power_gem.png b/graphics/battle_anims/sprites/new/power_gem.png deleted file mode 100644 index 5523bb8a75..0000000000 Binary files a/graphics/battle_anims/sprites/new/power_gem.png and /dev/null differ diff --git a/graphics/battle_anims/sprites/new/punishment.png b/graphics/battle_anims/sprites/new/punishment.png deleted file mode 100644 index 9215b6ec07..0000000000 Binary files a/graphics/battle_anims/sprites/new/punishment.png and /dev/null differ diff --git a/graphics/battle_anims/sprites/new/quick_guard.png b/graphics/battle_anims/sprites/new/quick_guard.png deleted file mode 100644 index 71d343eeb5..0000000000 Binary files a/graphics/battle_anims/sprites/new/quick_guard.png and /dev/null differ diff --git a/graphics/battle_anims/sprites/new/stealth_rock.png b/graphics/battle_anims/sprites/new/stealth_rock.png deleted file mode 100644 index 6ade3bb879..0000000000 Binary files a/graphics/battle_anims/sprites/new/stealth_rock.png and /dev/null differ diff --git a/graphics/battle_anims/sprites/new/stone_edge.png b/graphics/battle_anims/sprites/new/stone_edge.png deleted file mode 100644 index 8e27efb9a2..0000000000 Binary files a/graphics/battle_anims/sprites/new/stone_edge.png and /dev/null differ diff --git a/graphics/battle_anims/sprites/new/water_gun.png b/graphics/battle_anims/sprites/new/water_gun.png deleted file mode 100644 index 4f30b2133d..0000000000 Binary files a/graphics/battle_anims/sprites/new/water_gun.png and /dev/null differ diff --git a/graphics/battle_anims/sprites/new/wood.png b/graphics/battle_anims/sprites/new/wood.png deleted file mode 100644 index 1b64a647f5..0000000000 Binary files a/graphics/battle_anims/sprites/new/wood.png and /dev/null differ diff --git a/graphics/battle_anims/sprites/new/obstruct.png b/graphics/battle_anims/sprites/obstruct.png similarity index 100% rename from graphics/battle_anims/sprites/new/obstruct.png rename to graphics/battle_anims/sprites/obstruct.png diff --git a/graphics/battle_anims/sprites/new/omega_stone.png b/graphics/battle_anims/sprites/omega_stone.png similarity index 100% rename from graphics/battle_anims/sprites/new/omega_stone.png rename to graphics/battle_anims/sprites/omega_stone.png diff --git a/graphics/battle_anims/sprites/new/pink_diamond.png b/graphics/battle_anims/sprites/pink_diamond.png similarity index 100% rename from graphics/battle_anims/sprites/new/pink_diamond.png rename to graphics/battle_anims/sprites/pink_diamond.png diff --git a/graphics/battle_anims/sprites/new/poison_column.png b/graphics/battle_anims/sprites/poison_column.png similarity index 100% rename from graphics/battle_anims/sprites/new/poison_column.png rename to graphics/battle_anims/sprites/poison_column.png diff --git a/graphics/battle_anims/sprites/new/poltergeist.pal b/graphics/battle_anims/sprites/poltergeist.pal similarity index 100% rename from graphics/battle_anims/sprites/new/poltergeist.pal rename to graphics/battle_anims/sprites/poltergeist.pal diff --git a/graphics/battle_anims/sprites/new/power_trick.png b/graphics/battle_anims/sprites/power_trick.png similarity index 100% rename from graphics/battle_anims/sprites/new/power_trick.png rename to graphics/battle_anims/sprites/power_trick.png diff --git a/graphics/battle_anims/sprites/new/purple_drake.png b/graphics/battle_anims/sprites/purple_drake.png similarity index 100% rename from graphics/battle_anims/sprites/new/purple_drake.png rename to graphics/battle_anims/sprites/purple_drake.png diff --git a/graphics/battle_anims/sprites/new/razor_shell.png b/graphics/battle_anims/sprites/razor_shell.png similarity index 100% rename from graphics/battle_anims/sprites/new/razor_shell.png rename to graphics/battle_anims/sprites/razor_shell.png diff --git a/graphics/battle_anims/sprites/new/rock_small.png b/graphics/battle_anims/sprites/rock_small.png similarity index 100% rename from graphics/battle_anims/sprites/new/rock_small.png rename to graphics/battle_anims/sprites/rock_small.png diff --git a/graphics/battle_anims/sprites/new/rocks.png b/graphics/battle_anims/sprites/rocks_new.png similarity index 100% rename from graphics/battle_anims/sprites/new/rocks.png rename to graphics/battle_anims/sprites/rocks_new.png diff --git a/graphics/battle_anims/sprites/new/shell_left.png b/graphics/battle_anims/sprites/shell_left.png similarity index 100% rename from graphics/battle_anims/sprites/new/shell_left.png rename to graphics/battle_anims/sprites/shell_left.png diff --git a/graphics/battle_anims/sprites/new/shell_right.png b/graphics/battle_anims/sprites/shell_right.png similarity index 100% rename from graphics/battle_anims/sprites/new/shell_right.png rename to graphics/battle_anims/sprites/shell_right.png diff --git a/graphics/battle_anims/sprites/new/spacial_rend_slices.pal b/graphics/battle_anims/sprites/spacial_rend_slices.pal similarity index 100% rename from graphics/battle_anims/sprites/new/spacial_rend_slices.pal rename to graphics/battle_anims/sprites/spacial_rend_slices.pal diff --git a/graphics/battle_anims/sprites/new/spikes.png b/graphics/battle_anims/sprites/spikes_new.png similarity index 100% rename from graphics/battle_anims/sprites/new/spikes.png rename to graphics/battle_anims/sprites/spikes_new.png diff --git a/graphics/battle_anims/sprites/new/spirit_shackle_arrow.png b/graphics/battle_anims/sprites/spirit_shackle_arrow.png similarity index 100% rename from graphics/battle_anims/sprites/new/spirit_shackle_arrow.png rename to graphics/battle_anims/sprites/spirit_shackle_arrow.png diff --git a/graphics/battle_anims/sprites/new/steam_eruption.png b/graphics/battle_anims/sprites/steam_eruption.png similarity index 100% rename from graphics/battle_anims/sprites/new/steam_eruption.png rename to graphics/battle_anims/sprites/steam_eruption.png diff --git a/graphics/battle_anims/sprites/new/steamroller.png b/graphics/battle_anims/sprites/steamroller.png similarity index 100% rename from graphics/battle_anims/sprites/new/steamroller.png rename to graphics/battle_anims/sprites/steamroller.png diff --git a/graphics/battle_anims/sprites/new/steel_beam.pal b/graphics/battle_anims/sprites/steel_beam.pal similarity index 100% rename from graphics/battle_anims/sprites/new/steel_beam.pal rename to graphics/battle_anims/sprites/steel_beam.pal diff --git a/graphics/battle_anims/sprites/new/stone_pillar.png b/graphics/battle_anims/sprites/stone_pillar.png similarity index 100% rename from graphics/battle_anims/sprites/new/stone_pillar.png rename to graphics/battle_anims/sprites/stone_pillar.png diff --git a/graphics/battle_anims/sprites/new/straight_beam.png b/graphics/battle_anims/sprites/straight_beam.png similarity index 100% rename from graphics/battle_anims/sprites/new/straight_beam.png rename to graphics/battle_anims/sprites/straight_beam.png diff --git a/graphics/battle_anims/sprites/new/substitute_back.png b/graphics/battle_anims/sprites/substitute_back_new.png similarity index 100% rename from graphics/battle_anims/sprites/new/substitute_back.png rename to graphics/battle_anims/sprites/substitute_back_new.png diff --git a/graphics/battle_anims/sprites/new/substitute_front.png b/graphics/battle_anims/sprites/substitute_new.png similarity index 100% rename from graphics/battle_anims/sprites/new/substitute_front.png rename to graphics/battle_anims/sprites/substitute_new.png diff --git a/graphics/battle_anims/sprites/new/surf_new.pal b/graphics/battle_anims/sprites/surf_new.pal similarity index 100% rename from graphics/battle_anims/sprites/new/surf_new.pal rename to graphics/battle_anims/sprites/surf_new.pal diff --git a/graphics/battle_anims/sprites/new/sword.png b/graphics/battle_anims/sprites/sword_new.png similarity index 100% rename from graphics/battle_anims/sprites/new/sword.png rename to graphics/battle_anims/sprites/sword_new.png diff --git a/graphics/battle_anims/sprites/new/teeth.png b/graphics/battle_anims/sprites/teeth_new.png similarity index 100% rename from graphics/battle_anims/sprites/new/teeth.png rename to graphics/battle_anims/sprites/teeth_new.png diff --git a/graphics/battle_anims/sprites/new/tornado.png b/graphics/battle_anims/sprites/tornado.png similarity index 100% rename from graphics/battle_anims/sprites/new/tornado.png rename to graphics/battle_anims/sprites/tornado.png diff --git a/graphics/battle_anims/sprites/new/z_move_symbol.png b/graphics/battle_anims/sprites/z_move_symbol.png similarity index 100% rename from graphics/battle_anims/sprites/new/z_move_symbol.png rename to graphics/battle_anims/sprites/z_move_symbol.png diff --git a/graphics/battle_frontier/arena_judgement_symbols.png b/graphics/battle_frontier/arena_judgment_symbols.png similarity index 100% rename from graphics/battle_frontier/arena_judgement_symbols.png rename to graphics/battle_frontier/arena_judgment_symbols.png diff --git a/include/battle.h b/include/battle.h index fa8d4f7c7b..71b731da66 100644 --- a/include/battle.h +++ b/include/battle.h @@ -14,9 +14,8 @@ #include "pokeball.h" #include "battle_debug.h" -#define GET_BATTLER_POSITION(battler) (gBattlerPositions[battler]) #define GET_BATTLER_SIDE(battler) (GetBattlerPosition(battler) & BIT_SIDE) -#define GET_BATTLER_SIDE2(battler) (GET_BATTLER_POSITION(battler) & BIT_SIDE) +#define GET_BATTLER_SIDE2(battler) (gBattlerPositions[battler] & BIT_SIDE) // Used to exclude moves learned temporarily by Transform or Mimic #define MOVE_IS_PERMANENT(battler, moveSlot) \ @@ -515,7 +514,7 @@ struct BattleStruct u8 faintedActionsState; u8 faintedActionsBattlerId; u32 expValue; - u8 field_52; + u8 scriptPartyIdx; // for printing the nickname u8 sentInPokes; bool8 selectionScriptFinished[MAX_BATTLERS_COUNT]; u8 battlerPartyIndexes[MAX_BATTLERS_COUNT]; @@ -621,6 +620,9 @@ struct BattleStruct u8 stickyWebUser; u8 appearedInBattle; // Bitfield to track which Pokemon appeared in battle. Used for Burmy's form change u8 skyDropTargets[MAX_BATTLERS_COUNT]; // For Sky Drop, to account for if multiple Pokemon use Sky Drop in a double battle. + // When using a move which hits multiple opponents which is then bounced by a target, we need to make sure, the move hits both opponents, the one with bounce, and the one without. + u8 attackerBeforeBounce:2; + u8 targetsDone[MAX_BATTLERS_COUNT]; // Each battler as a bit. }; #define F_DYNAMIC_TYPE_1 (1 << 6) @@ -761,7 +763,7 @@ struct BattleHealthboxInfo u8 specialAnimActive:1; // x40 u8 triedShinyMonAnim:1; u8 finishedShinyMonAnim:1; - u8 field_1_x1E:4; + u8 opponentDrawPartyStatusSummaryDelay:4; u8 bgmRestored:1; u8 waitForCry:1; u8 healthboxSlideInStarted:1; diff --git a/include/battle_ai_util.h b/include/battle_ai_util.h index 5e66577e30..11eba7b661 100644 --- a/include/battle_ai_util.h +++ b/include/battle_ai_util.h @@ -5,7 +5,7 @@ #define AI_IS_FASTER 0 #define AI_IS_SLOWER 1 -#define FOE(battler) ((battler ^ BIT_SIDE) & BIT_SIDE) +#define FOE(battler) ((BATTLE_OPPOSITE(battler)) & BIT_SIDE) bool32 AI_RandLessThan(u8 val); void RecordLastUsedMoveByTarget(void); diff --git a/include/battle_controllers.h b/include/battle_controllers.h index 769dccbd69..e1ab98b0c7 100644 --- a/include/battle_controllers.h +++ b/include/battle_controllers.h @@ -208,9 +208,7 @@ void PrepareBufferDataTransferLink(u8 bufferId, u16 size, u8 *data); // emitters void BtlController_EmitGetMonData(u8 bufferId, u8 requestId, u8 monToCheck); -void BtlController_EmitGetRawMonData(u8 bufferId, u8 monId, u8 bytes); // unused void BtlController_EmitSetMonData(u8 bufferId, u8 requestId, u8 monToCheck, u8 bytes, void *data); -void BtlController_EmitSetRawMonData(u8 bufferId, u8 monId, u8 bytes, void *data); // unused void BtlController_EmitLoadMonSprite(u8 bufferId); void BtlController_EmitSwitchInAnim(u8 bufferId, u8 partyId, bool8 dontClearSubstituteBit); void BtlController_EmitReturnMonToBall(u8 bufferId, bool8 skipAnim); @@ -218,10 +216,7 @@ void BtlController_EmitDrawTrainerPic(u8 bufferId); void BtlController_EmitTrainerSlide(u8 bufferId); void BtlController_EmitTrainerSlideBack(u8 bufferId); void BtlController_EmitFaintAnimation(u8 bufferId); -void BtlController_EmitPaletteFade(u8 bufferId); // unused -void BtlController_EmitSuccessBallThrowAnim(u8 bufferId); // unused void BtlController_EmitBallThrowAnim(u8 bufferId, u8 caseId); -void BtlController_EmitPause(u8 bufferId, u8 toWait, void *data); // unused void BtlController_EmitMoveAnimation(u8 bufferId, u16 move, u8 turnOfMove, u16 movePower, s32 dmg, u8 friendship, struct DisableStruct *disableStructPtr, u8 multihit); void BtlController_EmitPrintString(u8 bufferId, u16 stringId); void BtlController_EmitPrintSelectionString(u8 bufferId, u16 stringId); @@ -230,24 +225,15 @@ void BtlController_EmitYesNoBox(u8 bufferId); void BtlController_EmitChooseMove(u8 bufferId, bool8 isDoubleBattle, bool8 NoPpNumber, struct ChooseMoveStruct *movePpData); void BtlController_EmitChooseItem(u8 bufferId, u8 *battlePartyOrder); void BtlController_EmitChoosePokemon(u8 bufferId, u8 caseId, u8 slotId, u16 abilityId, u8 *data); -void BtlController_EmitCmd23(u8 bufferId); // unused void BtlController_EmitHealthBarUpdate(u8 bufferId, u16 hpValue); void BtlController_EmitExpUpdate(u8 bufferId, u8 partyId, s32 expPoints); void BtlController_EmitStatusIconUpdate(u8 bufferId, u32 status1, u32 status2); void BtlController_EmitStatusAnimation(u8 bufferId, bool8 status2, u32 status); -void BtlController_EmitStatusXor(u8 bufferId, u8 b); // unused void BtlController_EmitDataTransfer(u8 bufferId, u16 size, void *data); -void BtlController_EmitDMA3Transfer(u8 bufferId, void *dst, u16 size, void *data); // unused -void BtlController_EmitPlayBGM(u8 bufferId, u16 songId, void *data); // unused -void BtlController_EmitCmd32(u8 bufferId, u16 size, void *data); // unused void BtlController_EmitTwoReturnValues(u8 bufferId, u8 ret8, u32 ret32); void BtlController_EmitChosenMonReturnValue(u8 bufferId, u8 partyId, u8 *battlePartyOrder); void BtlController_EmitOneReturnValue(u8 bufferId, u16 ret); void BtlController_EmitOneReturnValue_Duplicate(u8 bufferId, u16 ret); -void BtlController_EmitClearUnkVar(u8 bufferId); // unused -void BtlController_EmitSetUnkVar(u8 bufferId, u8 b); // unused -void BtlController_EmitClearUnkFlag(u8 bufferId); // unused -void BtlController_EmitToggleUnkFlag(u8 bufferId); // unused void BtlController_EmitHitAnimation(u8 bufferId); void BtlController_EmitCantSwitch(u8 bufferId); void BtlController_EmitPlaySE(u8 bufferId, u16 songId); diff --git a/include/battle_message.h b/include/battle_message.h index 4102bb5c9a..5cbf8f522b 100644 --- a/include/battle_message.h +++ b/include/battle_message.h @@ -218,7 +218,7 @@ struct BattleMsgData u16 lastItem; u16 lastAbility; u8 scrActive; - u8 unk1605E; + u8 bakScriptPartyIdx; u8 hpScale; u8 itemEffectBattler; u8 moveType; @@ -309,7 +309,7 @@ extern const u8 gText_OpponentMon1Name[]; extern const u8 gText_Mind[]; extern const u8 gText_Skill[]; extern const u8 gText_Body[]; -extern const u8 gText_Judgement[]; +extern const u8 gText_Judgment[]; extern const u8 gText_EmptyString3[]; extern const u8 gText_RecordBattleToPass[]; extern const u8 gText_BattleRecordedOnPass[]; diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 7e2e9a01e6..00a0747bdb 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -151,7 +151,7 @@ extern const u8 BattleScript_SandstreamActivates[]; extern const u8 BattleScript_ShedSkinActivates[]; extern const u8 BattleScript_WeatherFormChanges[]; extern const u8 BattleScript_WeatherFormChangesLoop[]; -extern const u8 BattleScript_CastformChange[]; +extern const u8 BattleScript_WeatherFormChange[]; extern const u8 BattleScript_IntimidateActivatesEnd3[]; extern const u8 BattleScript_IntimidateActivates[]; extern const u8 BattleScript_DroughtActivates[]; diff --git a/include/battle_util.h b/include/battle_util.h index 5dbefd7e7e..9dcd0c9166 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -26,7 +26,7 @@ #define ABILITYEFFECT_MOVE_END_ATTACKER 4 #define ABILITYEFFECT_MOVE_END 5 #define ABILITYEFFECT_IMMUNITY 6 -#define ABILITYEFFECT_FORECAST 7 +#define ABILITYEFFECT_WEATHER_FORM 7 #define ABILITYEFFECT_SYNCHRONIZE 8 #define ABILITYEFFECT_ATK_SYNCHRONIZE 9 #define ABILITYEFFECT_INTIMIDATE1 10 diff --git a/include/config.h b/include/config.h index d4a71c0766..d6c60a2fa8 100644 --- a/include/config.h +++ b/include/config.h @@ -44,4 +44,13 @@ #define POKEMON_EXPANSION #define ITEM_EXPANSION +// Generation constants used in configs to define behavior +#define GEN_3 0 +#define GEN_4 1 +#define GEN_5 2 +#define GEN_6 3 +#define GEN_7 4 +#define GEN_8 5 +#define GEN_LATEST GEN_8 + #endif // GUARD_CONFIG_H diff --git a/include/constants/battle.h b/include/constants/battle.h index 5cffb74ab3..e2ea128c25 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -31,8 +31,8 @@ #define B_POSITION_OPPONENT_RIGHT 3 // These macros can be used with either battler ID or positions to get the partner or the opposite mon -#define BATTLE_OPPOSITE(id) ((id) ^ 1) -#define BATTLE_PARTNER(id) ((id) ^ 2) +#define BATTLE_OPPOSITE(id) ((id) ^ BIT_SIDE) +#define BATTLE_PARTNER(id) ((id) ^ BIT_FLANK) #define B_SIDE_PLAYER 0 #define B_SIDE_OPPONENT 1 @@ -460,8 +460,8 @@ #define ARENA_WIN_MIND 18 #define ARENA_WIN_SKILL 19 #define ARENA_WIN_BODY 20 -#define ARENA_WIN_JUDGEMENT_TITLE 21 -#define ARENA_WIN_JUDGEMENT_TEXT 22 +#define ARENA_WIN_JUDGMENT_TITLE 21 +#define ARENA_WIN_JUDGMENT_TEXT 22 // Flag for BattlePutTextOnWindow. Never set #define B_WIN_COPYTOVRAM (1 << 7) diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index 89134daf91..b8d7c9f8ae 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -1,136 +1,128 @@ #ifndef GUARD_CONSTANTS_BATTLE_CONFIG_H #define GUARD_CONSTANTS_BATTLE_CONFIG_H -#ifndef GEN_3 - #define GEN_3 0 - #define GEN_4 1 - #define GEN_5 2 - #define GEN_6 3 - #define GEN_7 4 - #define GEN_8 5 -#endif - // Calculation settings -#define B_CRIT_CHANCE GEN_7 // Chances of a critical hit landing. See CalcCritChanceStage. Gen6+ chances guarantee that Farfetch'd and Sirfetch'd always get critical hits while holding a Leek and using high-crit ratio moves. -#define B_CRIT_MULTIPLIER GEN_7 // In Gen6+, critical hits multiply damage by 1.5 instead of 2. -#define B_PARALYSIS_SPEED GEN_7 // In Gen7+, Speed is decreased by 50% instead of 75%. -#define B_CONFUSION_SELF_DMG_CHANCE GEN_7 // In Gen7+, confusion has a 33.3% of self-damage, instead of 50%. -#define B_MULTI_HIT_CHANCE GEN_7 // In Gen5+, multi-hit moves have different %. See Cmd_setmultihitcounter for values. -#define B_WHITEOUT_MONEY GEN_7 // In Gen4+, the amount of money lost by losing a battle is determined by the amount of badges earned. Previously, it would cut the current money by half. (While this change was also in FRLG, for the sake of simplicity, setting this to GEN_3 will result in RSE behavior.) +#define B_CRIT_CHANCE GEN_LATEST // Chances of a critical hit landing. See CalcCritChanceStage. Gen6+ chances guarantee that Farfetch'd and Sirfetch'd always get critical hits while holding a Leek and using high-crit ratio moves. +#define B_CRIT_MULTIPLIER GEN_LATEST // In Gen6+, critical hits multiply damage by 1.5 instead of 2. +#define B_PARALYSIS_SPEED GEN_LATEST // In Gen7+, Speed is decreased by 50% instead of 75%. +#define B_CONFUSION_SELF_DMG_CHANCE GEN_LATEST // In Gen7+, confusion has a 33.3% of self-damage, instead of 50%. +#define B_MULTI_HIT_CHANCE GEN_LATEST // In Gen5+, multi-hit moves have different %. See Cmd_setmultihitcounter for values. +#define B_WHITEOUT_MONEY GEN_LATEST // In Gen4+, the amount of money lost by losing a battle is determined by the amount of badges earned. Previously, it would cut the current money by half. (While this change was also in FRLG, for the sake of simplicity, setting this to GEN_3 will result in RSE behavior.) // Exp and stat settings -#define B_EXP_CATCH GEN_7 // In Gen6+, Pokémon get experience from catching. -#define B_TRAINER_EXP_MULTIPLIER GEN_7 // In Gen7+, trainer battles no longer give a 1.5 multiplier to EXP gain. -#define B_SPLIT_EXP GEN_7 // In Gen6+, all participating mon get full experience. -#define B_SCALED_EXP GEN_7 // In Gen5 and Gen7+, experience is weighted by level difference. -#define B_BADGE_BOOST GEN_7 // In Gen4+, Gym Badges no longer boost a Pokémon's stats. -#define B_MAX_LEVEL_EV_GAINS GEN_7 // In Gen5+, Lv100 Pokémon can obtain Effort Values normally. -#define B_RECALCULATE_STATS GEN_7 // In Gen5+, the stats of the Pokémon who participate in battle are recalculated at the end of each battle. +#define B_EXP_CATCH GEN_LATEST // In Gen6+, Pokémon get experience from catching. +#define B_TRAINER_EXP_MULTIPLIER GEN_LATEST // In Gen7+, trainer battles no longer give a 1.5 multiplier to EXP gain. +#define B_SPLIT_EXP GEN_LATEST // In Gen6+, all participating mon get full experience. +#define B_SCALED_EXP GEN_LATEST // In Gen5 and Gen7+, experience is weighted by level difference. +#define B_BADGE_BOOST GEN_LATEST // In Gen4+, Gym Badges no longer boost a Pokémon's stats. +#define B_MAX_LEVEL_EV_GAINS GEN_LATEST // In Gen5+, Lv100 Pokémon can obtain Effort Values normally. +#define B_RECALCULATE_STATS GEN_LATEST // In Gen5+, the stats of the Pokémon who participate in battle are recalculated at the end of each battle. // Damage settings -#define B_BURN_DAMAGE GEN_7 // In Gen7+, burn damage is 1/16th of max HP instead of 1/8th. -#define B_BURN_FACADE_DMG GEN_7 // In Gen6+, burn's effect of lowering the Attack stat no longer applies to Facade. -#define B_BINDING_DAMAGE GEN_7 // In Gen6+, binding damage is 1/8 of max HP instead of 1/16. (With Binding Band, 1/6 and 1/8 respectively.) -#define B_PSYWAVE_DMG GEN_7 // Psywave's damage formula. See Cmd_psywavedamageeffect. -#define B_PAYBACK_SWITCH_BOOST GEN_7 // In Gen5+, if the opponent switches out, Payback's damage will no longer be doubled. -#define B_HIDDEN_POWER_DMG GEN_7 // In Gen6+, Hidden Power's base power was set to always be 60. Before, it was determined by the mon's IVs. -#define B_ROUGH_SKIN_DMG GEN_7 // In Gen4+, Rough Skin contact damage is 1/8th of max HP instead of 1/16th. This will also affect Iron Barbs. -#define B_KNOCK_OFF_DMG GEN_8 // In Gen6+, Knock Off deals 50% more damage when knocking off an item. -#define B_SPORT_DMG_REDUCTION GEN_7 // In Gen5+, Water/Mud Sport reduce Fire/Electric Damage by 67% instead of 50%. -#define B_EXPLOSION_DEFENSE GEN_7 // In Gen5+, Self-Destruct and Explosion don't halve the targets' defense. +#define B_BURN_DAMAGE GEN_LATEST // In Gen7+, burn damage is 1/16th of max HP instead of 1/8th. +#define B_BURN_FACADE_DMG GEN_LATEST // In Gen6+, burn's effect of lowering the Attack stat no longer applies to Facade. +#define B_BINDING_DAMAGE GEN_LATEST // In Gen6+, binding damage is 1/8 of max HP instead of 1/16. (With Binding Band, 1/6 and 1/8 respectively.) +#define B_PSYWAVE_DMG GEN_LATEST // Psywave's damage formula. See Cmd_psywavedamageeffect. +#define B_PAYBACK_SWITCH_BOOST GEN_LATEST // In Gen5+, if the opponent switches out, Payback's damage will no longer be doubled. +#define B_HIDDEN_POWER_DMG GEN_LATEST // In Gen6+, Hidden Power's base power was set to always be 60. Before, it was determined by the mon's IVs. +#define B_ROUGH_SKIN_DMG GEN_LATEST // In Gen4+, Rough Skin contact damage is 1/8th of max HP instead of 1/16th. This will also affect Iron Barbs. +#define B_KNOCK_OFF_DMG GEN_LATEST // In Gen6+, Knock Off deals 50% more damage when knocking off an item. +#define B_SPORT_DMG_REDUCTION GEN_LATEST // In Gen5+, Water/Mud Sport reduce Fire/Electric Damage by 67% instead of 50%. +#define B_EXPLOSION_DEFENSE GEN_LATEST // In Gen5+, Self-Destruct and Explosion don't halve the targets' defense. // Type settings -#define B_GHOSTS_ESCAPE GEN_7 // In Gen6+, abilities like Shadow Tag or moves like Mean Look fail on Ghost-type Pokémon. They can also escape any Wild Battle. -#define B_PARALYZE_ELECTRIC GEN_7 // In Gen6+, Electric-type Pokémon can't be paralyzed. -#define B_POWDER_GRASS GEN_7 // In Gen6+, Grass-type Pokémon are immune to powder and spore moves. -#define B_STEEL_RESISTANCES GEN_7 // In Gen6+, Steel-type Pokémon are no longer resistant to Dark-type and Ghost-type moves. -#define B_PRANKSTER_DARK_TYPES GEN_7 // In Gen7+, Prankster-elevated status moves do not affect Dark type Pokémon. -#define B_SHEER_COLD_IMMUNITY GEN_7 // In Gen7+, Ice-types are immune to Sheer Cold +#define B_GHOSTS_ESCAPE GEN_LATEST // In Gen6+, abilities like Shadow Tag or moves like Mean Look fail on Ghost-type Pokémon. They can also escape any Wild Battle. +#define B_PARALYZE_ELECTRIC GEN_LATEST // In Gen6+, Electric-type Pokémon can't be paralyzed. +#define B_POWDER_GRASS GEN_LATEST // In Gen6+, Grass-type Pokémon are immune to powder and spore moves. +#define B_STEEL_RESISTANCES GEN_LATEST // In Gen6+, Steel-type Pokémon are no longer resistant to Dark-type and Ghost-type moves. +#define B_PRANKSTER_DARK_TYPES GEN_LATEST // In Gen7+, Prankster-elevated status moves do not affect Dark type Pokémon. +#define B_SHEER_COLD_IMMUNITY GEN_LATEST // In Gen7+, Ice-types are immune to Sheer Cold // Turn settings -#define B_BINDING_TURNS GEN_7 // In Gen5+, binding moves last for 4-5 turns instead of 2-5 turns. (With Grip Claw, 7 and 5 turns respectively.) -#define B_UPROAR_TURNS GEN_7 // In Gen5+, Uproar lasts for 3 turns instead of 2-5 turns. -#define B_DISABLE_TURNS GEN_7 // Disable's turns. See Cmd_disablelastusedattack. -#define B_TAILWIND_TURNS GEN_7 // In Gen5+, Tailwind lasts 4 turns instead of 3. -#define B_SLEEP_TURNS GEN_7 // In Gen5+, sleep lasts for 1-3 turns instead of 2-5 turns. -#define B_TAUNT_TURNS GEN_7 // In Gen5+, Taunt lasts 3 turns if the user acts before the target, or 4 turns if the target acted before the user. In Gen3, taunt lasts 2 turns and in Gen 4, 3-5 turns. -#define B_SPORT_TURNS GEN_7 // In Gen6+, Water/Mud Sport last 5 turns, even if the user switches out. -#define B_MEGA_EVO_TURN_ORDER GEN_7 // In Gen7, a Pokémon's Speed after Mega Evolution is used to determine turn order, not its Speed before. -#define B_RECALC_TURN_AFTER_ACTIONS GEN_8 // In Gen8, switching/using a move affects the current turn's order of actions. -#define B_FAINT_SWITCH_IN GEN_7 // In Gen4+, sending out a new Pokémon after the previous one fainted happens at the end of the turn. Before, it would happen after each action. +#define B_BINDING_TURNS GEN_LATEST // In Gen5+, binding moves last for 4-5 turns instead of 2-5 turns. (With Grip Claw, 7 and 5 turns respectively.) +#define B_UPROAR_TURNS GEN_LATEST // In Gen5+, Uproar lasts for 3 turns instead of 2-5 turns. +#define B_DISABLE_TURNS GEN_LATEST // Disable's turns. See Cmd_disablelastusedattack. +#define B_TAILWIND_TURNS GEN_LATEST // In Gen5+, Tailwind lasts 4 turns instead of 3. +#define B_SLEEP_TURNS GEN_LATEST // In Gen5+, sleep lasts for 1-3 turns instead of 2-5 turns. +#define B_TAUNT_TURNS GEN_LATEST // In Gen5+, Taunt lasts 3 turns if the user acts before the target, or 4 turns if the target acted before the user. In Gen3, taunt lasts 2 turns and in Gen 4, 3-5 turns. +#define B_SPORT_TURNS GEN_LATEST // In Gen6+, Water/Mud Sport last 5 turns, even if the user switches out. +#define B_MEGA_EVO_TURN_ORDER GEN_LATEST // In Gen7, a Pokémon's Speed after Mega Evolution is used to determine turn order, not its Speed before. +#define B_RECALC_TURN_AFTER_ACTIONS GEN_LATEST // In Gen8, switching/using a move affects the current turn's order of actions. +#define B_FAINT_SWITCH_IN GEN_LATEST // In Gen4+, sending out a new Pokémon after the previous one fainted happens at the end of the turn. Before, it would happen after each action. // Move data settings -#define B_UPDATED_MOVE_DATA GEN_8 // Updates move data in gBattleMoves, including Power, Accuracy, PP, stat changes, targets, chances of secondary effects, etc. -#define B_PHYSICAL_SPECIAL_SPLIT GEN_7 // In Gen3, the move's type determines if it will do physical or special damage. The split icon in the summary will reflect this. -#define B_RECOIL_IF_MISS_DMG GEN_7 // In Gen5+, Jump Kick and High Jump Kick will always do half of the user's max HP when missing. -#define B_KLUTZ_FLING_INTERACTION GEN_7 // In Gen5+, Pokémon with the Klutz ability can't use Fling. -#define B_UPDATED_CONVERSION GEN_7 // In Gen6+, Conversion changes the user's type to match their first move's. Before, it would choose a move at random. -#define B_PP_REDUCED_BY_SPITE GEN_7 // In Gen4+, Spite reduces the foe's last move's PP by 4, instead of 2 to 5. +#define B_UPDATED_MOVE_DATA GEN_LATEST // Updates move data in gBattleMoves, including Power, Accuracy, PP, stat changes, targets, chances of secondary effects, etc. +#define B_PHYSICAL_SPECIAL_SPLIT GEN_LATEST // In Gen3, the move's type determines if it will do physical or special damage. The split icon in the summary will reflect this. +#define B_RECOIL_IF_MISS_DMG GEN_LATEST // In Gen5+, Jump Kick and High Jump Kick will always do half of the user's max HP when missing. +#define B_KLUTZ_FLING_INTERACTION GEN_LATEST // In Gen5+, Pokémon with the Klutz ability can't use Fling. +#define B_UPDATED_CONVERSION GEN_LATEST // In Gen6+, Conversion changes the user's type to match their first move's. Before, it would choose a move at random. +#define B_PP_REDUCED_BY_SPITE GEN_LATEST // In Gen4+, Spite reduces the foe's last move's PP by 4, instead of 2 to 5. // Move accuracy settings -#define B_TOXIC_NEVER_MISS GEN_7 // In Gen6+, if Toxic is used by a Poison-type Pokémon, it will never miss. -#define B_MINIMIZE_DMG_ACC GEN_7 // In Gen6+, moves that causes double damage to minimized Pokémon will also skip accuracy checks. -#define B_BLIZZARD_HAIL GEN_7 // In Gen4+, Blizzard bypasses accuracy checks if it's hailing. -#define B_SHEER_COLD_ACC GEN_7 // In Gen7+, Sheer Cold's base chance of hitting is reduced to 20% if the user isn't Ice-typed. +#define B_TOXIC_NEVER_MISS GEN_LATEST // In Gen6+, if Toxic is used by a Poison-type Pokémon, it will never miss. +#define B_MINIMIZE_DMG_ACC GEN_LATEST // In Gen6+, moves that causes double damage to minimized Pokémon will also skip accuracy checks. +#define B_BLIZZARD_HAIL GEN_LATEST // In Gen4+, Blizzard bypasses accuracy checks if it's hailing. +#define B_SHEER_COLD_ACC GEN_LATEST // In Gen7+, Sheer Cold's base chance of hitting is reduced to 20% if the user isn't Ice-typed. // Move stat change settings -#define B_FELL_STINGER_STAT_RAISE GEN_7 // In Gen7+, it raises Atk by 3 stages instead of 2 if it causes the target to faint. -#define B_KINGS_SHIELD_LOWER_ATK GEN_7 // In Gen7+, it lowers Atk by 1 stage instead of 2 of oponents that hit it. -#define B_SPEED_BUFFING_RAPID_SPIN GEN_8 // In Gen8, Rapid Spin raises the user's Speed by 1 stage. -#define B_CHARGE_SPDEF_RAISE GEN_7 // In Gen5+, Charge raises the user's Special Defense by 1 stage. -#define B_MINIMIZE_EVASION GEN_7 // In Gen5+, Minimize raises evasion by 2 stages instead of 1. -#define B_GROWTH_STAT_RAISE GEN_7 // In Gen5+, Growth raises Attack in addition to Special Attack by 1 stage each. Under the effects of the sun, it raises them by 2 stages each instead. +#define B_FELL_STINGER_STAT_RAISE GEN_LATEST // In Gen7+, it raises Atk by 3 stages instead of 2 if it causes the target to faint. +#define B_KINGS_SHIELD_LOWER_ATK GEN_LATEST // In Gen8+, it lowers Atk by 1 stage instead of 2 of oponents that hit it. +#define B_SPEED_BUFFING_RAPID_SPIN GEN_LATEST // In Gen8, Rapid Spin raises the user's Speed by 1 stage. +#define B_CHARGE_SPDEF_RAISE GEN_LATEST // In Gen5+, Charge raises the user's Special Defense by 1 stage. +#define B_MINIMIZE_EVASION GEN_LATEST // In Gen5+, Minimize raises evasion by 2 stages instead of 1. +#define B_GROWTH_STAT_RAISE GEN_LATEST // In Gen5+, Growth raises Attack in addition to Special Attack by 1 stage each. Under the effects of the sun, it raises them by 2 stages each instead. // Other move settings -#define B_SOUND_SUBSTITUTE GEN_7 // In Gen6+, sound moves bypass Substitute. -#define B_INCINERATE_GEMS GEN_7 // In Gen6+, Incinerate can destroy Gems. -#define B_CAN_SPITE_FAIL GEN_7 // In Gen4+, Spite can no longer fail if the foe's last move only has 1 remaining PP. -#define B_CRASH_IF_TARGET_IMMUNE GEN_7 // In Gen4+, The user of Jump Kick or High Jump Kick will "keep going and crash" if it attacks a target that is immune to the move. -#define B_MEMENTO_FAIL GEN_7 // In Gen4+, Memento fails if there is no target or if the target is protected or behind substitute. But not if Atk/Sp. Atk are at -6. -#define B_GLARE_GHOST GEN_7 // In Gen4+, Glare can hit Ghost-type Pokémon normally. -#define B_SKILL_SWAP GEN_7 // In Gen4+, Skill Swap triggers switch-in abilities after use. -#define B_BRICK_BREAK GEN_7 // In Gen4+, you can destroy your own side's screens. In Gen 5+, screens are not removed if the target is immune. -#define B_WISH_HP_SOURCE GEN_7 // In Gen5+, Wish heals half of the user's max HP instead of the target's. -#define B_RAMPAGE_CANCELLING GEN_7 // In Gen5+, a failed Thrash, etc, will cancel except on its last turn. -#define B_HEAL_BLOCKING GEN_7 // In Gen5+, Heal Block prevents healing by Black Sludge, Leftovers, Shell Bell. Affected Pokémon will not consume held HP-restoring Berries or Berry Juice. - // Draining abilities will not heal but will prevent damage. In Gen6+, Heal Block prevents the use of most HP-draining moves. -#define B_ROOTED_GROUNDING GEN_7 // In Gen4+, Ingrain causes the affected Pokémon to become grounded. +#define B_SOUND_SUBSTITUTE GEN_LATEST // In Gen6+, sound moves bypass Substitute. +#define B_INCINERATE_GEMS GEN_LATEST // In Gen6+, Incinerate can destroy Gems. +#define B_CAN_SPITE_FAIL GEN_LATEST // In Gen4+, Spite can no longer fail if the foe's last move only has 1 remaining PP. +#define B_CRASH_IF_TARGET_IMMUNE GEN_LATEST // In Gen4+, The user of Jump Kick or High Jump Kick will "keep going and crash" if it attacks a target that is immune to the move. +#define B_MEMENTO_FAIL GEN_LATEST // In Gen4+, Memento fails if there is no target or if the target is protected or behind substitute. But not if Atk/Sp. Atk are at -6. +#define B_GLARE_GHOST GEN_LATEST // In Gen4+, Glare can hit Ghost-type Pokémon normally. +#define B_SKILL_SWAP GEN_LATEST // In Gen4+, Skill Swap triggers switch-in abilities after use. +#define B_BRICK_BREAK GEN_LATEST // In Gen4+, you can destroy your own side's screens. In Gen 5+, screens are not removed if the target is immune. +#define B_WISH_HP_SOURCE GEN_LATEST // In Gen5+, Wish heals half of the user's max HP instead of the target's. +#define B_RAMPAGE_CANCELLING GEN_LATEST // In Gen5+, a failed Thrash, etc, will cancel except on its last turn. +#define B_HEAL_BLOCKING GEN_LATEST // In Gen5+, Heal Block prevents healing by Black Sludge, Leftovers, Shell Bell. Affected Pokémon will not consume held HP-restoring Berries or Berry Juice. + // Draining abilities will not heal but will prevent damage. In Gen6+, Heal Block prevents the use of most HP-draining moves. +#define B_ROOTED_GROUNDING GEN_LATEST // In Gen4+, Ingrain causes the affected Pokémon to become grounded. // Ability settings -#define B_EXPANDED_ABILITY_NAMES TRUE // If TRUE, ability names are increased from 12 characters to 16 characters. -#define B_ABILITY_WEATHER GEN_7 // In Gen6+, ability-induced weather lasts 5 turns. Before, it lasted until the battle ended or until it was changed by a move or a different weather-affecting ability. -#define B_GALE_WINGS GEN_7 // In Gen7+ requires full HP to trigger. -#define B_STANCE_CHANGE_FAIL GEN_7 // In Gen7+, Stance Change fails if the Pokémon is unable to use a move because of confusion, paralysis, etc. In Gen6, it doesn't. -#define B_SHADOW_TAG_ESCAPE GEN_7 // In Gen4+, if both sides have a Pokémon with Shadow Tag, all battlers can escape. Before, neither side could escape this situation. -#define B_MOODY_ACC_EVASION GEN_8 // In Gen8, Moody CANNOT raise Accuracy and Evasion anymore. -#define B_FLASH_FIRE_FROZEN GEN_7 // In Gen5+, Flash Fire can trigger even when frozen, when it couldn't before. -#define B_SYNCHRONIZE_NATURE GEN_8 // In Gen8, if a Pokémon with Synchronize is leading the party, it's 100% guaranteed that wild Pokémon will have the same ability, as opposed to 50% previously. -#define B_SYNCHRONIZE_TOXIC GEN_8 // In Gen5+, if a Pokémon with Synchronize is badly poisoned, the opponent will also become badly poisoned. Previously, the opponent would become regular poisoned. -#define B_UPDATED_INTIMIDATE GEN_8 // In Gen8, Intimidate doesn't work on opponents with the Inner Focus, Scrappy, Own Tempo or Oblivious abilities. It also activates Rattled. -#define B_OBLIVIOUS_TAUNT GEN_7 // In Gen6+, Pokémon with Oblivious can't be taunted. -#define B_STURDY GEN_7 // In Gen5+, Sturdy causes the Pokémon to have 1 HP remaining if another Pokémon's attack or confusion damage would have brought it from full health to 0 HP. -#define B_PLUS_MINUS_INTERACTION GEN_7 // In Gen5+, Plus and Minus can be activated with themselves and the opposite ability. Before, only the opposing ability could activate it. +#define B_EXPANDED_ABILITY_NAMES TRUE // If TRUE, ability names are increased from 12 characters to 16 characters. +#define B_ABILITY_WEATHER GEN_LATEST // In Gen6+, ability-induced weather lasts 5 turns. Before, it lasted until the battle ended or until it was changed by a move or a different weather-affecting ability. +#define B_GALE_WINGS GEN_LATEST // In Gen7+ requires full HP to trigger. +#define B_STANCE_CHANGE_FAIL GEN_LATEST // In Gen7+, Stance Change fails if the Pokémon is unable to use a move because of confusion, paralysis, etc. In Gen6, it doesn't. +#define B_SHADOW_TAG_ESCAPE GEN_LATEST // In Gen4+, if both sides have a Pokémon with Shadow Tag, all battlers can escape. Before, neither side could escape this situation. +#define B_MOODY_ACC_EVASION GEN_LATEST // In Gen8, Moody CANNOT raise Accuracy and Evasion anymore. +#define B_FLASH_FIRE_FROZEN GEN_LATEST // In Gen5+, Flash Fire can trigger even when frozen, when it couldn't before. +#define B_SYNCHRONIZE_NATURE GEN_LATEST // In Gen8, if a Pokémon with Synchronize is leading the party, it's 100% guaranteed that wild Pokémon will have the same ability, as opposed to 50% previously. +#define B_SYNCHRONIZE_TOXIC GEN_LATEST // In Gen5+, if a Pokémon with Synchronize is badly poisoned, the opponent will also become badly poisoned. Previously, the opponent would become regular poisoned. +#define B_UPDATED_INTIMIDATE GEN_LATEST // In Gen8, Intimidate doesn't work on opponents with the Inner Focus, Scrappy, Own Tempo or Oblivious abilities. It also activates Rattled. +#define B_OBLIVIOUS_TAUNT GEN_LATEST // In Gen6+, Pokémon with Oblivious can't be taunted. +#define B_STURDY GEN_LATEST // In Gen5+, Sturdy causes the Pokémon to have 1 HP remaining if another Pokémon's attack or confusion damage would have brought it from full health to 0 HP. +#define B_PLUS_MINUS_INTERACTION GEN_LATEST // In Gen5+, Plus and Minus can be activated with themselves and the opposite ability. Before, only the opposing ability could activate it. +#define B_WEATHER_FORMS GEN_LATEST // In Gen5+, Castform and Cherrim revert to their base form upon losing their respective ability. Cherrim needs Flower Gift to swap forms. // Item settings -#define B_HP_BERRIES GEN_7 // In Gen4+, berries which restore hp activate immediately after HP drops to half. In Gen3, the effect occurs at the end of the turn. -#define B_BERRIES_INSTANT GEN_7 // In Gen4+, most berries activate on battle start/switch-in if applicable. In Gen3, they only activate either at the move end or turn end. -#define B_CONFUSE_BERRIES_HEAL GEN_8 // Before Gen7, Figy and similar berries restore 1/8th of HP and trigger at half HP. In Gen7 they restore half HP, triggering at 25% HP. In Gen8 they heal 1/3rd of HP. - // Requires using Item Expansion or manually editing the holdEffectParam of Figy, Wiki, Mago, Aguav and Iapapa berries. -#define B_X_ITEMS_BUFF GEN_7 // In Gen7+, the X Items raise a stat by 2 stages instead of 1. -#define B_MENTAL_HERB GEN_5 // In Gen5+, the Mental Herb cures Infatuation, Taunt, Encore, Torment, Heal Block, and Disable -#define B_TRAINERS_KNOCK_OFF_ITEMS TRUE // If TRUE, trainers can steal/swap your items (non-berries are restored after battle). In vanilla games trainers cannot steal items. -#define B_SOUL_DEW_BOOST GEN_7 // In Gens3-6, Soul Dew boosts Lati@s' Sp. Atk and Sp. Def. In Gen7+ it boosts the power of their Psychic and Dragon type moves instead. -#define B_NET_BALL_MODIFIER GEN_7 // In Gen7+, Net Ball's catch multiplier is x5 instead of x3. -#define B_DIVE_BALL_MODIFIER GEN_7 // In Gen4+, Dive Ball's effectiveness increases by when Surfing or Fishing. -#define B_NEST_BALL_MODIFIER GEN_7 // Nest Ball's formula varies depending on the Gen. See Cmd_handleballthrow. -#define B_REPEAT_BALL_MODIFIER GEN_7 // In Gen7+, Repeat Ball's catch multiplier is x3.5 instead of x3. -#define B_TIMER_BALL_MODIFIER GEN_7 // In Gen5+, Timer Ball's effectiveness increases by x0.3 per turn instead of x0.1 -#define B_DUSK_BALL_MODIFIER GEN_7 // In Gen7+, Dusk Ball's catch multiplier is x3 instead of x3.5. -#define B_QUICK_BALL_MODIFIER GEN_7 // In Gen5+, Quick Ball's catch multiplier is x5 instead of x4. -#define B_LURE_BALL_MODIFIER GEN_7 // In Gen7+, Lure Ball's catch multiplier is x5 instead of x3. -#define B_HEAVY_BALL_MODIFIER GEN_7 // In Gen7+, Heavy Ball's ranges change. See Cmd_handleballthrow. -#define B_DREAM_BALL_MODIFIER GEN_8 // In Gen8, Dream Ball's catch multiplier is x4 when the target is asleep or has the ability Comatose. -#define B_SERENE_GRACE_BOOST GEN_7 // In Gen5+, Serene Grace boosts the added flinch chance of King's Rock and Razor Fang. +#define B_HP_BERRIES GEN_LATEST // In Gen4+, berries which restore hp activate immediately after HP drops to half. In Gen3, the effect occurs at the end of the turn. +#define B_BERRIES_INSTANT GEN_LATEST // In Gen4+, most berries activate on battle start/switch-in if applicable. In Gen3, they only activate either at the move end or turn end. +#define B_CONFUSE_BERRIES_HEAL GEN_LATEST // Before Gen7, Figy and similar berries restore 1/8th of HP and trigger at half HP. In Gen7 they restore half HP, triggering at 25% HP. In Gen8 they heal 1/3rd of HP. +#define B_X_ITEMS_BUFF GEN_LATEST // In Gen7+, the X Items raise a stat by 2 stages instead of 1. +#define B_MENTAL_HERB GEN_LATEST // In Gen5+, the Mental Herb cures Taunt, Encore, Torment, Heal Block, and Disable in addition to Infatuation from before. +#define B_TRAINERS_KNOCK_OFF_ITEMS TRUE // If TRUE, trainers can steal/swap your items (non-berries are restored after battle). In vanilla games trainers cannot steal items. +#define B_SOUL_DEW_BOOST GEN_LATEST // In Gens3-6, Soul Dew boosts Lati@s' Sp. Atk and Sp. Def. In Gen7+ it boosts the power of their Psychic and Dragon type moves instead. +#define B_NET_BALL_MODIFIER GEN_LATEST // In Gen7+, Net Ball's catch multiplier is x5 instead of x3. +#define B_DIVE_BALL_MODIFIER GEN_LATEST // In Gen4+, Dive Ball's effectiveness increases by when Surfing or Fishing. +#define B_NEST_BALL_MODIFIER GEN_LATEST // Nest Ball's formula varies depending on the Gen. See Cmd_handleballthrow. +#define B_REPEAT_BALL_MODIFIER GEN_LATEST // In Gen7+, Repeat Ball's catch multiplier is x3.5 instead of x3. +#define B_TIMER_BALL_MODIFIER GEN_LATEST // In Gen5+, Timer Ball's effectiveness increases by x0.3 per turn instead of x0.1 +#define B_DUSK_BALL_MODIFIER GEN_LATEST // In Gen7+, Dusk Ball's catch multiplier is x3 instead of x3.5. +#define B_QUICK_BALL_MODIFIER GEN_LATEST // In Gen5+, Quick Ball's catch multiplier is x5 instead of x4. +#define B_LURE_BALL_MODIFIER GEN_LATEST // In Gen7+, Lure Ball's catch multiplier is x5 instead of x3. +#define B_HEAVY_BALL_MODIFIER GEN_LATEST // In Gen7+, Heavy Ball's ranges change. See Cmd_handleballthrow. +#define B_DREAM_BALL_MODIFIER GEN_LATEST // In Gen8, Dream Ball's catch multiplier is x4 when the target is asleep or has the ability Comatose. +#define B_SPORT_BALL_MODIFIER GEN_LATEST // In Gen8, Sport Ball's catch multiplier was reduced from x1.5 to x1. +#define B_SERENE_GRACE_BOOST GEN_LATEST // In Gen5+, Serene Grace boosts the added flinch chance of King's Rock and Razor Fang. // Flag settings // To use the following features in scripting, replace the 0s with the flag ID you're assigning it to. @@ -138,6 +130,8 @@ #define B_FLAG_INVERSE_BATTLE 0 // If this flag is set, the battle's type effectiveness are inversed. For example, fire is super effective against water. #define B_FLAG_FORCE_DOUBLE_WILD 0 // If this flag is set, all land and surfing wild battles will be double battles. #define B_SMART_WILD_AI_FLAG 0 // If not 0, you can set this flag in a script to enable smart wild pokemon +#define B_FLAG_NO_BAG_USE 0 // If this flag is set, the ability to use the bag in battle is disabled. +#define B_FLAG_NO_CATCHING 0 // If this flag is set, the ability to catch wild Pokémon is disabled. // Var Settings // To use the following features in scripting, replace the 0s with the var ID you're assigning it to. @@ -146,13 +140,13 @@ #define B_VAR_WILD_AI_FLAGS 0 // If not 0, you can use this var to add to default wild AI flags. NOT usable with flags above (1 << 15) // Terrain settings -#define B_TERRAIN_BG_CHANGE TRUE // If set to TRUE, terrain moves permanently change the default battle background until the effect fades. -#define B_THUNDERSTORM_TERRAIN TRUE // If TRUE, overworld Thunderstorm generates Rain and Electric Terrain as in Gen 8. -#define B_TERRAIN_TYPE_BOOST GEN_8 // In Gen8, damage is boosted by 30% instead of 50%. -#define B_SECRET_POWER_EFFECT GEN_7 // Secret Power's effects change depending on terrain and generation. See GetSecretPowerMoveEffect. -#define B_SECRET_POWER_ANIMATION GEN_7 // Secret Power's animations change depending on terrain and generation. -#define B_NATURE_POWER_MOVES GEN_8 // Nature Power calls different moves depending on terrain and generation. See sNaturePowerMoves. -#define B_CAMOUFLAGE_TYPES GEN_7 // Camouflage changes the user to different types depending on terrain and generation. See sTerrainToType. +#define B_TERRAIN_BG_CHANGE TRUE // If set to TRUE, terrain moves permanently change the default battle background until the effect fades. +#define B_THUNDERSTORM_TERRAIN TRUE // If TRUE, overworld Thunderstorm generates Rain and Electric Terrain as in Gen 8. +#define B_TERRAIN_TYPE_BOOST GEN_LATEST // In Gen8, damage is boosted by 30% instead of 50%. +#define B_SECRET_POWER_EFFECT GEN_LATEST // Secret Power's effects change depending on terrain and generation. See GetSecretPowerMoveEffect. +#define B_SECRET_POWER_ANIMATION GEN_LATEST // Secret Power's animations change depending on terrain and generation. +#define B_NATURE_POWER_MOVES GEN_LATEST // Nature Power calls different moves depending on terrain and generation. See sNaturePowerMoves. +#define B_CAMOUFLAGE_TYPES GEN_LATEST // Camouflage changes the user to different types depending on terrain and generation. See sTerrainToType. // Interface settings #define B_ABILITY_POP_UP TRUE // In Gen5+, the Pokémon abilities are displayed in a pop-up, when they activate in battle. @@ -164,18 +158,18 @@ #define B_EXPANDED_MOVE_NAMES FALSE // If set to TRUE, move names are increased from 12 characters to 16 characters. // Catching settings -#define B_SEMI_INVULNERABLE_CATCH GEN_7 // In Gen4+, you cannot throw a ball against a Pokemon that is in a semi-invulnerable state (dig/fly/etc) -#define B_CATCHING_CHARM_BOOST 20 // % boost in Critical Capture odds if player has the Catching Charm. -#define B_CRITICAL_CAPTURE TRUE // If set to TRUE, Critical Capture will be enabled. -#define B_LAST_USED_BALL TRUE // If TRUE, the "last used ball" feature from Gen 7 will be implemented -#define B_LAST_USED_BALL_BUTTON R_BUTTON // If last used ball is implemented, this button (or button combo) will trigger throwing the last used ball. +#define B_SEMI_INVULNERABLE_CATCH GEN_LATEST // In Gen4+, you cannot throw a ball against a Pokemon that is in a semi-invulnerable state (dig/fly/etc) +#define B_CATCHING_CHARM_BOOST 20 // % boost in Critical Capture odds if player has the Catching Charm. +#define B_CRITICAL_CAPTURE TRUE // If set to TRUE, Critical Capture will be enabled. +#define B_LAST_USED_BALL TRUE // If TRUE, the "last used ball" feature from Gen 7 will be implemented +#define B_LAST_USED_BALL_BUTTON R_BUTTON // If last used ball is implemented, this button (or button combo) will trigger throwing the last used ball. // Other settings -#define B_DOUBLE_WILD_CHANCE 0 // % chance of encountering two Pokémon in a Wild Encounter. -#define B_MULTI_BATTLE_WHITEOUT GEN_8 // In Gen4+, multi battles end when the Player and also their Partner don't have any more Pokémon to fight. -#define B_EVOLUTION_AFTER_WHITEOUT GEN_6 // In Gen6+, Pokemon that qualify for evolution after battle will evolve even if the player loses. -#define B_WILD_NATURAL_ENEMIES TRUE // If set to TRUE, certain wild mon species will attack other species when partnered in double wild battles (eg. Zangoose vs Seviper) -#define B_AFFECTION_MECHANICS FALSE // In Gen6+, there's a stat called affection that can trigger different effects in battle. From LGPE onwards, those effects use friendship instead. +#define B_DOUBLE_WILD_CHANCE 0 // % chance of encountering two Pokémon in a Wild Encounter. +#define B_MULTI_BATTLE_WHITEOUT GEN_LATEST // In Gen4+, multi battles end when the Player and also their Partner don't have any more Pokémon to fight. +#define B_EVOLUTION_AFTER_WHITEOUT GEN_LATEST // In Gen6+, Pokemon that qualify for evolution after battle will evolve even if the player loses. +#define B_WILD_NATURAL_ENEMIES TRUE // If set to TRUE, certain wild mon species will attack other species when partnered in double wild battles (eg. Zangoose vs Seviper) +#define B_AFFECTION_MECHANICS FALSE // In Gen6+, there's a stat called affection that can trigger different effects in battle. From LGPE onwards, those effects use friendship instead. // Animation Settings #define B_NEW_SWORD_PARTICLE FALSE // If set to TRUE, it updates Swords Dance's particle. diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index 077cba1eb2..47b0dbe79f 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -311,8 +311,9 @@ #define MOVEEND_PICKPOCKET 27 #define MOVEEND_DANCER 28 #define MOVEEND_EMERGENCY_EXIT 29 -#define MOVEEND_CLEAR_BITS 30 -#define MOVEEND_COUNT 31 +#define MOVEEND_WEATHER_FORM 30 +#define MOVEEND_CLEAR_BITS 31 +#define MOVEEND_COUNT 32 // switch cases #define B_SWITCH_NORMAL 0 diff --git a/include/constants/flags.h b/include/constants/flags.h index 8fbc246300..4e108e1fe9 100644 --- a/include/constants/flags.h +++ b/include/constants/flags.h @@ -568,7 +568,7 @@ #define FLAG_HIDDEN_ITEM_LILYCOVE_CITY_HEART_SCALE (FLAG_HIDDEN_ITEMS_START + 0x1B) #define FLAG_HIDDEN_ITEM_FALLARBOR_TOWN_NUGGET (FLAG_HIDDEN_ITEMS_START + 0x1C) #define FLAG_HIDDEN_ITEM_MT_PYRE_EXTERIOR_ULTRA_BALL (FLAG_HIDDEN_ITEMS_START + 0x1D) -#define FLAG_HIDDEN_ITEM_ROUTE_113_TM_32 (FLAG_HIDDEN_ITEMS_START + 0x1E) +#define FLAG_HIDDEN_ITEM_ROUTE_113_TM32 (FLAG_HIDDEN_ITEMS_START + 0x1E) #define FLAG_HIDDEN_ITEM_ABANDONED_SHIP_RM_1_KEY (FLAG_HIDDEN_ITEMS_START + 0x1F) #define FLAG_HIDDEN_ITEM_ABANDONED_SHIP_RM_2_KEY (FLAG_HIDDEN_ITEMS_START + 0x20) #define FLAG_HIDDEN_ITEM_ABANDONED_SHIP_RM_4_KEY (FLAG_HIDDEN_ITEMS_START + 0x21) @@ -1053,7 +1053,7 @@ #define FLAG_ITEM_ROUTE_109_PP_UP 0x3ED #define FLAG_ITEM_ROUTE_109_RARE_CANDY 0x3EE #define FLAG_ITEM_ROUTE_110_DIRE_HIT 0x3EF -#define FLAG_ITEM_ROUTE_111_TM_37 0x3F0 +#define FLAG_ITEM_ROUTE_111_TM37 0x3F0 #define FLAG_ITEM_ROUTE_111_STARDUST 0x3F1 #define FLAG_ITEM_ROUTE_111_HP_UP 0x3F2 #define FLAG_ITEM_ROUTE_112_NUGGET 0x3F3 @@ -1062,7 +1062,7 @@ #define FLAG_ITEM_ROUTE_114_RARE_CANDY 0x3F6 #define FLAG_ITEM_ROUTE_114_PROTEIN 0x3F7 #define FLAG_ITEM_ROUTE_115_SUPER_POTION 0x3F8 -#define FLAG_ITEM_ROUTE_115_TM_01 0x3F9 +#define FLAG_ITEM_ROUTE_115_TM01 0x3F9 #define FLAG_ITEM_ROUTE_115_IRON 0x3FA #define FLAG_ITEM_ROUTE_116_ETHER 0x3FB #define FLAG_ITEM_ROUTE_116_REPEL 0x3FC @@ -1089,7 +1089,7 @@ #define FLAG_ITEM_RUSTBORO_CITY_X_DEFEND 0x411 #define FLAG_ITEM_LILYCOVE_CITY_MAX_REPEL 0x412 #define FLAG_ITEM_MOSSDEEP_CITY_NET_BALL 0x413 -#define FLAG_ITEM_METEOR_FALLS_1F_1R_TM_23 0x414 +#define FLAG_ITEM_METEOR_FALLS_1F_1R_TM23 0x414 #define FLAG_ITEM_METEOR_FALLS_1F_1R_FULL_HEAL 0x415 #define FLAG_ITEM_METEOR_FALLS_1F_1R_MOON_STONE 0x416 #define FLAG_ITEM_METEOR_FALLS_1F_1R_PP_UP 0x417 @@ -1119,35 +1119,35 @@ #define FLAG_ITEM_AQUA_HIDEOUT_B1F_MAX_ELIXIR 0x42F #define FLAG_ITEM_AQUA_HIDEOUT_B2F_NEST_BALL 0x430 #define FLAG_ITEM_MT_PYRE_EXTERIOR_MAX_POTION 0x431 -#define FLAG_ITEM_MT_PYRE_EXTERIOR_TM_48 0x432 +#define FLAG_ITEM_MT_PYRE_EXTERIOR_TM48 0x432 #define FLAG_ITEM_NEW_MAUVILLE_ULTRA_BALL 0x433 #define FLAG_ITEM_NEW_MAUVILLE_ESCAPE_ROPE 0x434 #define FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_6_LUXURY_BALL 0x435 #define FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_4_SCANNER 0x436 -#define FLAG_ITEM_SCORCHED_SLAB_TM_11 0x437 -#define FLAG_ITEM_METEOR_FALLS_B1F_2R_TM_02 0x438 +#define FLAG_ITEM_SCORCHED_SLAB_TM11 0x437 +#define FLAG_ITEM_METEOR_FALLS_B1F_2R_TM02 0x438 #define FLAG_ITEM_SHOAL_CAVE_ENTRANCE_BIG_PEARL 0x439 #define FLAG_ITEM_SHOAL_CAVE_INNER_ROOM_RARE_CANDY 0x43A #define FLAG_ITEM_SHOAL_CAVE_STAIRS_ROOM_ICE_HEAL 0x43B #define FLAG_ITEM_VICTORY_ROAD_1F_MAX_ELIXIR 0x43C #define FLAG_ITEM_VICTORY_ROAD_1F_PP_UP 0x43D -#define FLAG_ITEM_VICTORY_ROAD_B1F_TM_29 0x43E +#define FLAG_ITEM_VICTORY_ROAD_B1F_TM29 0x43E #define FLAG_ITEM_VICTORY_ROAD_B1F_FULL_RESTORE 0x43F #define FLAG_ITEM_VICTORY_ROAD_B2F_FULL_HEAL 0x440 -#define FLAG_ITEM_MT_PYRE_6F_TM_30 0x441 -#define FLAG_ITEM_SEAFLOOR_CAVERN_ROOM_9_TM_26 0x442 +#define FLAG_ITEM_MT_PYRE_6F_TM30 0x441 +#define FLAG_ITEM_SEAFLOOR_CAVERN_ROOM_9_TM26 0x442 #define FLAG_ITEM_FIERY_PATH_TM06 0x443 #define FLAG_ITEM_ROUTE_124_RED_SHARD 0x444 #define FLAG_ITEM_ROUTE_124_BLUE_SHARD 0x445 -#define FLAG_ITEM_SAFARI_ZONE_NORTH_WEST_TM_22 0x446 +#define FLAG_ITEM_SAFARI_ZONE_NORTH_WEST_TM22 0x446 #define FLAG_ITEM_ABANDONED_SHIP_ROOMS_1F_HARBOR_MAIL 0x447 #define FLAG_ITEM_ABANDONED_SHIP_ROOMS_B1F_ESCAPE_ROPE 0x448 #define FLAG_ITEM_ABANDONED_SHIP_ROOMS_2_B1F_DIVE_BALL 0x449 -#define FLAG_ITEM_ABANDONED_SHIP_ROOMS_B1F_TM_13 0x44A +#define FLAG_ITEM_ABANDONED_SHIP_ROOMS_B1F_TM13 0x44A #define FLAG_ITEM_ABANDONED_SHIP_ROOMS_2_1F_REVIVE 0x44B #define FLAG_ITEM_ABANDONED_SHIP_CAPTAINS_OFFICE_STORAGE_KEY 0x44C #define FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_3_WATER_STONE 0x44D -#define FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_1_TM_18 0x44E +#define FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_1_TM18 0x44E #define FLAG_ITEM_ROUTE_121_CARBOS 0x44F #define FLAG_ITEM_ROUTE_123_ULTRA_BALL 0x450 #define FLAG_ITEM_ROUTE_126_GREEN_SHARD 0x451 @@ -1157,7 +1157,7 @@ #define FLAG_ITEM_ROUTE_123_ELIXIR 0x455 #define FLAG_ITEM_NEW_MAUVILLE_THUNDER_STONE 0x456 #define FLAG_ITEM_FIERY_PATH_FIRE_STONE 0x457 -#define FLAG_ITEM_SHOAL_CAVE_ICE_ROOM_TM_07 0x458 +#define FLAG_ITEM_SHOAL_CAVE_ICE_ROOM_TM07 0x458 #define FLAG_ITEM_SHOAL_CAVE_ICE_ROOM_NEVER_MELT_ICE 0x459 #define FLAG_ITEM_ROUTE_103_GUARD_SPEC 0x45A #define FLAG_ITEM_ROUTE_104_X_ACCURACY 0x45B diff --git a/include/constants/global.h b/include/constants/global.h index 2a773dbb95..07ed190208 100644 --- a/include/constants/global.h +++ b/include/constants/global.h @@ -2,6 +2,7 @@ #define GUARD_CONSTANTS_GLOBAL_H #include "constants/battle_config.h" +#include "constants/overworld_config.h" // Invalid Versions show as "----------" in Gen 4 and Gen 5's summary screen. // In Gens 6 and 7, invalid versions instead show "a distant land" in the summary screen. diff --git a/include/constants/item_config.h b/include/constants/item_config.h index 70b4440c84..9261241a5f 100644 --- a/include/constants/item_config.h +++ b/include/constants/item_config.h @@ -1,21 +1,12 @@ #ifndef GUARD_CONSTANTS_ITEM_CONFIG_H #define GUARD_CONSTANTS_ITEM_CONFIG_H -#ifndef GEN_3 -#define GEN_3 0 -#define GEN_4 1 -#define GEN_5 2 -#define GEN_6 3 -#define GEN_7 4 -#define GEN_8 5 -#endif - // Item config -#define I_SHINY_CHARM_REROLLS 3 // Amount of re-rolls if the player has the Shiny Charm. Set to 0 to disable Shiny Charm's effects. -#define I_KEY_FOSSILS GEN_7 // In Gen4+, all Gen 3 fossils became regular items. -#define I_KEY_ESCAPE_ROPE GEN_7 // In Gen8, Escape Rope became a Key Item. Keep in mind, this will make it free to buy in marts. -#define I_HEALTH_RECOVERY GEN_7 // In Gen7+, certain healing items recover a different amount of HP than they used to. -#define I_SITRUS_BERRY_HEAL GEN_7 // In Gen4+, Sitrus Berry was changed from healing 30 HP to healing 25% of Max HP. -#define I_VITAMIN_EV_CAP GEN_8 // In Gen8, the Vitamins no longer have a cap of 100 EV per stat. +#define I_SHINY_CHARM_REROLLS 3 // Amount of re-rolls if the player has the Shiny Charm. Set to 0 to disable Shiny Charm's effects. +#define I_KEY_FOSSILS GEN_LATEST // In Gen4+, all Gen 3 fossils became regular items. +#define I_KEY_ESCAPE_ROPE GEN_LATEST // In Gen8, Escape Rope became a Key Item. Keep in mind, this will make it free to buy in marts. +#define I_HEALTH_RECOVERY GEN_LATEST // In Gen7+, certain healing items recover a different amount of HP than they used to. +#define I_SITRUS_BERRY_HEAL GEN_LATEST // In Gen4+, Sitrus Berry was changed from healing 30 HP to healing 25% of Max HP. +#define I_VITAMIN_EV_CAP GEN_LATEST // In Gen8, the Vitamins no longer have a cap of 100 EV per stat. #endif // GUARD_CONSTANTS_ITEM_CONFIG_H diff --git a/include/constants/moves.h b/include/constants/moves.h index 822853e93b..75691de76a 100644 --- a/include/constants/moves.h +++ b/include/constants/moves.h @@ -781,8 +781,33 @@ #define MOVE_GLACIAL_LANCE 752 #define MOVE_ASTRAL_BARRAGE 753 #define MOVE_EERIE_SPELL 754 +// Legends: Arceus Moves +#define MOVE_DIRE_CLAW 755 +#define MOVE_PSYSHIELD_BASH 756 +#define MOVE_POWER_SHIFT 757 +#define MOVE_STONE_AXE 758 +#define MOVE_SPRINGTIDE_STORM 759 +#define MOVE_MYSTICAL_POWER 760 +#define MOVE_RAGING_FURY 761 +#define MOVE_WAVE_CRASH 762 +#define MOVE_CHLOROBLAST 763 +#define MOVE_MOUNTAIN_GALE 764 +#define MOVE_VICTORY_DANCE 765 +#define MOVE_HEADLONG_RUSH 766 +#define MOVE_BARB_BARRAGE 767 +#define MOVE_ESPER_WING 768 +#define MOVE_BITTER_MALICE 769 +#define MOVE_SHELTER 770 +#define MOVE_TRIPLE_ARROWS 771 +#define MOVE_INFERNAL_PARADE 772 +#define MOVE_CEASELESS_EDGE 773 +#define MOVE_BLEAKWIND_STORM 774 +#define MOVE_WILDBOLT_STORM 775 +#define MOVE_SANDSEAR_STORM 776 +#define MOVE_LUNAR_BLESSING 777 +#define MOVE_TAKE_HEART 778 -#define MOVES_COUNT_GEN8 755 +#define MOVES_COUNT_GEN8 779 #define MOVES_COUNT MOVES_COUNT_GEN8 diff --git a/include/constants/overworld_config.h b/include/constants/overworld_config.h new file mode 100644 index 0000000000..50f45933df --- /dev/null +++ b/include/constants/overworld_config.h @@ -0,0 +1,18 @@ +#ifndef GUARD_CONSTANTS_OVERWORLD_CONFIG_H +#define GUARD_CONSTANTS_OVERWORLD_CONFIG_H + +// Overworld flags +#define OW_FLAG_NO_ENCOUNTER 0 // If this flag is set, wild encounters will be disabled. +#define OW_FLAG_NO_TRAINER_SEE 0 // If this flag is set, trainers will not battle the player unless they're talked to. + +// Debug options +#define DEBUG_SYSTEM_ENABLE TRUE // Enables a overworld debug menu for changing flags, variables, giving pokemon and more, accessed by holding R and pressing START while in the overworld by default. +#define DEBUG_SYSTEM_HELD_KEYS (R_BUTTON) // The keys required to be held to open the debug menu. +#define DEBUG_SYSTEM_TRIGGER_EVENT pressedStartButton // The event that opens the menu when holding the key(s) defined in DEBUG_SYSTEM_HELD_KEYS. +#define DEBUG_SYSTEM_IN_MENU FALSE // Replaces the overworld debug menu button combination with a start menu entry (above Pokédex). + +// Replace the used flags with others or disable with a 0 +#define DEBUG_FLAG_NO_COLLISION 0 // If this flag is set, the debug function in the Utility submenu to disable player collision can be used. +#define DEBUG_FLAG_PC_FROM_DEBUG_MENU 0 // If this flag is set, the debug function in debug menu to access the player PC works. + +#endif // GUARD_CONSTANTS_OVERWORLD_CONFIG_H diff --git a/include/constants/pokemon_config.h b/include/constants/pokemon_config.h index 4826a7c46d..dd10ee2363 100644 --- a/include/constants/pokemon_config.h +++ b/include/constants/pokemon_config.h @@ -1,34 +1,25 @@ #ifndef GUARD_CONSTANTS_POKEMON_CONFIG_H #define GUARD_CONSTANTS_POKEMON_CONFIG_H -#ifndef GEN_3 -#define GEN_3 0 -#define GEN_4 1 -#define GEN_5 2 -#define GEN_6 3 -#define GEN_7 4 -#define GEN_8 5 -#endif - -#define P_UPDATED_TYPES GEN_8 // Since Gen 6, several Pokémon were changed to be partially or fully Fairy type. -#define P_UPDATED_STATS GEN_8 // Since Gen 6, Pokémon stats are updated with each passing generation. -#define P_UPDATED_ABILITIES GEN_8 // Since Gen 6, certain Pokémon have their abilities changed. -#define P_UPDATED_EGG_GROUPS GEN_8 // Since Gen 8, certain Pokémon have gained new egg groups. -#define P_SHEDINJA_BALL GEN_8 // Since Gen 4, Shedinja requires a Poké Ball for its evolution. In Gen 3, Shedinja inherits Nincada's Ball. -#define P_LEGENDARY_PERFECT_IVS GEN_8 // Since Gen 6, Legendaries, Mythicals and Ultra Beasts found in the wild or given through gifts have at least 3 perfect IVs. -#define P_KADABRA_EVERSTONE GEN_8 // Since Gen 4, Kadabra can evolve even when holding an Everstone. -#define P_NIDORAN_M_DITTO_BREED GEN_8 // Since Gen 5, when Nidoran♂ breeds with Ditto it can produce Nidoran♀ offspring. Before, it would only yield male offspring. This change also applies to Volbeat. +#define P_UPDATED_TYPES GEN_LATEST // Since Gen 6, several Pokémon were changed to be partially or fully Fairy type. +#define P_UPDATED_STATS GEN_LATEST // Since Gen 6, Pokémon stats are updated with each passing generation. +#define P_UPDATED_ABILITIES GEN_LATEST // Since Gen 6, certain Pokémon have their abilities changed. +#define P_UPDATED_EGG_GROUPS GEN_LATEST // Since Gen 8, certain Pokémon have gained new egg groups. +#define P_SHEDINJA_BALL GEN_LATEST // Since Gen 4, Shedinja requires a Poké Ball for its evolution. In Gen 3, Shedinja inherits Nincada's Ball. +#define P_LEGENDARY_PERFECT_IVS GEN_LATEST // Since Gen 6, Legendaries, Mythicals and Ultra Beasts found in the wild or given through gifts have at least 3 perfect IVs. +#define P_KADABRA_EVERSTONE GEN_LATEST // Since Gen 4, Kadabra can evolve even when holding an Everstone. +#define P_NIDORAN_M_DITTO_BREED GEN_LATEST // Since Gen 5, when Nidoran♂ breeds with Ditto it can produce Nidoran♀ offspring. Before, it would only yield male offspring. This change also applies to Volbeat. // Modifying the latest generation WILL change the saveblock due to Dex flags and will require a new save file. // Forms are kept based on the base species, Eg: Meowth and Persian will keep all of their forms, but Perrserker will not be available if P_GEN_8_POKEMON is set to FALSE. // If you're disabling a generation previous to others (eg: Gen 5 but not Gen 6, 7 and 8), // remember to update NATIONAL_DEX enum in include/constants/pokedex.h to avoid players from softlocking in the non-existant entries. -#define P_GEN_4_POKEMON TRUE // Generation 4 Pokémon (DPPt, HGSS) -#define P_GEN_5_POKEMON TRUE // Generation 5 Pokémon (BW, B2W2) -#define P_GEN_6_POKEMON TRUE // Generation 6 Pokémon (XY, ORAS) -#define P_GEN_7_POKEMON TRUE // Generation 7 Pokémon (SM, USUM) -#define P_GEN_8_POKEMON TRUE // Generation 8 Pokémon (SwSh, BDSP, LA) +#define P_GEN_4_POKEMON TRUE // Generation 4 Pokémon (DPPt, HGSS) +#define P_GEN_5_POKEMON TRUE // Generation 5 Pokémon (BW, B2W2) +#define P_GEN_6_POKEMON TRUE // Generation 6 Pokémon (XY, ORAS) +#define P_GEN_7_POKEMON TRUE // Generation 7 Pokémon (SM, USUM, LGPE) +#define P_GEN_8_POKEMON TRUE // Generation 8 Pokémon (SwSh, BDSP, LA) -#define P_ENABLE_DEBUG TRUE // Enables a debug menu for pokemon sprites and icons, accessed by pressing SELECT in the summary screen. +#define P_ENABLE_DEBUG TRUE // Enables a debug menu for pokemon sprites and icons, accessed by pressing SELECT in the summary screen. #endif // GUARD_CONSTANTS_POKEMON_CONFIG_H diff --git a/include/constants/songs.h b/include/constants/songs.h index d6a4184959..a7b6381fc8 100644 --- a/include/constants/songs.h +++ b/include/constants/songs.h @@ -276,8 +276,10 @@ #define SE_PIKE_CURTAIN_CLOSE 267 // SE_CURTAIN #define SE_PIKE_CURTAIN_OPEN 268 // SE_CURTAIN1 #define SE_SUDOWOODO_SHAKE 269 // SE_USSOKI +#define END_SE SE_SUDOWOODO_SHAKE // Music +#define START_MUS 350 #define MUS_LITTLEROOT_TEST 350 // MUS_TETSUJI #define MUS_GSC_ROUTE38 351 // MUS_FIELD13 #define MUS_CAUGHT 352 // MUS_KACHI22 @@ -488,6 +490,7 @@ #define MUS_RG_TRAINER_TOWER 556 // MUS_RG_T_TOWER #define MUS_RG_SLOW_PALLET 557 // MUS_RG_SLOWMASARA #define MUS_RG_TEACHY_TV_MENU 558 // MUS_RG_TVNOIZE +#define END_MUS MUS_RG_TEACHY_TV_MENU #define PH_TRAP_BLEND 559 #define PH_TRAP_HELD 560 diff --git a/include/debug.h b/include/debug.h new file mode 100644 index 0000000000..f56efbde34 --- /dev/null +++ b/include/debug.h @@ -0,0 +1,8 @@ +#ifndef GUARD_DEBUG_H +#define GUARD_DEBUG_H + +#include "constants/overworld_config.h" + +void Debug_ShowMainMenu(void); + +#endif // GUARD_DEBUG_H diff --git a/include/event_data.h b/include/event_data.h index b1fa694601..51875ec5a4 100644 --- a/include/event_data.h +++ b/include/event_data.h @@ -20,10 +20,12 @@ void EnableResetRTC(void); bool32 CanResetRTC(void); u16 *GetVarPointer(u16 id); u16 VarGet(u16 id); +u16 VarGetIfExist(u16 id); bool8 VarSet(u16 id, u16 value); u8 VarGetObjectEventGraphicsId(u8 id); u8 *GetFlagPointer(u16 id); u8 FlagSet(u16 id); +u8 FlagToggle(u16 id); u8 FlagClear(u16 id); bool8 FlagGet(u16 id); diff --git a/include/graphics.h b/include/graphics.h index a55832da7e..609d9d2ae4 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -9170,8 +9170,8 @@ extern const u16 gTilesetAnims_BattleDomePals0_1[]; extern const u16 gTilesetAnims_BattleDomePals0_2[]; extern const u16 gTilesetAnims_BattleDomePals0_3[]; -extern const u32 gBattleArenaJudgementSymbolsGfx[]; -extern const u32 gBattleArenaJudgementSymbolsPalette[]; +extern const u32 gBattleArenaJudgmentSymbolsGfx[]; +extern const u32 gBattleArenaJudgmentSymbolsPalette[]; extern const u32 gBattleWindowTextPalette[]; diff --git a/include/item_use.h b/include/item_use.h index 036a541012..d55f7cf0d7 100644 --- a/include/item_use.h +++ b/include/item_use.h @@ -43,6 +43,7 @@ enum { BALL_THROW_UNABLE_NO_ROOM, BALL_THROW_UNABLE_SEMI_INVULNERABLE, BALL_THROW_ABLE, + BALL_THROW_UNABLE_DISABLED_FLAG, }; bool32 CanThrowBall(void); diff --git a/include/main_menu.h b/include/main_menu.h index 5f92719d5e..81e2d9794b 100644 --- a/include/main_menu.h +++ b/include/main_menu.h @@ -3,5 +3,6 @@ void CB2_InitMainMenu(void); void CreateYesNoMenuParameterized(u8 x, u8 y, u16 baseTileNum, u16 baseBlock, u8 yesNoPalNum, u8 winPalNum); +void NewGameBirchSpeech_SetDefaultPlayerName(u8); #endif // GUARD_MAIN_MENU_H diff --git a/include/pokemon.h b/include/pokemon.h index 94fdff91d2..ed8d868bee 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -142,7 +142,7 @@ struct PokemonSubstruct3 /* 0x02 */ u16 metLevel:7; /* 0x02 */ u16 metGame:4; - /* 0x03 */ u16 unused3_3:4; + /* 0x03 */ u16 unused1:4; /* 0x03 */ u16 otGender:1; /* 0x04 */ u32 hpIV:5; @@ -152,6 +152,7 @@ struct PokemonSubstruct3 /* 0x05 */ u32 spAttackIV:5; /* 0x06 */ u32 spDefenseIV:5; /* 0x07 */ u32 isEgg:1; + /* 0x07 */ u32 unused2:1; /* 0x08 */ u32 coolRibbon:3; /* 0x08 */ u32 beautyRibbon:3; @@ -463,6 +464,7 @@ void SetMonData(struct Pokemon *mon, s32 field, const void *dataArg); void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *dataArg); void CopyMon(void *dest, void *src, size_t size); u8 GiveMonToPlayer(struct Pokemon *mon); +u8 SendMonToPC(struct Pokemon* mon); u8 CalculatePlayerPartyCount(void); u8 CalculateEnemyPartyCount(void); u8 GetMonsStateToDoubles(void); diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h index eb25c0ff27..eb5f9a992d 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -72,4 +72,6 @@ u8 *GetWaldaPhrasePtr(void); void SetWaldaPhrase(const u8 *src); bool32 IsWaldaPhraseEmpty(void); +void EnterPokeStorage(u8 boxOption); + #endif // GUARD_POKEMON_STORAGE_SYSTEM_H diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index f496b90e81..312ff853ca 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -142,8 +142,10 @@ static u32 GetWildAiFlags(void) if (avgLevel >= 80) flags |= AI_FLAG_HP_AWARE; - if (B_VAR_WILD_AI_FLAGS != 0 && VarGet(B_VAR_WILD_AI_FLAGS) != 0) +#if B_VAR_WILD_AI_FLAGS != 0 + if (VarGet(B_VAR_WILD_AI_FLAGS) != 0) flags |= VarGet(B_VAR_WILD_AI_FLAGS); +#endif return flags; } @@ -486,7 +488,7 @@ static u8 ChooseMoveOrAction_Doubles(void) bestMovePointsForTarget[i] = mostViableMovesScores[0]; // Don't use a move against ally if it has less than 100 points. - if (i == (sBattler_AI ^ BIT_FLANK) && bestMovePointsForTarget[i] < 100) + if (i == BATTLE_PARTNER(sBattler_AI) && bestMovePointsForTarget[i] < 100) { bestMovePointsForTarget[i] = -1; mostViableMovesScores[0] = mostViableMovesScores[0]; // Needed to match. @@ -1273,10 +1275,10 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score -= 10; break; case EFFECT_OHKO: - if (B_SHEER_COLD_IMMUNITY >= GEN_7 - && move == MOVE_SHEER_COLD - && IS_BATTLER_OF_TYPE(battlerDef, TYPE_ICE)) + #if B_SHEER_COLD_IMMUNITY >= GEN_7 + if (move == MOVE_SHEER_COLD && IS_BATTLER_OF_TYPE(battlerDef, TYPE_ICE)) return 0; + #endif if (!ShouldTryOHKO(battlerAtk, battlerDef, AI_DATA->abilities[battlerAtk], AI_DATA->abilities[battlerDef], move)) score -= 10; break; @@ -1304,8 +1306,10 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score -= 8; else if (AI_DATA->hpPercents[battlerAtk] <= 25) score -= 10; - else if (B_SOUND_SUBSTITUTE >= GEN_6 && TestMoveFlagsInMoveset(battlerDef, FLAG_SOUND)) + #if B_SOUND_SUBSTITUTE >= GEN_6 + else if (TestMoveFlagsInMoveset(battlerDef, FLAG_SOUND)) score -= 8; + #endif break; case EFFECT_LEECH_SEED: if (gStatuses3[battlerDef] & STATUS3_LEECHSEED @@ -1317,8 +1321,10 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case EFFECT_DISABLE: if (gDisableStructs[battlerDef].disableTimer == 0 - && (B_MENTAL_HERB >= GEN_5 && AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB) - && !PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) + #if B_MENTAL_HERB >= GEN_5 + && AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB + #endif + && !PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) { if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER) // Attacker should go first { @@ -1337,8 +1343,10 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case EFFECT_ENCORE: if (gDisableStructs[battlerDef].encoreTimer == 0 - && (B_MENTAL_HERB >= GEN_5 && AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB) - && !DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove)) + #if B_MENTAL_HERB >= GEN_5 + && AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB + #endif + && !DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove)) { if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER) // Attacker should go first { @@ -1570,9 +1578,10 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score -= 10; break; } - - if (B_MENTAL_HERB >= GEN_5 && AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_MENTAL_HERB) + #if B_MENTAL_HERB >= GEN_5 + if (AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_MENTAL_HERB) score -= 6; + #endif break; case EFFECT_WILL_O_WISP: if (!AI_CanBurn(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef], BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) @@ -2976,6 +2985,8 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) u16 predictedMove = AI_DATA->predictedMoves[battlerDef]; bool32 isDoubleBattle = IsValidDoubleBattle(battlerAtk); u32 i; + // We only check for moves that have a 20% chance or more for their secondary effect to happen because moves with a smaller chance are rather worthless. We don't want the AI to use those. + bool32 sereneGraceBoost = (AI_DATA->abilities[battlerAtk] == ABILITY_SERENE_GRACE && (gBattleMoves[move].secondaryEffectChance >= 20 && gBattleMoves[move].secondaryEffectChance < 100)); // Targeting partner, check benefits of doing that instead if (IsTargetingPartner(battlerAtk, battlerDef)) @@ -3434,7 +3445,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score += 2; break; case EFFECT_CONFUSE_HIT: - if (AI_DATA->abilities[battlerAtk] == ABILITY_SERENE_GRACE) + if (sereneGraceBoost) score++; //fallthrough case EFFECT_CONFUSE: @@ -3453,7 +3464,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_SPECIAL_DEFENSE_DOWN_HIT: case EFFECT_ACCURACY_DOWN_HIT: case EFFECT_EVASION_DOWN_HIT: - if (AI_DATA->abilities[battlerAtk] == ABILITY_SERENE_GRACE && AI_DATA->abilities[battlerDef] != ABILITY_CONTRARY) + if (sereneGraceBoost && AI_DATA->abilities[battlerDef] != ABILITY_CONTRARY) score += 2; break; case EFFECT_SPEED_DOWN_HIT: @@ -3461,12 +3472,10 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score -= 2; else if (!AI_RandLessThan(70)) score++; - if (AI_DATA->abilities[battlerAtk] == ABILITY_SERENE_GRACE && AI_DATA->abilities[battlerDef] != ABILITY_CONTRARY) - score++; if (ShouldLowerSpeed(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef])) { - if (AI_DATA->abilities[battlerAtk] == ABILITY_SERENE_GRACE && AI_DATA->abilities[battlerDef] != ABILITY_CONTRARY) - score += 4; + if (sereneGraceBoost && AI_DATA->abilities[battlerDef] != ABILITY_CONTRARY) + score += 5; else score += 2; } @@ -3545,7 +3554,10 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case EFFECT_DISABLE: if (gDisableStructs[battlerDef].disableTimer == 0 - && (B_MENTAL_HERB >= GEN_5 && AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB)) // mental herb + #if B_MENTAL_HERB >= GEN_5 + && AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB // mental herb + #endif + ) { if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER) // AI goes first { @@ -3567,7 +3579,10 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case EFFECT_ENCORE: if (gDisableStructs[battlerDef].encoreTimer == 0 - && (B_MENTAL_HERB >= GEN_5 && AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB)) // mental herb + #if B_MENTAL_HERB >= GEN_5 + && AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB // mental herb + #endif + ) { if (IsEncoreEncouragedEffect(gBattleMoves[gLastMoves[battlerDef]].effect)) score += 3; @@ -3597,7 +3612,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score++; break; case EFFECT_SPEED_UP_HIT: - if (AI_DATA->abilities[battlerAtk] == ABILITY_SERENE_GRACE && AI_DATA->abilities[battlerDef] != ABILITY_CONTRARY && !WillAIStrikeFirst()) + if (sereneGraceBoost && AI_DATA->abilities[battlerDef] != ABILITY_CONTRARY && !WillAIStrikeFirst()) score += 3; break; case EFFECT_DESTINY_BOND: @@ -3616,7 +3631,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) { bool32 canSteal = FALSE; - #if defined B_TRAINERS_KNOCK_OFF_ITEMS && B_TRAINERS_KNOCK_OFF_ITEMS == TRUE + #if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE canSteal = TRUE; #endif if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER || GetBattlerSide(battlerAtk) == B_SIDE_PLAYER) @@ -3841,7 +3856,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } break; case EFFECT_ATTACK_UP_HIT: - if (AI_DATA->abilities[battlerAtk] == ABILITY_SERENE_GRACE) + if (sereneGraceBoost) IncreaseStatUpScore(battlerAtk, battlerDef, STAT_ATK, &score); break; case EFFECT_FELL_STINGER: diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index e29970cdf1..f2a2efe557 100644 --- a/src/battle_ai_switch_items.c +++ b/src/battle_ai_switch_items.c @@ -446,10 +446,10 @@ bool32 ShouldSwitch(void) if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { battlerIn1 = gActiveBattler; - if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_FLANK)]) + if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler)))]) battlerIn2 = gActiveBattler; else - battlerIn2 = GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_FLANK); + battlerIn2 = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler))); } else { @@ -537,7 +537,7 @@ void AI_TrySwitchOrUseItem(void) else { battlerIn1 = GetBattlerAtPosition(battlerIdentity); - battlerIn2 = GetBattlerAtPosition(battlerIdentity ^ BIT_FLANK); + battlerIn2 = GetBattlerAtPosition(BATTLE_PARTNER(battlerIdentity)); } GetAIPartyIndexes(gActiveBattler, &firstId, &lastId); @@ -571,7 +571,7 @@ void AI_TrySwitchOrUseItem(void) } } - BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_USE_MOVE, (gActiveBattler ^ BIT_SIDE) << 8); + BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_USE_MOVE, BATTLE_OPPOSITE(gActiveBattler) << 8); } // If there are two(or more) mons to choose from, always choose one that has baton pass @@ -719,10 +719,10 @@ u8 GetMostSuitableMonToSwitchInto(void) if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { battlerIn1 = gActiveBattler; - if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_FLANK)]) + if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler)))]) battlerIn2 = gActiveBattler; else - battlerIn2 = GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_FLANK); + battlerIn2 = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler))); opposingBattler = BATTLE_OPPOSITE(battlerIn1); if (gAbsentBattlerFlags & gBitTable[opposingBattler]) @@ -730,7 +730,7 @@ u8 GetMostSuitableMonToSwitchInto(void) } else { - opposingBattler = GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_SIDE); + opposingBattler = GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerPosition(gActiveBattler))); battlerIn1 = gActiveBattler; battlerIn2 = gActiveBattler; } diff --git a/src/battle_ai_util.c b/src/battle_ai_util.c index 25c7f3b9d5..75964664e3 100644 --- a/src/battle_ai_util.c +++ b/src/battle_ai_util.c @@ -600,21 +600,25 @@ bool32 AtMaxHp(u8 battlerId) bool32 IsBattlerTrapped(u8 battler, bool8 checkSwitch) { u8 holdEffect = AI_DATA->holdEffects[battler]; - if ((B_GHOSTS_ESCAPE >= GEN_6 && IS_BATTLER_OF_TYPE(battler, TYPE_GHOST)) - || (checkSwitch && holdEffect == HOLD_EFFECT_SHED_SHELL) - || (!checkSwitch && GetBattlerAbility(battler) == ABILITY_RUN_AWAY) - || (!checkSwitch && holdEffect == HOLD_EFFECT_CAN_ALWAYS_RUN)) - { + +#if B_GHOSTS_ESCAPE >= GEN_6 + if (IS_BATTLER_OF_TYPE(battler, TYPE_GHOST)) return FALSE; - } - else - { - if (gBattleMons[battler].status2 & (STATUS2_ESCAPE_PREVENTION | STATUS2_WRAPPED) - || IsAbilityPreventingEscape(battler) - || gStatuses3[battler] & (STATUS3_ROOTED | STATUS3_SKY_DROPPED) - || (gFieldStatuses & STATUS_FIELD_FAIRY_LOCK)) - return TRUE; - } +#endif + if (checkSwitch && holdEffect == HOLD_EFFECT_SHED_SHELL) + return FALSE; + else if (!checkSwitch && GetBattlerAbility(battler) == ABILITY_RUN_AWAY) + return FALSE; + else if (!checkSwitch && holdEffect == HOLD_EFFECT_CAN_ALWAYS_RUN) + return FALSE; + else if (gBattleMons[battler].status2 & (STATUS2_ESCAPE_PREVENTION | STATUS2_WRAPPED)) + return TRUE; + else if (gStatuses3[battler] & (STATUS3_ROOTED | STATUS3_SKY_DROPPED)) + return TRUE; + else if (gFieldStatuses & STATUS_FIELD_FAIRY_LOCK) + return TRUE; + else if (IsAbilityPreventingEscape(battler)) + return TRUE; return FALSE; } @@ -647,9 +651,11 @@ bool32 IsTruantMonVulnerable(u32 battlerAI, u32 opposingBattler) // move checks bool32 IsAffectedByPowder(u8 battler, u16 ability, u16 holdEffect) { - if ((B_POWDER_GRASS >= GEN_6 && IS_BATTLER_OF_TYPE(battler, TYPE_GRASS)) - || ability == ABILITY_OVERCOAT - || holdEffect == HOLD_EFFECT_SAFETY_GOGGLES) + if (ability == ABILITY_OVERCOAT + #if B_POWDER_GRASS >= GEN_6 + || IS_BATTLER_OF_TYPE(battler, TYPE_GRASS) + #endif + || holdEffect == HOLD_EFFECT_SAFETY_GOGGLES) return FALSE; return TRUE; } @@ -1415,8 +1421,10 @@ bool32 IsMoveEncouragedToHit(u8 battlerAtk, u8 battlerDef, u16 move) if (AI_DATA->abilities[battlerDef] == ABILITY_NO_GUARD || AI_DATA->abilities[battlerAtk] == ABILITY_NO_GUARD) return TRUE; - if (B_TOXIC_NEVER_MISS >= GEN_6 && gBattleMoves[move].effect == EFFECT_TOXIC && IS_BATTLER_OF_TYPE(battlerAtk, TYPE_POISON)) +#if B_TOXIC_NEVER_MISS >= GEN_6 + if (gBattleMoves[move].effect == EFFECT_TOXIC && IS_BATTLER_OF_TYPE(battlerAtk, TYPE_POISON)) return TRUE; +#endif // discouraged from hitting if (AI_WeatherHasEffect() && (gBattleWeather & B_WEATHER_SUN) @@ -1426,10 +1434,12 @@ bool32 IsMoveEncouragedToHit(u8 battlerAtk, u8 battlerDef, u16 move) // increased accuracy but don't always hit if ((AI_WeatherHasEffect() && (((gBattleWeather & B_WEATHER_RAIN) && (gBattleMoves[move].effect == EFFECT_THUNDER || gBattleMoves[move].effect == EFFECT_HURRICANE)) - || (((gBattleWeather & B_WEATHER_HAIL) && move == MOVE_BLIZZARD)))) - || (gBattleMoves[move].effect == EFFECT_VITAL_THROW) - || (gBattleMoves[move].accuracy == 0) - || ((B_MINIMIZE_DMG_ACC >= GEN_6) && (gStatuses3[battlerDef] & STATUS3_MINIMIZED) && (gBattleMoves[move].flags & FLAG_DMG_MINIMIZE))) + || (((gBattleWeather & B_WEATHER_HAIL) && move == MOVE_BLIZZARD)))) + || (gBattleMoves[move].effect == EFFECT_VITAL_THROW) + #if B_MINIMIZE_DMG_ACC >= GEN_6 + || ((gStatuses3[battlerDef] & STATUS3_MINIMIZED) && (gBattleMoves[move].flags & FLAG_DMG_MINIMIZE)) + #endif + || (gBattleMoves[move].accuracy == 0)) { return TRUE; } @@ -1461,10 +1471,10 @@ bool32 ShouldTryOHKO(u8 battlerAtk, u8 battlerDef, u16 atkAbility, u16 defAbilit else // test the odds { u16 odds = accuracy + (gBattleMons[battlerAtk].level - gBattleMons[battlerDef].level); - #if B_SHEER_COLD_ACC >= GEN_7 - if (gCurrentMove == MOVE_SHEER_COLD && !IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_ICE)) - odds -= 10; - #endif + #if B_SHEER_COLD_ACC >= GEN_7 + if (gCurrentMove == MOVE_SHEER_COLD && !IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_ICE)) + odds -= 10; + #endif if (Random() % 100 + 1 < odds && gBattleMons[battlerAtk].level >= gBattleMons[battlerDef].level) return TRUE; } @@ -2240,10 +2250,15 @@ static u32 GetTrapDamage(u8 battlerId) if (gBattleMons[battlerId].status2 & STATUS2_WRAPPED) { if (holdEffect == HOLD_EFFECT_BINDING_BAND) - damage = gBattleMons[battlerId].maxHP / (B_BINDING_DAMAGE >= GEN_6) ? 6 : 8; + #if B_BINDING_DAMAGE >= GEN_6 + damage = gBattleMons[battlerId].maxHP / 6; else - damage = gBattleMons[battlerId].maxHP / (B_BINDING_DAMAGE >= GEN_6) ? 8 : 16; - + damage = gBattleMons[battlerId].maxHP / 8; + #else + damage = gBattleMons[battlerId].maxHP / 8; + else + damage = gBattleMons[battlerId].maxHP / 16; + #endif if (damage == 0) damage = 1; } @@ -2462,14 +2477,22 @@ bool32 ShouldPivot(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u8 mo return PIVOT; // Won't get the two turns, pivot if (!IS_MOVE_STATUS(move) && (shouldSwitch - || (AtMaxHp(battlerDef) && (AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_FOCUS_SASH - || (defAbility == ABILITY_STURDY && B_STURDY >= GEN_5) || defAbility == ABILITY_MULTISCALE || defAbility == ABILITY_SHADOW_SHIELD)))) + || (AtMaxHp(battlerDef) && (AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_FOCUS_SASH + #if B_STURDY >= GEN_5 + || defAbility == ABILITY_STURDY + #endif + || defAbility == ABILITY_MULTISCALE + || defAbility == ABILITY_SHADOW_SHIELD)))) return PIVOT; // pivot to break sash/sturdy/multiscale } else if (!hasStatBoost) { if (!IS_MOVE_STATUS(move) && (AtMaxHp(battlerDef) && (AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_FOCUS_SASH - || (defAbility == ABILITY_STURDY && B_STURDY >= GEN_5) || defAbility == ABILITY_MULTISCALE || defAbility == ABILITY_SHADOW_SHIELD))) + #if B_STURDY >= GEN_5 + || (defAbility == ABILITY_STURDY) + #endif + || defAbility == ABILITY_MULTISCALE + || defAbility == ABILITY_SHADOW_SHIELD))) return PIVOT; // pivot to break sash/sturdy/multiscale if (shouldSwitch) @@ -2608,7 +2631,7 @@ bool32 CanKnockOffItem(u8 battler, u16 item) | BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_SECRET_BASE - #if defined B_TRAINERS_KNOCK_OFF_ITEMS + #if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE | BATTLE_TYPE_TRAINER #endif )) && GetBattlerSide(battler) == B_SIDE_PLAYER) @@ -3248,7 +3271,7 @@ s32 CountUsablePartyMons(u8 battlerId) if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { battlerOnField1 = gBattlerPartyIndexes[battlerId]; - battlerOnField2 = gBattlerPartyIndexes[GetBattlerAtPosition(GetBattlerPosition(battlerId) ^ BIT_FLANK)]; + battlerOnField2 = gBattlerPartyIndexes[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(battlerId)))]; } else // In singles there's only one battlerId by side. { diff --git a/src/battle_anim.c b/src/battle_anim.c index e3885ec4eb..2806160149 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -927,7 +927,7 @@ static void Cmd_clearmonbg(void) if (sMonAnimTaskIdArray[0] != TASK_NONE) gSprites[gBattlerSpriteIds[battlerId]].invisible = FALSE; if (animBattlerId > 1 && sMonAnimTaskIdArray[1] != TASK_NONE) - gSprites[gBattlerSpriteIds[battlerId ^ BIT_FLANK]].invisible = FALSE; + gSprites[gBattlerSpriteIds[BATTLE_PARTNER(battlerId)]].invisible = FALSE; else animBattlerId = 0; @@ -1034,8 +1034,8 @@ static void Cmd_clearmonbg_static(void) if (IsBattlerSpriteVisible(battlerId)) gSprites[gBattlerSpriteIds[battlerId]].invisible = FALSE; - if (animBattlerId > 1 && IsBattlerSpriteVisible(battlerId ^ BIT_FLANK)) - gSprites[gBattlerSpriteIds[battlerId ^ BIT_FLANK]].invisible = FALSE; + if (animBattlerId > 1 && IsBattlerSpriteVisible(BATTLE_PARTNER(battlerId))) + gSprites[gBattlerSpriteIds[BATTLE_PARTNER(battlerId)]].invisible = FALSE; else animBattlerId = 0; @@ -1061,7 +1061,7 @@ static void Task_ClearMonBgStatic(u8 taskId) if (IsBattlerSpriteVisible(battlerId)) ResetBattleAnimBg(toBG_2); - if (gTasks[taskId].data[0] > 1 && IsBattlerSpriteVisible(battlerId ^ BIT_FLANK)) + if (gTasks[taskId].data[0] > 1 && IsBattlerSpriteVisible(BATTLE_PARTNER(battlerId))) ResetBattleAnimBg(toBG_2 ^ 1); DestroyTask(taskId); @@ -1266,10 +1266,10 @@ static void LoadDefaultBg(void) { if (IsContest()) LoadContestBgAfterMoveAnim(); - #if B_TERRAIN_BG_CHANGE == TRUE +#if B_TERRAIN_BG_CHANGE == TRUE else if (gFieldStatuses & STATUS_FIELD_TERRAIN_ANY) DrawTerrainTypeBattleBackground(); - #endif +#endif else DrawMainBattleBackground(); } diff --git a/src/battle_anim_bug.c b/src/battle_anim_bug.c index 894fd866e0..bd91f18d19 100644 --- a/src/battle_anim_bug.c +++ b/src/battle_anim_bug.c @@ -199,7 +199,7 @@ static void AnimMegahornHorn(struct Sprite *sprite) gBattleAnimArgs[2] = -gBattleAnimArgs[2]; gBattleAnimArgs[0] = -gBattleAnimArgs[0]; } - else if (!GetBattlerSide(gBattleAnimTarget)) + else if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER) { StartSpriteAffineAnim(sprite, 1); gBattleAnimArgs[1] = -gBattleAnimArgs[1]; @@ -226,7 +226,7 @@ static void AnimLeechLifeNeedle(struct Sprite *sprite) gBattleAnimArgs[0] = -gBattleAnimArgs[0]; StartSpriteAffineAnim(sprite, 2); } - else if (!GetBattlerSide(gBattleAnimTarget)) + else if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER) { gBattleAnimArgs[1] = -gBattleAnimArgs[1]; gBattleAnimArgs[0] = -gBattleAnimArgs[0]; @@ -297,7 +297,7 @@ static void AnimStringWrap(struct Sprite *sprite) sprite->x += gBattleAnimArgs[0]; sprite->y += gBattleAnimArgs[1]; - if (!GetBattlerSide(gBattleAnimTarget)) + if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER) sprite->y += 8; sprite->callback = AnimStringWrap_Step; diff --git a/src/battle_anim_dark.c b/src/battle_anim_dark.c index becbc8fcf9..75e4107e9a 100644 --- a/src/battle_anim_dark.c +++ b/src/battle_anim_dark.c @@ -859,8 +859,8 @@ void AnimTask_InitMementoShadow(u8 taskId) if (IsBattlerSpriteVisible(BATTLE_PARTNER(gBattleAnimAttacker))) { - MoveBattlerSpriteToBG(gBattleAnimAttacker ^ 2, toBG2 ^ 1, TRUE); - gSprites[gBattlerSpriteIds[gBattleAnimAttacker ^ 2]].invisible = FALSE; + MoveBattlerSpriteToBG(BATTLE_PARTNER(gBattleAnimAttacker), toBG2 ^ 1, TRUE); + gSprites[gBattlerSpriteIds[BATTLE_PARTNER(gBattleAnimAttacker)]].invisible = FALSE; } DestroyAnimVisualTask(taskId); diff --git a/src/battle_anim_effects_2.c b/src/battle_anim_effects_2.c index 7ce8979735..489c5c747d 100755 --- a/src/battle_anim_effects_2.c +++ b/src/battle_anim_effects_2.c @@ -1703,7 +1703,7 @@ void AnimTask_AirCutterProjectile(u8 taskId) } else { - if ((gBattlerPositions[gBattleAnimTarget] & BIT_SIDE) == B_SIDE_PLAYER) + if (GET_BATTLER_SIDE2(gBattleAnimTarget) == B_SIDE_PLAYER) { gTasks[taskId].data[4] = 1; gBattleAnimArgs[0] = -gBattleAnimArgs[0]; diff --git a/src/battle_anim_fight.c b/src/battle_anim_fight.c index 18034348fe..9ffe2d3c22 100644 --- a/src/battle_anim_fight.c +++ b/src/battle_anim_fight.c @@ -564,7 +564,7 @@ static void AnimFistOrFootRandomPos(struct Sprite *sprite) if (Random2() & 1) y *= -1; - if ((gBattlerPositions[battler] & BIT_SIDE) == B_SIDE_PLAYER) + if (GET_BATTLER_SIDE2(battler) == B_SIDE_PLAYER) y += 0xFFF0; sprite->x += x; diff --git a/src/battle_anim_fire.c b/src/battle_anim_fire.c index 8061da9bd2..bc411f6e52 100644 --- a/src/battle_anim_fire.c +++ b/src/battle_anim_fire.c @@ -1008,7 +1008,7 @@ static void CreateEruptionLaunchRocks(u8 spriteId, u8 taskId, u8 activeSpritesId u16 y = GetEruptionLaunchRockInitialYPos(spriteId); u16 x = gSprites[spriteId].x; - if(!GetBattlerSide(gBattleAnimAttacker)) + if(GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER) { x -= 12; sign = 1; @@ -1310,7 +1310,7 @@ void AnimTask_MoveHeatWaveTargets(u8 taskId) struct Task *task = &gTasks[taskId]; task->data[12] = GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER ? 1 : -1; - task->data[13] = IsBattlerSpriteVisible(gBattleAnimTarget ^ BIT_FLANK) + 1; + task->data[13] = IsBattlerSpriteVisible(BATTLE_PARTNER(gBattleAnimTarget)) + 1; task->data[14] = GetAnimBattlerSpriteId(ANIM_TARGET); task->data[15] = GetAnimBattlerSpriteId(ANIM_DEF_PARTNER); diff --git a/src/battle_anim_flying.c b/src/battle_anim_flying.c index 8fdb316ec5..59d012f9ae 100644 --- a/src/battle_anim_flying.c +++ b/src/battle_anim_flying.c @@ -906,8 +906,8 @@ static void AnimWhirlwindLine(struct Sprite * sprite) else InitSpritePosToAnimTarget(sprite, FALSE); - if ((gBattleAnimArgs[2] == ANIM_ATTACKER && !GetBattlerSide(gBattleAnimAttacker)) - || (gBattleAnimArgs[2] == ANIM_TARGET && !GetBattlerSide(gBattleAnimTarget))) + if ((gBattleAnimArgs[2] == ANIM_ATTACKER && GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER) + || (gBattleAnimArgs[2] == ANIM_TARGET && GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER)) { sprite->x += 8; } diff --git a/src/battle_anim_ghost.c b/src/battle_anim_ghost.c index f14b35ccb2..81cc6760c9 100644 --- a/src/battle_anim_ghost.c +++ b/src/battle_anim_ghost.c @@ -880,7 +880,7 @@ void AnimTask_DestinyBondWhiteShadow(u8 taskId) for (battler = 0; battler < MAX_BATTLERS_COUNT; battler++) { if (battler != gBattleAnimAttacker - && battler != (gBattleAnimAttacker ^ 2) + && battler != BATTLE_PARTNER(gBattleAnimAttacker) && IsBattlerSpriteVisible(battler)) { if (gAnimMoveIndex == MOVE_DARK_VOID diff --git a/src/battle_anim_ice.c b/src/battle_anim_ice.c index 22bfddee20..e3b4e59d1e 100644 --- a/src/battle_anim_ice.c +++ b/src/battle_anim_ice.c @@ -1276,12 +1276,12 @@ static void InitPoisonGasCloudAnim(struct Sprite *sprite) if (GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2) < GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2)) sprite->data[7] = 0x8000; - if ((gBattlerPositions[gBattleAnimTarget] & BIT_SIDE) == B_SIDE_PLAYER) + if (GET_BATTLER_SIDE2(gBattleAnimTarget) == B_SIDE_PLAYER) { gBattleAnimArgs[1] = -gBattleAnimArgs[1]; gBattleAnimArgs[3] = -gBattleAnimArgs[3]; - if ((sprite->data[7] & 0x8000) && (gBattlerPositions[gBattleAnimAttacker] & BIT_SIDE) == B_SIDE_PLAYER) + if ((sprite->data[7] & 0x8000) && GET_BATTLER_SIDE2(gBattleAnimAttacker) == B_SIDE_PLAYER) sprite->subpriority = gSprites[GetAnimBattlerSpriteId(ANIM_TARGET)].subpriority + 1; sprite->data[6] = 1; @@ -1541,7 +1541,7 @@ static void AnimHailBegin(struct Sprite *sprite) sprite->data[3], sprite->data[4], sprite->subpriority); sprite->data[0] = spriteId; - if (spriteId != 64) + if (spriteId != MAX_SPRITES) { gSprites[sprite->data[0]].callback = AnimHailContinue; gSprites[sprite->data[0]].data[6] = sprite->data[6]; diff --git a/src/battle_anim_mon_movement.c b/src/battle_anim_mon_movement.c index 91798463bd..aa8e4e2ac1 100644 --- a/src/battle_anim_mon_movement.c +++ b/src/battle_anim_mon_movement.c @@ -898,11 +898,11 @@ void AnimTask_RotateMonSpriteToSide(u8 taskId) { if (gBattleAnimArgs[2] == ANIM_ATTACKER) { - gTasks[taskId].data[7] = !GetBattlerSide(gBattleAnimAttacker); + gTasks[taskId].data[7] = GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER; } else { - gTasks[taskId].data[7] = !GetBattlerSide(gBattleAnimTarget); + gTasks[taskId].data[7] = GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER; } } if (gTasks[taskId].data[7]) diff --git a/src/battle_anim_mons.c b/src/battle_anim_mons.c index 659c088b26..104c778852 100644 --- a/src/battle_anim_mons.c +++ b/src/battle_anim_mons.c @@ -896,7 +896,7 @@ u8 GetBattlerSide(u8 battlerId) u8 GetBattlerPosition(u8 battlerId) { - return GET_BATTLER_POSITION(battlerId); + return gBattlerPositions[battlerId]; } u8 GetBattlerAtPosition(u8 position) @@ -2534,7 +2534,7 @@ void AnimWeatherBallUp(struct Sprite *sprite) { sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2); sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET); - if (!GetBattlerSide(gBattleAnimAttacker)) + if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER) sprite->data[0] = 5; else sprite->data[0] = -10; @@ -2560,7 +2560,7 @@ void AnimWeatherBallDown(struct Sprite *sprite) sprite->data[0] = gBattleAnimArgs[2]; sprite->data[2] = sprite->x + gBattleAnimArgs[4]; sprite->data[4] = sprite->y + gBattleAnimArgs[5]; - if (!GetBattlerSide(gBattleAnimTarget)) + if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER) { x = (u16)gBattleAnimArgs[4] + 30; sprite->x += x; diff --git a/src/battle_anim_new.c b/src/battle_anim_new.c index 35c1244670..0a3d433b46 100644 --- a/src/battle_anim_new.c +++ b/src/battle_anim_new.c @@ -6523,7 +6523,7 @@ const struct SpriteTemplate gSoulStealZStarSpriteTemplate = //general void AnimTask_IsTargetPartner(u8 taskId) { - if (gBattleAnimTarget == (gBattleAnimAttacker ^ BIT_FLANK)) + if (gBattleAnimTarget == BATTLE_PARTNER(gBattleAnimAttacker)) gBattleAnimArgs[0] = 1; else gBattleAnimArgs[0] = 0; diff --git a/src/battle_anim_psychic.c b/src/battle_anim_psychic.c index c96ae31756..2ec5b2600d 100644 --- a/src/battle_anim_psychic.c +++ b/src/battle_anim_psychic.c @@ -687,7 +687,7 @@ static void AnimDefensiveWall_Step5(struct Sprite *sprite) if (IsBattlerSpriteVisible(battler)) ResetBattleAnimBg(toBG2); - battler = battlerCopy ^ 2; + battler = BATTLE_PARTNER(battlerCopy); if (IsBattlerSpriteVisible(battler)) ResetBattleAnimBg(toBG2 ^ var0); } @@ -1035,7 +1035,7 @@ static void AnimTask_SkillSwap_Step(u8 taskId) { task->data[1] = 0; spriteId = CreateSprite(&gSkillSwapOrbSpriteTemplate, task->data[11], task->data[12], 0); - if (spriteId != 64) + if (spriteId != MAX_SPRITES) { gSprites[spriteId].data[0] = 16; gSprites[spriteId].data[2] = task->data[13]; diff --git a/src/battle_arena.c b/src/battle_arena.c index e0a2c5e748..82f6a47d05 100644 --- a/src/battle_arena.c +++ b/src/battle_arena.c @@ -38,9 +38,9 @@ static void BufferArenaOpponentName(void); static void SpriteCB_JudgmentIcon(struct Sprite *sprite); static void ShowJudgmentSprite(u8 x, u8 y, u8 category, u8 battler); -#define JUDGEMENT_STATE_FINISHED 8 +#define JUDGMENT_STATE_FINISHED 8 -#define TAG_JUDGEMENT_ICON 1000 +#define TAG_JUDGMENT_ICON 1000 enum { ANIM_ICON_X, // Player lost @@ -275,7 +275,7 @@ static const s8 sMindRatings[MOVES_COUNT] = [MOVE_PSYCHO_BOOST] = 1, }; -static const struct OamData sOam_JudgementIcon = +static const struct OamData sOam_JudgmentIcon = { .y = 0, .affineMode = ST_OAM_AFFINE_OFF, @@ -292,52 +292,52 @@ static const struct OamData sOam_JudgementIcon = .affineParam = 0 }; -static const union AnimCmd sAnim_JudgementIcon_X[] = +static const union AnimCmd sAnim_JudgmentIcon_X[] = { ANIMCMD_FRAME(0, 1), ANIMCMD_END }; -static const union AnimCmd sAnim_JudgementIcon_Triangle[] = +static const union AnimCmd sAnim_JudgmentIcon_Triangle[] = { ANIMCMD_FRAME(4, 1), ANIMCMD_END }; -static const union AnimCmd sAnim_JudgementIcon_Circle[] = +static const union AnimCmd sAnim_JudgmentIcon_Circle[] = { ANIMCMD_FRAME(8, 1), ANIMCMD_END }; -static const union AnimCmd sAnim_JudgementIcon_Line[] = +static const union AnimCmd sAnim_JudgmentIcon_Line[] = { ANIMCMD_FRAME(12, 1), ANIMCMD_END }; -static const union AnimCmd *const sAnims_JudgementIcon[] = +static const union AnimCmd *const sAnims_JudgmentIcon[] = { - [ANIM_ICON_X] = sAnim_JudgementIcon_X, - [ANIM_ICON_TRIANGLE] = sAnim_JudgementIcon_Triangle, - [ANIM_ICON_CIRCLE] = sAnim_JudgementIcon_Circle, - [ANIM_ICON_LINE] = sAnim_JudgementIcon_Line, + [ANIM_ICON_X] = sAnim_JudgmentIcon_X, + [ANIM_ICON_TRIANGLE] = sAnim_JudgmentIcon_Triangle, + [ANIM_ICON_CIRCLE] = sAnim_JudgmentIcon_Circle, + [ANIM_ICON_LINE] = sAnim_JudgmentIcon_Line, }; static const struct SpriteTemplate sSpriteTemplate_JudgmentIcon = { - .tileTag = TAG_JUDGEMENT_ICON, + .tileTag = TAG_JUDGMENT_ICON, .paletteTag = TAG_NONE, - .oam = &sOam_JudgementIcon, - .anims = sAnims_JudgementIcon, + .oam = &sOam_JudgmentIcon, + .anims = sAnims_JudgmentIcon, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCB_JudgmentIcon, }; -static const struct CompressedSpriteSheet sBattleArenaJudgementSymbolsSpriteSheet[] = +static const struct CompressedSpriteSheet sBattleArenaJudgmentSymbolsSpriteSheet[] = { - {gBattleArenaJudgementSymbolsGfx, 0x200, TAG_JUDGEMENT_ICON}, + {gBattleArenaJudgmentSymbolsGfx, 0x200, TAG_JUDGMENT_ICON}, {0} }; @@ -389,8 +389,8 @@ u8 BattleArena_ShowJudgmentWindow(u8 *state) case 0: BeginNormalPaletteFade(0x7FFFFF1C, 4, 0, 8, RGB_BLACK); SetGpuReg(REG_OFFSET_WININ, (WININ_WIN0_ALL & ~WININ_WIN0_BG0) | WININ_WIN1_ALL); - LoadCompressedSpriteSheet(sBattleArenaJudgementSymbolsSpriteSheet); - LoadCompressedPalette(gBattleArenaJudgementSymbolsPalette, 0x1F0, 0x20); + LoadCompressedSpriteSheet(sBattleArenaJudgmentSymbolsSpriteSheet); + LoadCompressedPalette(gBattleArenaJudgmentSymbolsPalette, 0x1F0, 0x20); gBattle_WIN0H = 0xFF; gBattle_WIN0V = 0x70; (*state)++; @@ -417,8 +417,8 @@ u8 BattleArena_ShowJudgmentWindow(u8 *state) BattlePutTextOnWindow(gText_Mind, ARENA_WIN_MIND); BattlePutTextOnWindow(gText_Skill, ARENA_WIN_SKILL); BattlePutTextOnWindow(gText_Body, ARENA_WIN_BODY); - BattleStringExpandPlaceholdersToDisplayedString(gText_Judgement); - BattlePutTextOnWindow(gDisplayedStringBattle, ARENA_WIN_JUDGEMENT_TITLE); + BattleStringExpandPlaceholdersToDisplayedString(gText_Judgment); + BattlePutTextOnWindow(gDisplayedStringBattle, ARENA_WIN_JUDGMENT_TITLE); (*state)++; } break; @@ -441,8 +441,8 @@ u8 BattleArena_ShowJudgmentWindow(u8 *state) PlaySE(SE_ARENA_TIMEUP1); ShowJudgmentSprite(80, 40, ARENA_CATEGORY_MIND, B_POSITION_PLAYER_LEFT); ShowJudgmentSprite(160, 40, ARENA_CATEGORY_MIND, B_POSITION_OPPONENT_LEFT); - BattleStringExpandPlaceholdersToDisplayedString(gText_Judgement); - BattlePutTextOnWindow(gDisplayedStringBattle, ARENA_WIN_JUDGEMENT_TITLE); + BattleStringExpandPlaceholdersToDisplayedString(gText_Judgment); + BattlePutTextOnWindow(gDisplayedStringBattle, ARENA_WIN_JUDGMENT_TITLE); (*state)++; result = ARENA_RESULT_STEP_DONE; break; @@ -450,8 +450,8 @@ u8 BattleArena_ShowJudgmentWindow(u8 *state) PlaySE(SE_ARENA_TIMEUP1); ShowJudgmentSprite(80, 56, ARENA_CATEGORY_SKILL, B_POSITION_PLAYER_LEFT); ShowJudgmentSprite(160, 56, ARENA_CATEGORY_SKILL, B_POSITION_OPPONENT_LEFT); - BattleStringExpandPlaceholdersToDisplayedString(gText_Judgement); - BattlePutTextOnWindow(gDisplayedStringBattle, ARENA_WIN_JUDGEMENT_TITLE); + BattleStringExpandPlaceholdersToDisplayedString(gText_Judgment); + BattlePutTextOnWindow(gDisplayedStringBattle, ARENA_WIN_JUDGMENT_TITLE); (*state)++; result = ARENA_RESULT_STEP_DONE; break; @@ -459,8 +459,8 @@ u8 BattleArena_ShowJudgmentWindow(u8 *state) PlaySE(SE_ARENA_TIMEUP1); ShowJudgmentSprite(80, 72, ARENA_CATEGORY_BODY, B_POSITION_PLAYER_LEFT); ShowJudgmentSprite(160, 72, ARENA_CATEGORY_BODY, B_POSITION_OPPONENT_LEFT); - BattleStringExpandPlaceholdersToDisplayedString(gText_Judgement); - BattlePutTextOnWindow(gDisplayedStringBattle, ARENA_WIN_JUDGEMENT_TITLE); + BattleStringExpandPlaceholdersToDisplayedString(gText_Judgment); + BattlePutTextOnWindow(gDisplayedStringBattle, ARENA_WIN_JUDGMENT_TITLE); (*state)++; result = ARENA_RESULT_STEP_DONE; break; @@ -482,11 +482,11 @@ u8 BattleArena_ShowJudgmentWindow(u8 *state) } (*state)++; break; - case JUDGEMENT_STATE_FINISHED: - // Finishing this state is the indicator to SpriteCB_JudgmentIcon that its safe to destroy the judgement icon sprites + case JUDGMENT_STATE_FINISHED: + // Finishing this state is the indicator to SpriteCB_JudgmentIcon that its safe to destroy the judgment icon sprites (*state)++; break; - case JUDGEMENT_STATE_FINISHED + 1: + case JUDGMENT_STATE_FINISHED + 1: SetGpuReg(REG_OFFSET_WININ, (WININ_WIN0_ALL & ~WININ_WIN0_BG0) | WININ_WIN1_ALL); HandleBattleWindow(5, 0, 24, 13, WINDOW_CLEAR); CopyBgTilemapBufferToVram(0); @@ -494,11 +494,11 @@ u8 BattleArena_ShowJudgmentWindow(u8 *state) BeginNormalPaletteFade(0x7FFFFF1C, 4, 8, 0, RGB_BLACK); (*state)++; break; - case JUDGEMENT_STATE_FINISHED + 2: + case JUDGMENT_STATE_FINISHED + 2: if (!gPaletteFade.active) { SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_ALL | WININ_WIN1_ALL); - FreeSpriteTilesByTag(TAG_JUDGEMENT_ICON); + FreeSpriteTilesByTag(TAG_JUDGMENT_ICON); result = ARENA_RESULT_STEP_DONE; (*state)++; } @@ -562,7 +562,7 @@ static void ShowJudgmentSprite(u8 x, u8 y, u8 category, u8 battler) static void SpriteCB_JudgmentIcon(struct Sprite *sprite) { - if (gBattleCommunication[0] > JUDGEMENT_STATE_FINISHED) + if (gBattleCommunication[0] > JUDGMENT_STATE_FINISHED) DestroySprite(sprite); } diff --git a/src/battle_bg.c b/src/battle_bg.c index 3965be2eab..5ea08c97cc 100644 --- a/src/battle_bg.c +++ b/src/battle_bg.c @@ -575,7 +575,7 @@ static const struct WindowTemplate sBattleArenaWindowTemplates[] = .paletteNum = 5, .baseBlock = 0x013c, }, - [ARENA_WIN_JUDGEMENT_TITLE] = { + [ARENA_WIN_JUDGMENT_TITLE] = { .bg = 0, .tilemapLeft = 8, .tilemapTop = 11, @@ -584,7 +584,7 @@ static const struct WindowTemplate sBattleArenaWindowTemplates[] = .paletteNum = 5, .baseBlock = 0x0148, }, - [ARENA_WIN_JUDGEMENT_TEXT] = { + [ARENA_WIN_JUDGMENT_TEXT] = { .bg = 0, .tilemapLeft = 2, .tilemapTop = 15, @@ -870,11 +870,11 @@ void LoadBattleTextboxAndBackground(void) CopyBgTilemapBufferToVram(0); LoadCompressedPalette(gBattleTextboxPalette, 0, 0x40); LoadBattleMenuWindowGfx(); - #if B_TERRAIN_BG_CHANGE == TRUE - DrawTerrainTypeBattleBackground(); - #else - DrawMainBattleBackground(); - #endif +#if B_TERRAIN_BG_CHANGE == TRUE + DrawTerrainTypeBattleBackground(); +#else + DrawMainBattleBackground(); +#endif } static void DrawLinkBattleParticipantPokeballs(u8 taskId, u8 multiplayerId, u8 bgId, u8 destX, u8 destY) diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c index 26ee356c34..0b2bab9e66 100644 --- a/src/battle_controller_link_opponent.c +++ b/src/battle_controller_link_opponent.c @@ -370,16 +370,13 @@ static void TryShinyAnimAfterMonAnim(void) { TryShinyAnimation(gActiveBattler, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]]); } - else + else if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim) { - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; - FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); - FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); - LinkOpponentBufferExecCompleted(); - } + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; + FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); + FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); + LinkOpponentBufferExecCompleted(); } } } @@ -1752,14 +1749,14 @@ static void LinkOpponentHandleDrawPartyStatusSummary(void) if (gBattleResources->bufferA[gActiveBattler][2] != 0) { - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1E < 2) + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].opponentDrawPartyStatusSummaryDelay < 2) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1E++; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].opponentDrawPartyStatusSummaryDelay++; return; } else { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1E = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].opponentDrawPartyStatusSummaryDelay = 0; } } diff --git a/src/battle_controller_link_partner.c b/src/battle_controller_link_partner.c index 4afa2cb18e..da1599a906 100644 --- a/src/battle_controller_link_partner.c +++ b/src/battle_controller_link_partner.c @@ -219,7 +219,7 @@ static void Intro_WaitForHealthbox(void) else { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) + && gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy) { finished = TRUE; } @@ -238,7 +238,7 @@ static void Intro_WaitForHealthbox(void) static void Intro_ShowHealthbox(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive && gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy && ++gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay != 1) @@ -247,10 +247,10 @@ static void Intro_ShowHealthbox(void) if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - DestroySprite(&gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]]); - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); - StartHealthboxSlideIn(gActiveBattler ^ BIT_FLANK); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]); + DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]]); + UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)], &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], HEALTHBOX_ALL); + StartHealthboxSlideIn(BATTLE_PARTNER(gActiveBattler)); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]); } DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c index 760fbf3203..5e21232d9b 100644 --- a/src/battle_controller_opponent.c +++ b/src/battle_controller_opponent.c @@ -226,7 +226,7 @@ static void Intro_DelayAndEnd(void) static bool32 TwoIntroMons(u32 battlerId) // Double battle with both player pokemon active. { - return (IsDoubleBattle() && IsValidForBattle(&gEnemyParty[gBattlerPartyIndexes[battlerId ^ BIT_FLANK]])); + return (IsDoubleBattle() && IsValidForBattle(&gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(battlerId)]])); } static void Intro_WaitForShinyAnimAndHealthbox(void) @@ -244,25 +244,25 @@ static void Intro_WaitForShinyAnimAndHealthbox(void) else { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) + && gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy) healthboxAnimDone = TRUE; twoMons = TRUE; } gBattleControllerOpponentHealthboxData = &gBattleSpritesDataPtr->healthBoxesData[gActiveBattler]; - gBattleControllerOpponentFlankHealthboxData = &gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK]; + gBattleControllerOpponentFlankHealthboxData = &gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)]; if (healthboxAnimDone) { if (twoMons == TRUE) { if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim - && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim) + && gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim = FALSE; FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); } @@ -273,8 +273,8 @@ static void Intro_WaitForShinyAnimAndHealthbox(void) { if (GetBattlerPosition(gActiveBattler) == 3) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim) + if (!gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim) { FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); @@ -308,20 +308,20 @@ static void Intro_TryShinyAnimShowHealthbox(void) if (!(gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) && (!(gBattleTypeFlags & BATTLE_TYPE_MULTI) || BATTLE_TWO_VS_ONE_OPPONENT) && twoMons - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim) - TryShinyAnimation(gActiveBattler ^ BIT_FLANK, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]]); + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim) + TryShinyAnimation(BATTLE_PARTNER(gActiveBattler), &gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]]); - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive) + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted) { if (twoMons && (!(gBattleTypeFlags & BATTLE_TYPE_MULTI) || BATTLE_TWO_VS_ONE_OPPONENT)) { - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); - StartHealthboxSlideIn(gActiveBattler ^ BIT_FLANK); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]); + UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)], &gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], HEALTHBOX_ALL); + StartHealthboxSlideIn(BATTLE_PARTNER(gActiveBattler)); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]); } UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); StartHealthboxSlideIn(gActiveBattler); @@ -332,7 +332,7 @@ static void Intro_TryShinyAnimShowHealthbox(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].waitForCry && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].waitForCry + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].waitForCry && !IsCryPlayingOrClearCrySongs()) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored) @@ -361,8 +361,8 @@ static void Intro_TryShinyAnimShowHealthbox(void) { if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy - && gSprites[gBattlerSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) + && gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy + && gSprites[gBattlerSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy) { battlerAnimsDone = TRUE; } @@ -372,8 +372,8 @@ static void Intro_TryShinyAnimShowHealthbox(void) { if (twoMons && (!(gBattleTypeFlags & BATTLE_TYPE_MULTI) || BATTLE_TWO_VS_ONE_OPPONENT)) { - DestroySprite(&gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]]); - SetBattlerShadowSpriteCallback(gActiveBattler ^ BIT_FLANK, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], MON_DATA_SPECIES)); + DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]]); + SetBattlerShadowSpriteCallback(BATTLE_PARTNER(gActiveBattler), GetMonData(&gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], MON_DATA_SPECIES)); } DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); @@ -1618,7 +1618,7 @@ static void OpponentHandleChooseMove(void) target = GetBattlerAtPosition(Random() & 2); } while (!CanTargetBattler(gActiveBattler, target, move)); - #if B_WILD_NATURAL_ENEMIES == TRUE + #if B_WILD_NATURAL_ENEMIES == TRUE // Don't bother to loop through table if the move can't attack ally if (!(gBattleMoves[move].target & MOVE_TARGET_BOTH)) { @@ -1650,7 +1650,7 @@ static void OpponentHandleChooseMove(void) BtlController_EmitTwoReturnValues(BUFFER_B, 10, (chosenMoveId) | (target << 8)); } else - #endif + #endif BtlController_EmitTwoReturnValues(BUFFER_B, 10, (chosenMoveId) | (target << 8)); } else @@ -1974,14 +1974,14 @@ static void OpponentHandleDrawPartyStatusSummary(void) if (gBattleResources->bufferA[gActiveBattler][2] != 0) { - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1E < 2) + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].opponentDrawPartyStatusSummaryDelay < 2) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1E++; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].opponentDrawPartyStatusSummaryDelay++; return; } else { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1E = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].opponentDrawPartyStatusSummaryDelay = 0; } } diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index ea3bf2915b..6e9cdcc25a 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -330,12 +330,14 @@ static void HandleInputChooseAction(void) { SwapHpBarsWithHpText(); } - else if (B_ENABLE_DEBUG && gMain.newKeys & SELECT_BUTTON) +#if B_ENABLE_DEBUG == TRUE + else if (gMain.newKeys & SELECT_BUTTON) { BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_DEBUG, 0); PlayerBufferExecCompleted(); } - #if B_LAST_USED_BALL == TRUE +#endif +#if B_LAST_USED_BALL == TRUE else if (JOY_NEW(B_LAST_USED_BALL_BUTTON) && CanThrowLastUsedBall()) { PlaySE(SE_SELECT); @@ -343,7 +345,7 @@ static void HandleInputChooseAction(void) BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_THROW_BALL, 0); PlayerBufferExecCompleted(); } - #endif +#endif } static void UnusedEndBounceEffect(void) @@ -628,7 +630,7 @@ static void HandleInputChooseMove(void) if (moveTarget & MOVE_TARGET_USER) gMultiUsePlayerCursor = gActiveBattler; else - gMultiUsePlayerCursor = GetBattlerAtPosition((GetBattlerPosition(gActiveBattler) & BIT_SIDE) ^ BIT_SIDE); + gMultiUsePlayerCursor = GetBattlerAtPosition(BATTLE_OPPOSITE(GET_BATTLER_SIDE(gActiveBattler))); if (!gBattleResources->bufferA[gActiveBattler][1]) // not a double battle { @@ -652,26 +654,25 @@ static void HandleInputChooseMove(void) canSelectTarget = 0; } + #if B_SHOW_TARGETS == TRUE // Show all available targets for multi-target moves - if (B_SHOW_TARGETS) + if ((moveTarget & MOVE_TARGET_ALL_BATTLERS) == MOVE_TARGET_ALL_BATTLERS) { - if ((moveTarget & MOVE_TARGET_ALL_BATTLERS) == MOVE_TARGET_ALL_BATTLERS) - { - u32 i = 0; - for (i = 0; i < gBattlersCount; i++) - TryShowAsTarget(i); + u32 i = 0; + for (i = 0; i < gBattlersCount; i++) + TryShowAsTarget(i); - canSelectTarget = 3; - } - else if (moveTarget & (MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY)) - { - TryShowAsTarget(gMultiUsePlayerCursor); - TryShowAsTarget(BATTLE_PARTNER(gMultiUsePlayerCursor)); - if (moveTarget & MOVE_TARGET_FOES_AND_ALLY) - TryShowAsTarget(BATTLE_PARTNER(gActiveBattler)); - canSelectTarget = 2; - } + canSelectTarget = 3; } + else if (moveTarget & (MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY)) + { + TryShowAsTarget(gMultiUsePlayerCursor); + TryShowAsTarget(BATTLE_PARTNER(gMultiUsePlayerCursor)); + if (moveTarget & MOVE_TARGET_FOES_AND_ALLY) + TryShowAsTarget(BATTLE_PARTNER(gActiveBattler)); + canSelectTarget = 2; + } + #endif } switch (canSelectTarget) @@ -1160,7 +1161,7 @@ static void Intro_WaitForShinyAnimAndHealthbox(void) if (TwoIntroMons(gActiveBattler) && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) + && gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy) healthboxAnimDone = TRUE; } else @@ -1171,20 +1172,20 @@ static void Intro_WaitForShinyAnimAndHealthbox(void) // If healthbox and shiny anim are done if (healthboxAnimDone && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim - && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim) + && gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim) { // Reset shiny anim (even if it didn't occur) gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim = FALSE; FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); if (TwoIntroMons(gActiveBattler)) - HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], gActiveBattler ^ BIT_FLANK); + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], BATTLE_PARTNER(gActiveBattler)); gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 3; gBattlerControllerFuncs[gActiveBattler] = Intro_DelayAndEnd; @@ -1202,21 +1203,21 @@ static void Intro_TryShinyAnimShowHealthbox(void) TryShinyAnimation(gActiveBattler, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]]); // Start shiny animation if applicable for 2nd pokemon - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive) - TryShinyAnimation(gActiveBattler ^ BIT_FLANK, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]]); + if (!gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive) + TryShinyAnimation(BATTLE_PARTNER(gActiveBattler), &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]]); // Show healthbox after ball anim if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive) + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted) { if (TwoIntroMons(gActiveBattler) && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); - StartHealthboxSlideIn(gActiveBattler ^ BIT_FLANK); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]); + UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)], &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], HEALTHBOX_ALL); + StartHealthboxSlideIn(BATTLE_PARTNER(gActiveBattler)); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]); } UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); StartHealthboxSlideIn(gActiveBattler); @@ -1228,7 +1229,7 @@ static void Intro_TryShinyAnimShowHealthbox(void) // Restore bgm after cry has played and healthbox anim is started if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].waitForCry && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].waitForCry + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].waitForCry && !IsCryPlayingOrClearCrySongs()) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored) @@ -1247,8 +1248,8 @@ static void Intro_TryShinyAnimShowHealthbox(void) { if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy - && gSprites[gBattlerSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) + && gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy + && gSprites[gBattlerSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy) { battlerAnimsDone = TRUE; } @@ -1266,7 +1267,7 @@ static void Intro_TryShinyAnimShowHealthbox(void) if (bgmRestored && battlerAnimsDone) { if (TwoIntroMons(gActiveBattler) && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) - DestroySprite(&gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]]); + DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]]); DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); gBattleSpritesDataPtr->animationData->introAnimActive = FALSE; @@ -1399,7 +1400,7 @@ static void Task_GiveExpToMon(u8 taskId) gActiveBattler = savedActiveBattler; if (IsDoubleBattle() == TRUE - && ((u16)(monId) == gBattlerPartyIndexes[battlerId] || (u16)(monId) == gBattlerPartyIndexes[battlerId ^ BIT_FLANK])) + && ((u16)(monId) == gBattlerPartyIndexes[battlerId] || (u16)(monId) == gBattlerPartyIndexes[BATTLE_PARTNER(battlerId)])) gTasks[taskId].func = Task_LaunchLvlUpAnim; else gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter; @@ -1494,7 +1495,7 @@ static void Task_LaunchLvlUpAnim(u8 taskId) u8 battlerId = gTasks[taskId].tExpTask_battler; u8 monIndex = gTasks[taskId].tExpTask_monId; - if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[battlerId ^ BIT_FLANK]) + if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[BATTLE_PARTNER(battlerId)]) battlerId ^= BIT_FLANK; InitAndLaunchSpecialAnimation(battlerId, battlerId, battlerId, B_ANIM_LVL_UP); @@ -1511,8 +1512,8 @@ static void Task_UpdateLvlInHealthbox(u8 taskId) GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value. - if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[battlerId ^ BIT_FLANK]) - UpdateHealthboxAttribute(gHealthboxSpriteIds[battlerId ^ BIT_FLANK], &gPlayerParty[monIndex], HEALTHBOX_ALL); + if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[BATTLE_PARTNER(battlerId)]) + UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(battlerId)], &gPlayerParty[monIndex], HEALTHBOX_ALL); else UpdateHealthboxAttribute(gHealthboxSpriteIds[battlerId], &gPlayerParty[monIndex], HEALTHBOX_ALL); diff --git a/src/battle_controller_player_partner.c b/src/battle_controller_player_partner.c index f29bd1b871..d39d745a6f 100644 --- a/src/battle_controller_player_partner.c +++ b/src/battle_controller_player_partner.c @@ -233,7 +233,7 @@ static void Intro_WaitForHealthbox(void) else { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) + && gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy) { finished = TRUE; } @@ -252,7 +252,7 @@ static void Intro_WaitForHealthbox(void) static void Intro_ShowHealthbox(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive && gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy && ++gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay != 1) @@ -261,10 +261,10 @@ static void Intro_ShowHealthbox(void) if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - DestroySprite(&gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]]); - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); - StartHealthboxSlideIn(gActiveBattler ^ BIT_FLANK); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]); + DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]]); + UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)], &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], HEALTHBOX_ALL); + StartHealthboxSlideIn(BATTLE_PARTNER(gActiveBattler)); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]); } DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); @@ -340,7 +340,7 @@ static void Task_GiveExpToMon(u8 taskId) gActiveBattler = savedActiveBank; if (IsDoubleBattle() == TRUE - && ((u16)(monId) == gBattlerPartyIndexes[battlerId] || (u16)(monId) == gBattlerPartyIndexes[battlerId ^ BIT_FLANK])) + && ((u16)(monId) == gBattlerPartyIndexes[battlerId] || (u16)(monId) == gBattlerPartyIndexes[BATTLE_PARTNER(battlerId)])) gTasks[taskId].func = Task_LaunchLvlUpAnim; else gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter; @@ -435,7 +435,7 @@ static void Task_LaunchLvlUpAnim(u8 taskId) u8 battlerId = gTasks[taskId].tExpTask_bank; u8 monIndex = gTasks[taskId].tExpTask_monId; - if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[battlerId ^ BIT_FLANK]) + if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[BATTLE_PARTNER(battlerId)]) battlerId ^= BIT_FLANK; InitAndLaunchSpecialAnimation(battlerId, battlerId, battlerId, B_ANIM_LVL_UP); @@ -452,8 +452,8 @@ static void Task_UpdateLvlInHealthbox(u8 taskId) GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value - if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[battlerId ^ BIT_FLANK]) - UpdateHealthboxAttribute(gHealthboxSpriteIds[battlerId ^ BIT_FLANK], &gPlayerParty[monIndex], HEALTHBOX_ALL); + if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[BATTLE_PARTNER(battlerId)]) + UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(battlerId)], &gPlayerParty[monIndex], HEALTHBOX_ALL); else UpdateHealthboxAttribute(gHealthboxSpriteIds[battlerId], &gPlayerParty[monIndex], HEALTHBOX_ALL); diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c index 14efa76c22..6d52f1bf8c 100644 --- a/src/battle_controller_recorded_opponent.c +++ b/src/battle_controller_recorded_opponent.c @@ -228,9 +228,9 @@ static void Intro_WaitForShinyAnimAndHealthbox(void) else { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy + && gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].animEnded - && gSprites[gBattlerSpriteIds[gActiveBattler ^ BIT_FLANK]].animEnded) + && gSprites[gBattlerSpriteIds[BATTLE_PARTNER(gActiveBattler)]].animEnded) healthboxAnimDone = TRUE; } @@ -240,13 +240,13 @@ static void Intro_WaitForShinyAnimAndHealthbox(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim) return; - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim) + if (!gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim) return; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim = FALSE; FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); } @@ -265,19 +265,19 @@ static void Intro_TryShinyAnimShowHealthbox(void) && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) TryShinyAnimation(gActiveBattler, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]]); - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive) - TryShinyAnimation(gActiveBattler ^ BIT_FLANK, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]]); + if (!gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive) + TryShinyAnimation(BATTLE_PARTNER(gActiveBattler), &gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]]); - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive) + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); - StartHealthboxSlideIn(gActiveBattler ^ BIT_FLANK); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]); + UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)], &gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], HEALTHBOX_ALL); + StartHealthboxSlideIn(BATTLE_PARTNER(gActiveBattler)); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]); } UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); StartHealthboxSlideIn(gActiveBattler); @@ -288,7 +288,7 @@ static void Intro_TryShinyAnimShowHealthbox(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].waitForCry && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].waitForCry + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].waitForCry && !IsCryPlayingOrClearCrySongs()) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored) @@ -319,8 +319,8 @@ static void Intro_TryShinyAnimShowHealthbox(void) { if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy - && gSprites[gBattlerSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) + && gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy + && gSprites[gBattlerSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy) { battlerAnimsDone = TRUE; } @@ -330,8 +330,8 @@ static void Intro_TryShinyAnimShowHealthbox(void) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - DestroySprite(&gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]]); - SetBattlerShadowSpriteCallback(gActiveBattler ^ BIT_FLANK, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], MON_DATA_SPECIES)); + DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]]); + SetBattlerShadowSpriteCallback(BATTLE_PARTNER(gActiveBattler), GetMonData(&gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], MON_DATA_SPECIES)); } DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); @@ -1692,14 +1692,14 @@ static void RecordedOpponentHandleDrawPartyStatusSummary(void) if (gBattleResources->bufferA[gActiveBattler][2] != 0) { - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1E < 2) + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].opponentDrawPartyStatusSummaryDelay < 2) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1E++; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].opponentDrawPartyStatusSummaryDelay++; return; } else { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1E = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].opponentDrawPartyStatusSummaryDelay = 0; } } diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c index 0d531db92c..ecc8e09de4 100644 --- a/src/battle_controller_recorded_player.c +++ b/src/battle_controller_recorded_player.c @@ -215,27 +215,27 @@ static void Intro_WaitForShinyAnimAndHealthbox(void) else { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) + && gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy) { healthboxAnimDone = TRUE; } } if (healthboxAnimDone && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim - && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim) + && gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim = FALSE; FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); if (IsDoubleBattle()) - HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], gActiveBattler ^ BIT_FLANK); + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], BATTLE_PARTNER(gActiveBattler)); gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 3; gBattlerControllerFuncs[gActiveBattler] = Intro_DelayAndEnd; @@ -251,7 +251,7 @@ static void Intro_WaitForShinyAnimAndHealthbox(void) else { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) + && gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy) { healthboxAnimDone = TRUE; } @@ -278,21 +278,21 @@ static void Intro_TryShinyAnimShowHealthbox(void) && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) TryShinyAnimation(gActiveBattler, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]]); - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive) - TryShinyAnimation(gActiveBattler ^ BIT_FLANK, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]]); + if (!gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive) + TryShinyAnimation(BATTLE_PARTNER(gActiveBattler), &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]]); } if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive) + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); - StartHealthboxSlideIn(gActiveBattler ^ BIT_FLANK); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]); + UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)], &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], HEALTHBOX_ALL); + StartHealthboxSlideIn(BATTLE_PARTNER(gActiveBattler)); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]); } UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); StartHealthboxSlideIn(gActiveBattler); @@ -303,7 +303,7 @@ static void Intro_TryShinyAnimShowHealthbox(void) if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].waitForCry - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].waitForCry + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].waitForCry && !IsCryPlayingOrClearCrySongs()) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored) @@ -327,7 +327,7 @@ static void Intro_TryShinyAnimShowHealthbox(void) && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) - DestroySprite(&gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]]); + DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]]); DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); gBattleSpritesDataPtr->animationData->introAnimActive = FALSE; diff --git a/src/battle_controller_wally.c b/src/battle_controller_wally.c index 0b480a23ac..4f4f2eb6f2 100644 --- a/src/battle_controller_wally.c +++ b/src/battle_controller_wally.c @@ -291,21 +291,21 @@ static void Intro_TryShinyAnimShowHealthbox(void) && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) TryShinyAnimation(gActiveBattler, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]]); - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive) - TryShinyAnimation(gActiveBattler ^ BIT_FLANK, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]]); + if (!gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive) + TryShinyAnimation(BATTLE_PARTNER(gActiveBattler), &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]]); if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive && gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - DestroySprite(&gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]]); - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); - StartHealthboxSlideIn(gActiveBattler ^ BIT_FLANK); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]); + DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]]); + UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)], &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], HEALTHBOX_ALL); + StartHealthboxSlideIn(BATTLE_PARTNER(gActiveBattler)); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]); } DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); @@ -326,13 +326,13 @@ static void Intro_WaitForShinyAnimAndHealthbox(void) healthboxAnimDone = TRUE; if (healthboxAnimDone && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim - && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim) + && gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim = FALSE; FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); diff --git a/src/battle_controllers.c b/src/battle_controllers.c index 82ce1ebf20..8603678b07 100644 --- a/src/battle_controllers.c +++ b/src/battle_controllers.c @@ -9,7 +9,6 @@ #include "link.h" #include "link_rfu.h" #include "party_menu.h" -#include "pokemon.h" #include "recorded_battle.h" #include "task.h" #include "util.h" @@ -923,7 +922,8 @@ void BtlController_EmitGetMonData(u8 bufferId, u8 requestId, u8 monToCheck) PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } -void BtlController_EmitGetRawMonData(u8 bufferId, u8 monId, u8 bytes) +// Unused +static void BtlController_EmitGetRawMonData(u8 bufferId, u8 monId, u8 bytes) { sBattleBuffersTransferData[0] = CONTROLLER_GETRAWMONDATA; sBattleBuffersTransferData[1] = monId; @@ -944,7 +944,8 @@ void BtlController_EmitSetMonData(u8 bufferId, u8 requestId, u8 monToCheck, u8 b PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 3 + bytes); } -void BtlController_EmitSetRawMonData(u8 bufferId, u8 monId, u8 bytes, void *data) +// Unused +static void BtlController_EmitSetRawMonData(u8 bufferId, u8 monId, u8 bytes, void *data) { s32 i; @@ -1017,7 +1018,8 @@ void BtlController_EmitFaintAnimation(u8 bufferId) PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } -void BtlController_EmitPaletteFade(u8 bufferId) +// Unused +static void BtlController_EmitPaletteFade(u8 bufferId) { sBattleBuffersTransferData[0] = CONTROLLER_PALETTEFADE; sBattleBuffersTransferData[1] = CONTROLLER_PALETTEFADE; @@ -1026,7 +1028,8 @@ void BtlController_EmitPaletteFade(u8 bufferId) PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } -void BtlController_EmitSuccessBallThrowAnim(u8 bufferId) +// Unused +static void BtlController_EmitSuccessBallThrowAnim(u8 bufferId) { sBattleBuffersTransferData[0] = CONTROLLER_SUCCESSBALLTHROWANIM; sBattleBuffersTransferData[1] = CONTROLLER_SUCCESSBALLTHROWANIM; @@ -1042,7 +1045,8 @@ void BtlController_EmitBallThrowAnim(u8 bufferId, u8 caseId) PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 2); } -void BtlController_EmitPause(u8 bufferId, u8 toWait, void *data) +// Unused +static void BtlController_EmitPause(u8 bufferId, u8 toWait, void *data) { s32 i; @@ -1099,7 +1103,7 @@ void BtlController_EmitPrintString(u8 bufferId, u16 stringID) stringInfo->lastItem = gLastUsedItem; stringInfo->lastAbility = gLastUsedAbility; stringInfo->scrActive = gBattleScripting.battler; - stringInfo->unk1605E = gBattleStruct->field_52; + stringInfo->bakScriptPartyIdx = gBattleStruct->scriptPartyIdx; stringInfo->hpScale = gBattleStruct->hpScale; stringInfo->itemEffectBattler = gPotentialItemEffectBattler; stringInfo->moveType = gBattleMoves[gCurrentMove].type; @@ -1131,7 +1135,7 @@ void BtlController_EmitPrintSelectionString(u8 bufferId, u16 stringID) stringInfo->lastItem = gLastUsedItem; stringInfo->lastAbility = gLastUsedAbility; stringInfo->scrActive = gBattleScripting.battler; - stringInfo->unk1605E = gBattleStruct->field_52; + stringInfo->bakScriptPartyIdx = gBattleStruct->scriptPartyIdx; for (i = 0; i < MAX_BATTLERS_COUNT; i++) stringInfo->abilities[i] = gBattleMons[i].ability; @@ -1202,7 +1206,8 @@ void BtlController_EmitChoosePokemon(u8 bufferId, u8 caseId, u8 slotId, u16 abil PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 8); // Only 7 bytes were written. } -void BtlController_EmitCmd23(u8 bufferId) +// Unused +static void BtlController_EmitCmd23(u8 bufferId) { sBattleBuffersTransferData[0] = CONTROLLER_23; sBattleBuffersTransferData[1] = CONTROLLER_23; @@ -1257,7 +1262,8 @@ void BtlController_EmitStatusAnimation(u8 bufferId, bool8 status2, u32 status) PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 6); } -void BtlController_EmitStatusXor(u8 bufferId, u8 b) +// Unused +static void BtlController_EmitStatusXor(u8 bufferId, u8 b) { sBattleBuffersTransferData[0] = CONTROLLER_STATUSXOR; sBattleBuffersTransferData[1] = b; @@ -1277,7 +1283,8 @@ void BtlController_EmitDataTransfer(u8 bufferId, u16 size, void *data) PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, size + 4); } -void BtlController_EmitDMA3Transfer(u8 bufferId, void *dst, u16 size, void *data) +// Unused +static void BtlController_EmitDMA3Transfer(u8 bufferId, void *dst, u16 size, void *data) { s32 i; @@ -1294,7 +1301,7 @@ void BtlController_EmitDMA3Transfer(u8 bufferId, void *dst, u16 size, void *data } // Unused -void BtlController_EmitPlayBGM(u8 bufferId, u16 songId, void *data) +static void BtlController_EmitPlayBGM(u8 bufferId, u16 songId, void *data) { s32 i; @@ -1309,7 +1316,8 @@ void BtlController_EmitPlayBGM(u8 bufferId, u16 songId, void *data) PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, songId + 3); } -void BtlController_EmitCmd32(u8 bufferId, u16 size, void *data) +// Unused +static void BtlController_EmitCmd32(u8 bufferId, u16 size, void *data) { s32 i; @@ -1361,7 +1369,8 @@ void BtlController_EmitOneReturnValue_Duplicate(u8 bufferId, u16 ret) PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } -void BtlController_EmitClearUnkVar(u8 bufferId) +// Unused +static void BtlController_EmitClearUnkVar(u8 bufferId) { sBattleBuffersTransferData[0] = CONTROLLER_CLEARUNKVAR; sBattleBuffersTransferData[1] = CONTROLLER_CLEARUNKVAR; @@ -1370,14 +1379,16 @@ void BtlController_EmitClearUnkVar(u8 bufferId) PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } -void BtlController_EmitSetUnkVar(u8 bufferId, u8 b) +// Unused +static void BtlController_EmitSetUnkVar(u8 bufferId, u8 b) { sBattleBuffersTransferData[0] = CONTROLLER_SETUNKVAR; sBattleBuffersTransferData[1] = b; PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 2); } -void BtlController_EmitClearUnkFlag(u8 bufferId) +// Unused +static void BtlController_EmitClearUnkFlag(u8 bufferId) { sBattleBuffersTransferData[0] = CONTROLLER_CLEARUNKFLAG; sBattleBuffersTransferData[1] = CONTROLLER_CLEARUNKFLAG; @@ -1386,7 +1397,8 @@ void BtlController_EmitClearUnkFlag(u8 bufferId) PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } -void BtlController_EmitToggleUnkFlag(u8 bufferId) +// Unused +static void BtlController_EmitToggleUnkFlag(u8 bufferId) { sBattleBuffersTransferData[0] = CONTROLLER_TOGGLEUNKFLAG; sBattleBuffersTransferData[1] = CONTROLLER_TOGGLEUNKFLAG; diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index d832ebbc1c..37dbf0aab6 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -259,7 +259,7 @@ u16 ChooseMoveAndTargetInBattlePalace(void) else if (moveTarget == MOVE_TARGET_SELECTED) chosenMoveId |= GetBattlePalaceTarget(); else - chosenMoveId |= (GetBattlerAtPosition((GetBattlerPosition(gActiveBattler) & BIT_SIDE) ^ BIT_SIDE) << 8); + chosenMoveId |= (GetBattlerAtPosition(BATTLE_OPPOSITE(GET_BATTLER_SIDE(gActiveBattler))) << 8); return chosenMoveId; } @@ -315,7 +315,7 @@ static u16 GetBattlePalaceTarget(void) } if (gBattleMons[opposing1].hp == gBattleMons[opposing2].hp) - return (((gActiveBattler & BIT_SIDE) ^ BIT_SIDE) + (Random() & 2)) << 8; + return (BATTLE_OPPOSITE(gActiveBattler & BIT_SIDE) + (Random() & 2)) << 8; switch (gBattlePalaceNatureToMoveTarget[GetNatureFromPersonality(gBattleMons[gActiveBattler].personality)]) { @@ -330,11 +330,11 @@ static u16 GetBattlePalaceTarget(void) else return opposing2 << 8; case PALACE_TARGET_RANDOM: - return (((gActiveBattler & BIT_SIDE) ^ BIT_SIDE) + (Random() & 2)) << 8; + return (BATTLE_OPPOSITE(gActiveBattler & BIT_SIDE) + (Random() & 2)) << 8; } } - return (gActiveBattler ^ BIT_SIDE) << 8; + return BATTLE_OPPOSITE(gActiveBattler) << 8; } // Wait for the pokemon to finish appearing out from the pokeball on send out @@ -1019,7 +1019,7 @@ void HandleLowHpMusicChange(struct Pokemon *mon, u8 battlerId) { if (!gBattleSpritesDataPtr->battlerData[battlerId].lowHpSong) { - if (!gBattleSpritesDataPtr->battlerData[battlerId ^ BIT_FLANK].lowHpSong) + if (!gBattleSpritesDataPtr->battlerData[BATTLE_PARTNER(battlerId)].lowHpSong) PlaySE(SE_LOW_HEALTH); gBattleSpritesDataPtr->battlerData[battlerId].lowHpSong = 1; } @@ -1032,7 +1032,7 @@ void HandleLowHpMusicChange(struct Pokemon *mon, u8 battlerId) m4aSongNumStop(SE_LOW_HEALTH); return; } - if (IsDoubleBattle() && !gBattleSpritesDataPtr->battlerData[battlerId ^ BIT_FLANK].lowHpSong) + if (IsDoubleBattle() && !gBattleSpritesDataPtr->battlerData[BATTLE_PARTNER(battlerId)].lowHpSong) { m4aSongNumStop(SE_LOW_HEALTH); return; @@ -1046,7 +1046,7 @@ void BattleStopLowHpSound(void) gBattleSpritesDataPtr->battlerData[playerBattler].lowHpSong = 0; if (IsDoubleBattle()) - gBattleSpritesDataPtr->battlerData[playerBattler ^ BIT_FLANK].lowHpSong = 0; + gBattleSpritesDataPtr->battlerData[BATTLE_PARTNER(playerBattler)].lowHpSong = 0; m4aSongNumStop(SE_LOW_HEALTH); } diff --git a/src/battle_interface.c b/src/battle_interface.c index 545808fb5c..5be969105f 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -1033,10 +1033,10 @@ void UpdateOamPriorityInAllHealthboxes(u8 priority, bool32 hideHPBoxes) if (indicatorSpriteId != 0xFF) gSprites[indicatorSpriteId].oam.priority = priority; - #if B_HIDE_HEALTHBOX_IN_ANIMS + #if B_HIDE_HEALTHBOX_IN_ANIMS if (hideHPBoxes && IsBattlerAlive(i)) TryToggleHealboxVisibility(priority, healthboxLeftSpriteId, healthboxRightSpriteId, healthbarSpriteId, indicatorSpriteId); - #endif + #endif } } @@ -3119,10 +3119,11 @@ static void RestoreOverwrittenPixels(u8 *tiles) void CreateAbilityPopUp(u8 battlerId, u32 ability, bool32 isDoubleBattle) { +#if B_ABILITY_POP_UP == TRUE const s16 (*coords)[2]; u8 spriteId1, spriteId2, battlerPosition, taskId; - if (!B_ABILITY_POP_UP) + return; if (gBattleScripting.abilityPopupOverwrite != 0) @@ -3189,6 +3190,7 @@ void CreateAbilityPopUp(u8 battlerId, u32 ability, bool32 isDoubleBattle) PrintBattlerOnAbilityPopUp(battlerId, spriteId1, spriteId2); PrintAbilityOnAbilityPopUp(ability, spriteId1, spriteId2); RestoreOverwrittenPixels((void*)(OBJ_VRAM0) + (gSprites[spriteId1].oam.tileNum * 32)); +#endif } void UpdateAbilityPopup(u8 battlerId) diff --git a/src/battle_main.c b/src/battle_main.c index 72c1b58167..c71a7b4985 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -3362,10 +3362,11 @@ static void DoBattleIntro(void) } else // Skip party summary since it is a wild battle. { - if (B_FAST_INTRO) - *state = 7; // Don't wait for sprite, print message at the same time. - else - *state = 6; // Wait for sprite to load. + #if B_FAST_INTRO == TRUE + *state = 7; // Don't wait for sprite, print message at the same time. + #else + *state = 6; // Wait for sprite to load. + #endif } break; case 5: // draw party summary in trainer battles @@ -3434,10 +3435,11 @@ static void DoBattleIntro(void) } else { - if (B_FAST_INTRO) - *state = 15; // Wait for text to be printed. - else - *state = 14; // Wait for text and sprite. + #if B_FAST_INTRO == TRUE + *state = 15; // Wait for text to be printed. + #else + *state = 14; // Wait for text and sprite. + #endif } } break; @@ -3475,9 +3477,11 @@ static void DoBattleIntro(void) BtlController_EmitIntroTrainerBallThrow(BUFFER_A); MarkBattlerForControllerExec(gActiveBattler); } - if (B_FAST_INTRO && !(gBattleTypeFlags & (BATTLE_TYPE_RECORDED | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_RECORDED_IS_MASTER | BATTLE_TYPE_LINK))) + #if B_FAST_INTRO == TRUE + if (!(gBattleTypeFlags & (BATTLE_TYPE_RECORDED | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_RECORDED_IS_MASTER | BATTLE_TYPE_LINK))) *state = 15; // Print at the same time as trainer sends out second mon. else + #endif (*state)++; break; case 14: // wait for opponent 2 send out @@ -3497,13 +3501,14 @@ static void DoBattleIntro(void) gActiveBattler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); // A hack that makes fast intro work in trainer battles too. - if (B_FAST_INTRO - && gBattleTypeFlags & BATTLE_TYPE_TRAINER + #if B_FAST_INTRO == TRUE + if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && !(gBattleTypeFlags & (BATTLE_TYPE_RECORDED | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_RECORDED_IS_MASTER | BATTLE_TYPE_LINK)) && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_SIDE]].callback == SpriteCallbackDummy) { return; } + #endif PrepareStringBattle(STRINGID_INTROSENDOUT, gActiveBattler); } @@ -4001,6 +4006,16 @@ static void HandleTurnActionSelectionState(void) } break; case B_ACTION_USE_ITEM: + if (FlagGet(B_FLAG_NO_BAG_USE)) + { + RecordedBattle_ClearBattlerAction(gActiveBattler, 1); + gSelectionBattleScripts[gActiveBattler] = BattleScript_ActionSelectionItemsCantBeUsed; + gBattleCommunication[gActiveBattler] = STATE_SELECTION_SCRIPT; + *(gBattleStruct->selectionScriptFinished + gActiveBattler) = FALSE; + *(gBattleStruct->stateIdAfterSelScript + gActiveBattler) = STATE_BEFORE_ACTION_CHOSEN; + return; + } + if ((gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_FRONTIER_NO_PYRAMID | BATTLE_TYPE_EREADER_TRAINER @@ -4266,7 +4281,7 @@ static void HandleTurnActionSelectionState(void) if (((gBattleTypeFlags & BATTLE_TYPE_MULTI) || !(gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) || (position & BIT_FLANK) != B_FLANK_LEFT - || (*(&gBattleStruct->absentBattlerFlags) & gBitTable[GetBattlerAtPosition(position ^ BIT_FLANK)])) + || (*(&gBattleStruct->absentBattlerFlags) & gBitTable[GetBattlerAtPosition(BATTLE_PARTNER(position))])) { BtlController_EmitLinkStandbyMsg(BUFFER_A, LINK_STANDBY_MSG_STOP_BOUNCE, i); } @@ -4386,9 +4401,9 @@ static void UpdateBattlerPartyOrdersOnSwitch(void) *(gActiveBattler * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) |= (gBattleResources->bufferB[gActiveBattler][2] & 0xF0); *(gActiveBattler * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 1) = gBattleResources->bufferB[gActiveBattler][3]; - *((gActiveBattler ^ BIT_FLANK) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) &= (0xF0); - *((gActiveBattler ^ BIT_FLANK) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) |= (gBattleResources->bufferB[gActiveBattler][2] & 0xF0) >> 4; - *((gActiveBattler ^ BIT_FLANK) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 2) = gBattleResources->bufferB[gActiveBattler][3]; + *((BATTLE_PARTNER(gActiveBattler)) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) &= (0xF0); + *((BATTLE_PARTNER(gActiveBattler)) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) |= (gBattleResources->bufferB[gActiveBattler][2] & 0xF0) >> 4; + *((BATTLE_PARTNER(gActiveBattler)) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 2) = gBattleResources->bufferB[gActiveBattler][3]; } } @@ -4457,7 +4472,11 @@ u32 GetBattlerTotalSpeedStat(u8 battlerId) // paralysis drop if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS && ability != ABILITY_QUICK_FEET) - speed /= (B_PARALYSIS_SPEED >= GEN_7 ? 2 : 4); + #if B_PARALYSIS_SPEED >= GEN_7 + speed /= 2; + #else + speed /= 4; + #endif return speed; } @@ -4482,8 +4501,10 @@ s8 GetMovePriority(u32 battlerId, u16 move) priority = gBattleMoves[move].priority; if (ability == ABILITY_GALE_WINGS - && gBattleMoves[move].type == TYPE_FLYING - && (B_GALE_WINGS <= GEN_6 || BATTLER_MAX_HP(battlerId))) + #if B_GALE_WINGS >= GEN_7 + && BATTLER_MAX_HP(battlerId) + #endif + && gBattleMoves[move].type == TYPE_FLYING) { priority++; } @@ -5130,10 +5151,10 @@ static void HandleEndTurn_FinishBattle(void) RecordedBattle_SetPlaybackFinished(); BeginFastPaletteFade(3); FadeOutMapMusic(5); - #if B_TRAINERS_KNOCK_OFF_ITEMS + #if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) TryRestoreStolenItems(); - #endif + #endif for (i = 0; i < PARTY_SIZE; i++) { UndoMegaEvolution(i); @@ -5175,7 +5196,10 @@ static void FreeResetData_ReturnToOvOrDoEvolutions(void) | BATTLE_TYPE_FRONTIER | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_WALLY_TUTORIAL)) - && (B_EVOLUTION_AFTER_WHITEOUT >= GEN_6 || gBattleOutcome == B_OUTCOME_WON || gBattleOutcome == B_OUTCOME_CAUGHT)) + #if B_EVOLUTION_AFTER_WHITEOUT <= GEN_5 + && (gBattleOutcome == B_OUTCOME_WON || gBattleOutcome == B_OUTCOME_CAUGHT) + #endif + ) { gBattleMainFunc = TrySpecialEvolution; } @@ -5460,5 +5484,9 @@ void SetTotemBoost(void) bool32 IsWildMonSmart(void) { - return (B_SMART_WILD_AI_FLAG != 0 && FlagGet(B_SMART_WILD_AI_FLAG)); +#if B_SMART_WILD_AI_FLAG != 0 + return (FlagGet(B_SMART_WILD_AI_FLAG)); +#else + return FALSE; +#endif } diff --git a/src/battle_message.c b/src/battle_message.c index 91eeb4ad6e..8298accf1f 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -1947,7 +1947,7 @@ const u8 gText_OpponentMon1Name[] = _("{B_OPPONENT_MON1_NAME}"); const u8 gText_Mind[] = _("Mind"); const u8 gText_Skill[] = _("Skill"); const u8 gText_Body[] = _("Body"); -const u8 gText_Judgement[] = _("{B_BUFF1}{CLEAR 13}Judgment{CLEAR 13}{B_BUFF2}"); +const u8 gText_Judgment[] = _("{B_BUFF1}{CLEAR 13}Judgment{CLEAR 13}{B_BUFF2}"); static const u8 sText_TwoTrainersSentPkmn[] = _("{B_TRAINER1_CLASS} {B_TRAINER1_NAME} sent\nout {B_OPPONENT_MON1_NAME}!\p{B_TRAINER2_CLASS} {B_TRAINER2_NAME} sent\nout {B_OPPONENT_MON2_NAME}!"); static const u8 sText_Trainer2SentOutPkmn[] = _("{B_TRAINER2_CLASS} {B_TRAINER2_NAME} sent\nout {B_BUFF1}!"); static const u8 sText_TwoTrainersWantToBattle[] = _("{B_TRAINER1_CLASS} {B_TRAINER1_NAME} and\n{B_TRAINER2_CLASS} {B_TRAINER2_NAME}\lwant to battle!\p"); @@ -2600,7 +2600,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] = .bgColor = TEXT_DYNAMIC_COLOR_5, .shadowColor = TEXT_DYNAMIC_COLOR_6, }, - [ARENA_WIN_JUDGEMENT_TITLE] = { + [ARENA_WIN_JUDGMENT_TITLE] = { .fillValue = PIXEL_FILL(0xE), .fontId = FONT_NORMAL, .x = -1, @@ -2612,7 +2612,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] = .bgColor = TEXT_DYNAMIC_COLOR_5, .shadowColor = TEXT_DYNAMIC_COLOR_6, }, - [ARENA_WIN_JUDGEMENT_TEXT] = { + [ARENA_WIN_JUDGMENT_TEXT] = { .fillValue = PIXEL_FILL(0x1), .fontId = FONT_NORMAL, .x = 0, @@ -2643,7 +2643,7 @@ void BufferStringBattle(u16 stringID) gLastUsedItem = gBattleMsgDataPtr->lastItem; gLastUsedAbility = gBattleMsgDataPtr->lastAbility; gBattleScripting.battler = gBattleMsgDataPtr->scrActive; - gBattleStruct->field_52 = gBattleMsgDataPtr->unk1605E; + gBattleStruct->scriptPartyIdx = gBattleMsgDataPtr->bakScriptPartyIdx; gBattleStruct->hpScale = gBattleMsgDataPtr->hpScale; gPotentialItemEffectBattler = gBattleMsgDataPtr->itemEffectBattler; gBattleStruct->stringMoveType = gBattleMsgDataPtr->moveType; @@ -2703,7 +2703,7 @@ void BufferStringBattle(u16 stringID) { if (gBattleTypeFlags & BATTLE_TYPE_LEGENDARY) stringPtr = sText_LegendaryPkmnAppeared; - else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && IsValidForBattle(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]])) // interesting, looks like they had something planned for wild double battles + else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && IsValidForBattle(&gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]])) // interesting, looks like they had something planned for wild double battles stringPtr = sText_TwoWildPkmnAppeared; else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL) stringPtr = sText_WildPkmnAppearedPause; @@ -2714,7 +2714,7 @@ void BufferStringBattle(u16 stringID) case STRINGID_INTROSENDOUT: // poke first send-out if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) { - if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && IsValidForBattle(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]])) + if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && IsValidForBattle(&gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]])) { if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) stringPtr = sText_InGamePartnerSentOutZGoN; @@ -2732,7 +2732,7 @@ void BufferStringBattle(u16 stringID) } else { - if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && IsValidForBattle(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]])) + if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && IsValidForBattle(&gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]])) { if (BATTLE_TWO_VS_ONE_OPPONENT) stringPtr = sText_Trainer1SentOutTwoPkmn; @@ -3403,11 +3403,11 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst) dstID++; toCpy++; } - GetMonData(&gEnemyParty[gBattleStruct->field_52], MON_DATA_NICKNAME, text); + GetMonData(&gEnemyParty[gBattleStruct->scriptPartyIdx], MON_DATA_NICKNAME, text); } else { - GetMonData(&gPlayerParty[gBattleStruct->field_52], MON_DATA_NICKNAME, text); + GetMonData(&gPlayerParty[gBattleStruct->scriptPartyIdx], MON_DATA_NICKNAME, text); } StringGet_Nickname(text); toCpy = text; @@ -3851,7 +3851,7 @@ void BattlePutTextOnWindow(const u8 *text, u8 windowId) printerTemplate.x = printerTemplate.currentX = alignX; } - if (windowId == ARENA_WIN_JUDGEMENT_TEXT) + if (windowId == ARENA_WIN_JUDGMENT_TEXT) gTextFlags.useAlternateDownArrow = FALSE; else gTextFlags.useAlternateDownArrow = TRUE; @@ -3861,7 +3861,7 @@ void BattlePutTextOnWindow(const u8 *text, u8 windowId) else gTextFlags.autoScroll = FALSE; - if (windowId == B_WIN_MSG || windowId == ARENA_WIN_JUDGEMENT_TEXT) + if (windowId == B_WIN_MSG || windowId == ARENA_WIN_JUDGMENT_TEXT) { if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK)) speed = 1; diff --git a/src/battle_pike.c b/src/battle_pike.c index 229f6211ba..3519bb2ce2 100644 --- a/src/battle_pike.c +++ b/src/battle_pike.c @@ -813,6 +813,9 @@ static bool8 DoesAbilityPreventStatus(struct Pokemon *mon, u32 status) u16 ability = GetMonAbility(mon); bool8 ret = FALSE; + if (ability == ABILITY_COMATOSE) + return TRUE; + switch (status) { case STATUS1_FREEZE: @@ -856,8 +859,10 @@ static bool8 DoesTypePreventStatus(u16 species, u32 status) break; case STATUS1_PARALYSIS: if (gBaseStats[species].type1 == TYPE_GROUND || gBaseStats[species].type2 == TYPE_GROUND - || (B_PARALYZE_ELECTRIC >= GEN_6 && - (gBaseStats[species].type1 == TYPE_ELECTRIC || gBaseStats[species].type2 == TYPE_ELECTRIC))) + #if B_PARALYZE_ELECTRIC >= GEN_6 + || gBaseStats[species].type1 == TYPE_ELECTRIC || gBaseStats[species].type2 == TYPE_ELECTRIC + #endif + ) ret = TRUE; break; case STATUS1_BURN: diff --git a/src/battle_pyramid_bag.c b/src/battle_pyramid_bag.c index 9fab996da8..7a4d981f01 100644 --- a/src/battle_pyramid_bag.c +++ b/src/battle_pyramid_bag.c @@ -1404,20 +1404,20 @@ void TryStoreHeldItemsInPyramidBag(void) { u8 i; struct Pokemon *party = gPlayerParty; - u16 *newItems = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(u16)); - u8 *newQuantities = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(u8)); + u16 *newItems = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(*newItems)); + u8 *newQuantities = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(*newQuantities)); u16 heldItem; - memcpy(newItems, gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode], PYRAMID_BAG_ITEMS_COUNT * sizeof(u16)); - memcpy(newQuantities, gSaveBlock2Ptr->frontier.pyramidBag.quantity[gSaveBlock2Ptr->frontier.lvlMode], PYRAMID_BAG_ITEMS_COUNT * sizeof(u8)); + memcpy(newItems, gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode], PYRAMID_BAG_ITEMS_COUNT * sizeof(*newItems)); + memcpy(newQuantities, gSaveBlock2Ptr->frontier.pyramidBag.quantity[gSaveBlock2Ptr->frontier.lvlMode], PYRAMID_BAG_ITEMS_COUNT * sizeof(*newQuantities)); for (i = 0; i < FRONTIER_PARTY_SIZE; i++) { heldItem = GetMonData(&party[i], MON_DATA_HELD_ITEM); if (heldItem != ITEM_NONE && !AddBagItem(heldItem, 1)) { // Cant store party held items in pyramid bag because bag is full - memcpy(gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode], newItems, PYRAMID_BAG_ITEMS_COUNT * sizeof(u16)); - memcpy(gSaveBlock2Ptr->frontier.pyramidBag.quantity[gSaveBlock2Ptr->frontier.lvlMode], newQuantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(u8)); + memcpy(gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode], newItems, PYRAMID_BAG_ITEMS_COUNT * sizeof(*newItems)); + memcpy(gSaveBlock2Ptr->frontier.pyramidBag.quantity[gSaveBlock2Ptr->frontier.lvlMode], newQuantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(*newQuantities)); Free(newItems); Free(newQuantities); gSpecialVar_Result = 1; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 2b65a61a07..b03220066d 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -548,8 +548,8 @@ static void Cmd_switchoutabilities(void); static void Cmd_jumpifhasnohp(void); static void Cmd_getsecretpowereffect(void); static void Cmd_pickup(void); -static void Cmd_docastformchangeanimation(void); -static void Cmd_trycastformdatachange(void); +static void Cmd_doweatherformchangeanimation(void); +static void Cmd_tryweatherformdatachange(void); static void Cmd_settypebasedhalvers(void); static void Cmd_jumpifsubstituteblocks(void); static void Cmd_tryrecycleitem(void); @@ -807,8 +807,8 @@ void (* const gBattleScriptingCommandsTable[])(void) = Cmd_jumpifhasnohp, //0xE3 Cmd_getsecretpowereffect, //0xE4 Cmd_pickup, //0xE5 - Cmd_docastformchangeanimation, //0xE6 - Cmd_trycastformdatachange, //0xE7 + Cmd_doweatherformchangeanimation, //0xE6 + Cmd_tryweatherformdatachange, //0xE7 Cmd_settypebasedhalvers, //0xE8 Cmd_jumpifsubstituteblocks, //0xE9 Cmd_tryrecycleitem, //0xEA @@ -1396,10 +1396,10 @@ static void Cmd_attackcanceler(void) gBattlescriptCurrInstr = BattleScript_MoveEnd; return; } - #if (B_STANCE_CHANGE_FAIL <= GEN_6) +#if B_STANCE_CHANGE_FAIL <= GEN_6 if (TryAegiFormChange()) return; - #endif +#endif if (AtkCanceller_UnableToUseMove()) return; @@ -1431,10 +1431,10 @@ static void Cmd_attackcanceler(void) gMoveResultFlags |= MOVE_RESULT_MISSED; return; } - #if (B_STANCE_CHANGE_FAIL >= GEN_7) +#if B_STANCE_CHANGE_FAIL >= GEN_7 if (TryAegiFormChange()) return; - #endif +#endif gHitMarker &= ~HITMARKER_ALLOW_NO_PP; @@ -1467,7 +1467,6 @@ static void Cmd_attackcanceler(void) && !gProtectStructs[gBattlerAttacker].usesBouncedMove) { PressurePPLose(gBattlerAttacker, gBattlerTarget, MOVE_MAGIC_COAT); - gProtectStructs[gBattlerTarget].bounceMove = FALSE; gProtectStructs[gBattlerTarget].usesBouncedMove = TRUE; gBattleCommunication[MULTISTRING_CHOOSER] = 0; if (BlocksPrankster(gCurrentMove, gBattlerTarget, gBattlerAttacker, TRUE)) @@ -1602,13 +1601,13 @@ static bool32 AccuracyCalcHelper(u16 move) JumpIfMoveFailed(7, move); return TRUE; } - else if (B_TOXIC_NEVER_MISS >= GEN_6 - && gBattleMoves[move].effect == EFFECT_TOXIC - && IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_POISON)) +#if B_TOXIC_NEVER_MISS >= GEN_6 + else if (gBattleMoves[move].effect == EFFECT_TOXIC && IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_POISON)) { JumpIfMoveFailed(7, move); return TRUE; } +#endif // If the attacker has the ability No Guard and they aren't targeting a Pokemon involved in a Sky Drop with the move Sky Drop, move hits. else if (GetBattlerAbility(gBattlerAttacker) == ABILITY_NO_GUARD && (move != MOVE_SKY_DROP || gBattleStruct->skyDropTargets[gBattlerTarget] == 0xFF)) { @@ -1640,14 +1639,40 @@ static bool32 AccuracyCalcHelper(u16 move) return TRUE; } - if ((WEATHER_HAS_EFFECT && - ((IsBattlerWeatherAffected(gBattlerTarget, B_WEATHER_RAIN) && (gBattleMoves[move].effect == EFFECT_THUNDER || gBattleMoves[move].effect == EFFECT_HURRICANE)) - || ((B_BLIZZARD_HAIL >= GEN_4 && (gBattleWeather & B_WEATHER_HAIL) && move == MOVE_BLIZZARD)))) - || (gBattleMoves[move].effect == EFFECT_VITAL_THROW) - || (gBattleMoves[move].accuracy == 0) - || ((B_MINIMIZE_DMG_ACC >= GEN_6) && (gStatuses3[gBattlerTarget] & STATUS3_MINIMIZED) && (gBattleMoves[move].flags & FLAG_DMG_MINIMIZE))) + if (WEATHER_HAS_EFFECT) + { + if ((IsBattlerWeatherAffected(gBattlerTarget, B_WEATHER_RAIN) && (gBattleMoves[move].effect == EFFECT_THUNDER || gBattleMoves[move].effect == EFFECT_HURRICANE))) + { + // thunder/hurricane ignore acc checks in rain unless target is holding utility umbrella + JumpIfMoveFailed(7, move); + return TRUE; + } + #if B_BLIZZARD_HAIL >= GEN_4 + else if ((gBattleWeather & B_WEATHER_HAIL) && move == MOVE_BLIZZARD) + { + // thunder/hurricane ignore acc checks in rain unless target is holding utility umbrella + JumpIfMoveFailed(7, move); + return TRUE; + } + #endif + } + + if (gBattleMoves[move].effect == EFFECT_VITAL_THROW) + { + JumpIfMoveFailed(7, move); + return TRUE; + } + +#if B_MINIMIZE_DMG_ACC >= GEN_6 + if ((gStatuses3[gBattlerTarget] & STATUS3_MINIMIZED) && (gBattleMoves[move].flags & FLAG_DMG_MINIMIZE)) + { + JumpIfMoveFailed(7, move); + return TRUE; + } +#endif + + if (gBattleMoves[move].accuracy == 0) { - // thunder/hurricane ignore acc checks in rain unless target is holding utility umbrella JumpIfMoveFailed(7, move); return TRUE; } @@ -2927,7 +2952,11 @@ void SetMoveEffect(bool32 primary, u32 certain) BattleScriptPush(gBattlescriptCurrInstr + 1); if (sStatusFlagsForMoveEffects[gBattleScripting.moveEffect] == STATUS1_SLEEP) - gBattleMons[gEffectBattler].status1 |= (B_SLEEP_TURNS >= GEN_5) ? ((Random() % 3) + 2) : ((Random() % 4) + 3); + #if B_SLEEP_TURNS >= GEN_5 + gBattleMons[gEffectBattler].status1 |= ((Random() % 3) + 2); + #else + gBattleMons[gEffectBattler].status1 |= ((Random() % 4) + 3); + #endif else gBattleMons[gEffectBattler].status1 |= sStatusFlagsForMoveEffects[gBattleScripting.moveEffect]; @@ -3029,7 +3058,11 @@ void SetMoveEffect(bool32 primary, u32 certain) { gBattleMons[gEffectBattler].status2 |= STATUS2_MULTIPLETURNS; gLockedMoves[gEffectBattler] = gCurrentMove; - gBattleMons[gEffectBattler].status2 |= STATUS2_UPROAR_TURN(B_UPROAR_TURNS >= GEN_5 ? 3 : ((Random() & 3) + 2)); + #if B_UPROAR_TURNS >= GEN_5 + gBattleMons[gEffectBattler].status2 |= STATUS2_UPROAR_TURN(3); + #else + gBattleMons[gEffectBattler].status2 |= STATUS2_UPROAR_TURN((Random() & 3) + 2); + #endif BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = sMoveEffectBS_Ptrs[gBattleScripting.moveEffect]; @@ -3084,9 +3117,15 @@ void SetMoveEffect(bool32 primary, u32 certain) { gBattleMons[gEffectBattler].status2 |= STATUS2_WRAPPED; if (GetBattlerHoldEffect(gBattlerAttacker, TRUE) == HOLD_EFFECT_GRIP_CLAW) - gDisableStructs[gEffectBattler].wrapTurns = (B_BINDING_TURNS >= GEN_5) ? 7 : 5; + #if B_BINDING_TURNS >= GEN_5 + gDisableStructs[gEffectBattler].wrapTurns = 7; else - gDisableStructs[gEffectBattler].wrapTurns = (B_BINDING_TURNS >= GEN_5) ? ((Random() % 2) + 4) : ((Random() % 4) + 2); + gDisableStructs[gEffectBattler].wrapTurns = (Random() % 2) + 4; + #else + gDisableStructs[gEffectBattler].wrapTurns = 5; + else + gDisableStructs[gEffectBattler].wrapTurns = (Random() % 4) + 2; + #endif gBattleStruct->wrappedMove[gEffectBattler] = gCurrentMove; gBattleStruct->wrappedBy[gEffectBattler] = gBattlerAttacker; @@ -3501,8 +3540,11 @@ void SetMoveEffect(bool32 primary, u32 certain) gBattlescriptCurrInstr++; break; case MOVE_EFFECT_INCINERATE: - if ((B_INCINERATE_GEMS >= GEN_6 && GetBattlerHoldEffect(gEffectBattler, FALSE) == HOLD_EFFECT_GEMS) - || (gBattleMons[gEffectBattler].item >= FIRST_BERRY_INDEX && gBattleMons[gEffectBattler].item <= LAST_BERRY_INDEX)) + if ((gBattleMons[gEffectBattler].item >= FIRST_BERRY_INDEX && gBattleMons[gEffectBattler].item <= LAST_BERRY_INDEX) + #if B_INCINERATE_GEMS >= GEN_6 + || (GetBattlerHoldEffect(gEffectBattler, FALSE) == HOLD_EFFECT_GEMS) + #endif + ) { gLastUsedItem = gBattleMons[gEffectBattler].item; gBattleMons[gEffectBattler].item = 0; @@ -4046,13 +4088,20 @@ static void Cmd_getexp(void) gBattleMoveDamage = 0; // only give exp share bonus in later gens if the mon wasn't sent out - if ((holdEffect == HOLD_EFFECT_EXP_SHARE) && ((gBattleMoveDamage == 0) || (B_SPLIT_EXP < GEN_6))) + #if B_SPLIT_EXP < GEN_6 + if (holdEffect == HOLD_EFFECT_EXP_SHARE) gBattleMoveDamage += gExpShareExp; + #else + if (holdEffect == HOLD_EFFECT_EXP_SHARE && gBattleMoveDamage == 0) + gBattleMoveDamage += gExpShareExp; + #endif if (holdEffect == HOLD_EFFECT_LUCKY_EGG) gBattleMoveDamage = (gBattleMoveDamage * 150) / 100; - if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && B_TRAINER_EXP_MULTIPLIER <= GEN_7) + #if B_TRAINER_EXP_MULTIPLIER <= GEN_7 + if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) gBattleMoveDamage = (gBattleMoveDamage * 150) / 100; - #if (B_SCALED_EXP >= GEN_5) && (B_SCALED_EXP != GEN_6) + #endif + #if (B_SCALED_EXP >= GEN_5) && (B_SCALED_EXP != GEN_6) { // Note: There is an edge case where if a pokemon receives a large amount of exp, it wouldn't be properly calculated // because of multiplying by scaling factor(the value would simply be larger than an u32 can hold). Hence u64 is needed. @@ -4061,7 +4110,7 @@ static void Cmd_getexp(void) value /= sExperienceScalingFactors[gBattleMons[gBattlerFainted].level + GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_LEVEL) + 10]; gBattleMoveDamage = value + 1; } - #endif + #endif #if B_AFFECTION_MECHANICS == TRUE if (GetMonFriendshipScore(&gPlayerParty[gBattleStruct->expGetterMonId]) >= FRIENDSHIP_50_TO_99) gBattleMoveDamage = (gBattleMoveDamage * 120) / 100; @@ -4766,14 +4815,14 @@ static void Cmd_playanimation(void) gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]); argumentPtr = T2_READ_PTR(gBattlescriptCurrInstr + 3); - #if B_TERRAIN_BG_CHANGE == FALSE +#if B_TERRAIN_BG_CHANGE == FALSE if (animId == B_ANIM_RESTORE_BG) { // workaround for .if not working gBattlescriptCurrInstr += 7; return; } - #endif +#endif if (animId == B_ANIM_STATS_CHANGE || animId == B_ANIM_SNATCH_MOVE @@ -5035,6 +5084,20 @@ static bool32 TryKnockOffBattleScript(u32 battlerDef) return FALSE; } +static u32 GetNextTarget(u32 moveTarget) +{ + u32 i; + for (i = 0; i < MAX_BATTLERS_COUNT; i++) + { + if (i != gBattlerAttacker + && IsBattlerAlive(i) + && !(gBattleStruct->targetsDone[gBattlerAttacker] & gBitTable[i]) + && (GetBattlerSide(i) != GetBattlerSide(gBattlerAttacker) || moveTarget == MOVE_TARGET_FOES_AND_ALLY)) + break; + } + return i; +} + static void Cmd_moveend(void) { s32 i; @@ -5081,7 +5144,11 @@ static void Cmd_moveend(void) i = gBattlerAttacker; gBattlerAttacker = gBattlerTarget; gBattlerTarget = i; // gBattlerTarget and gBattlerAttacker are swapped in order to activate Defiant, if applicable - gBattleScripting.moveEffect = (B_KINGS_SHIELD_LOWER_ATK >= GEN_8) ? MOVE_EFFECT_ATK_MINUS_1 : MOVE_EFFECT_ATK_MINUS_2; + #if B_KINGS_SHIELD_LOWER_ATK >= GEN_8 + gBattleScripting.moveEffect = MOVE_EFFECT_ATK_MINUS_1; + #else + gBattleScripting.moveEffect = MOVE_EFFECT_ATK_MINUS_2; + #endif BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_KingsShieldEffect; effect = 1; @@ -5427,6 +5494,7 @@ static void Cmd_moveend(void) && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)) gProtectStructs[gBattlerAttacker].targetAffected = TRUE; + gBattleStruct->targetsDone[gBattlerAttacker] |= gBitTable[gBattlerTarget]; if (!(gHitMarker & HITMARKER_UNABLE_TO_USE_MOVE) && gBattleTypeFlags & BATTLE_TYPE_DOUBLE && !gProtectStructs[gBattlerAttacker].chargingTurn @@ -5434,28 +5502,12 @@ static void Cmd_moveend(void) || moveTarget == MOVE_TARGET_FOES_AND_ALLY) && !(gHitMarker & HITMARKER_NO_ATTACKSTRING)) { - u8 battlerId; + u32 nextTarget = GetNextTarget(moveTarget); + gHitMarker |= HITMARKER_NO_PPDEDUCT; - if (moveTarget == MOVE_TARGET_FOES_AND_ALLY) + if (nextTarget != MAX_BATTLERS_COUNT) { - gHitMarker |= HITMARKER_NO_PPDEDUCT; - for (battlerId = gBattlerTarget + 1; battlerId < gBattlersCount; battlerId++) - { - if (battlerId == gBattlerAttacker) - continue; - if (IsBattlerAlive(battlerId)) - break; - } - } - else - { - battlerId = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerTarget))); - gHitMarker |= HITMARKER_NO_ATTACKSTRING; - } - - if (IsBattlerAlive(battlerId)) - { - gBattleStruct->moveTarget[gBattlerAttacker] = gBattlerTarget = battlerId; // Fix for moxie spread moves + gBattleStruct->moveTarget[gBattlerAttacker] = gBattlerTarget = nextTarget; // Fix for moxie spread moves gBattleScripting.moveendState = 0; MoveValuesCleanUp(); gBattleScripting.moveEffect = gBattleScripting.savedMoveEffect; @@ -5463,11 +5515,31 @@ static void Cmd_moveend(void) gBattlescriptCurrInstr = BattleScript_FlushMessageBox; return; } - else + // Check if the move used was actually a bounced move. If so, we need to go back to the original attacker and make sure, its move hits all 2 or 3 pokemon. + else if (gProtectStructs[gBattlerAttacker].usesBouncedMove) { - gHitMarker |= HITMARKER_NO_ATTACKSTRING; - gHitMarker &= ~HITMARKER_NO_PPDEDUCT; + u8 originalBounceTarget = gBattlerAttacker; + gBattlerAttacker = gBattleStruct->attackerBeforeBounce; + gBattleStruct->targetsDone[gBattlerAttacker] |= gBitTable[originalBounceTarget]; + gBattleStruct->targetsDone[originalBounceTarget] = 0; + + nextTarget = GetNextTarget(moveTarget); + if (nextTarget != MAX_BATTLERS_COUNT) + { + // We found another target for the original move user. + gBattleStruct->moveTarget[gBattlerAttacker] = gBattlerTarget = nextTarget; + gBattleScripting.moveendState = 0; + gBattleScripting.animTurn = 0; + gBattleScripting.animTargetsHit = 0; + MoveValuesCleanUp(); + BattleScriptPush(gBattleScriptsForMoveEffects[gBattleMoves[gCurrentMove].effect]); + gBattlescriptCurrInstr = BattleScript_FlushMessageBox; + return; + } } + + gHitMarker |= HITMARKER_NO_ATTACKSTRING; + gHitMarker &= ~HITMARKER_NO_PPDEDUCT; } RecordLastUsedMoveBy(gBattlerAttacker, gCurrentMove); gBattleScripting.moveendState++; @@ -5651,36 +5723,63 @@ static void Cmd_moveend(void) BattleScriptPushCursor(); if (gBattleTypeFlags & BATTLE_TYPE_TRAINER || GetBattlerSide(i) == B_SIDE_PLAYER) { - if (B_ABILITY_POP_UP) - gBattlescriptCurrInstr = BattleScript_EmergencyExit; - else - gBattlescriptCurrInstr = BattleScript_EmergencyExitNoPopUp; + #if B_ABILITY_POP_UP == TRUE + gBattlescriptCurrInstr = BattleScript_EmergencyExit; + #else + gBattlescriptCurrInstr = BattleScript_EmergencyExitNoPopUp; + #endif } else { - if (B_ABILITY_POP_UP) - gBattlescriptCurrInstr = BattleScript_EmergencyExitWild; - else - gBattlescriptCurrInstr = BattleScript_EmergencyExitWildNoPopUp; + #if B_ABILITY_POP_UP == TRUE + gBattlescriptCurrInstr = BattleScript_EmergencyExitWild; + #else + gBattlescriptCurrInstr = BattleScript_EmergencyExitWildNoPopUp; + #endif } return; } } gBattleScripting.moveendState++; break; + case MOVEEND_WEATHER_FORM: + for (i = 0; i < MAX_BATTLERS_COUNT; i++) + { + switch (gBattleMons[i].species) + { + case SPECIES_CASTFORM: + case SPECIES_CHERRIM: +#ifdef POKEMON_EXPANSION + case SPECIES_CASTFORM_RAINY: + case SPECIES_CASTFORM_SNOWY: + case SPECIES_CASTFORM_SUNNY: + case SPECIES_CHERRIM_SUNSHINE: +#endif + effect = TryWeatherFormChange(i); + if (effect) + { + BattleScriptPushCursorAndCallback(BattleScript_WeatherFormChange); + gBattleScripting.battler = i; + gBattleStruct->formToChangeInto = effect - 1; + } + } + } + gBattleScripting.moveendState++; + break; case MOVEEND_CLEAR_BITS: // Clear/Set bits for things like using a move for all targets and all hits. if (gSpecialStatuses[gBattlerAttacker].instructedChosenTarget) *(gBattleStruct->moveTarget + gBattlerAttacker) = gSpecialStatuses[gBattlerAttacker].instructedChosenTarget & 0x3; if (gSpecialStatuses[gBattlerAttacker].dancerOriginalTarget) *(gBattleStruct->moveTarget + gBattlerAttacker) = gSpecialStatuses[gBattlerAttacker].dancerOriginalTarget & 0x3; - #if B_RAMPAGE_CANCELLING >= GEN_5 + #if B_RAMPAGE_CANCELLING >= GEN_5 if (gBattleMoves[gCurrentMove].effect == EFFECT_RAMPAGE // If we're rampaging && (gMoveResultFlags & MOVE_RESULT_NO_EFFECT) // And it is unusable && (gBattleMons[gBattlerAttacker].status2 & STATUS2_LOCK_CONFUSE) != STATUS2_LOCK_CONFUSE_TURN(1)) // And won't end this turn CancelMultiTurnMoves(gBattlerAttacker); // Cancel it - #endif + #endif + gBattleStruct->targetsDone[gBattlerAttacker] = 0; gProtectStructs[gBattlerAttacker].usesBouncedMove = FALSE; gProtectStructs[gBattlerAttacker].targetAffected = FALSE; gBattleStruct->ateBoost[gBattlerAttacker] = 0; @@ -6265,7 +6364,7 @@ static void Cmd_openpartyscreen(void) *(gBattleStruct->monToSwitchIntoId + gActiveBattler) = PARTY_SIZE; gBattleStruct->field_93 &= ~(gBitTable[gActiveBattler]); - BtlController_EmitChoosePokemon(BUFFER_A, hitmarkerFaintBits, *(gBattleStruct->monToSwitchIntoId + (gActiveBattler ^ 2)), ABILITY_NONE, gBattleStruct->battlerPartyOrders[gActiveBattler]); + BtlController_EmitChoosePokemon(BUFFER_A, hitmarkerFaintBits, *(gBattleStruct->monToSwitchIntoId + BATTLE_PARTNER(gActiveBattler)), ABILITY_NONE, gBattleStruct->battlerPartyOrders[gActiveBattler]); MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr += 6; @@ -6286,7 +6385,7 @@ static void Cmd_openpartyscreen(void) } else { - gActiveBattler = GetBattlerAtPosition(GetBattlerPosition(battlerId) ^ BIT_SIDE); + gActiveBattler = GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerPosition(battlerId))); if (gAbsentBattlerFlags & gBitTable[gActiveBattler]) gActiveBattler ^= BIT_FLANK; @@ -6342,9 +6441,9 @@ static void Cmd_switchhandleorder(void) *(gActiveBattler * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) |= (gBattleResources->bufferB[gActiveBattler][2] & 0xF0); *(gActiveBattler * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 1) = gBattleResources->bufferB[gActiveBattler][3]; - *((gActiveBattler ^ BIT_FLANK) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) &= (0xF0); - *((gActiveBattler ^ BIT_FLANK) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) |= (gBattleResources->bufferB[gActiveBattler][2] & 0xF0) >> 4; - *((gActiveBattler ^ BIT_FLANK) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 2) = gBattleResources->bufferB[gActiveBattler][3]; + *((BATTLE_PARTNER(gActiveBattler)) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) &= (0xF0); + *((BATTLE_PARTNER(gActiveBattler)) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) |= (gBattleResources->bufferB[gActiveBattler][2] & 0xF0) >> 4; + *((BATTLE_PARTNER(gActiveBattler)) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 2) = gBattleResources->bufferB[gActiveBattler][3]; } else if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) { @@ -6484,7 +6583,7 @@ static void Cmd_switchineffects(void) else { // There is a hack here to ensure the truant counter will be 0 when the battler's next turn starts. - // The truant counter is not updated in the case where a mon switches in after a lost judgement in the battle arena. + // The truant counter is not updated in the case where a mon switches in after a lost judgment in the battle arena. if (GetBattlerAbility(gActiveBattler) == ABILITY_TRUANT && gCurrentActionFuncId != B_ACTION_USE_MOVE && !gDisableStructs[gActiveBattler].truantSwitchInHack) @@ -6496,7 +6595,7 @@ static void Cmd_switchineffects(void) || ItemBattleEffects(ITEMEFFECT_ON_SWITCH_IN, gActiveBattler, FALSE) || AbilityBattleEffects(ABILITYEFFECT_INTIMIDATE2, 0, 0, 0, 0) || AbilityBattleEffects(ABILITYEFFECT_TRACE2, 0, 0, 0, 0) - || AbilityBattleEffects(ABILITYEFFECT_FORECAST, 0, 0, 0, 0)) + || AbilityBattleEffects(ABILITYEFFECT_WEATHER_FORM, 0, 0, 0, 0)) return; gSideStatuses[GetBattlerSide(gActiveBattler)] &= ~(SIDE_STATUS_SPIKES_DAMAGED | SIDE_STATUS_TOXIC_SPIKES_DAMAGED | SIDE_STATUS_STEALTH_ROCK_DAMAGED | SIDE_STATUS_STICKY_WEB_DAMAGED); @@ -7513,7 +7612,7 @@ static void Cmd_hpthresholds(void) if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) { gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]); - opposingBattler = gActiveBattler ^ BIT_SIDE; + opposingBattler = BATTLE_OPPOSITE(gActiveBattler); result = gBattleMons[opposingBattler].hp * 100 / gBattleMons[opposingBattler].maxHP; if (result == 0) @@ -7541,7 +7640,7 @@ static void Cmd_hpthresholds2(void) if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) { gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]); - opposingBattler = gActiveBattler ^ BIT_SIDE; + opposingBattler = BATTLE_OPPOSITE(gActiveBattler); hpSwitchout = *(gBattleStruct->hpOnSwitchout + GetBattlerSide(opposingBattler)); result = (hpSwitchout - gBattleMons[opposingBattler].hp) * 100 / hpSwitchout; @@ -8083,8 +8182,9 @@ static void Cmd_various(void) CancelMultiTurnMoves(gActiveBattler); break; case VARIOUS_SET_MAGIC_COAT_TARGET: + gBattleStruct->attackerBeforeBounce = gActiveBattler; gBattlerAttacker = gBattlerTarget; - side = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE; + side = BATTLE_OPPOSITE(GetBattlerSide(gBattlerAttacker)); if (IsAffectedByFollowMe(gBattlerAttacker, side, gCurrentMove)) gBattlerTarget = gSideTimers[side].followmeTarget; else @@ -8193,10 +8293,10 @@ static void Cmd_various(void) break; case VARIOUS_ARENA_JUDGMENT_STRING: BattleStringExpandPlaceholdersToDisplayedString(gRefereeStringsTable[gBattlescriptCurrInstr[1]]); - BattlePutTextOnWindow(gDisplayedStringBattle, ARENA_WIN_JUDGEMENT_TEXT); + BattlePutTextOnWindow(gDisplayedStringBattle, ARENA_WIN_JUDGMENT_TEXT); break; case VARIOUS_ARENA_WAIT_STRING: - if (IsTextPrinterActive(ARENA_WIN_JUDGEMENT_TEXT)) + if (IsTextPrinterActive(ARENA_WIN_JUDGMENT_TEXT)) return; break; case VARIOUS_WAIT_CRY: @@ -8407,11 +8507,11 @@ static void Cmd_various(void) && !NoAliveMonsForEitherParty() && CompareStat(gBattlerAttacker, STAT_ATK, MAX_STAT_STAGE, CMP_LESS_THAN)) { - if (B_FELL_STINGER_STAT_RAISE >= GEN_7) - SET_STATCHANGER(STAT_ATK, 3, FALSE); - else - SET_STATCHANGER(STAT_ATK, 2, FALSE); - + #if B_FELL_STINGER_STAT_RAISE >= GEN_7 + SET_STATCHANGER(STAT_ATK, 3, FALSE); + #else + SET_STATCHANGER(STAT_ATK, 2, FALSE); + #endif PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_ATK); BattleScriptPush(gBattlescriptCurrInstr + 3); gBattlescriptCurrInstr = BattleScript_FellStingerRaisesStat; @@ -9976,13 +10076,16 @@ static void Cmd_manipulatedamage(void) gBattleMoveDamage *= -1; break; case DMG_RECOIL_FROM_MISS: + #if B_RECOIL_IF_MISS_DMG >= GEN_5 + gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 2; + #elif B_RECOIL_IF_MISS_DMG == GEN_4 + if ((gBattleMons[gBattlerTarget].maxHP / 2) < gBattleMoveDamage) + gBattleMoveDamage = gBattleMons[gBattlerTarget].maxHP / 2; + #else gBattleMoveDamage /= 2; + #endif if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; - if (B_RECOIL_IF_MISS_DMG >= GEN_5) - gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 2; - if ((B_RECOIL_IF_MISS_DMG <= GEN_4) && ((gBattleMons[gBattlerTarget].maxHP / 2) < gBattleMoveDamage)) - gBattleMoveDamage = gBattleMons[gBattlerTarget].maxHP / 2; break; case DMG_DOUBLED: gBattleMoveDamage *= 2; @@ -10601,8 +10704,9 @@ static void Cmd_setmultihitcounter(void) { gMultiHitCounter = 5; } - else if (B_MULTI_HIT_CHANCE >= GEN_5) + else { + #if B_MULTI_HIT_CHANCE >= GEN_5 // Based on Gen 5's odds // 35% for 2 hits // 35% for 3 hits @@ -10617,9 +10721,7 @@ static void Cmd_setmultihitcounter(void) gMultiHitCounter = 4; else gMultiHitCounter = 5; - } - else - { + #else // 2 and 3 hits: 37.5% // 4 and 5 hits: 12.5% gMultiHitCounter = Random() % 4; @@ -10627,6 +10729,7 @@ static void Cmd_setmultihitcounter(void) gMultiHitCounter = (Random() % 4) + 2; else gMultiHitCounter += 2; + #endif } } @@ -10710,7 +10813,7 @@ static void Cmd_forcerandomswitch(void) monsCount = 6; minNeeded = 2; battler2PartyId = gBattlerPartyIndexes[gBattlerTarget]; - battler1PartyId = gBattlerPartyIndexes[gBattlerTarget ^ BIT_FLANK]; + battler1PartyId = gBattlerPartyIndexes[BATTLE_PARTNER(gBattlerTarget)]; } else if ((gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER && gBattleTypeFlags & BATTLE_TYPE_LINK) || (gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER && gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK) @@ -10729,7 +10832,7 @@ static void Cmd_forcerandomswitch(void) monsCount = PARTY_SIZE / 2; minNeeded = 1; battler2PartyId = gBattlerPartyIndexes[gBattlerTarget]; - battler1PartyId = gBattlerPartyIndexes[gBattlerTarget ^ BIT_FLANK]; + battler1PartyId = gBattlerPartyIndexes[BATTLE_PARTNER(gBattlerTarget)]; } else if ((gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK) || (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK)) @@ -10747,7 +10850,7 @@ static void Cmd_forcerandomswitch(void) monsCount = PARTY_SIZE / 2; minNeeded = 1; battler2PartyId = gBattlerPartyIndexes[gBattlerTarget]; - battler1PartyId = gBattlerPartyIndexes[gBattlerTarget ^ BIT_FLANK]; + battler1PartyId = gBattlerPartyIndexes[BATTLE_PARTNER(gBattlerTarget)]; } else if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) { @@ -10774,7 +10877,7 @@ static void Cmd_forcerandomswitch(void) minNeeded = 1; } battler2PartyId = gBattlerPartyIndexes[gBattlerTarget]; - battler1PartyId = gBattlerPartyIndexes[gBattlerTarget ^ BIT_FLANK]; + battler1PartyId = gBattlerPartyIndexes[BATTLE_PARTNER(gBattlerTarget)]; } else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { @@ -10783,7 +10886,7 @@ static void Cmd_forcerandomswitch(void) monsCount = PARTY_SIZE; minNeeded = 2; battler2PartyId = gBattlerPartyIndexes[gBattlerTarget]; - battler1PartyId = gBattlerPartyIndexes[gBattlerTarget ^ BIT_FLANK]; + battler1PartyId = gBattlerPartyIndexes[BATTLE_PARTNER(gBattlerTarget)]; } else { @@ -10836,7 +10939,7 @@ static void Cmd_forcerandomswitch(void) || (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK && gBattleTypeFlags & BATTLE_TYPE_MULTI)) { SwitchPartyOrderLinkMulti(gBattlerTarget, i, 0); - SwitchPartyOrderLinkMulti(gBattlerTarget ^ BIT_FLANK, i, 1); + SwitchPartyOrderLinkMulti(BATTLE_PARTNER(gBattlerTarget), i, 1); } if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) @@ -11020,10 +11123,10 @@ static void Cmd_tryKO(void) else { u16 odds = gBattleMoves[gCurrentMove].accuracy + (gBattleMons[gBattlerAttacker].level - gBattleMons[gBattlerTarget].level); - #if B_SHEER_COLD_ACC >= GEN_7 - if (gCurrentMove == MOVE_SHEER_COLD && !IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_ICE)) - odds -= 10; - #endif + #if B_SHEER_COLD_ACC >= GEN_7 + if (gCurrentMove == MOVE_SHEER_COLD && !IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_ICE)) + odds -= 10; + #endif if (Random() % 100 + 1 < odds && gBattleMons[gBattlerAttacker].level >= gBattleMons[gBattlerTarget].level) lands = TRUE; } @@ -11212,7 +11315,7 @@ static void Cmd_updatestatusicon(void) } if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) { - gActiveBattler = GetBattlerAtPosition(GetBattlerPosition(gBattlerAttacker) ^ BIT_FLANK); + gActiveBattler = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerAttacker))); if (!(gAbsentBattlerFlags & gBitTable[gActiveBattler])) { BtlController_EmitStatusIconUpdate(BUFFER_A, gBattleMons[gActiveBattler].status1, gBattleMons[gActiveBattler].status2); @@ -11394,10 +11497,11 @@ static void Cmd_dmgtolevel(void) static void Cmd_psywavedamageeffect(void) { s32 randDamage; - if (B_PSYWAVE_DMG >= GEN_6) - randDamage = (Random() % 101); - else - randDamage = (Random() % 11) * 10; +#if B_PSYWAVE_DMG >= GEN_6 + randDamage = (Random() % 101); +#else + randDamage = (Random() % 11) * 10; +#endif gBattleMoveDamage = gBattleMons[gBattlerAttacker].level * (randDamage + 50) / 100; gBattlescriptCurrInstr++; } @@ -11468,12 +11572,13 @@ static void Cmd_disablelastusedattack(void) PREPARE_MOVE_BUFFER(gBattleTextBuff1, gBattleMons[gBattlerTarget].moves[i]) gDisableStructs[gBattlerTarget].disabledMove = gBattleMons[gBattlerTarget].moves[i]; - if (B_DISABLE_TURNS == GEN_3) - gDisableStructs[gBattlerTarget].disableTimer = (Random() & 3) + 2; - else if (B_DISABLE_TURNS == GEN_4) - gDisableStructs[gBattlerTarget].disableTimer = (Random() & 3) + 4; - else - gDisableStructs[gBattlerTarget].disableTimer = 4; + #if B_DISABLE_TURNS == GEN_3 + gDisableStructs[gBattlerTarget].disableTimer = (Random() & 3) + 2; + #elif B_DISABLE_TURNS == GEN_4 + gDisableStructs[gBattlerTarget].disableTimer = (Random() & 3) + 4; + #else + gDisableStructs[gBattlerTarget].disableTimer = 4; + #endif gDisableStructs[gBattlerTarget].disableTimerStartValue = gDisableStructs[gBattlerTarget].disableTimer; // used to save the random amount of turns? gBattlescriptCurrInstr += 5; } @@ -11751,7 +11856,11 @@ static void Cmd_settailwind(void) { gSideStatuses[side] |= SIDE_STATUS_TAILWIND; gSideTimers[side].tailwindBattlerId = gBattlerAttacker; - gSideTimers[side].tailwindTimer = (B_TAILWIND_TURNS >= GEN_5) ? 4 : 3; + #if B_TAILWIND_TURNS >= GEN_5 + gSideTimers[side].tailwindTimer = 4; + #else + gSideTimers[side].tailwindTimer = 3; + #endif gBattlescriptCurrInstr += 5; } else @@ -11850,7 +11959,7 @@ static void Cmd_healpartystatus(void) gBattleCommunication[MULTISTRING_CHOOSER] |= B_MSG_BELL_SOUNDPROOF_ATTACKER; } - gActiveBattler = gBattleScripting.battler = GetBattlerAtPosition(GetBattlerPosition(gBattlerAttacker) ^ BIT_FLANK); + gActiveBattler = gBattleScripting.battler = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerAttacker))); if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && !(gAbsentBattlerFlags & gBitTable[gActiveBattler])) @@ -11900,7 +12009,7 @@ static void Cmd_healpartystatus(void) gBattleMons[gBattlerAttacker].status1 = 0; gBattleMons[gBattlerAttacker].status2 &= ~STATUS2_NIGHTMARE; - gActiveBattler = GetBattlerAtPosition(GetBattlerPosition(gBattlerAttacker) ^ BIT_FLANK); + gActiveBattler = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerAttacker))); if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && !(gAbsentBattlerFlags & gBitTable[gActiveBattler])) { @@ -11939,7 +12048,7 @@ static void Cmd_cursetarget(void) static void Cmd_trysetspikes(void) { - u8 targetSide = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE; + u8 targetSide = BATTLE_OPPOSITE(GetBattlerSide(gBattlerAttacker)); if (gSideTimers[targetSide].spikesAmount == 3) { @@ -12647,7 +12756,7 @@ static void Cmd_settaunt(void) static void Cmd_trysethelpinghand(void) { - gBattlerTarget = GetBattlerAtPosition(GetBattlerPosition(gBattlerAttacker) ^ BIT_FLANK); + gBattlerTarget = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerAttacker))); if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && !(gAbsentBattlerFlags & gBitTable[gBattlerTarget]) @@ -12674,7 +12783,7 @@ static void Cmd_tryswapitems(void) | BATTLE_TYPE_FRONTIER | BATTLE_TYPE_SECRET_BASE | BATTLE_TYPE_RECORDED_LINK - #if B_TRAINERS_KNOCK_OFF_ITEMS + #if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE | BATTLE_TYPE_TRAINER #endif )))) @@ -12813,14 +12922,14 @@ static void Cmd_trywish(void) break; case 1: // heal effect PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gBattlerTarget, gWishFutureKnock.wishPartyId[gBattlerTarget]) - #if B_WISH_HP_SOURCE >= GEN_5 - if (GetBattlerSide(gBattlerTarget) == B_SIDE_PLAYER) - gBattleMoveDamage = max(1, GetMonData(&gPlayerParty[gWishFutureKnock.wishPartyId[gBattlerTarget]], MON_DATA_MAX_HP) / 2); - else - gBattleMoveDamage = max(1, GetMonData(&gEnemyParty[gWishFutureKnock.wishPartyId[gBattlerTarget]], MON_DATA_MAX_HP) / 2); - #else - gBattleMoveDamage = max(1, gBattleMons[gBattlerTarget].maxHP / 2); - #endif + #if B_WISH_HP_SOURCE >= GEN_5 + if (GetBattlerSide(gBattlerTarget) == B_SIDE_PLAYER) + gBattleMoveDamage = max(1, GetMonData(&gPlayerParty[gWishFutureKnock.wishPartyId[gBattlerTarget]], MON_DATA_MAX_HP) / 2); + else + gBattleMoveDamage = max(1, GetMonData(&gEnemyParty[gWishFutureKnock.wishPartyId[gBattlerTarget]], MON_DATA_MAX_HP) / 2); + #else + gBattleMoveDamage = max(1, gBattleMons[gBattlerTarget].maxHP / 2); + #endif gBattleMoveDamage *= -1; if (gBattleMons[gBattlerTarget].hp == gBattleMons[gBattlerTarget].maxHP) @@ -13220,45 +13329,40 @@ u16 GetSecretPowerMoveEffect(void) { switch (gBattleTerrain) { - case BATTLE_TERRAIN_GRASS: - #if B_SECRET_POWER_EFFECT >= GEN_4 - moveEffect = MOVE_EFFECT_SLEEP; - #else - moveEffect = MOVE_EFFECT_POISON; - #endif - break; + #if B_SECRET_POWER_EFFECT >= GEN_6 + case BATTLE_TERRAIN_GRASS: moveEffect = MOVE_EFFECT_SLEEP; break; + case BATTLE_TERRAIN_UNDERWATER: moveEffect = MOVE_EFFECT_ATK_MINUS_1; break; + case BATTLE_TERRAIN_POND: moveEffect = MOVE_EFFECT_ATK_MINUS_1; break; + case BATTLE_TERRAIN_MOUNTAIN: moveEffect = MOVE_EFFECT_ACC_MINUS_1; break; + case BATTLE_TERRAIN_PUDDLE: moveEffect = MOVE_EFFECT_SPD_MINUS_1; break; + #elif B_SECRET_POWER_EFFECT >= GEN_5 + case BATTLE_TERRAIN_GRASS: moveEffect = MOVE_EFFECT_SLEEP; break; + case BATTLE_TERRAIN_UNDERWATER: moveEffect = MOVE_EFFECT_DEF_MINUS_1; break; + case BATTLE_TERRAIN_POND: moveEffect = MOVE_EFFECT_ATK_MINUS_1; break; + case BATTLE_TERRAIN_MOUNTAIN: moveEffect = MOVE_EFFECT_ACC_MINUS_1; break; + case BATTLE_TERRAIN_PUDDLE: moveEffect = MOVE_EFFECT_SPD_MINUS_1; break; + #elif B_SECRET_POWER_EFFECT >= GEN_4 + case BATTLE_TERRAIN_GRASS: moveEffect = MOVE_EFFECT_SLEEP; break; + case BATTLE_TERRAIN_UNDERWATER: moveEffect = MOVE_EFFECT_DEF_MINUS_1; break; + case BATTLE_TERRAIN_POND: moveEffect = MOVE_EFFECT_ATK_MINUS_1; break; + case BATTLE_TERRAIN_MOUNTAIN: moveEffect = MOVE_EFFECT_FLINCH; break; + case BATTLE_TERRAIN_PUDDLE: moveEffect = MOVE_EFFECT_ACC_MINUS_1; break; + #else + case BATTLE_TERRAIN_GRASS: moveEffect = MOVE_EFFECT_POISON; break; + case BATTLE_TERRAIN_UNDERWATER: moveEffect = MOVE_EFFECT_DEF_MINUS_1; break; + case BATTLE_TERRAIN_POND: moveEffect = MOVE_EFFECT_SPD_MINUS_1; break; + case BATTLE_TERRAIN_MOUNTAIN: moveEffect = MOVE_EFFECT_CONFUSION; break; + case BATTLE_TERRAIN_PUDDLE: moveEffect = MOVE_EFFECT_ACC_MINUS_1; break; + #endif case BATTLE_TERRAIN_LONG_GRASS: moveEffect = MOVE_EFFECT_SLEEP; break; case BATTLE_TERRAIN_SAND: moveEffect = MOVE_EFFECT_ACC_MINUS_1; break; - case BATTLE_TERRAIN_UNDERWATER: - #if B_SECRET_POWER_EFFECT >= GEN_6 - moveEffect = MOVE_EFFECT_ATK_MINUS_1; - #else - moveEffect = MOVE_EFFECT_DEF_MINUS_1; - #endif - break; case BATTLE_TERRAIN_WATER: moveEffect = MOVE_EFFECT_ATK_MINUS_1; break; - case BATTLE_TERRAIN_POND: - #if B_SECRET_POWER_EFFECT >= GEN_4 - moveEffect = MOVE_EFFECT_ATK_MINUS_1; - #else - moveEffect = MOVE_EFFECT_SPD_MINUS_1; - #endif - break; - case BATTLE_TERRAIN_MOUNTAIN: - #if B_SECRET_POWER_EFFECT >= GEN_5 - moveEffect = MOVE_EFFECT_ACC_MINUS_1; - #elif B_SECRET_POWER_EFFECT == GEN_4 - moveEffect = MOVE_EFFECT_FLINCH; - #else - moveEffect = MOVE_EFFECT_CONFUSION; - #endif - break; case BATTLE_TERRAIN_CAVE: case BATTLE_TERRAIN_BURIAL_GROUND: case BATTLE_TERRAIN_SPACE: @@ -13270,13 +13374,6 @@ u16 GetSecretPowerMoveEffect(void) case BATTLE_TERRAIN_SWAMP: moveEffect = MOVE_EFFECT_SPD_MINUS_1; break; - case BATTLE_TERRAIN_PUDDLE: - #if B_SECRET_POWER_EFFECT >= GEN_5 - moveEffect = MOVE_EFFECT_SPD_MINUS_1; - #else - moveEffect = MOVE_EFFECT_ACC_MINUS_1; - #endif - break; case BATTLE_TERRAIN_SNOW: case BATTLE_TERRAIN_ICE: moveEffect = MOVE_EFFECT_FREEZE; @@ -13313,10 +13410,7 @@ static void Cmd_pickup(void) species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2); heldItem = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM); - if (GetMonData(&gPlayerParty[i], MON_DATA_ABILITY_NUM)) - ability = gBaseStats[species].abilities[1]; - else - ability = gBaseStats[species].abilities[0]; + ability = gBaseStats[species].abilities[GetMonData(&gPlayerParty[i], MON_DATA_ABILITY_NUM)]; if (ability == ABILITY_PICKUP && species != SPECIES_NONE @@ -13352,10 +13446,7 @@ static void Cmd_pickup(void) if (lvlDivBy10 > 9) lvlDivBy10 = 9; - if (GetMonData(&gPlayerParty[i], MON_DATA_ABILITY_NUM)) - ability = gBaseStats[species].abilities[1]; - else - ability = gBaseStats[species].abilities[0]; + ability = gBaseStats[species].abilities[GetMonData(&gPlayerParty[i], MON_DATA_ABILITY_NUM)]; if (ability == ABILITY_PICKUP && species != SPECIES_NONE @@ -13399,7 +13490,7 @@ static void Cmd_pickup(void) gBattlescriptCurrInstr++; } -static void Cmd_docastformchangeanimation(void) +static void Cmd_doweatherformchangeanimation(void) { gActiveBattler = gBattleScripting.battler; @@ -13412,7 +13503,7 @@ static void Cmd_docastformchangeanimation(void) gBattlescriptCurrInstr++; } -static void Cmd_trycastformdatachange(void) +static void Cmd_tryweatherformdatachange(void) { u8 form; @@ -13420,7 +13511,7 @@ static void Cmd_trycastformdatachange(void) form = TryWeatherFormChange(gBattleScripting.battler); if (form) { - BattleScriptPushCursorAndCallback(BattleScript_CastformChange); + BattleScriptPushCursorAndCallback(BattleScript_WeatherFormChange); *(&gBattleStruct->formToChangeInto) = form - 1; } } @@ -13462,7 +13553,7 @@ static void Cmd_settypebasedhalvers(void) #else if (!(gStatuses4[gBattlerAttacker] & STATUS4_WATER_SPORT)) { - gStatuses4[gBattlerAttacker] |= v; + gStatuses4[gBattlerAttacker] |= STATUS4_WATER_SPORT; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WEAKEN_FIRE; worked = TRUE; } @@ -13479,12 +13570,14 @@ bool32 DoesSubstituteBlockMove(u8 battlerAtk, u8 battlerDef, u32 move) { if (!(gBattleMons[battlerDef].status2 & STATUS2_SUBSTITUTE)) return FALSE; - else if (gBattleMoves[move].flags & FLAG_SOUND && B_SOUND_SUBSTITUTE >= GEN_6) +#if B_SOUND_SUBSTITUTE >= GEN_6 + else if (gBattleMoves[move].flags & FLAG_SOUND) + return FALSE; +#endif + else if (gBattleMoves[move].flags & FLAG_HIT_IN_SUBSTITUTE) return FALSE; else if (GetBattlerAbility(battlerAtk) == ABILITY_INFILTRATOR) return FALSE; - else if (gBattleMoves[move].flags & FLAG_HIT_IN_SUBSTITUTE) - return FALSE; else return TRUE; } @@ -13577,7 +13670,7 @@ static void Cmd_settypetoterrain(void) // Unused static void Cmd_pursuitdoubles(void) { - gActiveBattler = GetBattlerAtPosition(GetBattlerPosition(gBattlerAttacker) ^ BIT_FLANK); + gActiveBattler = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerAttacker))); if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && !(gAbsentBattlerFlags & gBitTable[gActiveBattler]) @@ -13616,18 +13709,18 @@ static void Cmd_removelightscreenreflect(void) u8 side; bool32 failed; - #if B_BRICK_BREAK >= GEN_4 - // From Gen 4 onwards, Brick Break can remove screens on the user's side if used on an ally - side = GetBattlerSide(gBattlerTarget); - #else - side = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE; - #endif +#if B_BRICK_BREAK >= GEN_4 +// From Gen 4 onwards, Brick Break can remove screens on the user's side if used on an ally + side = GetBattlerSide(gBattlerTarget); +#else + side = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE; +#endif - #if B_BRICK_BREAK >= GEN_5 - failed = (gMoveResultFlags & MOVE_RESULT_NO_EFFECT); - #else - failed = FALSE; - #endif +#if B_BRICK_BREAK >= GEN_5 + failed = (gMoveResultFlags & MOVE_RESULT_NO_EFFECT); +#else + failed = FALSE; +#endif if (!failed && (gSideTimers[side].reflectTimer @@ -13707,79 +13800,82 @@ static void Cmd_handleballthrow(void) { case ITEM_ULTRA_BALL: ballMultiplier = 20; + break; + #if B_SPORT_BALL_MODIFIER <= GEN_7 + case ITEM_SPORT_BALL: + #endif case ITEM_GREAT_BALL: case ITEM_SAFARI_BALL: - case ITEM_SPORT_BALL: ballMultiplier = 15; + break; case ITEM_NET_BALL: if (IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_WATER) || IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_BUG)) - #if B_NET_BALL_MODIFIER >= GEN_7 - ballMultiplier = 35; - #else - ballMultiplier = 30; - #endif + #if B_NET_BALL_MODIFIER >= GEN_7 + ballMultiplier = 35; + #else + ballMultiplier = 30; + #endif break; case ITEM_DIVE_BALL: + if (GetCurrentMapType() == MAP_TYPE_UNDERWATER #if B_DIVE_BALL_MODIFIER >= GEN_4 - if (GetCurrentMapType() == MAP_TYPE_UNDERWATER || gIsFishingEncounter || gIsSurfingEncounter) - ballMultiplier = 35; - #else - if (GetCurrentMapType() == MAP_TYPE_UNDERWATER) - ballMultiplier = 35; + || gIsFishingEncounter || gIsSurfingEncounter #endif + ) + ballMultiplier = 35; break; case ITEM_NEST_BALL: - #if B_NEST_BALL_MODIFIER >= GEN_6 - //((41 - Pokémon's level) ÷ 10)× if Pokémon's level is between 1 and 29, 1× otherwise. - if (gBattleMons[gBattlerTarget].level < 30) - ballMultiplier = 41 - gBattleMons[gBattlerTarget].level; - #elif B_NEST_BALL_MODIFIER == GEN_5 - //((41 - Pokémon's level) ÷ 10)×, minimum 1× - if (gBattleMons[gBattlerTarget].level < 31) - ballMultiplier = 41 - gBattleMons[gBattlerTarget].level; - #else - //((40 - Pokémon's level) ÷ 10)×, minimum 1× - if (gBattleMons[gBattlerTarget].level < 40) - { - ballMultiplier = 40 - gBattleMons[gBattlerTarget].level; - if (ballMultiplier <= 9) - ballMultiplier = 10; - } - #endif + #if B_NEST_BALL_MODIFIER >= GEN_6 + //((41 - Pokémon's level) ÷ 10)× if Pokémon's level is between 1 and 29, 1× otherwise. + if (gBattleMons[gBattlerTarget].level < 30) + ballMultiplier = 41 - gBattleMons[gBattlerTarget].level; + #elif B_NEST_BALL_MODIFIER == GEN_5 + //((41 - Pokémon's level) ÷ 10)×, minimum 1× + if (gBattleMons[gBattlerTarget].level < 31) + ballMultiplier = 41 - gBattleMons[gBattlerTarget].level; + #else + //((40 - Pokémon's level) ÷ 10)×, minimum 1× + if (gBattleMons[gBattlerTarget].level < 40) + { + ballMultiplier = 40 - gBattleMons[gBattlerTarget].level; + if (ballMultiplier <= 9) + ballMultiplier = 10; + } + #endif break; case ITEM_REPEAT_BALL: - if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(gBattleMons[gBattlerTarget].species), FLAG_GET_CAUGHT)) - #if B_REPEAT_BALL_MODIFIER >= GEN_7 - ballMultiplier = 35; - #else - ballMultiplier = 30; - #endif - break; - case ITEM_TIMER_BALL: - #if B_TIMER_BALL_MODIFIER >= GEN_5 - ballMultiplier = (gBattleResults.battleTurnCounter * 3) + 10; + if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(gBattleMons[gBattlerTarget].species), FLAG_GET_CAUGHT)) + #if B_REPEAT_BALL_MODIFIER >= GEN_7 + ballMultiplier = 35; #else - ballMultiplier = gBattleResults.battleTurnCounter + 10; + ballMultiplier = 30; #endif + break; + case ITEM_TIMER_BALL: + #if B_TIMER_BALL_MODIFIER >= GEN_5 + ballMultiplier = (gBattleResults.battleTurnCounter * 3) + 10; + #else + ballMultiplier = gBattleResults.battleTurnCounter + 10; + #endif if (ballMultiplier > 40) ballMultiplier = 40; break; case ITEM_DUSK_BALL: RtcCalcLocalTime(); if ((gLocalTime.hours >= 20 && gLocalTime.hours <= 3) || gMapHeader.cave || gMapHeader.mapType == MAP_TYPE_UNDERGROUND) - #if B_DUSK_BALL_MODIFIER >= GEN_7 - ballMultiplier = 30; - #else - ballMultiplier = 35; - #endif + #if B_DUSK_BALL_MODIFIER >= GEN_7 + ballMultiplier = 30; + #else + ballMultiplier = 35; + #endif break; case ITEM_QUICK_BALL: if (gBattleResults.battleTurnCounter == 0) - #if B_QUICK_BALL_MODIFIER >= GEN_5 - ballMultiplier = 50; - #else - ballMultiplier = 40; - #endif + #if B_QUICK_BALL_MODIFIER >= GEN_5 + ballMultiplier = 50; + #else + ballMultiplier = 40; + #endif break; case ITEM_LEVEL_BALL: if (gBattleMons[gBattlerAttacker].level >= 4 * gBattleMons[gBattlerTarget].level) @@ -13791,11 +13887,11 @@ static void Cmd_handleballthrow(void) break; case ITEM_LURE_BALL: if (gIsFishingEncounter) - #if B_LURE_BALL_MODIFIER >= GEN_7 - ballMultiplier = 50; - #else - ballMultiplier = 30; - #endif + #if B_LURE_BALL_MODIFIER >= GEN_7 + ballMultiplier = 50; + #else + ballMultiplier = 30; + #endif break; case ITEM_MOON_BALL: for (i = 0; i < EVOS_PER_MON; i++) @@ -13821,44 +13917,44 @@ static void Cmd_handleballthrow(void) break; case ITEM_HEAVY_BALL: i = GetPokedexHeightWeight(SpeciesToNationalPokedexNum(gBattleMons[gBattlerTarget].species), 1); - #if B_HEAVY_BALL_MODIFIER >= GEN_7 - if (i < 1000) - ballAddition = -20; - else if (i < 2000) - ballAddition = 0; - else if (i < 3000) - ballAddition = 20; - else - ballAddition = 30; - #elif B_HEAVY_BALL_MODIFIER >= GEN_4 - if (i < 2048) - ballAddition = -20; - else if (i < 3072) - ballAddition = 20; - else if (i < 4096) - ballAddition = 30; - else - ballAddition = 40; - #else - if (i < 1024) - ballAddition = -20; - else if (i < 2048) - ballAddition = 0; - else if (i < 3072) - ballAddition = 20; - else if (i < 4096) - ballAddition = 30; - else - ballAddition = 40; - #endif + #if B_HEAVY_BALL_MODIFIER >= GEN_7 + if (i < 1000) + ballAddition = -20; + else if (i < 2000) + ballAddition = 0; + else if (i < 3000) + ballAddition = 20; + else + ballAddition = 30; + #elif B_HEAVY_BALL_MODIFIER >= GEN_4 + if (i < 2048) + ballAddition = -20; + else if (i < 3072) + ballAddition = 20; + else if (i < 4096) + ballAddition = 30; + else + ballAddition = 40; + #else + if (i < 1024) + ballAddition = -20; + else if (i < 2048) + ballAddition = 0; + else if (i < 3072) + ballAddition = 20; + else if (i < 4096) + ballAddition = 30; + else + ballAddition = 40; + #endif break; case ITEM_DREAM_BALL: - #if B_DREAM_BALL_MODIFIER >= GEN_8 - if (gBattleMons[gBattlerTarget].status1 & STATUS1_SLEEP || GetBattlerAbility(gBattlerTarget) == ABILITY_COMATOSE) - ballMultiplier = 40; - #else - ballMultiplier = 10; - #endif + #if B_DREAM_BALL_MODIFIER >= GEN_8 + if (gBattleMons[gBattlerTarget].status1 & STATUS1_SLEEP || GetBattlerAbility(gBattlerTarget) == ABILITY_COMATOSE) + ballMultiplier = 40; + #else + ballMultiplier = 10; + #endif break; case ITEM_BEAST_BALL: ballMultiplier = 1; @@ -14250,13 +14346,11 @@ static const u16 sTelekinesisBanList[] = { SPECIES_DIGLETT, SPECIES_DUGTRIO, -// #ifdef NEW_POKEMON SPECIES_DIGLETT_ALOLAN, SPECIES_DUGTRIO_ALOLAN, SPECIES_SANDYGAST, SPECIES_PALOSSAND, SPECIES_GENGAR_MEGA, -// #endif }; bool32 IsTelekinesisBannedSpecies(u16 species) @@ -14394,33 +14488,33 @@ static void Cmd_metalburstdamagecalculator(void) static bool32 CriticalCapture(u32 odds) { - #if B_CRITICAL_CAPTURE == TRUE - u32 numCaught = GetNationalPokedexCount(FLAG_GET_CAUGHT); +#if B_CRITICAL_CAPTURE == TRUE + u32 numCaught = GetNationalPokedexCount(FLAG_GET_CAUGHT); - if (numCaught <= (NATIONAL_DEX_COUNT * 30) / 650) - odds = 0; - else if (numCaught <= (NATIONAL_DEX_COUNT * 150) / 650) - odds /= 2; - else if (numCaught <= (NATIONAL_DEX_COUNT * 300) / 650) - ; // odds = (odds * 100) / 100; - else if (numCaught <= (NATIONAL_DEX_COUNT * 450) / 650) - odds = (odds * 150) / 100; - else if (numCaught <= (NATIONAL_DEX_COUNT * 600) / 650) - odds *= 2; - else - odds = (odds * 250) / 100; + if (numCaught <= (NATIONAL_DEX_COUNT * 30) / 650) + odds = 0; + else if (numCaught <= (NATIONAL_DEX_COUNT * 150) / 650) + odds /= 2; + else if (numCaught <= (NATIONAL_DEX_COUNT * 300) / 650) + ; // odds = (odds * 100) / 100; + else if (numCaught <= (NATIONAL_DEX_COUNT * 450) / 650) + odds = (odds * 150) / 100; + else if (numCaught <= (NATIONAL_DEX_COUNT * 600) / 650) + odds *= 2; + else + odds = (odds * 250) / 100; - #ifdef ITEM_CATCHING_CHARM - if (CheckBagHasItem(ITEM_CATCHING_CHARM, 1)) - odds = (odds * (100 + B_CATCHING_CHARM_BOOST)) / 100; - #endif - - odds /= 6; - if ((Random() % 255) < odds) - return TRUE; - - return FALSE; - #else - return FALSE; + #ifdef ITEM_CATCHING_CHARM + if (CheckBagHasItem(ITEM_CATCHING_CHARM, 1)) + odds = (odds * (100 + B_CATCHING_CHARM_BOOST)) / 100; #endif + + odds /= 6; + if ((Random() % 255) < odds) + return TRUE; + + return FALSE; +#else + return FALSE; +#endif } diff --git a/src/battle_util.c b/src/battle_util.c index c92d3690fc..71133a8467 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -58,6 +58,7 @@ functions instead of at the top of the file with the other declarations. static bool32 TryRemoveScreens(u8 battler); static bool32 IsUnnerveAbilityOnOpposingSide(u8 battlerId); +static u8 GetFlingPowerFromItemId(u16 itemId); extern const u8 *const gBattleScriptsForMoveEffects[]; extern const u8 *const gBattlescriptsForRunningByItem[]; @@ -315,7 +316,7 @@ void HandleAction_UseMove(void) GET_MOVE_TYPE(gChosenMove, moveType); // choose target - side = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE; + side = BATTLE_OPPOSITE(GetBattlerSide(gBattlerAttacker)); if (IsAffectedByFollowMe(gBattlerAttacker, side, gCurrentMove) && moveTarget == MOVE_TARGET_SELECTED && GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gSideTimers[side].followmeTarget)) @@ -381,13 +382,13 @@ void HandleAction_UseMove(void) { if (GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gBattlerTarget)) { - gBattlerTarget = GetBattlerAtPosition(GetBattlerPosition(gBattlerTarget) ^ BIT_FLANK); + gBattlerTarget = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerTarget))); } else { - gBattlerTarget = GetBattlerAtPosition(GetBattlerPosition(gBattlerAttacker) ^ BIT_SIDE); + gBattlerTarget = GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerPosition(gBattlerAttacker))); if (!IsBattlerAlive(gBattlerTarget)) - gBattlerTarget = GetBattlerAtPosition(GetBattlerPosition(gBattlerTarget) ^ BIT_FLANK); + gBattlerTarget = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerTarget))); } } } @@ -426,7 +427,7 @@ void HandleAction_UseMove(void) if (gAbsentBattlerFlags & gBitTable[gBattlerTarget] && GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gBattlerTarget)) { - gBattlerTarget = GetBattlerAtPosition(GetBattlerPosition(gBattlerTarget) ^ BIT_FLANK); + gBattlerTarget = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerTarget))); } } else if (moveTarget == MOVE_TARGET_ALLY) @@ -454,13 +455,13 @@ void HandleAction_UseMove(void) { if (GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gBattlerTarget)) { - gBattlerTarget = GetBattlerAtPosition(GetBattlerPosition(gBattlerTarget) ^ BIT_FLANK); + gBattlerTarget = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerTarget))); } else { - gBattlerTarget = GetBattlerAtPosition(GetBattlerPosition(gBattlerAttacker) ^ BIT_SIDE); + gBattlerTarget = GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerPosition(gBattlerAttacker))); if (!IsBattlerAlive(gBattlerTarget)) - gBattlerTarget = GetBattlerAtPosition(GetBattlerPosition(gBattlerTarget) ^ BIT_FLANK); + gBattlerTarget = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerTarget))); } } } @@ -2152,6 +2153,7 @@ enum ENDTURN_ION_DELUGE, ENDTURN_FAIRY_LOCK, ENDTURN_RETALIATE, + ENDTURN_WEATHER_FORM, ENDTURN_STATUS_HEAL, ENDTURN_FIELD_COUNT, }; @@ -2600,6 +2602,10 @@ u8 DoFieldEndTurnEffects(void) gSideTimers[B_SIDE_OPPONENT].retaliateTimer--; gBattleStruct->turnCountersTracker++; break; + case ENDTURN_WEATHER_FORM: + AbilityBattleEffects(ABILITYEFFECT_WEATHER_FORM, 0, 0, 0, 0); + gBattleStruct->turnCountersTracker++; + break; case ENDTURN_STATUS_HEAL: for (gBattlerAttacker = 0; gBattlerAttacker < gBattlersCount; gBattlerAttacker++) { @@ -2829,8 +2835,11 @@ u8 DoBattlerEndTurnEffects(void) && gBattleMons[gActiveBattler].hp != 0) { MAGIC_GUARD_CHECK; - - gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / (B_BURN_DAMAGE >= GEN_7 ? 16 : 8); + #if B_BURN_DAMAGE >= GEN_7 + gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 16; + #else + gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 8; + #endif if (ability == ABILITY_HEATPROOF) { if (gBattleMoveDamage > (gBattleMoveDamage / 2) + 1) // Record ability if the burn takes less damage than it normally would. @@ -2891,9 +2900,15 @@ u8 DoBattlerEndTurnEffects(void) PREPARE_MOVE_BUFFER(gBattleTextBuff1, gBattleStruct->wrappedMove[gActiveBattler]); gBattlescriptCurrInstr = BattleScript_WrapTurnDmg; if (GetBattlerHoldEffect(gBattleStruct->wrappedBy[gActiveBattler], TRUE) == HOLD_EFFECT_BINDING_BAND) - gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / ((B_BINDING_DAMAGE >= GEN_6) ? 6 : 8); + #if B_BINDING_DAMAGE >= GEN_6 + gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 6; else - gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / ((B_BINDING_DAMAGE >= GEN_6) ? 8 : 16); + gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 8; + #else + gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 8; + else + gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 16; + #endif if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; @@ -3084,7 +3099,11 @@ u8 DoBattlerEndTurnEffects(void) } else { - gBattleMons[gActiveBattler].status1 |= (B_SLEEP_TURNS >= GEN_5) ? ((Random() % 3) + 2) : ((Random() % 4) + 3); + #if B_SLEEP_TURNS >= GEN_5 + gBattleMons[gActiveBattler].status1 |= ((Random() % 3) + 2); + #else + gBattleMons[gActiveBattler].status1 |= ((Random() % 4) + 3); + #endif BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); MarkBattlerForControllerExec(gActiveBattler); BattleScriptExecute(BattleScript_YawnMakesAsleep); @@ -3240,7 +3259,7 @@ bool8 HandleWishPerishSongOnTurnEnd(void) BattleScriptExecute(BattleScript_MonTookFutureAttack); if (gWishFutureKnock.futureSightCounter[gActiveBattler] == 0 - && gWishFutureKnock.futureSightCounter[gActiveBattler ^ BIT_FLANK] == 0) + && gWishFutureKnock.futureSightCounter[BATTLE_PARTNER(gActiveBattler)] == 0) { gSideStatuses[GET_BATTLER_SIDE(gBattlerTarget)] &= ~SIDE_STATUS_FUTUREATTACK; } @@ -3349,7 +3368,7 @@ bool8 HandleFaintedMonActions(void) gBattleStruct->faintedActionsState = 3; else gBattleStruct->faintedActionsState = 1; - #if B_FAINT_SWITCH_IN >= GEN_4 + #if B_FAINT_SWITCH_IN >= GEN_4 // Don't switch mons until all pokemon performed their actions or the battle's over. if (gBattleOutcome == 0 && !NoAliveMonsForEitherParty() @@ -3358,10 +3377,10 @@ bool8 HandleFaintedMonActions(void) gAbsentBattlerFlags |= gBitTable[gBattlerFainted]; return FALSE; } - #endif + #endif break; case 3: - #if B_FAINT_SWITCH_IN >= GEN_4 + #if B_FAINT_SWITCH_IN >= GEN_4 // Don't switch mons until all pokemon performed their actions or the battle's over. if (gBattleOutcome == 0 && !NoAliveMonsForEitherParty() @@ -3369,7 +3388,7 @@ bool8 HandleFaintedMonActions(void) { return FALSE; } - #endif + #endif gBattleStruct->faintedActionsBattlerId = 0; gBattleStruct->faintedActionsState++; // fall through @@ -3631,7 +3650,12 @@ u8 AtkCanceller_UnableToUseMove(void) gBattleMons[gBattlerAttacker].status2 -= STATUS2_CONFUSION_TURN(1); if (gBattleMons[gBattlerAttacker].status2 & STATUS2_CONFUSION) { - if (Random() % ((B_CONFUSION_SELF_DMG_CHANCE >= GEN_7) ? 3 : 2) == 0) // confusion dmg + // confusion dmg + #if B_CONFUSION_SELF_DMG_CHANCE >= GEN_7 + if (Random() % 3 == 0) + #else + if (Random() % 2 == 0) + #endif { gBattleCommunication[MULTISTRING_CHOOSER] = TRUE; gBattlerTarget = gBattlerAttacker; @@ -3734,8 +3758,11 @@ u8 AtkCanceller_UnableToUseMove(void) case CANCELLER_POWDER_MOVE: if ((gBattleMoves[gCurrentMove].flags & FLAG_POWDER) && (gBattlerAttacker != gBattlerTarget)) { - if ((B_POWDER_GRASS >= GEN_6 && IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_GRASS)) - || GetBattlerAbility(gBattlerTarget) == ABILITY_OVERCOAT) + #if B_POWDER_GRASS >= GEN_6 + if (IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_GRASS) || GetBattlerAbility(gBattlerTarget) == ABILITY_OVERCOAT) + #else + if (GetBattlerAbility(gBattlerTarget) == ABILITY_OVERCOAT) + #endif { gBattlerAbility = gBattlerTarget; effect = 1; @@ -3998,21 +4025,48 @@ u8 TryWeatherFormChange(u8 battler) bool32 weatherEffect = WEATHER_HAS_EFFECT; u16 holdEffect = GetBattlerHoldEffect(battler, TRUE); - if (gBattleMons[battler].species == SPECIES_CASTFORM) + switch (gBattleMons[battler].species) { + case SPECIES_CASTFORM: +/* Placeholder + case SPECIES_CASTFORM_RAINY: + case SPECIES_CASTFORM_SNOWY: + case SPECIES_CASTFORM_SUNNY:*/ +#if B_WEATHER_FORMS >= GEN_5 + if (gBattleMons[battler].hp == 0) + { + ret = 0; // No change + } + else if (GetBattlerAbility(battler) != ABILITY_FORECAST || !weatherEffect) + { + if (!IS_BATTLER_OF_TYPE(battler, TYPE_NORMAL)) + { + SET_BATTLER_TYPE(battler, TYPE_NORMAL); + ret = CASTFORM_NORMAL + 1; + } + else + { + ret = 0; // No change + } + } +#else if (GetBattlerAbility(battler) != ABILITY_FORECAST || gBattleMons[battler].hp == 0) { ret = 0; // No change } - else if (!weatherEffect && !IS_BATTLER_OF_TYPE(battler, TYPE_NORMAL)) - { - SET_BATTLER_TYPE(battler, TYPE_NORMAL); - ret = CASTFORM_NORMAL + 1; - } else if (!weatherEffect) { - ret = 0; // No change + if (!IS_BATTLER_OF_TYPE(battler, TYPE_NORMAL)) + { + SET_BATTLER_TYPE(battler, TYPE_NORMAL); + ret = CASTFORM_NORMAL + 1; + } + else + { + ret = 0; // No change + } } +#endif else if (holdEffect == HOLD_EFFECT_UTILITY_UMBRELLA || (!(gBattleWeather & (B_WEATHER_RAIN | B_WEATHER_SUN | B_WEATHER_HAIL)) && !IS_BATTLER_OF_TYPE(battler, TYPE_NORMAL))) { SET_BATTLER_TYPE(battler, TYPE_NORMAL); @@ -4033,15 +4087,23 @@ u8 TryWeatherFormChange(u8 battler) SET_BATTLER_TYPE(battler, TYPE_ICE); ret = CASTFORM_ICE + 1; } - } - else if (gBattleMons[battler].species == SPECIES_CHERRIM) - { - if (GetBattlerAbility(battler) != ABILITY_FLOWER_GIFT || gBattleMons[battler].hp == 0) + break; + case SPECIES_CHERRIM: +// case SPECIES_CHERRIM_SUNSHINE: + if (gBattleMons[battler].hp == 0) ret = 0; // No change +#if B_WEATHER_FORMS >= GEN_5 + if (GetBattlerAbility(battler) != ABILITY_FLOWER_GIFT) + if (gBattleMonForms[battler] != 0) + ret = CHERRIM_OVERCAST + 1; + else + ret = 0; // No change +#endif else if (gBattleMonForms[battler] == 0 && weatherEffect && holdEffect != HOLD_EFFECT_UTILITY_UMBRELLA && gBattleWeather & B_WEATHER_SUN) ret = CHERRIM_SUNSHINE + 1; else if (gBattleMonForms[battler] != 0 && (!weatherEffect || holdEffect == HOLD_EFFECT_UTILITY_UMBRELLA || !(gBattleWeather & B_WEATHER_SUN))) ret = CHERRIM_OVERCAST + 1; + break; } return ret; @@ -4062,19 +4124,20 @@ bool32 TryChangeBattleWeather(u8 battler, u32 weatherEnumId, bool32 viaAbility) { u16 battlerAbility = GetBattlerAbility(battler); - if (viaAbility && B_ABILITY_WEATHER <= GEN_5 - && !(gBattleWeather & sWeatherFlagsInfo[weatherEnumId][1])) + if (gBattleWeather & B_WEATHER_PRIMAL_ANY + && battlerAbility != ABILITY_DESOLATE_LAND + && battlerAbility != ABILITY_PRIMORDIAL_SEA + && battlerAbility != ABILITY_DELTA_STREAM) + { + return FALSE; + } +#if B_ABILITY_WEATHER <= GEN_5 + else if (viaAbility && !(gBattleWeather & sWeatherFlagsInfo[weatherEnumId][1])) { gBattleWeather = (sWeatherFlagsInfo[weatherEnumId][0] | sWeatherFlagsInfo[weatherEnumId][1]); return TRUE; } - else if (gBattleWeather & B_WEATHER_PRIMAL_ANY - && battlerAbility != ABILITY_DESOLATE_LAND - && battlerAbility != ABILITY_PRIMORDIAL_SEA - && battlerAbility != ABILITY_DELTA_STREAM) - { - return FALSE; - } +#endif else if (!(gBattleWeather & (sWeatherFlagsInfo[weatherEnumId][0] | sWeatherFlagsInfo[weatherEnumId][1]))) { gBattleWeather = (sWeatherFlagsInfo[weatherEnumId][0]); @@ -4273,7 +4336,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move BattleScriptPushCursorAndCallback(BattleScript_OverworldTerrain); effect++; } - #if B_THUNDERSTORM_TERRAIN == TRUE + #if B_THUNDERSTORM_TERRAIN == TRUE else if (GetCurrentWeather() == WEATHER_RAIN_THUNDERSTORM && !(gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN)) { // overworld weather started rain, so just do electric terrain anim @@ -4282,7 +4345,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move BattleScriptPushCursorAndCallback(BattleScript_OverworldTerrain); effect++; } - #endif + #endif break; case ABILITYEFFECT_SWITCH_IN_WEATHER: if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED)) @@ -4642,11 +4705,15 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move } break; case ABILITY_FORECAST: +#if B_WEATHER_FORMS >= GEN_5 case ABILITY_FLOWER_GIFT: +#else + TRY_WEATHER_FORM: +#endif effect = TryWeatherFormChange(battler); if (effect != 0) { - BattleScriptPushCursorAndCallback(BattleScript_CastformChange); + BattleScriptPushCursorAndCallback(BattleScript_WeatherFormChange); *(&gBattleStruct->formToChangeInto) = effect - 1; } break; @@ -4722,6 +4789,12 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move effect++; } break; +#if B_WEATHER_FORMS < GEN_5 + default: + if (gBattleMons[battler].species == SPECIES_CHERRIM) + goto TRY_WEATHER_FORM; + break; +#endif } break; case ABILITYEFFECT_ENDTURN: // 1 @@ -4804,7 +4877,11 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (gDisableStructs[battler].isFirstTurn != 2) { u32 validToRaise = 0, validToLower = 0; - u32 statsNum = (B_MOODY_ACC_EVASION != GEN_8) ? NUM_BATTLE_STATS : NUM_STATS; + #if B_MOODY_ACC_EVASION < GEN_8 + u32 statsNum = NUM_BATTLE_STATS; + #else + u32 statsNum = NUM_STATS; + #endif for (i = STAT_ATK; i < statsNum; i++) { @@ -4991,7 +5068,11 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move effect = 2, statId = STAT_ATK; break; case ABILITY_FLASH_FIRE: - if (moveType == TYPE_FIRE && !((gBattleMons[battler].status1 & STATUS1_FREEZE) && B_FLASH_FIRE_FROZEN <= GEN_4)) + if (moveType == TYPE_FIRE + #if B_FLASH_FIRE_FROZEN <= GEN_4 + && !(gBattleMons[battler].status1 & STATUS1_FREEZE) + #endif + ) { if (!(gBattleResources->flags->flags[battler] & RESOURCE_FLAG_FLASH_FIRE)) { @@ -5726,20 +5807,28 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move } } break; - case ABILITYEFFECT_FORECAST: // 6 + case ABILITYEFFECT_WEATHER_FORM: // 6 for (battler = 0; battler < gBattlersCount; battler++) { - u16 battlerAbility = GetBattlerAbility(battler); - if (battlerAbility == ABILITY_FORECAST || battlerAbility == ABILITY_FLOWER_GIFT) + switch (gBattleMons[battler].species) { + case SPECIES_CASTFORM: + case SPECIES_CHERRIM: +#ifdef POKEMON_EXPANSION + case SPECIES_CASTFORM_RAINY: + case SPECIES_CASTFORM_SNOWY: + case SPECIES_CASTFORM_SUNNY: + case SPECIES_CHERRIM_SUNSHINE: +#endif effect = TryWeatherFormChange(battler); if (effect != 0) { - BattleScriptPushCursorAndCallback(BattleScript_CastformChange); + BattleScriptPushCursorAndCallback(BattleScript_WeatherFormChange); gBattleScripting.battler = battler; gBattleStruct->formToChangeInto = effect - 1; return effect; } + break; } } break; @@ -5817,7 +5906,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move { if (gBattleMons[i].ability == ABILITY_TRACE && (gBattleResources->flags->flags[i] & RESOURCE_FLAG_TRACED)) { - u8 side = (GetBattlerPosition(i) ^ BIT_SIDE) & BIT_SIDE; // side of the opposing pokemon + u8 side = (BATTLE_OPPOSITE(GetBattlerPosition(i))) & BIT_SIDE; // side of the opposing pokemon u8 target1 = GetBattlerAtPosition(side); u8 target2 = GetBattlerAtPosition(side + BIT_FLANK); @@ -6017,15 +6106,15 @@ u32 IsAbilityOnFieldExcept(u32 battlerId, u32 ability) u32 IsAbilityPreventingEscape(u32 battlerId) { u32 id; - #if B_GHOSTS_ESCAPE >= GEN_6 - if (IS_BATTLER_OF_TYPE(battlerId, TYPE_GHOST)) - return 0; - #endif - #if B_SHADOW_TAG_ESCAPE >= GEN_4 - if ((id = IsAbilityOnOpposingSide(battlerId, ABILITY_SHADOW_TAG)) && GetBattlerAbility(battlerId) != ABILITY_SHADOW_TAG) - #else - if (id = IsAbilityOnOpposingSide(battlerId, ABILITY_SHADOW_TAG)) - #endif +#if B_GHOSTS_ESCAPE >= GEN_6 + if (IS_BATTLER_OF_TYPE(battlerId, TYPE_GHOST)) + return 0; +#endif +#if B_SHADOW_TAG_ESCAPE >= GEN_4 + if ((id = IsAbilityOnOpposingSide(battlerId, ABILITY_SHADOW_TAG)) && GetBattlerAbility(battlerId) != ABILITY_SHADOW_TAG) +#else + if ((id = IsAbilityOnOpposingSide(battlerId, ABILITY_SHADOW_TAG))) +#endif return id; if ((id = IsAbilityOnOpposingSide(battlerId, ABILITY_ARENA_TRAP)) && IsBattlerGrounded(battlerId)) return id; @@ -6039,7 +6128,11 @@ bool32 CanBattlerEscape(u32 battlerId) // no ability check { if (GetBattlerHoldEffect(battlerId, TRUE) == HOLD_EFFECT_SHED_SHELL) return TRUE; - else if ((B_GHOSTS_ESCAPE >= GEN_6 && !IS_BATTLER_OF_TYPE(battlerId, TYPE_GHOST)) && gBattleMons[battlerId].status2 & (STATUS2_ESCAPE_PREVENTION | STATUS2_WRAPPED)) +#if B_GHOSTS_ESCAPE >= GEN_6 + else if (IS_BATTLER_OF_TYPE(battlerId, TYPE_GHOST)) + return TRUE; +#endif + else if (gBattleMons[battlerId].status2 & (STATUS2_ESCAPE_PREVENTION | STATUS2_WRAPPED)) return FALSE; else if (gStatuses3[battlerId] & STATUS3_ROOTED) return FALSE; @@ -6137,13 +6230,16 @@ bool32 CanBeBurned(u8 battlerId) bool32 CanBeParalyzed(u8 battlerId) { u16 ability = GetBattlerAbility(battlerId); - if ((B_PARALYZE_ELECTRIC >= GEN_6 && IS_BATTLER_OF_TYPE(battlerId, TYPE_ELECTRIC)) - || gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_SAFEGUARD - || ability == ABILITY_LIMBER - || ability == ABILITY_COMATOSE - || gBattleMons[battlerId].status1 & STATUS1_ANY - || IsAbilityStatusProtected(battlerId) - || IsBattlerTerrainAffected(battlerId, STATUS_FIELD_MISTY_TERRAIN)) + if ( + #if B_PARALYZE_ELECTRIC >= GEN_6 + IS_BATTLER_OF_TYPE(battlerId, TYPE_ELECTRIC) || + #endif + gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_SAFEGUARD + || ability == ABILITY_LIMBER + || ability == ABILITY_COMATOSE + || gBattleMons[battlerId].status1 & STATUS1_ANY + || IsAbilityStatusProtected(battlerId) + || IsBattlerTerrainAffected(battlerId, STATUS_FIELD_MISTY_TERRAIN)) return FALSE; return TRUE; } @@ -6205,11 +6301,11 @@ bool32 HasEnoughHpToEatBerry(u32 battlerId, u32 hpFraction, u32 itemId) static u8 HealConfuseBerry(u32 battlerId, u32 itemId, u8 flavorId, bool32 end2) { + if (HasEnoughHpToEatBerry(battlerId, CONFUSE_BERRY_HP_FRACTION, itemId) #if B_HEAL_BLOCKING >= GEN_5 - if (HasEnoughHpToEatBerry(battlerId, CONFUSE_BERRY_HP_FRACTION, itemId) && !(gStatuses3[battlerId] & STATUS3_HEAL_BLOCK)) -#else - if (HasEnoughHpToEatBerry(battlerId, CONFUSE_BERRY_HP_FRACTION, itemId)) + && !(gStatuses3[battlerId] & STATUS3_HEAL_BLOCK) #endif + ) { PREPARE_FLAVOR_BUFFER(gBattleTextBuff1, flavorId); @@ -6397,12 +6493,11 @@ u8 TryHandleSeed(u8 battler, u32 terrainFlag, u8 statId, u16 itemId, bool32 exec static u8 ItemHealHp(u32 battlerId, u32 itemId, bool32 end2, bool32 percentHeal) { -#if B_HEAL_BLOCKING >= GEN_5 - if (HasEnoughHpToEatBerry(battlerId, 2, itemId) && !(gStatuses3[battlerId] & STATUS3_HEAL_BLOCK) -#else - if (HasEnoughHpToEatBerry(battlerId, 2, itemId) -#endif - && !(gBattleScripting.overrideBerryRequirements && gBattleMons[battlerId].hp == gBattleMons[battlerId].maxHP)) + if (!(gBattleScripting.overrideBerryRequirements && gBattleMons[battlerId].hp == gBattleMons[battlerId].maxHP) + #if B_HEAL_BLOCKING >= GEN_5 + && !(gStatuses3[battlerId] & STATUS3_HEAL_BLOCK) + #endif + && HasEnoughHpToEatBerry(battlerId, 2, itemId)) { if (percentHeal) gBattleMoveDamage = (gBattleMons[battlerId].maxHP * GetBattlerHoldEffectParam(battlerId) / 100) * -1; @@ -6447,46 +6542,46 @@ static bool32 GetMentalHerbEffect(u8 battlerId) StringCopy(gBattleTextBuff1, gStatusConditionString_LoveJpn); ret = TRUE; } - #if B_MENTAL_HERB >= GEN_5 - // Check taunt - if (gDisableStructs[battlerId].tauntTimer != 0) - { - gDisableStructs[battlerId].tauntTimer = gDisableStructs[battlerId].tauntTimer2 = 0; - gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_TAUNT; - PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_TAUNT); - ret = TRUE; - } - // Check encore - if (gDisableStructs[battlerId].encoreTimer != 0) - { - gDisableStructs[battlerId].encoredMove = 0; - gDisableStructs[battlerId].encoreTimerStartValue = gDisableStructs[battlerId].encoreTimer = 0; - gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_ENCORE; // STRINGID_PKMNENCOREENDED - ret = TRUE; - } - // Check torment - if (gBattleMons[battlerId].status2 & STATUS2_TORMENT) - { - gBattleMons[battlerId].status2 &= ~STATUS2_TORMENT; - gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_TORMENT; - ret = TRUE; - } - // Check heal block - if (gStatuses3[battlerId] & STATUS3_HEAL_BLOCK) - { - gStatuses3[battlerId] &= ~STATUS3_HEAL_BLOCK; - gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_HEALBLOCK; - ret = TRUE; - } - // Check disable - if (gDisableStructs[battlerId].disableTimer != 0) - { - gDisableStructs[battlerId].disableTimer = gDisableStructs[battlerId].disableTimerStartValue = 0; - gDisableStructs[battlerId].disabledMove = 0; - gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_DISABLE; - ret = TRUE; - } - #endif +#if B_MENTAL_HERB >= GEN_5 + // Check taunt + if (gDisableStructs[battlerId].tauntTimer != 0) + { + gDisableStructs[battlerId].tauntTimer = gDisableStructs[battlerId].tauntTimer2 = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_TAUNT; + PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_TAUNT); + ret = TRUE; + } + // Check encore + if (gDisableStructs[battlerId].encoreTimer != 0) + { + gDisableStructs[battlerId].encoredMove = 0; + gDisableStructs[battlerId].encoreTimerStartValue = gDisableStructs[battlerId].encoreTimer = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_ENCORE; // STRINGID_PKMNENCOREENDED + ret = TRUE; + } + // Check torment + if (gBattleMons[battlerId].status2 & STATUS2_TORMENT) + { + gBattleMons[battlerId].status2 &= ~STATUS2_TORMENT; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_TORMENT; + ret = TRUE; + } + // Check heal block + if (gStatuses3[battlerId] & STATUS3_HEAL_BLOCK) + { + gStatuses3[battlerId] &= ~STATUS3_HEAL_BLOCK; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_HEALBLOCK; + ret = TRUE; + } + // Check disable + if (gDisableStructs[battlerId].disableTimer != 0) + { + gDisableStructs[battlerId].disableTimer = gDisableStructs[battlerId].disableTimerStartValue = 0; + gDisableStructs[battlerId].disabledMove = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_DISABLE; + ret = TRUE; + } +#endif return ret; } @@ -6537,48 +6632,39 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) BattleScriptExecute(BattleScript_WhiteHerbEnd2); } break; + #if B_BERRIES_INSTANT >= GEN_4 case HOLD_EFFECT_CONFUSE_SPICY: - if (B_BERRIES_INSTANT >= GEN_4) - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SPICY, TRUE); + effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SPICY, TRUE); break; case HOLD_EFFECT_CONFUSE_DRY: - if (B_BERRIES_INSTANT >= GEN_4) - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_DRY, TRUE); + effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_DRY, TRUE); break; case HOLD_EFFECT_CONFUSE_SWEET: - if (B_BERRIES_INSTANT >= GEN_4) - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SWEET, TRUE); + effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SWEET, TRUE); break; case HOLD_EFFECT_CONFUSE_BITTER: - if (B_BERRIES_INSTANT >= GEN_4) - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_BITTER, TRUE); + effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_BITTER, TRUE); break; case HOLD_EFFECT_CONFUSE_SOUR: - if (B_BERRIES_INSTANT >= GEN_4) - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SOUR, TRUE); + effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SOUR, TRUE); break; case HOLD_EFFECT_ATTACK_UP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_ATK, TRUE); + effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_ATK, TRUE); break; case HOLD_EFFECT_DEFENSE_UP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_DEF, TRUE); + effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_DEF, TRUE); break; case HOLD_EFFECT_SPEED_UP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPEED, TRUE); + effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPEED, TRUE); break; case HOLD_EFFECT_SP_ATTACK_UP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPATK, TRUE); + effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPATK, TRUE); break; case HOLD_EFFECT_SP_DEFENSE_UP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPDEF, TRUE); + effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPDEF, TRUE); break; case HOLD_EFFECT_CRITICAL_UP: - if (B_BERRIES_INSTANT >= GEN_4 && !(gBattleMons[battlerId].status2 & STATUS2_FOCUS_ENERGY) && HasEnoughHpToEatBerry(battlerId, GetBattlerHoldEffectParam(battlerId), gLastUsedItem)) + if (!(gBattleMons[battlerId].status2 & STATUS2_FOCUS_ENERGY) && HasEnoughHpToEatBerry(battlerId, GetBattlerHoldEffectParam(battlerId), gLastUsedItem)) { gBattleMons[battlerId].status2 |= STATUS2_FOCUS_ENERGY; BattleScriptExecute(BattleScript_BerryFocusEnergyEnd2); @@ -6586,11 +6672,10 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } break; case HOLD_EFFECT_RANDOM_STAT_UP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = RandomStatRaiseBerry(battlerId, gLastUsedItem, TRUE); + effect = RandomStatRaiseBerry(battlerId, gLastUsedItem, TRUE); break; case HOLD_EFFECT_CURE_PAR: - if (B_BERRIES_INSTANT >= GEN_4 && gBattleMons[battlerId].status1 & STATUS1_PARALYSIS && !UnnerveOn(battlerId, gLastUsedItem)) + if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS && !UnnerveOn(battlerId, gLastUsedItem)) { gBattleMons[battlerId].status1 &= ~STATUS1_PARALYSIS; BattleScriptExecute(BattleScript_BerryCurePrlzEnd2); @@ -6598,7 +6683,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } break; case HOLD_EFFECT_CURE_PSN: - if (B_BERRIES_INSTANT >= GEN_4 && gBattleMons[battlerId].status1 & STATUS1_PSN_ANY && !UnnerveOn(battlerId, gLastUsedItem)) + if (gBattleMons[battlerId].status1 & STATUS1_PSN_ANY && !UnnerveOn(battlerId, gLastUsedItem)) { gBattleMons[battlerId].status1 &= ~(STATUS1_PSN_ANY | STATUS1_TOXIC_COUNTER); BattleScriptExecute(BattleScript_BerryCurePsnEnd2); @@ -6606,7 +6691,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } break; case HOLD_EFFECT_CURE_BRN: - if (B_BERRIES_INSTANT >= GEN_4 && gBattleMons[battlerId].status1 & STATUS1_BURN && !UnnerveOn(battlerId, gLastUsedItem)) + if (gBattleMons[battlerId].status1 & STATUS1_BURN && !UnnerveOn(battlerId, gLastUsedItem)) { gBattleMons[battlerId].status1 &= ~STATUS1_BURN; BattleScriptExecute(BattleScript_BerryCureBrnEnd2); @@ -6614,7 +6699,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } break; case HOLD_EFFECT_CURE_FRZ: - if (B_BERRIES_INSTANT >= GEN_4 && gBattleMons[battlerId].status1 & STATUS1_FREEZE && !UnnerveOn(battlerId, gLastUsedItem)) + if (gBattleMons[battlerId].status1 & STATUS1_FREEZE && !UnnerveOn(battlerId, gLastUsedItem)) { gBattleMons[battlerId].status1 &= ~STATUS1_FREEZE; BattleScriptExecute(BattleScript_BerryCureFrzEnd2); @@ -6622,7 +6707,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } break; case HOLD_EFFECT_CURE_SLP: - if (B_BERRIES_INSTANT >= GEN_4 && gBattleMons[battlerId].status1 & STATUS1_SLEEP && !UnnerveOn(battlerId, gLastUsedItem)) + if (gBattleMons[battlerId].status1 & STATUS1_SLEEP && !UnnerveOn(battlerId, gLastUsedItem)) { gBattleMons[battlerId].status1 &= ~STATUS1_SLEEP; gBattleMons[battlerId].status2 &= ~STATUS2_NIGHTMARE; @@ -6631,7 +6716,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } break; case HOLD_EFFECT_CURE_STATUS: - if (B_BERRIES_INSTANT >= GEN_4 && (gBattleMons[battlerId].status1 & STATUS1_ANY || gBattleMons[battlerId].status2 & STATUS2_CONFUSION) && !UnnerveOn(battlerId, gLastUsedItem)) + if ((gBattleMons[battlerId].status1 & STATUS1_ANY || gBattleMons[battlerId].status2 & STATUS2_CONFUSION) && !UnnerveOn(battlerId, gLastUsedItem)) { i = 0; if (gBattleMons[battlerId].status1 & STATUS1_PSN_ANY) @@ -6676,13 +6761,12 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } break; case HOLD_EFFECT_RESTORE_HP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = ItemHealHp(battlerId, gLastUsedItem, TRUE, FALSE); + effect = ItemHealHp(battlerId, gLastUsedItem, TRUE, FALSE); break; case HOLD_EFFECT_RESTORE_PCT_HP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = ItemHealHp(battlerId, gLastUsedItem, TRUE, TRUE); + effect = ItemHealHp(battlerId, gLastUsedItem, TRUE, TRUE); break; + #endif case HOLD_EFFECT_AIR_BALLOON: effect = ITEM_EFFECT_OTHER; gBattleScripting.battler = battlerId; @@ -7043,62 +7127,52 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) DO_ITEMEFFECT_MOVE_END: switch (battlerHoldEffect) { + #if B_HP_BERRIES >= GEN_4 case HOLD_EFFECT_MICLE_BERRY: - if (B_HP_BERRIES >= GEN_4) - effect = TrySetMicleBerry(battlerId, gLastUsedItem, FALSE); + effect = TrySetMicleBerry(battlerId, gLastUsedItem, FALSE); break; case HOLD_EFFECT_RESTORE_HP: - if (B_HP_BERRIES >= GEN_4) - effect = ItemHealHp(battlerId, gLastUsedItem, FALSE, FALSE); + effect = ItemHealHp(battlerId, gLastUsedItem, FALSE, FALSE); break; + #endif + #if B_BERRIES_INSTANT >= GEN_4 case HOLD_EFFECT_RESTORE_PCT_HP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = ItemHealHp(battlerId, gLastUsedItem, FALSE, TRUE); + effect = ItemHealHp(battlerId, gLastUsedItem, FALSE, TRUE); break; case HOLD_EFFECT_CONFUSE_SPICY: - if (B_BERRIES_INSTANT >= GEN_4) - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SPICY, FALSE); + effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SPICY, FALSE); break; case HOLD_EFFECT_CONFUSE_DRY: - if (B_BERRIES_INSTANT >= GEN_4) - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_DRY, FALSE); + effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_DRY, FALSE); break; case HOLD_EFFECT_CONFUSE_SWEET: - if (B_BERRIES_INSTANT >= GEN_4) - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SWEET, FALSE); + effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SWEET, FALSE); break; case HOLD_EFFECT_CONFUSE_BITTER: - if (B_BERRIES_INSTANT >= GEN_4) - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_BITTER, FALSE); + effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_BITTER, FALSE); break; case HOLD_EFFECT_CONFUSE_SOUR: - if (B_BERRIES_INSTANT >= GEN_4) - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SOUR, FALSE); + effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SOUR, FALSE); break; case HOLD_EFFECT_ATTACK_UP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_ATK, FALSE); + effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_ATK, FALSE); break; case HOLD_EFFECT_DEFENSE_UP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_DEF, FALSE); + effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_DEF, FALSE); break; case HOLD_EFFECT_SPEED_UP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPEED, FALSE); + effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPEED, FALSE); break; case HOLD_EFFECT_SP_ATTACK_UP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPATK, FALSE); + effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPATK, FALSE); break; case HOLD_EFFECT_SP_DEFENSE_UP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPDEF, FALSE); + effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPDEF, FALSE); break; case HOLD_EFFECT_RANDOM_STAT_UP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = RandomStatRaiseBerry(battlerId, gLastUsedItem, FALSE); + effect = RandomStatRaiseBerry(battlerId, gLastUsedItem, FALSE); break; + #endif case HOLD_EFFECT_CURE_PAR: if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS && !UnnerveOn(battlerId, gLastUsedItem)) { @@ -7232,10 +7306,10 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) switch (atkHoldEffect) { case HOLD_EFFECT_FLINCH: - #if B_SERENE_GRACE_BOOST >= GEN_5 - if (GetBattlerAbility(gBattlerAttacker) == ABILITY_SERENE_GRACE) - atkHoldEffectParam *= 2; - #endif + #if B_SERENE_GRACE_BOOST >= GEN_5 + if (GetBattlerAbility(gBattlerAttacker) == ABILITY_SERENE_GRACE) + atkHoldEffectParam *= 2; + #endif if (gBattleMoveDamage != 0 // Need to have done damage && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && TARGET_TURN_DAMAGED @@ -7579,7 +7653,7 @@ u32 GetMoveTarget(u16 move, u8 setTarget) switch (moveTarget) { case MOVE_TARGET_SELECTED: - side = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE; + side = BATTLE_OPPOSITE(GetBattlerSide(gBattlerAttacker)); if (IsAffectedByFollowMe(gBattlerAttacker, side, move)) { targetBattler = gSideTimers[side].followmeTarget; @@ -7609,18 +7683,18 @@ u32 GetMoveTarget(u16 move, u8 setTarget) case MOVE_TARGET_BOTH: case MOVE_TARGET_FOES_AND_ALLY: case MOVE_TARGET_OPPONENTS_FIELD: - targetBattler = GetBattlerAtPosition((GetBattlerPosition(gBattlerAttacker) & BIT_SIDE) ^ BIT_SIDE); + targetBattler = GetBattlerAtPosition(BATTLE_OPPOSITE(GET_BATTLER_SIDE(gBattlerAttacker))); if (!IsBattlerAlive(targetBattler)) targetBattler ^= BIT_FLANK; break; case MOVE_TARGET_RANDOM: - side = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE; + side = BATTLE_OPPOSITE(GetBattlerSide(gBattlerAttacker)); if (IsAffectedByFollowMe(gBattlerAttacker, side, move)) targetBattler = gSideTimers[side].followmeTarget; else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && moveTarget & MOVE_TARGET_RANDOM) targetBattler = SetRandomTarget(gBattlerAttacker); else - targetBattler = GetBattlerAtPosition((GetBattlerPosition(gBattlerAttacker) & BIT_SIDE) ^ BIT_SIDE); + targetBattler = GetBattlerAtPosition(BATTLE_OPPOSITE(GET_BATTLER_SIDE(gBattlerAttacker))); break; case MOVE_TARGET_USER_OR_SELECTED: case MOVE_TARGET_USER: @@ -7781,9 +7855,12 @@ u32 GetBattlerHoldEffect(u8 battlerId, bool32 checkNegating) gPotentialItemEffectBattler = battlerId; - if (B_ENABLE_DEBUG && gBattleStruct->debugHoldEffects[battlerId] != 0 && gBattleMons[battlerId].item) +#if B_ENABLE_DEBUG == TRUE + if (gBattleStruct->debugHoldEffects[battlerId] != 0 && gBattleMons[battlerId].item) return gBattleStruct->debugHoldEffects[battlerId]; - else if (gBattleMons[battlerId].item == ITEM_ENIGMA_BERRY) + else +#endif + if (gBattleMons[battlerId].item == ITEM_ENIGMA_BERRY) return gEnigmaBerries[battlerId].holdEffect; else return ItemId_GetHoldEffect(gBattleMons[battlerId].item); @@ -7913,7 +7990,7 @@ u8 GetBattleMonMoveSlot(struct BattlePokemon *battleMon, u16 move) { u8 i; - for (i = 0; i < 4; i++) + for (i = 0; i < MAX_MON_MOVES; i++) { if (battleMon->moves[i] == move) break; @@ -8117,7 +8194,7 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef) // todo break; case EFFECT_FLING: - basePower = ItemId_GetFlingPower(gBattleMons[battlerAtk].item); + basePower = GetFlingPowerFromItemId(gBattleMons[battlerAtk].item); break; case EFFECT_ERUPTION: basePower = gBattleMons[battlerAtk].hp * basePower / gBattleMons[battlerAtk].maxHP; @@ -8261,7 +8338,10 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef) break; case EFFECT_PAYBACK: if (GetBattlerTurnOrderNum(battlerAtk) > GetBattlerTurnOrderNum(battlerDef) - && (gDisableStructs[battlerDef].isFirstTurn != 2 || B_PAYBACK_SWITCH_BOOST < GEN_5)) + #if B_PAYBACK_SWITCH_BOOST >= GEN_5 + && (gDisableStructs[battlerDef].isFirstTurn != 2) + #endif + ) basePower *= 2; break; case EFFECT_BOLT_BEAK: @@ -8547,11 +8627,11 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe MulModifier(&modifier, holdEffectModifier); break; case HOLD_EFFECT_SOUL_DEW: - #if B_SOUL_DEW_BOOST >= GEN_7 + #if B_SOUL_DEW_BOOST >= GEN_7 if ((gBattleMons[battlerAtk].species == SPECIES_LATIAS || gBattleMons[battlerAtk].species == SPECIES_LATIOS) && (moveType == TYPE_PSYCHIC || moveType == TYPE_DRAGON)) - #else + #else if ((gBattleMons[battlerAtk].species == SPECIES_LATIAS || gBattleMons[battlerAtk].species == SPECIES_LATIOS) && !(gBattleTypeFlags & BATTLE_TYPE_FRONTIER) && IS_MOVE_SPECIAL(move)) - #endif + #endif MulModifier(&modifier, holdEffectModifier); break; case HOLD_EFFECT_GEMS: @@ -8634,6 +8714,12 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe break; } +#if B_TERRAIN_TYPE_BOOST >= GEN_8 + #define TERRAIN_TYPE_BOOST UQ_4_12(1.3) +#else + #define TERRAIN_TYPE_BOOST UQ_4_12(1.5) +#endif + // various effecs if (gProtectStructs[battlerAtk].helpingHand) MulModifier(&modifier, UQ_4_12(1.5)); @@ -8642,24 +8728,28 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe if (gStatuses3[battlerAtk] & STATUS3_ME_FIRST) MulModifier(&modifier, UQ_4_12(1.5)); if (gFieldStatuses & STATUS_FIELD_GRASSY_TERRAIN && moveType == TYPE_GRASS && IsBattlerGrounded(battlerAtk) && !(gStatuses3[battlerAtk] & STATUS3_SEMI_INVULNERABLE)) - MulModifier(&modifier, (B_TERRAIN_TYPE_BOOST >= GEN_8) ? UQ_4_12(1.3) : UQ_4_12(1.5)); + MulModifier(&modifier, TERRAIN_TYPE_BOOST); if (gFieldStatuses & STATUS_FIELD_MISTY_TERRAIN && moveType == TYPE_DRAGON && IsBattlerGrounded(battlerDef) && !(gStatuses3[battlerDef] & STATUS3_SEMI_INVULNERABLE)) MulModifier(&modifier, UQ_4_12(0.5)); if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN && moveType == TYPE_ELECTRIC && IsBattlerGrounded(battlerAtk) && !(gStatuses3[battlerAtk] & STATUS3_SEMI_INVULNERABLE)) - MulModifier(&modifier, (B_TERRAIN_TYPE_BOOST >= GEN_8) ? UQ_4_12(1.3) : UQ_4_12(1.5)); + MulModifier(&modifier, TERRAIN_TYPE_BOOST); if (gFieldStatuses & STATUS_FIELD_PSYCHIC_TERRAIN && moveType == TYPE_PSYCHIC && IsBattlerGrounded(battlerAtk) && !(gStatuses3[battlerAtk] & STATUS3_SEMI_INVULNERABLE)) - MulModifier(&modifier, (B_TERRAIN_TYPE_BOOST >= GEN_8) ? UQ_4_12(1.3) : UQ_4_12(1.5)); + MulModifier(&modifier, TERRAIN_TYPE_BOOST); #if B_SPORT_TURNS >= GEN_6 - if ((gFieldStatuses & STATUS_FIELD_MUDSPORT && moveType == TYPE_ELECTRIC) - || (gFieldStatuses & STATUS_FIELD_WATERSPORT && moveType == TYPE_FIRE)) - MulModifier(&modifier, (B_SPORT_DMG_REDUCTION >= GEN_5) ? UQ_4_12(0.23) : UQ_4_12(0.5)); + if ((moveType == TYPE_ELECTRIC && gFieldStatuses & STATUS_FIELD_MUDSPORT) + || (moveType == TYPE_FIRE && gFieldStatuses & STATUS_FIELD_WATERSPORT)) #else if ((moveType == TYPE_ELECTRIC && AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, 0, ABILITYEFFECT_MUD_SPORT, 0)) - || (moveType == TYPE_FIRE && AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, 0, ABILITYEFFECT_WATER_SPORT, 0))) - MulModifier(&modifier, (B_SPORT_DMG_REDUCTION >= GEN_5) ? UQ_4_12(0.23) : UQ_4_12(0.5)); + || (moveType == TYPE_FIRE && AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, 0, ABILITYEFFECT_WATER_SPORT, 0))) + #endif + #if B_SPORT_DMG_REDUCTION >= GEN_5 + MulModifier(&modifier, UQ_4_12(0.23)); + #else + MulModifier(&modifier, UQ_4_12(0.5)); #endif return ApplyModifier(modifier, basePower); } +#undef TERRAIN_TYPE_BOOST static u32 CalcAttackStat(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, bool32 isCrit, bool32 updateFlags) { @@ -9035,11 +9125,17 @@ static u32 CalcFinalDmg(u32 dmg, u16 move, u8 battlerAtk, u8 battlerDef, u8 move // check crit if (isCrit) - dmg = ApplyModifier((B_CRIT_MULTIPLIER >= GEN_6 ? UQ_4_12(1.5) : UQ_4_12(2.0)), dmg); + #if B_CRIT_MULTIPLIER >= GEN_6 + dmg = ApplyModifier(UQ_4_12(1.5), dmg); + #else + dmg = ApplyModifier(UQ_4_12(2.0), dmg); + #endif // check burn if (gBattleMons[battlerAtk].status1 & STATUS1_BURN && IS_MOVE_PHYSICAL(move) - && (gBattleMoves[move].effect != EFFECT_FACADE || B_BURN_FACADE_DMG < GEN_6) + #if B_BURN_FACADE_DMG >= GEN_6 + && gBattleMoves[move].effect != EFFECT_FACADE + #endif && abilityAtk != ABILITY_GUTS) dmg = ApplyModifier(UQ_4_12(0.5), dmg); @@ -9313,14 +9409,18 @@ static u16 CalcTypeEffectivenessMultiplierInternal(u16 move, u8 moveType, u8 bat RecordAbilityBattle(battlerDef, ABILITY_LEVITATE); } } - else if (B_SHEER_COLD_IMMUNITY >= GEN_7 && move == MOVE_SHEER_COLD && IS_BATTLER_OF_TYPE(battlerDef, TYPE_ICE)) +#if B_SHEER_COLD_IMMUNITY >= GEN_7 + else if (move == MOVE_SHEER_COLD && IS_BATTLER_OF_TYPE(battlerDef, TYPE_ICE)) { modifier = UQ_4_12(0.0); } - else if (B_GLARE_GHOST >= GEN_4 && move == MOVE_GLARE && IS_BATTLER_OF_TYPE(battlerDef, TYPE_GHOST)) +#endif +#if B_GLARE_GHOST >= GEN_4 + else if (move == MOVE_GLARE && IS_BATTLER_OF_TYPE(battlerDef, TYPE_GHOST)) { modifier = UQ_4_12(1.0); } +#endif // Thousand Arrows ignores type modifiers for flying mons if (!IsBattlerGrounded(battlerDef) && (gBattleMoves[move].flags & FLAG_DMG_UNGROUNDED_IGNORE_TYPE_IF_FLYING) @@ -9386,10 +9486,11 @@ u16 CalcPartyMonTypeEffectivenessMultiplier(u16 move, u16 speciesDef, u16 abilit u16 GetTypeModifier(u8 atkType, u8 defType) { - if (B_FLAG_INVERSE_BATTLE != 0 && FlagGet(B_FLAG_INVERSE_BATTLE)) +#if B_FLAG_INVERSE_BATTLE != 0 + if (FlagGet(B_FLAG_INVERSE_BATTLE)) return sInverseTypeEffectivenessTable[atkType][defType]; - else - return sTypeEffectivenessTable[atkType][defType]; +#endif + return sTypeEffectivenessTable[atkType][defType]; } s32 GetStealthHazardDamage(u8 hazardType, u8 battlerId) @@ -9535,9 +9636,12 @@ bool32 CanMegaEvolve(u8 battlerId) // Check if there is an entry in the evolution table for regular Mega Evolution. if (GetMegaEvolutionSpecies(species, itemId) != SPECIES_NONE) { + #if B_ENABLE_DEBUG == TRUE if (B_ENABLE_DEBUG && gBattleStruct->debugHoldEffects[battlerId]) holdEffect = gBattleStruct->debugHoldEffects[battlerId]; - else if (itemId == ITEM_ENIGMA_BERRY_E_READER) + else + #endif + if (itemId == ITEM_ENIGMA_BERRY_E_READER) holdEffect = gEnigmaBerries[battlerId].holdEffect; else holdEffect = ItemId_GetHoldEffect(itemId); @@ -9738,9 +9842,8 @@ bool32 SetIllusionMon(struct Pokemon *mon, u32 battlerId) bool8 ShouldGetStatBadgeBoost(u16 badgeFlag, u8 battlerId) { - if (B_BADGE_BOOST != GEN_3) - return FALSE; - else if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_FRONTIER)) +#if B_BADGE_BOOST != GEN_3 + if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_FRONTIER)) return FALSE; else if (GetBattlerSide(battlerId) != B_SIDE_PLAYER) return FALSE; @@ -9748,8 +9851,8 @@ bool8 ShouldGetStatBadgeBoost(u16 badgeFlag, u8 battlerId) return FALSE; else if (FlagGet(badgeFlag)) return TRUE; - else - return FALSE; +#endif + return FALSE; } u8 GetBattleMoveSplit(u32 moveId) @@ -9758,12 +9861,17 @@ u8 GetBattleMoveSplit(u32 moveId) return gBattleStruct->zmove.activeSplit; if (gBattleStruct != NULL && gBattleStruct->swapDamageCategory) // Photon Geyser, Shell Side Arm, Light That Burns the Sky return SPLIT_PHYSICAL; - else if (IS_MOVE_STATUS(moveId) || B_PHYSICAL_SPECIAL_SPLIT >= GEN_4) - return gBattleMoves[moveId].split; + +#if B_PHYSICAL_SPECIAL_SPLIT >= GEN_4 + return gBattleMoves[moveId].split; +#else + if (IS_MOVE_STATUS(moveId)) + return SPLIT_STATUS; else if (gBattleMoves[moveId].type < TYPE_MYSTERY) return SPLIT_PHYSICAL; else return SPLIT_SPECIAL; +#endif } static bool32 TryRemoveScreens(u8 battler) @@ -9840,6 +9948,19 @@ struct Pokemon *GetBattlerPartyData(u8 battlerId) return mon; } +static u8 GetFlingPowerFromItemId(u16 itemId) +{ + if (itemId >= ITEM_TM01 && itemId <= ITEM_HM08) + { + u8 power = gBattleMoves[ItemIdToBattleMoveId(itemId)].power; + if (power > 1) + return power; + return 10; // Status moves and moves with variable power always return 10 power. + } + else + return ItemId_GetFlingPower(itemId); +} + // Make sure the input bank is any bank on the specific mon's side bool32 CanFling(u8 battlerId) { @@ -9852,7 +9973,7 @@ bool32 CanFling(u8 battlerId) #endif || gFieldStatuses & STATUS_FIELD_MAGIC_ROOM || gDisableStructs[battlerId].embargoTimer != 0 - || ItemId_GetFlingPower(item) != 0 + || GetFlingPowerFromItemId(item) != 0 || !CanBattlerGetOrLoseItem(battlerId, item)) return FALSE; @@ -10008,7 +10129,7 @@ bool32 CanStealItem(u8 battlerStealing, u8 battlerItem, u16 item) | BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_SECRET_BASE - #if B_TRAINERS_KNOCK_OFF_ITEMS + #if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE | BATTLE_TYPE_TRAINER #endif ))) @@ -10037,14 +10158,14 @@ void TrySaveExchangedItem(u8 battlerId, u16 stolenItem) { // Because BtlController_EmitSetMonData does SetMonData, we need to save the stolen item only if it matches the battler's original // So, if the player steals an item during battle and has it stolen from it, it will not end the battle with it (naturally) - #if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE +#if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE // If regular trainer battle and mon's original item matches what is being stolen, save it to be restored at end of battle if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && !(gBattleTypeFlags & BATTLE_TYPE_FRONTIER) && GetBattlerSide(battlerId) == B_SIDE_PLAYER && stolenItem == gBattleStruct->itemStolen[gBattlerPartyIndexes[battlerId]].originalItem) gBattleStruct->itemStolen[gBattlerPartyIndexes[battlerId]].stolen = TRUE; - #endif +#endif } bool32 IsBattlerAffectedByHazards(u8 battlerId, bool32 toxicSpikes) diff --git a/src/battle_z_move.c b/src/battle_z_move.c index efa1e6e18c..d41e28ac23 100644 --- a/src/battle_z_move.c +++ b/src/battle_z_move.c @@ -58,7 +58,6 @@ static u8 GetZMoveScore(u8 battlerAtk, u8 battlerDef, u16 baseMove, u16 zMove); // Const Data static const struct SignatureZMove sSignatureZMoves[] = { -// #ifdef NEW_POKEMON {SPECIES_PIKACHU_COSPLAY, ITEM_PIKANIUM_Z, MOVE_VOLT_TACKLE, MOVE_CATASTROPIKA}, {SPECIES_PIKACHU_ROCK_STAR, ITEM_PIKANIUM_Z, MOVE_VOLT_TACKLE, MOVE_CATASTROPIKA}, {SPECIES_PIKACHU_BELLE, ITEM_PIKANIUM_Z, MOVE_VOLT_TACKLE, MOVE_CATASTROPIKA}, @@ -95,7 +94,6 @@ static const struct SignatureZMove sSignatureZMoves[] = {SPECIES_TAPU_LELE, ITEM_TAPUNIUM_Z, MOVE_NATURES_MADNESS, MOVE_GUARDIAN_OF_ALOLA}, {SPECIES_TAPU_FINI, ITEM_TAPUNIUM_Z, MOVE_NATURES_MADNESS, MOVE_GUARDIAN_OF_ALOLA}, {SPECIES_NECROZMA_ULTRA, ITEM_ULTRANECROZIUM_Z, MOVE_PHOTON_GEYSER, MOVE_LIGHT_THAT_BURNS_THE_SKY}, -// #endif {SPECIES_MEW, ITEM_MEWNIUM_Z, MOVE_PSYCHIC, MOVE_GENESIS_SUPERNOVA}, {SPECIES_PIKACHU, ITEM_PIKANIUM_Z, MOVE_VOLT_TACKLE, MOVE_CATASTROPIKA}, {SPECIES_EEVEE, ITEM_EEVIUM_Z, MOVE_LAST_RESORT, MOVE_EXTREME_EVOBOOST}, @@ -189,10 +187,13 @@ bool32 IsViableZMove(u8 battlerId, u16 move) if (IsPartnerMonFromSameTrainer(battlerId) && (mega->alreadyEvolved[partnerPosition] || (mega->toEvolve & gBitTable[BATTLE_PARTNER(battlerId)]))) return FALSE; // Partner has mega evolved or is about to mega evolve } - - if (B_ENABLE_DEBUG && gBattleStruct->debugHoldEffects[battlerId]) + +#if B_ENABLE_DEBUG == TRUE + if (gBattleStruct->debugHoldEffects[battlerId]) holdEffect = gBattleStruct->debugHoldEffects[battlerId]; - else if (item == ITEM_ENIGMA_BERRY) + else +#endif + if (item == ITEM_ENIGMA_BERRY) return FALSE; // HoldEffect = gEnigmaBerries[battlerId].holdEffect; else holdEffect = ItemId_GetHoldEffect(item); diff --git a/src/cable_car.c b/src/cable_car.c index 562e9eceb7..dd1da31762 100644 --- a/src/cable_car.c +++ b/src/cable_car.c @@ -202,7 +202,7 @@ static const struct OamData sOam_Cable = .paletteNum = 0, }; -static const struct SpriteTemplate sSpriteTemplate_CableCar[] = +static const struct SpriteTemplate sSpriteTemplates_CableCar[] = { { .tileTag = TAG_CABLE_CAR, @@ -224,7 +224,8 @@ static const struct SpriteTemplate sSpriteTemplate_CableCar[] = }, }; -static const struct SpriteTemplate sSpriteTemplate_Cable = { +static const struct SpriteTemplate sSpriteTemplate_Cable = +{ .tileTag = TAG_CABLE, .paletteTag = TAG_CABLE_CAR, .oam = &sOam_Cable, @@ -836,12 +837,12 @@ static void CreateCableCarSprites(void) gSprites[spriteId].sYPos = 73; } // Create car sprite - spriteId = CreateSprite(&sSpriteTemplate_CableCar[0], 176, 43, 0x67); + spriteId = CreateSprite(&sSpriteTemplates_CableCar[0], 176, 43, 0x67); gSprites[spriteId].x2 = gSprites[spriteId].y2 = 32; gSprites[spriteId].sXPos = 176; gSprites[spriteId].sYPos = 43; // Create door sprite - spriteId = CreateSprite(&sSpriteTemplate_CableCar[1], 200, 99, 0x65); + spriteId = CreateSprite(&sSpriteTemplates_CableCar[1], 200, 99, 0x65); gSprites[spriteId].x2 = 8; gSprites[spriteId].y2 = 4; gSprites[spriteId].sXPos = 200; @@ -864,12 +865,12 @@ static void CreateCableCarSprites(void) gSprites[spriteId].sYPos = 39; } // Create car sprite - spriteId = CreateSprite(&sSpriteTemplate_CableCar[0], 104, 9, 0x67); + spriteId = CreateSprite(&sSpriteTemplates_CableCar[0], 104, 9, 0x67); gSprites[spriteId].x2 = gSprites[spriteId].y2 = 32; gSprites[spriteId].sXPos = 104; gSprites[spriteId].sYPos = 9; // Create door sprite - spriteId = CreateSprite(&sSpriteTemplate_CableCar[1], 128, 65, 0x65); + spriteId = CreateSprite(&sSpriteTemplates_CableCar[1], 128, 65, 0x65); gSprites[spriteId].x2 = 8; gSprites[spriteId].y2 = 4; gSprites[spriteId].sXPos = 128; diff --git a/src/data/battle_anim.h b/src/data/battle_anim.h index 62f3802a5c..b8fb8c0378 100644 --- a/src/data/battle_anim.h +++ b/src/data/battle_anim.h @@ -1014,16 +1014,16 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_Pencil, 0x0200, ANIM_TAG_PENCIL}, {gBattleAnimSpriteGfx_AirWave, 0x0100, ANIM_TAG_AIR_WAVE}, {gBattleAnimSpriteGfx_Orb, 0x0200, ANIM_TAG_ORB}, - #if B_NEW_SWORD_PARTICLE +#if B_NEW_SWORD_PARTICLE {gBattleAnimSpriteGfx_NewSword, 0x0400, ANIM_TAG_SWORD}, - #else +#else {gBattleAnimSpriteGfx_Sword, 0x0400, ANIM_TAG_SWORD}, - #endif - #if B_NEW_LEECH_SEED_PARTICLE +#endif +#if B_NEW_LEECH_SEED_PARTICLE {gBattleAnimSpriteGfx_NewLeechSeed, 0x0180, ANIM_TAG_SEED}, - #else +#else {gBattleAnimSpriteGfx_Seed, 0x0180, ANIM_TAG_SEED}, - #endif +#endif {gBattleAnimSpriteGfx_Explosion6, 0x0800, ANIM_TAG_EXPLOSION_6}, {gBattleAnimSpriteGfx_PinkOrb, 0x0020, ANIM_TAG_PINK_ORB}, {gBattleAnimSpriteGfx_Gust, 0x0400, ANIM_TAG_GUST}, @@ -1046,11 +1046,11 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_HitDuplicate, 0x0A00, ANIM_TAG_HIT_DUPLICATE}, {gBattleAnimSpriteGfx_Leer, 0x0A00, ANIM_TAG_LEER}, {gBattleAnimSpriteGfx_BlueBurst, 0x0A00, ANIM_TAG_BLUE_BURST}, - #if B_NEW_EMBER_PARTICLES +#if B_NEW_EMBER_PARTICLES {gBattleAnimSpriteGfx_NewEmbers, 0x0A00, ANIM_TAG_SMALL_EMBER}, - #else +#else {gBattleAnimSpriteGfx_SmallEmber, 0x0A00, ANIM_TAG_SMALL_EMBER}, - #endif +#endif {gBattleAnimSpriteGfx_GraySmoke, 0x0A00, ANIM_TAG_GRAY_SMOKE}, {gBattleAnimSpriteGfx_BlueStar, 0x0E00, ANIM_TAG_BLUE_STAR}, {gBattleAnimSpriteGfx_BubbleBurst, 0x0380, ANIM_TAG_BUBBLE_BURST}, @@ -1079,20 +1079,20 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_RedFist, 0x0200, ANIM_TAG_RED_FIST}, {gBattleAnimSpriteGfx_SlamHit, 0x1000, ANIM_TAG_SLAM_HIT}, {gBattleAnimSpriteGfx_Ring, 0x0180, ANIM_TAG_RING}, - #if NEW_ROCKS_PARTICLE +#if NEW_ROCKS_PARTICLE {gBattleAnimSpriteGfx_NewRocks, 0x0C00, ANIM_TAG_ROCKS}, - #else +#else {gBattleAnimSpriteGfx_Rocks, 0x0C00, ANIM_TAG_ROCKS}, - #endif +#endif {gBattleAnimSpriteGfx_Z, 0x0100, ANIM_TAG_Z}, {gBattleAnimSpriteGfx_YellowUnk2, 0x0040, ANIM_TAG_YELLOW_UNK_2}, {gBattleAnimSpriteGfx_AirSlash, 0x0180, ANIM_TAG_AIR_SLASH}, {gBattleAnimSpriteGfx_SpinningGreenOrbs, 0x0800, ANIM_TAG_SPINNING_GREEN_ORBS}, - #if B_NEW_LEAF_PARTICLE +#if B_NEW_LEAF_PARTICLE {gBattleAnimSpriteGfx_NewLeaf, 0x0480, ANIM_TAG_LEAF}, - #else +#else {gBattleAnimSpriteGfx_Leaf, 0x0480, ANIM_TAG_LEAF}, - #endif +#endif {gBattleAnimSpriteGfx_Finger, 0x0200, ANIM_TAG_FINGER}, {gBattleAnimSpriteGfx_PoisonPowder, 0x0200, ANIM_TAG_POISON_POWDER}, {gBattleAnimSpriteGfx_BrownTriangle, 0x0100, ANIM_TAG_BROWN_TRIANGLE}, @@ -1156,11 +1156,11 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_Shock2, 0x0600, ANIM_TAG_SHOCK_2}, {gBattleAnimSpriteGfx_ClosingEye2, 0x0200, ANIM_TAG_CLOSING_EYE_2}, {gBattleAnimSpriteGfx_MetalBall, 0x0080, ANIM_TAG_METAL_BALL}, - #if NEW_SUBSTITUTE_PARTICLE +#if NEW_SUBSTITUTE_PARTICLE {gBattleAnimSpriteGfx_NewSubstituteFront, 0x0200, ANIM_TAG_MONSTER_DOLL}, - #else +#else {gBattleAnimSpriteGfx_MonsterDoll, 0x0200, ANIM_TAG_MONSTER_DOLL}, - #endif +#endif {gBattleAnimSpriteGfx_Whirlwind, 0x0800, ANIM_TAG_WHIRLWIND}, {gBattleAnimSpriteGfx_Whirlwind2, 0x0080, ANIM_TAG_WHIRLWIND_2}, {gBattleAnimSpriteGfx_Explosion4, 0x0a00, ANIM_TAG_EXPLOSION_4}, @@ -1172,19 +1172,19 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_CircleImpact, 0x0020, ANIM_TAG_CIRCLE_IMPACT}, {gBattleAnimSpriteGfx_Scratch, 0x0a00, ANIM_TAG_SCRATCH}, {gBattleAnimSpriteGfx_Cut, 0x0800, ANIM_TAG_CUT}, - #if B_NEW_TEETH_PARTICLE +#if B_NEW_TEETH_PARTICLE {gBattleAnimSpriteGfx_NewTeeth, 0x0800, ANIM_TAG_SHARP_TEETH}, - #else +#else {gBattleAnimSpriteGfx_SharpTeeth, 0x0800, ANIM_TAG_SHARP_TEETH}, - #endif +#endif {gBattleAnimSpriteGfx_RainbowRings, 0x00c0, ANIM_TAG_RAINBOW_RINGS}, {gBattleAnimSpriteGfx_IceCrystals, 0x01c0, ANIM_TAG_ICE_CRYSTALS}, {gBattleAnimSpriteGfx_IceSpikes, 0x0100, ANIM_TAG_ICE_SPIKES}, - #if B_NEW_HANDS_FEET_PARTICLE +#if B_NEW_HANDS_FEET_PARTICLE {gBattleAnimSpriteGfx_NewHandsAndFeet, 0x0800, ANIM_TAG_HANDS_AND_FEET}, - #else +#else {gBattleAnimSpriteGfx_HandsAndFeet, 0x0800, ANIM_TAG_HANDS_AND_FEET}, - #endif +#endif {gBattleAnimSpriteGfx_MistCloud, 0x0200, ANIM_TAG_MIST_CLOUD}, {gBattleAnimSpriteGfx_Clamp, 0x0800, ANIM_TAG_CLAMP}, {gBattleAnimSpriteGfx_Bubble, 0x0180, ANIM_TAG_BUBBLE}, @@ -1193,19 +1193,19 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_WaterOrb, 0x0200, ANIM_TAG_WATER_ORB}, {gBattleAnimSpriteGfx_PoisonBubble, 0x0180, ANIM_TAG_POISON_BUBBLE}, {gBattleAnimSpriteGfx_ToxicBubble, 0x0400, ANIM_TAG_TOXIC_BUBBLE}, - #if B_NEW_SPIKES_PARTICLE +#if B_NEW_SPIKES_PARTICLE {gBattleAnimSpriteGfx_NewSpikes, 0x0080, ANIM_TAG_SPIKES}, - #else +#else {gBattleAnimSpriteGfx_Spikes, 0x0080, ANIM_TAG_SPIKES}, - #endif +#endif {gBattleAnimSpriteGfx_HornHit2, 0x0100, ANIM_TAG_HORN_HIT_2}, {gBattleAnimSpriteGfx_AirWave2, 0x0100, ANIM_TAG_AIR_WAVE_2}, {gBattleAnimSpriteGfx_SmallBubbles, 0x0140, ANIM_TAG_SMALL_BUBBLES}, - #if B_NEW_FLY_BUBBLE_PARTICLE +#if B_NEW_FLY_BUBBLE_PARTICLE {gBattleAnimSpriteGfx_NewFly, 0x0800, ANIM_TAG_ROUND_SHADOW}, - #else +#else {gBattleAnimSpriteGfx_RoundShadow, 0x0800, ANIM_TAG_ROUND_SHADOW}, - #endif +#endif {gBattleAnimSpriteGfx_Sunlight, 0x0200, ANIM_TAG_SUNLIGHT}, {gBattleAnimSpriteGfx_Spore, 0x0100, ANIM_TAG_SPORE}, {gBattleAnimSpriteGfx_Flower, 0x00a0, ANIM_TAG_FLOWER}, @@ -1236,11 +1236,11 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_FocusEnergy, 0x0400, ANIM_TAG_FOCUS_ENERGY}, {gBattleAnimSpriteGfx_SphereToCube, 0x0a00, ANIM_TAG_SPHERE_TO_CUBE}, {gBattleAnimSpriteGfx_Tendrils, 0x1000, ANIM_TAG_TENDRILS}, - #if B_NEW_MEAN_LOOK_PARTICLE +#if B_NEW_MEAN_LOOK_PARTICLE {gBattleAnimSpriteGfx_NewEye, 0x0800, ANIM_TAG_EYE}, - #else +#else {gBattleAnimSpriteGfx_Eye, 0x0800, ANIM_TAG_EYE}, - #endif +#endif {gBattleAnimSpriteGfx_WhiteShadow, 0x0400, ANIM_TAG_WHITE_SHADOW}, {gBattleAnimSpriteGfx_TealAlert, 0x0200, ANIM_TAG_TEAL_ALERT}, {gBattleAnimSpriteGfx_OpeningEye, 0x0800, ANIM_TAG_OPENING_EYE}, @@ -1252,11 +1252,11 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_Spiral, 0x0800, ANIM_TAG_SPIRAL}, {gBattleAnimSpriteGfx_SnoreZ, 0x0200, ANIM_TAG_SNORE_Z}, {gBattleAnimSpriteGfx_Explosion, 0x0800, ANIM_TAG_EXPLOSION}, - #if B_NEW_CURSE_NAIL_PARTICLE +#if B_NEW_CURSE_NAIL_PARTICLE {gBattleAnimSpriteGfx_NewNail, 0x0400, ANIM_TAG_NAIL}, - #else +#else {gBattleAnimSpriteGfx_Nail, 0x0400, ANIM_TAG_NAIL}, - #endif +#endif {gBattleAnimSpriteGfx_GhostlySpirit, 0x0200, ANIM_TAG_GHOSTLY_SPIRIT}, {gBattleAnimSpriteGfx_WarmRock, 0x0a80, ANIM_TAG_WARM_ROCK}, {gBattleAnimSpriteGfx_BreakingEgg, 0x0600, ANIM_TAG_BREAKING_EGG}, @@ -1283,11 +1283,11 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_Roots, 0x0800, ANIM_TAG_ROOTS}, {gBattleAnimSpriteGfx_ItemBag, 0x0200, ANIM_TAG_ITEM_BAG}, {gBattleAnimSpriteGfx_JaggedMusicNote, 0x0400, ANIM_TAG_JAGGED_MUSIC_NOTE}, - #if B_NEW_BATON_PASS_BALL_PARTICLE +#if B_NEW_BATON_PASS_BALL_PARTICLE {gBattleAnimSpriteGfx_NewPokeball, 0x0080, ANIM_TAG_POKEBALL}, - #else +#else {gBattleAnimSpriteGfx_Pokeball, 0x0080, ANIM_TAG_POKEBALL}, - #endif +#endif {gBattleAnimSpriteGfx_Spotlight, 0x0800, ANIM_TAG_SPOTLIGHT}, {gBattleAnimSpriteGfx_LetterZ, 0x0200, ANIM_TAG_LETTER_Z}, {gBattleAnimSpriteGfx_RapidSpin, 0x0300, ANIM_TAG_RAPID_SPIN}, @@ -1302,11 +1302,11 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_PinkPetal, 0x0080, ANIM_TAG_PINK_PETAL}, {gBattleAnimSpriteGfx_PainSplit, 0x0180, ANIM_TAG_PAIN_SPLIT}, {gBattleAnimSpriteGfx_Confetti, 0x0180, ANIM_TAG_CONFETTI}, - #if B_NEW_MORNING_SUN_STAR_PARTICLE +#if B_NEW_MORNING_SUN_STAR_PARTICLE {gBattleAnimSpriteGfx_NewGreenStar, 0x0200, ANIM_TAG_GREEN_STAR}, - #else +#else {gBattleAnimSpriteGfx_GreenStar, 0x0200, ANIM_TAG_GREEN_STAR}, - #endif +#endif {gBattleAnimSpriteGfx_PinkCloud, 0x0200, ANIM_TAG_PINK_CLOUD}, {gBattleAnimSpriteGfx_SweatDrop, 0x0020, ANIM_TAG_SWEAT_DROP}, {gBattleAnimSpriteGfx_GuardRing, 0x0400, ANIM_TAG_GUARD_RING}, @@ -1461,16 +1461,16 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_Pencil, ANIM_TAG_PENCIL}, {gBattleAnimSpritePal_AirWave, ANIM_TAG_AIR_WAVE}, {gBattleAnimSpritePal_Orb, ANIM_TAG_ORB}, - #if B_NEW_SWORD_PARTICLE +#if B_NEW_SWORD_PARTICLE {gBattleAnimSpritePal_NewSword, ANIM_TAG_SWORD}, - #else +#else {gBattleAnimSpritePal_Sword, ANIM_TAG_SWORD}, - #endif - #if B_NEW_LEECH_SEED_PARTICLE +#endif +#if B_NEW_LEECH_SEED_PARTICLE {gBattleAnimSpritePal_NewLeechSeed, ANIM_TAG_SEED}, - #else +#else {gBattleAnimSpritePal_Seed, ANIM_TAG_SEED}, - #endif +#endif {gBattleAnimSpritePal_Explosion6, ANIM_TAG_EXPLOSION_6}, {gBattleAnimSpritePal_PinkOrb, ANIM_TAG_PINK_ORB}, {gBattleAnimSpritePal_Gust, ANIM_TAG_GUST}, @@ -1484,11 +1484,11 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_BlackSmoke, ANIM_TAG_BLACK_BALL}, {gBattleAnimSpritePal_Conversion, ANIM_TAG_CONVERSION}, {gBattleAnimSpritePal_Glass, ANIM_TAG_GLASS}, - #if B_NEW_HORN_ATTACK_PARTICLE +#if B_NEW_HORN_ATTACK_PARTICLE {gBattleAnimSpritePal_NewHornHit, ANIM_TAG_HORN_HIT}, - #else +#else {gBattleAnimSpritePal_HornHit, ANIM_TAG_HORN_HIT}, - #endif +#endif {gBattleAnimSpritePal_Hit, ANIM_TAG_HIT}, {gBattleAnimSpritePal_Hit2, ANIM_TAG_HIT_2}, {gBattleAnimSpritePal_BlueShards, ANIM_TAG_BLUE_SHARDS}, @@ -1497,11 +1497,11 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_HitDuplicate, ANIM_TAG_HIT_DUPLICATE}, {gBattleAnimSpritePal_Leer, ANIM_TAG_LEER}, {gBattleAnimSpritePal_BlueBurst, ANIM_TAG_BLUE_BURST}, - #if B_NEW_EMBER_PARTICLES +#if B_NEW_EMBER_PARTICLES {gBattleAnimSpritePal_NewEmbers, ANIM_TAG_SMALL_EMBER}, - #else +#else {gBattleAnimSpritePal_SmallEmber, ANIM_TAG_SMALL_EMBER}, - #endif +#endif {gBattleAnimSpritePal_GraySmoke, ANIM_TAG_GRAY_SMOKE}, {gBattleAnimSpritePal_BlueStar, ANIM_TAG_BLUE_STAR}, {gBattleAnimSpritePal_BubbleBurst, ANIM_TAG_BUBBLE_BURST}, @@ -1530,20 +1530,20 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_HumanoidFoot, ANIM_TAG_RED_FIST}, {gBattleAnimSpritePal_SlamHit, ANIM_TAG_SLAM_HIT}, {gBattleAnimSpritePal_Ring, ANIM_TAG_RING}, - #if NEW_ROCKS_PARTICLE +#if NEW_ROCKS_PARTICLE {gBattleAnimSpritePal_NewRocks, ANIM_TAG_ROCKS}, - #else +#else {gBattleAnimSpritePal_Rocks, ANIM_TAG_ROCKS}, - #endif +#endif {gBattleAnimSpritePal_Z, ANIM_TAG_Z}, {gBattleAnimSpritePal_YellowUnk2, ANIM_TAG_YELLOW_UNK_2}, {gBattleAnimSpritePal_AirSlash, ANIM_TAG_AIR_SLASH}, {gBattleAnimSpritePal_SpinningGreenOrbs, ANIM_TAG_SPINNING_GREEN_ORBS}, - #if B_NEW_LEAF_PARTICLE +#if B_NEW_LEAF_PARTICLE {gBattleAnimSpritePal_NewLeaf, ANIM_TAG_LEAF}, - #else +#else {gBattleAnimSpritePal_Leaf, ANIM_TAG_LEAF}, - #endif +#endif {gBattleAnimSpritePal_Finger, ANIM_TAG_FINGER}, {gBattleAnimSpritePal_PoisonPowder, ANIM_TAG_POISON_POWDER}, {gBattleAnimSpritePal_BrownTriangle, ANIM_TAG_BROWN_TRIANGLE}, @@ -1607,11 +1607,11 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_Shock2, ANIM_TAG_SHOCK_2}, {gBattleAnimSpritePal_ClosingEye2, ANIM_TAG_CLOSING_EYE_2}, {gBattleAnimSpritePal_MetalBall, ANIM_TAG_METAL_BALL}, - #if NEW_SUBSTITUTE_PARTICLE +#if NEW_SUBSTITUTE_PARTICLE {gBattleAnimSpritePal_NewSubstituteFront, ANIM_TAG_MONSTER_DOLL}, - #else +#else {gBattleAnimSpritePal_MonsterDoll, ANIM_TAG_MONSTER_DOLL}, - #endif +#endif {gBattleAnimSpritePal_Whirlwind, ANIM_TAG_WHIRLWIND}, {gBattleAnimSpritePal_Whirlwind, ANIM_TAG_WHIRLWIND_2}, {gBattleAnimSpritePal_Explosion4, ANIM_TAG_EXPLOSION_4}, @@ -1619,27 +1619,27 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_Tongue, ANIM_TAG_TONGUE}, {gBattleAnimSpritePal_Smoke, ANIM_TAG_SMOKE}, {gBattleAnimSpritePal_Smoke, ANIM_TAG_SMOKE_2}, - #if B_NEW_IMPACT_PALETTE +#if B_NEW_IMPACT_PALETTE {gBattleAnimSpritePal_NewImpact, ANIM_TAG_IMPACT}, - #else +#else {gBattleAnimSpritePal_Impact, ANIM_TAG_IMPACT}, - #endif +#endif {gBattleAnimSpritePal_CircleImpact, ANIM_TAG_CIRCLE_IMPACT}, {gBattleAnimSpritePal_Impact, ANIM_TAG_SCRATCH}, {gBattleAnimSpritePal_Impact, ANIM_TAG_CUT}, - #if B_NEW_TEETH_PARTICLE +#if B_NEW_TEETH_PARTICLE {gBattleAnimSpritePal_NewTeeth, ANIM_TAG_SHARP_TEETH}, - #else +#else {gBattleAnimSpritePal_SharpTeeth, ANIM_TAG_SHARP_TEETH}, - #endif +#endif {gBattleAnimSpritePal_RainbowRings, ANIM_TAG_RAINBOW_RINGS}, {gBattleAnimSpritePal_IceCrystals, ANIM_TAG_ICE_CRYSTALS}, {gBattleAnimSpritePal_IceCrystals, ANIM_TAG_ICE_SPIKES}, - #if B_NEW_HANDS_FEET_PARTICLE +#if B_NEW_HANDS_FEET_PARTICLE {gBattleAnimSpritePal_NewHandsAndFeet, ANIM_TAG_HANDS_AND_FEET}, - #else +#else {gBattleAnimSpritePal_HandsAndFeet, ANIM_TAG_HANDS_AND_FEET}, - #endif +#endif {gBattleAnimSpritePal_MistCloud, ANIM_TAG_MIST_CLOUD}, {gBattleAnimSpritePal_SharpTeeth, ANIM_TAG_CLAMP}, {gBattleAnimSpritePal_RainDrops, ANIM_TAG_BUBBLE}, @@ -1648,19 +1648,19 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_WaterImpact, ANIM_TAG_WATER_ORB}, {gBattleAnimSpritePal_PoisonBubble, ANIM_TAG_POISON_BUBBLE}, {gBattleAnimSpritePal_PoisonBubble, ANIM_TAG_TOXIC_BUBBLE}, - #if B_NEW_SPIKES_PARTICLE +#if B_NEW_SPIKES_PARTICLE {gBattleAnimSpritePal_NewSpikes, ANIM_TAG_SPIKES}, - #else +#else {gBattleAnimSpritePal_Spikes, ANIM_TAG_SPIKES}, - #endif +#endif {gBattleAnimSpritePal_HornHit2, ANIM_TAG_HORN_HIT_2}, {gBattleAnimSpritePal_AirWave2, ANIM_TAG_AIR_WAVE_2}, {gBattleAnimSpritePal_SmallBubbles, ANIM_TAG_SMALL_BUBBLES}, - #if B_NEW_FLY_BUBBLE_PARTICLE +#if B_NEW_FLY_BUBBLE_PARTICLE {gBattleAnimSpritePal_NewFly, ANIM_TAG_ROUND_SHADOW}, - #else +#else {gBattleAnimSpritePal_RoundShadow, ANIM_TAG_ROUND_SHADOW}, - #endif +#endif {gBattleAnimSpritePal_Sunlight, ANIM_TAG_SUNLIGHT}, {gBattleAnimSpritePal_Spore, ANIM_TAG_SPORE}, {gBattleAnimSpritePal_Flower, ANIM_TAG_FLOWER}, @@ -1691,11 +1691,11 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_FocusEnergy, ANIM_TAG_FOCUS_ENERGY}, {gBattleAnimSpritePal_SphereToCube, ANIM_TAG_SPHERE_TO_CUBE}, {gBattleAnimSpritePal_Tendrils, ANIM_TAG_TENDRILS}, - #if B_NEW_MEAN_LOOK_PARTICLE +#if B_NEW_MEAN_LOOK_PARTICLE {gBattleAnimSpritePal_NewEye, ANIM_TAG_EYE}, - #else +#else {gBattleAnimSpritePal_Eye, ANIM_TAG_EYE}, - #endif +#endif {gBattleAnimSpritePal_WhiteShadow, ANIM_TAG_WHITE_SHADOW}, {gBattleAnimSpritePal_TealAlert, ANIM_TAG_TEAL_ALERT}, {gBattleAnimSpritePal_OpeningEye, ANIM_TAG_OPENING_EYE}, @@ -1734,11 +1734,11 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_Roots, ANIM_TAG_ROOTS}, {gBattleAnimSpritePal_ItemBag, ANIM_TAG_ITEM_BAG}, {gBattleAnimSpritePal_JaggedMusicNote, ANIM_TAG_JAGGED_MUSIC_NOTE}, - #if B_NEW_BATON_PASS_BALL_PARTICLE +#if B_NEW_BATON_PASS_BALL_PARTICLE {gBattleAnimSpritePal_NewPokeball, ANIM_TAG_POKEBALL}, - #else +#else {gBattleAnimSpritePal_Pokeball, ANIM_TAG_POKEBALL}, - #endif +#endif {gBattleAnimSpritePal_Pokeball, ANIM_TAG_SPOTLIGHT}, {gBattleAnimSpritePal_LetterZ, ANIM_TAG_LETTER_Z}, {gBattleAnimSpritePal_RapidSpin, ANIM_TAG_RAPID_SPIN}, @@ -1753,11 +1753,11 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_PinkPetal, ANIM_TAG_PINK_PETAL}, {gBattleAnimSpritePal_PainSplit, ANIM_TAG_PAIN_SPLIT}, {gBattleAnimSpritePal_Confetti, ANIM_TAG_CONFETTI}, - #if B_NEW_MORNING_SUN_STAR_PARTICLE +#if B_NEW_MORNING_SUN_STAR_PARTICLE {gBattleAnimSpritePal_NewGreenStar, ANIM_TAG_GREEN_STAR}, - #else +#else {gBattleAnimSpritePal_GreenStar, ANIM_TAG_GREEN_STAR}, - #endif +#endif {gBattleAnimSpritePal_PinkCloud, ANIM_TAG_PINK_CLOUD}, {gBattleAnimSpritePal_SweatDrop, ANIM_TAG_SWEAT_DROP}, {gBattleAnimSpritePal_GuardRing, ANIM_TAG_GUARD_RING}, diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index f3795325d9..4b5cde44c0 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -13233,8 +13233,392 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .zMovePower = 160, .zMoveEffect = Z_EFFECT_NONE, }, - - // Z MOVES + + [MOVE_DIRE_CLAW] = + { + .effect = EFFECT_PLACEHOLDER, // EFFECT_DIRE_CLAW, + .power = 60, + .type = TYPE_POISON, + .accuracy = 100, + .pp = 15, + .secondaryEffectChance = 0, + .target = MOVE_TARGET_SELECTED, + .priority = 0, + .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .split = SPLIT_PHYSICAL, + .zMovePower = 120, + .zMoveEffect = Z_EFFECT_NONE, + }, + + [MOVE_PSYSHIELD_BASH] = + { + .effect = EFFECT_PLACEHOLDER, // EFFECT_PSYSHIELD_BASH, + .power = 70, + .type = TYPE_PSYCHIC, + .accuracy = 90, + .pp = 10, + .secondaryEffectChance = 50, // TODO: Adjust this value. Currently it's set to Fiery Dance's. + .target = MOVE_TARGET_SELECTED, + .priority = 0, + .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .split = SPLIT_PHYSICAL, + .zMovePower = 140, + .zMoveEffect = Z_EFFECT_NONE, + }, + + [MOVE_POWER_SHIFT] = + { + .effect = EFFECT_PLACEHOLDER, // EFFECT_POWER_SHIFT, + .power = 0, + .type = TYPE_NORMAL, + .accuracy = 0, + .pp = 10, + .secondaryEffectChance = 0, + .target = MOVE_TARGET_USER, + .priority = 0, + .flags = FLAG_MIRROR_MOVE_AFFECTED, + .split = SPLIT_STATUS, + .zMovePower = 100, + .zMoveEffect = Z_EFFECT_NONE, + }, + + [MOVE_STONE_AXE] = + { + .effect = EFFECT_PLACEHOLDER, // EFFECT_STONE_AXE, + .power = 65, + .type = TYPE_ROCK, + .accuracy = 90, + .pp = 15, + .secondaryEffectChance = 0, + .target = MOVE_TARGET_USER, + .priority = 0, + .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .split = SPLIT_PHYSICAL, + .zMovePower = 120, + .zMoveEffect = Z_EFFECT_NONE, + }, + + [MOVE_SPRINGTIDE_STORM] = + { + .effect = EFFECT_PLACEHOLDER, // EFFECT_SPRINGTIDE_STORM, + .power = 95, + .type = TYPE_FAIRY, + .accuracy = 80, + .pp = 5, + .secondaryEffectChance = 30, + .target = MOVE_TARGET_SELECTED, + .priority = 0, + .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, + .split = SPLIT_SPECIAL, + .zMovePower = 175, + .zMoveEffect = Z_EFFECT_NONE, + }, + + [MOVE_MYSTICAL_POWER] = + { + .effect = EFFECT_PLACEHOLDER, // EFFECT_MYSTICAL_POWER, + .power = 70, + .type = TYPE_PSYCHIC, + .accuracy = 90, + .pp = 10, + .secondaryEffectChance = 100, + .target = MOVE_TARGET_SELECTED, + .priority = 0, + .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .split = SPLIT_SPECIAL, + .zMovePower = 140, + .zMoveEffect = Z_EFFECT_NONE, + }, + + [MOVE_RAGING_FURY] = + { + .effect = EFFECT_PLACEHOLDER, // EFFECT_RAGING_FURY, + .power = 90, + .type = TYPE_FIRE, + .accuracy = 85, + .pp = 10, + .secondaryEffectChance = 100, + .target = MOVE_TARGET_SELECTED, + .priority = 0, + .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .split = SPLIT_PHYSICAL, + .zMovePower = 175, + .zMoveEffect = Z_EFFECT_NONE, + }, + + [MOVE_WAVE_CRASH] = + { + .effect = EFFECT_RECOIL_33, // TODO: Legends: Arceus mechanics. + .power = 75, + .type = TYPE_WATER, + .accuracy = 100, + .pp = 10, + .secondaryEffectChance = 100, + .target = MOVE_TARGET_SELECTED, + .priority = 0, + .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .split = SPLIT_PHYSICAL, + .zMovePower = 140, + .zMoveEffect = Z_EFFECT_NONE, + }, + + [MOVE_CHLOROBLAST] = + { + .effect = EFFECT_PLACEHOLDER, // EFFECT_CHLOROBLAST, + .power = 120, + .type = TYPE_GRASS, + .accuracy = 95, + .pp = 5, + .secondaryEffectChance = 100, + .target = MOVE_TARGET_SELECTED, + .priority = 0, + .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .split = SPLIT_SPECIAL, + .zMovePower = 190, + .zMoveEffect = Z_EFFECT_NONE, + }, + + [MOVE_MOUNTAIN_GALE] = + { + .effect = EFFECT_PLACEHOLDER, // EFFECT_ACTION_SPEED_DOWN_HIT, + .power = 100, + .type = TYPE_ICE, + .accuracy = 85, + .pp = 5, + .secondaryEffectChance = 100, + .target = MOVE_TARGET_SELECTED, + .priority = 0, + .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .split = SPLIT_PHYSICAL, + .zMovePower = 180, + .zMoveEffect = Z_EFFECT_NONE, + }, + + [MOVE_VICTORY_DANCE] = + { + .effect = EFFECT_PLACEHOLDER, // EFFECT_VICTORY_DANCE, + .power = 0, + .type = TYPE_FIGHTING, + .accuracy = 0, + .pp = 20, + .secondaryEffectChance = 100, + .target = MOVE_TARGET_USER, + .priority = 0, + .flags = FLAG_SNATCH_AFFECTED | FLAG_DANCE, + .split = SPLIT_STATUS, + .zMovePower = 100, + .zMoveEffect = Z_EFFECT_NONE, + }, + + [MOVE_HEADLONG_RUSH] = + { + .effect = EFFECT_PLACEHOLDER, // EFFECT_HEADLONG_RUSH, + .power = 100, + .type = TYPE_GROUND, + .accuracy = 100, + .pp = 5, + .secondaryEffectChance = 100, + .target = MOVE_TARGET_SELECTED, + .priority = 0, + .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .split = SPLIT_PHYSICAL, + .zMovePower = 180, + .zMoveEffect = Z_EFFECT_NONE, + }, + + [MOVE_BARB_BARRAGE] = + { + .effect = EFFECT_PLACEHOLDER, // EFFECT_BARB_BARRAGE, + .power = 60, + .type = TYPE_POISON, + .accuracy = 100, + .pp = 15, + .secondaryEffectChance = 0, + .target = MOVE_TARGET_SELECTED, + .priority = 0, + .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .split = SPLIT_PHYSICAL, + .zMovePower = 120, + .zMoveEffect = Z_EFFECT_NONE, + }, + + [MOVE_ESPER_WING] = + { + .effect = EFFECT_PLACEHOLDER, // EFFECT_ESPER_WING, + .power = 75, + .type = TYPE_PSYCHIC, + .accuracy = 90, + .pp = 10, + .secondaryEffectChance = 0, + .target = MOVE_TARGET_SELECTED, + .priority = 0, + .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .split = SPLIT_SPECIAL, + .zMovePower = 140, + .zMoveEffect = Z_EFFECT_NONE, + }, + + [MOVE_BITTER_MALICE] = + { + .effect = EFFECT_PLACEHOLDER, // EFFECT_ESPER_WING, + .power = 60, + .type = TYPE_GHOST, + .accuracy = 100, + .pp = 15, + .secondaryEffectChance = 0, + .target = MOVE_TARGET_SELECTED, + .priority = 0, + .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .split = SPLIT_SPECIAL, + .zMovePower = 120, + .zMoveEffect = Z_EFFECT_NONE, + }, + + [MOVE_SHELTER] = + { + .effect = EFFECT_PLACEHOLDER, // EFFECT_SHELTER, + .power = 0, + .type = TYPE_STEEL, + .accuracy = 0, + .pp = 10, + .secondaryEffectChance = 100, + .target = MOVE_TARGET_USER, + .priority = 0, + .flags = 0, + .split = SPLIT_STATUS, + .zMovePower = 100, + .zMoveEffect = Z_EFFECT_NONE, + }, + + [MOVE_TRIPLE_ARROWS] = + { + .effect = EFFECT_PLACEHOLDER, // EFFECT_TRIPLE_ARROWS, + .power = 50, + .type = TYPE_FIGHTING, + .accuracy = 100, + .pp = 15, + .secondaryEffectChance = 100, + .target = MOVE_TARGET_SELECTED, + .priority = 0, + .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .split = SPLIT_PHYSICAL, + .zMovePower = 100, + .zMoveEffect = Z_EFFECT_NONE, + }, + + [MOVE_INFERNAL_PARADE] = + { + .effect = EFFECT_PLACEHOLDER, // EFFECT_INFERNAL_PARADE, + .power = 60, + .type = TYPE_GHOST, + .accuracy = 100, + .pp = 15, + .secondaryEffectChance = 0, + .target = MOVE_TARGET_SELECTED, + .priority = 0, + .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .split = SPLIT_SPECIAL, + .zMovePower = 120, + .zMoveEffect = Z_EFFECT_NONE, + }, + + [MOVE_CEASELESS_EDGE] = + { + .effect = EFFECT_PLACEHOLDER, // EFFECT_CEASELESS_EDGE, + .power = 65, + .type = TYPE_DARK, + .accuracy = 90, + .pp = 15, + .secondaryEffectChance = 0, + .target = MOVE_TARGET_SELECTED, + .priority = 0, + .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .split = SPLIT_PHYSICAL, + .zMovePower = 120, + .zMoveEffect = Z_EFFECT_NONE, + }, + + [MOVE_BLEAKWIND_STORM] = + { + .effect = EFFECT_PLACEHOLDER, // EFFECT_BLEAKWIND_STORM, + .power = 95, + .type = TYPE_FLYING, + .accuracy = 80, + .pp = 5, + .secondaryEffectChance = 0, + .target = MOVE_TARGET_SELECTED, + .priority = 0, + .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .split = SPLIT_SPECIAL, + .zMovePower = 175, + .zMoveEffect = Z_EFFECT_NONE, + }, + + [MOVE_WILDBOLT_STORM] = + { + .effect = EFFECT_PLACEHOLDER, // EFFECT_WILDBOLT_STORM, + .power = 95, + .type = TYPE_ELECTRIC, + .accuracy = 80, + .pp = 5, + .secondaryEffectChance = 0, + .target = MOVE_TARGET_SELECTED, + .priority = 0, + .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .split = SPLIT_SPECIAL, + .zMovePower = 175, + .zMoveEffect = Z_EFFECT_NONE, + }, + + [MOVE_SANDSEAR_STORM] = + { + .effect = EFFECT_PLACEHOLDER, // EFFECT_SANDSEAR_STORM, + .power = 95, + .type = TYPE_GROUND, + .accuracy = 80, + .pp = 5, + .secondaryEffectChance = 0, + .target = MOVE_TARGET_SELECTED, + .priority = 0, + .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .split = SPLIT_SPECIAL, + .zMovePower = 175, + .zMoveEffect = Z_EFFECT_NONE, + }, + + [MOVE_LUNAR_BLESSING] = + { + .effect = EFFECT_PLACEHOLDER, // EFFECT_LUNAR_BLESSING, + .power = 0, + .type = TYPE_PSYCHIC, + .accuracy = 0, + .pp = 10, + .secondaryEffectChance = 0, + .target = MOVE_TARGET_USER, + .priority = 0, + .flags = FLAG_SNATCH_AFFECTED, + .split = SPLIT_STATUS, + .zMovePower = 100, + .zMoveEffect = Z_EFFECT_NONE, + }, + + [MOVE_TAKE_HEART] = + { + .effect = EFFECT_PLACEHOLDER, // EFFECT_TAKE_HEART, + .power = 0, + .type = TYPE_PSYCHIC, + .accuracy = 0, + .pp = 10, + .secondaryEffectChance = 0, + .target = MOVE_TARGET_USER, + .priority = 0, + .flags = FLAG_SNATCH_AFFECTED, + .split = SPLIT_STATUS, + .zMovePower = 100, + .zMoveEffect = Z_EFFECT_NONE, + }, + + // Z-Moves [MOVE_BREAKNECK_BLITZ] = { .effect = EFFECT_HIT, diff --git a/src/data/contest_moves.h b/src/data/contest_moves.h index 169e55991d..244f0ddb2e 100644 --- a/src/data/contest_moves.h +++ b/src/data/contest_moves.h @@ -5918,6 +5918,54 @@ const struct ContestMove gContestMoves[MOVES_COUNT] = .comboStarterId = 0, .comboMoves = {0} }, + + [MOVE_DIRE_CLAW] = {0}, // TODO + + [MOVE_PSYSHIELD_BASH] = {0}, // TODO + + [MOVE_POWER_SHIFT] = {0}, // TODO + + [MOVE_STONE_AXE] = {0}, // TODO + + [MOVE_SPRINGTIDE_STORM] = {0}, // TODO + + [MOVE_MYSTICAL_POWER] = {0}, // TODO + + [MOVE_RAGING_FURY] = {0}, // TODO + + [MOVE_WAVE_CRASH] = {0}, // TODO + + [MOVE_CHLOROBLAST] = {0}, // TODO + + [MOVE_MOUNTAIN_GALE] = {0}, // TODO + + [MOVE_VICTORY_DANCE] = {0}, // TODO + + [MOVE_HEADLONG_RUSH] = {0}, // TODO + + [MOVE_BARB_BARRAGE] = {0}, // TODO + + [MOVE_ESPER_WING] = {0}, // TODO + + [MOVE_BITTER_MALICE] = {0}, // TODO + + [MOVE_SHELTER] = {0}, // TODO + + [MOVE_TRIPLE_ARROWS] = {0}, // TODO + + [MOVE_INFERNAL_PARADE] = {0}, // TODO + + [MOVE_CEASELESS_EDGE] = {0}, // TODO + + [MOVE_BLEAKWIND_STORM] = {0}, // TODO + + [MOVE_WILDBOLT_STORM] = {0}, // TODO + + [MOVE_SANDSEAR_STORM] = {0}, // TODO + + [MOVE_LUNAR_BLESSING] = {0}, // TODO + + [MOVE_TAKE_HEART] = {0}, // TODO }; const struct ContestEffect gContestEffects[] = diff --git a/src/data/items.h b/src/data/items.h index 4e45e943d9..08060db773 100644 --- a/src/data/items.h +++ b/src/data/items.h @@ -7799,7 +7799,7 @@ const struct Item gItems[] = .flingPower = 10, }, -// TMs/HMs +// TMs/HMs. They don't have a set flingPower, as that's handled by GetFlingPowerFromItemId. [ITEM_TM01_FOCUS_PUNCH] = { @@ -7810,7 +7810,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 150, }, [ITEM_TM02_DRAGON_CLAW] = @@ -7822,7 +7821,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 80, }, [ITEM_TM03_WATER_PULSE] = @@ -7834,7 +7832,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 60, }, [ITEM_TM04_CALM_MIND] = @@ -7846,7 +7843,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM05_ROAR] = @@ -7858,7 +7854,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM06_TOXIC] = @@ -7870,7 +7865,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM07_HAIL] = @@ -7882,7 +7876,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM08_BULK_UP] = @@ -7894,7 +7887,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM09_BULLET_SEED] = @@ -7906,11 +7898,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flingPower = 25, - #else - .flingPower = 10, - #endif }, [ITEM_TM10_HIDDEN_POWER] = @@ -7922,11 +7909,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flingPower = 60, - #else - .flingPower = 10, - #endif }, [ITEM_TM11_SUNNY_DAY] = @@ -7938,7 +7920,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM12_TAUNT] = @@ -7950,7 +7931,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM13_ICE_BEAM] = @@ -7962,11 +7942,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flingPower = 90, - #else - .flingPower = 95, - #endif }, [ITEM_TM14_BLIZZARD] = @@ -7978,11 +7953,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flingPower = 110, - #else - .flingPower = 120, - #endif }, [ITEM_TM15_HYPER_BEAM] = @@ -7994,7 +7964,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 150, }, [ITEM_TM16_LIGHT_SCREEN] = @@ -8006,7 +7975,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM17_PROTECT] = @@ -8018,7 +7986,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM18_RAIN_DANCE] = @@ -8030,7 +7997,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM19_GIGA_DRAIN] = @@ -8042,11 +8008,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flingPower = 75, - #else - .flingPower = 60, - #endif }, [ITEM_TM20_SAFEGUARD] = @@ -8058,7 +8019,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM21_FRUSTRATION] = @@ -8070,7 +8030,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM22_SOLAR_BEAM] = @@ -8082,7 +8041,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 120, }, [ITEM_TM23_IRON_TAIL] = @@ -8094,7 +8052,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 100, }, [ITEM_TM24_THUNDERBOLT] = @@ -8106,11 +8063,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flingPower = 90, - #else - .flingPower = 95, - #endif }, [ITEM_TM25_THUNDER] = @@ -8122,11 +8074,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flingPower = 110, - #else - .flingPower = 120, - #endif }, [ITEM_TM26_EARTHQUAKE] = @@ -8138,7 +8085,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 100, }, [ITEM_TM27_RETURN] = @@ -8150,7 +8096,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM28_DIG] = @@ -8162,11 +8107,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_4 - .flingPower = 80, - #else - .flingPower = 60, - #endif }, [ITEM_TM29_PSYCHIC] = @@ -8178,7 +8118,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 90, }, [ITEM_TM30_SHADOW_BALL] = @@ -8190,7 +8129,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 80, }, [ITEM_TM31_BRICK_BREAK] = @@ -8202,7 +8140,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 75, }, [ITEM_TM32_DOUBLE_TEAM] = @@ -8214,7 +8151,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM33_REFLECT] = @@ -8226,7 +8162,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM34_SHOCK_WAVE] = @@ -8238,7 +8173,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 60, }, [ITEM_TM35_FLAMETHROWER] = @@ -8250,11 +8184,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flingPower = 90, - #else - .flingPower = 95, - #endif }, [ITEM_TM36_SLUDGE_BOMB] = @@ -8266,7 +8195,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 90, }, [ITEM_TM37_SANDSTORM] = @@ -8278,7 +8206,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM38_FIRE_BLAST] = @@ -8290,11 +8217,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flingPower = 110, - #else - .flingPower = 120, - #endif }, [ITEM_TM39_ROCK_TOMB] = @@ -8306,11 +8228,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flingPower = 60, - #else - .flingPower = 50, - #endif }, [ITEM_TM40_AERIAL_ACE] = @@ -8322,7 +8239,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 60, }, [ITEM_TM41_TORMENT] = @@ -8334,7 +8250,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM42_FACADE] = @@ -8346,7 +8261,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM43_SECRET_POWER] = @@ -8358,7 +8272,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 70, }, [ITEM_TM44_REST] = @@ -8370,7 +8283,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM45_ATTRACT] = @@ -8382,7 +8294,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM46_THIEF] = @@ -8394,11 +8305,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flingPower = 60, - #else - .flingPower = 40, - #endif }, [ITEM_TM47_STEEL_WING] = @@ -8410,7 +8316,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 70, }, [ITEM_TM48_SKILL_SWAP] = @@ -8422,7 +8327,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM49_SNATCH] = @@ -8434,7 +8338,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM50_OVERHEAT] = @@ -8446,11 +8349,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flingPower = 130, - #else - .flingPower = 140, - #endif }, [ITEM_TM51] = @@ -9013,7 +8911,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 50, }, [ITEM_HM02_FLY] = @@ -9026,11 +8923,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_4 - .flingPower = 90, - #else - .flingPower = 70, - #endif }, [ITEM_HM03_SURF] = @@ -9043,11 +8935,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flingPower = 90, - #else - .flingPower = 95, - #endif }, [ITEM_HM04_STRENGTH] = @@ -9060,7 +8947,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 80, }, [ITEM_HM05_FLASH] = @@ -9073,7 +8959,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_HM06_ROCK_SMASH] = @@ -9086,11 +8971,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_4 - .flingPower = 20, - #else - .flingPower = 40, - #endif }, [ITEM_HM07_WATERFALL] = @@ -9103,7 +8983,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 80, }, [ITEM_HM08_DIVE] = @@ -9116,11 +8995,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_4 - .flingPower = 80, - #else - .flingPower = 60, - #endif }, diff --git a/src/data/text/abilities.h b/src/data/text/abilities.h index cdc3276082..ac11b9de8b 100644 --- a/src/data/text/abilities.h +++ b/src/data/text/abilities.h @@ -119,7 +119,7 @@ static const u8 sHoneyGatherDescription[] = _("May gather Honey."); static const u8 sFriskDescription[] = _("Checks a foe's item."); static const u8 sRecklessDescription[] = _("Boosts moves with recoil."); static const u8 sMultitypeDescription[] = _("Changes type to its Plate."); -static const u8 sFlowerGiftDescription[] = _("Transforms in sunshine."); +static const u8 sFlowerGiftDescription[] = _("Allies power up in sunshine."); static const u8 sBadDreamsDescription[] = _("Damages sleeping Pokémon."); static const u8 sPickpocketDescription[] = _("Steals the foe's held item."); static const u8 sSheerForceDescription[] = _("Trades effects for power."); diff --git a/src/data/text/move_descriptions.h b/src/data/text/move_descriptions.h index 7d890b1d3d..1275fa4c7b 100644 --- a/src/data/text/move_descriptions.h +++ b/src/data/text/move_descriptions.h @@ -1,3 +1,10 @@ + +#if B_BINDING_TURNS >= GEN_5 +#define BINDING_TURNS "4 or 5" +#else +#define BINDING_TURNS "2 to 5" +#endif + static const u8 sNullDescription[] = _( ""); @@ -79,11 +86,7 @@ static const u8 sFlyDescription[] = _( static const u8 sBindDescription[] = _( "Binds and squeezes the foe\n" -#if B_BINDING_TURNS >= GEN_5 - "for 4 or 5 turns."); -#else - "for 2 to 5 turns."); -#endif + "for "BINDING_TURNS" turns."); static const u8 sSlamDescription[] = _( "Slams the foe with a long\n" @@ -143,11 +146,7 @@ static const u8 sBodySlamDescription[] = _( static const u8 sWrapDescription[] = _( "Wraps and squeezes the foe\n" -#if B_BINDING_TURNS >= GEN_5 - "4 or 5 times with vines, etc."); -#else - "2 to 5 times with vines, etc."); -#endif + BINDING_TURNS" times with vines, etc."); static const u8 sTakeDownDescription[] = _( "A reckless charge attack\n" @@ -339,11 +338,7 @@ static const u8 sDragonRageDescription[] = _( static const u8 sFireSpinDescription[] = _( "Traps the foe in a ring of\n" -#if B_BINDING_TURNS >= GEN_5 - "fire for 4 or 5 turns."); -#else - "fire for 2 to 5 turns."); -#endif + "fire for "BINDING_TURNS" turns."); static const u8 sThunderShockDescription[] = _( "An electrical attack that\n" @@ -523,11 +518,7 @@ static const u8 sWaterfallDescription[] = _( static const u8 sClampDescription[] = _( "Traps and squeezes the\n" -#if B_BINDING_TURNS >= GEN_5 - "foe for 4 or 5 turns."); -#else - "foe for 2 to 5 turns."); -#endif + "foe for "BINDING_TURNS" turns."); static const u8 sSwiftDescription[] = _( "Sprays star-shaped rays\n" @@ -1015,11 +1006,7 @@ static const u8 sRockSmashDescription[] = _( static const u8 sWhirlpoolDescription[] = _( "Traps and hurts the foe in\n" -#if B_BINDING_TURNS >= GEN_5 - "a whirlpool for 4 or 5 turns."); -#else - "a whirlpool for 2 to 5 turns."); -#endif + "a whirlpool for "BINDING_TURNS" turns."); static const u8 sBeatUpDescription[] = _( "Summons party Pokémon to\n" @@ -1030,7 +1017,11 @@ static const u8 sFakeOutDescription[] = _( "that causes flinching."); static const u8 sUproarDescription[] = _( +#if B_UPROAR_TURNS >= GEN_5 "Causes an uproar for 2 to 5\n" +#else + "Causes an uproar for 3\n" +#endif "turns and prevents sleep."); static const u8 sStockpileDescription[] = _( @@ -1331,11 +1322,7 @@ static const u8 sSkyUppercutDescription[] = _( static const u8 sSandTombDescription[] = _( "Traps and hurts the foe in\n" -#if B_BINDING_TURNS >= GEN_5 - "quicksand for 4 or 5 turns."); -#else - "quicksand for 2 to 5 turns."); -#endif + "quicksand for "BINDING_TURNS" turns."); static const u8 sSheerColdDescription[] = _( "A chilling attack that\n" @@ -1839,11 +1826,7 @@ static const u8 sSpacialRendDescription[] = _( static const u8 sMagmaStormDescription[] = _( "Traps the foe in a vortex\n" -#if B_BINDING_TURNS >= GEN_5 - "of fire for 4 or 5 turns."); -#else - "of fire for 2 to 5 turns."); -#endif + "of fire for "BINDING_TURNS" turns."); static const u8 sDarkVoidDescription[] = _( "Drags the foe into total\n" @@ -2395,11 +2378,7 @@ static const u8 sNuzzleDescription[] = _( static const u8 sInfestationDescription[] = _( "The foe is infested and\n" -#if B_BINDING_TURNS >= GEN_5 - "attacked for 4 or 5 turns."); -#else - "attacked for 2 to 5 turns."); -#endif + "attacked for "BINDING_TURNS" turns."); static const u8 sPowerUpPunchDescription[] = _( "A hard punch that raises\n" @@ -2944,11 +2923,7 @@ static const u8 sSurgingStrikesDescription[] = _( static const u8 sThunderCageDescription[] = _( "Traps the foe in a cage of\n" -#if B_BINDING_TURNS >= GEN_5 - "electricity for 4 or 5 turns."); -#else - "electricity for 2 to 5 turns."); -#endif + "electricity for "BINDING_TURNS" turns."); static const u8 sDragonEnergyDescription[] = _( "The higher the user's HP\n" @@ -2978,10 +2953,108 @@ static const u8 sEerieSpellDescription[] = _( "Attacks with psychic power.\n" "Foe's last move has 3 PP cut."); +static const u8 sDireClawDescription[] = _( + "High critical hit chance. May\n" + "paralyze, poison or drowse."); + +static const u8 sPsyshieldBashDescription[] = _( + "Hits a foe with psychic\n" + "energy. May raise Defense."); + +static const u8 sPowerShiftDescription[] = _( + "The user swaps its offensive\n" + "and defensive stats."); + +static const u8 sStoneAxeDescription[] = _( + "High critical hit ratio. Sets\n" + "Splinters that hurt the foe."); + +static const u8 sSpringtideStormDescription[] = _( + "Wraps a foe in fierce winds.\n" + "Varies with the user's form."); + +static const u8 sMysticalPowerDescription[] = _( + "Increases the user's better\n" + "of Atk. and Def. stats."); + +static const u8 sRagingFuryDescription[] = _( + "Viciously spews flames at\n" + "a foe, becoming fixated."); + +static const u8 sWaveCrashDescription[] = _( + "A water slam. Hurts the user\n" + "and raises its Action Speed."); + +static const u8 sChloroblastDescription[] = _( + "An blast that hurts the user\n" + "and lowers its Action Speed."); + +static const u8 sMountainGaleDescription[] = _( + "The user hurls giant chunks\n" + "of ice to damage the foe."); + +static const u8 sVictoryDanceDescription[] = _( + "Dances to raise damage 50%,\n" + "plus offenses and defenses."); + +static const u8 sHeadlongRushDescription[] = _( + "Hits with a full-body tackle,\n" + "lowering the foe's Defense."); + +static const u8 sBarbBarrageDescription[] = _( + "Can poison on impact. Powers\n" + "up if the foe has an ailment."); + +static const u8 sEsperWingDescription[] = _( + "High critical hit ratio.\n" + "Ups the user's Action Speed."); + +static const u8 sBitterMaliceDescription[] = _( + "Hurts a foe harder if it has\n" + "an ailment. Can give FrstBte."); + +static const u8 sShelterDescription[] = _( + "The user hardens their skin\n" + "and obscures itself."); + +static const u8 sTripleArrowsDescription[] = _( + "Ups critical-hit ratio for 3\n" + "turns. Lowers foe Defenses."); + +static const u8 sInfernalParadeDescription[] = _( + "Hurts a foe harder if it has\n" + "an ailment. May leave a burn."); + +static const u8 sCeaselessEdgeDescription[] = _( + "High critical hit ratio. Sets\n" + "Splinters that hurt the foe."); + +static const u8 sBleakwindStormDescription[] = _( + "Hits with brutal, cold winds.\n" + "May inflict frostbite."); + +static const u8 sWildboltStormDescription[] = _( + "Hits with a brutal tempest.\n" + "May inflict paralysis."); + +static const u8 sSandsearStormDescription[] = _( + "Hits with brutally hot sand.\n" + "May inflict a burn."); + +static const u8 sLunarBlessingDescription[] = _( + "The user heals themself and\n" + "conceals their presence."); + +static const u8 sTakeHeartDescription[] = _( + "The user lifts its spirits to\n" + "heal and strengthen itself."); + const u8 gNotDoneYetDescription[] = _( "This move can't be used. Its\n" "effect is in development."); +#undef BINDING_TURNS + // MOVE_NONE is ignored in this table. Make sure to always subtract 1 before getting the right pointer. const u8 *const gMoveDescriptionPointers[MOVES_COUNT - 1] = { @@ -3741,4 +3814,28 @@ const u8 *const gMoveDescriptionPointers[MOVES_COUNT - 1] = [MOVE_GLACIAL_LANCE - 1] = sGlacialLanceDescription, [MOVE_ASTRAL_BARRAGE - 1] = sAstralBarrageDescription, [MOVE_EERIE_SPELL - 1] = sEerieSpellDescription, + [MOVE_DIRE_CLAW - 1] = sDireClawDescription, + [MOVE_PSYSHIELD_BASH - 1] = sPsyshieldBashDescription, + [MOVE_POWER_SHIFT - 1] = sPowerShiftDescription, + [MOVE_STONE_AXE - 1] = sStoneAxeDescription, + [MOVE_SPRINGTIDE_STORM - 1] = sSpringtideStormDescription, + [MOVE_MYSTICAL_POWER - 1] = sMysticalPowerDescription, + [MOVE_RAGING_FURY - 1] = sRagingFuryDescription, + [MOVE_WAVE_CRASH - 1] = sWaveCrashDescription, + [MOVE_CHLOROBLAST - 1] = sChloroblastDescription, + [MOVE_MOUNTAIN_GALE - 1] = sMountainGaleDescription, + [MOVE_VICTORY_DANCE - 1] = sVictoryDanceDescription, + [MOVE_HEADLONG_RUSH - 1] = sHeadlongRushDescription, + [MOVE_BARB_BARRAGE - 1] = sBarbBarrageDescription, + [MOVE_ESPER_WING - 1] = sEsperWingDescription, + [MOVE_BITTER_MALICE - 1] = sBitterMaliceDescription, + [MOVE_SHELTER - 1] = sShelterDescription, + [MOVE_TRIPLE_ARROWS - 1] = sTripleArrowsDescription, + [MOVE_INFERNAL_PARADE - 1] = sInfernalParadeDescription, + [MOVE_CEASELESS_EDGE - 1] = sCeaselessEdgeDescription, + [MOVE_BLEAKWIND_STORM - 1] = sBleakwindStormDescription, + [MOVE_WILDBOLT_STORM - 1] = sWildboltStormDescription, + [MOVE_SANDSEAR_STORM - 1] = sSandsearStormDescription, + [MOVE_LUNAR_BLESSING - 1] = sLunarBlessingDescription, + [MOVE_TAKE_HEART - 1] = sTakeHeartDescription, }; diff --git a/src/data/text/move_names.h b/src/data/text/move_names.h index 48556d7fac..ffa00e3f63 100644 --- a/src/data/text/move_names.h +++ b/src/data/text/move_names.h @@ -757,6 +757,30 @@ const u8 gMoveNames[MOVES_COUNT][MOVE_NAME_LENGTH + 1] = [MOVE_GLACIAL_LANCE] = _("Glacial Lance"), [MOVE_ASTRAL_BARRAGE] = _("Astral Barrage"), [MOVE_EERIE_SPELL] = _("Eerie Spell"), + [MOVE_DIRE_CLAW] = _("Dire Claw"), + [MOVE_PSYSHIELD_BASH] = _("Psyshield Bash"), + [MOVE_POWER_SHIFT] = _("Power Shift"), + [MOVE_STONE_AXE] = _("Stone Axe"), + [MOVE_SPRINGTIDE_STORM] = _("Springtide Storm"), + [MOVE_MYSTICAL_POWER] = _("Mystical Power"), + [MOVE_RAGING_FURY] = _("Raging Fury"), + [MOVE_WAVE_CRASH] = _("Wave Crash"), + [MOVE_CHLOROBLAST] = _("Chloroblast"), + [MOVE_MOUNTAIN_GALE] = _("Mountain Gale"), + [MOVE_VICTORY_DANCE] = _("Victory Dance"), + [MOVE_HEADLONG_RUSH] = _("Headlong Rush"), + [MOVE_BARB_BARRAGE] = _("Barb Barrage"), + [MOVE_ESPER_WING] = _("Esper Wing"), + [MOVE_BITTER_MALICE] = _("Bitter Malice"), + [MOVE_SHELTER] = _("Shelter"), + [MOVE_TRIPLE_ARROWS] = _("Triple Arrows"), + [MOVE_INFERNAL_PARADE] = _("Infernal Parade"), + [MOVE_CEASELESS_EDGE] = _("Ceaseless Edge"), + [MOVE_BLEAKWIND_STORM] = _("Bleakwind Storm"), + [MOVE_WILDBOLT_STORM] = _("Wildbolt Storm"), + [MOVE_SANDSEAR_STORM] = _("Sandsear Storm"), + [MOVE_LUNAR_BLESSING] = _("Lunar Blessing"), + [MOVE_TAKE_HEART] = _("Take Heart"), }; #else // 12 letters @@ -1517,6 +1541,30 @@ const u8 gMoveNames[MOVES_COUNT][MOVE_NAME_LENGTH + 1] = [MOVE_GLACIAL_LANCE] = _("GlacialLance"), [MOVE_ASTRAL_BARRAGE] = _("AstrlBarrage"), [MOVE_EERIE_SPELL] = _("Eerie Spell"), + [MOVE_DIRE_CLAW] = _("Dire Claw"), + [MOVE_PSYSHIELD_BASH] = _("PsyshieldBsh"), + [MOVE_POWER_SHIFT] = _("Power Shift"), + [MOVE_STONE_AXE] = _("Stone Axe"), + [MOVE_SPRINGTIDE_STORM] = _("SprngtdeStrm"), + [MOVE_MYSTICAL_POWER] = _("MystcalPower"), + [MOVE_RAGING_FURY] = _("Raging Fury"), + [MOVE_WAVE_CRASH] = _("Wave Crash"), + [MOVE_CHLOROBLAST] = _("Chloroblast"), + [MOVE_MOUNTAIN_GALE] = _("MountainGale"), + [MOVE_VICTORY_DANCE] = _("VictoryDance"), + [MOVE_HEADLONG_RUSH] = _("HeadlongRush"), + [MOVE_BARB_BARRAGE] = _("Barb Barrage"), + [MOVE_ESPER_WING] = _("Esper Wing"), + [MOVE_BITTER_MALICE] = _("BitterMalice"), + [MOVE_SHELTER] = _("Shelter"), + [MOVE_TRIPLE_ARROWS] = _("TripleArrows"), + [MOVE_INFERNAL_PARADE] = _("InfrnlParade"), + [MOVE_CEASELESS_EDGE] = _("CeaslessEdge"), + [MOVE_BLEAKWIND_STORM] = _("BlekwndStorm"), + [MOVE_WILDBOLT_STORM] = _("WildbltStorm"), + [MOVE_SANDSEAR_STORM] = _("SndsearStorm"), + [MOVE_LUNAR_BLESSING] = _("LunarBlessng"), + [MOVE_TAKE_HEART] = _("Take Heart"), }; #endif diff --git a/src/daycare.c b/src/daycare.c index ad599d9af3..6108c6daa8 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -820,12 +820,12 @@ static u16 DetermineEggSpeciesAndParentSlots(struct DayCare *daycare, u8 *parent eggSpecies = SPECIES_NIDORAN_M; else if (eggSpecies == SPECIES_ILLUMISE && daycare->offspringPersonality & EGG_GENDER_MALE) eggSpecies = SPECIES_VOLBEAT; - #if P_NIDORAN_M_DITTO_BREED >= GEN_5 - else if (eggSpecies == SPECIES_NIDORAN_M && !(daycare->offspringPersonality & EGG_GENDER_MALE)) - eggSpecies = SPECIES_NIDORAN_F; - else if (eggSpecies == SPECIES_VOLBEAT && !(daycare->offspringPersonality & EGG_GENDER_MALE)) - eggSpecies = SPECIES_ILLUMISE; - #endif +#if P_NIDORAN_M_DITTO_BREED >= GEN_5 + else if (eggSpecies == SPECIES_NIDORAN_M && !(daycare->offspringPersonality & EGG_GENDER_MALE)) + eggSpecies = SPECIES_NIDORAN_F; + else if (eggSpecies == SPECIES_VOLBEAT && !(daycare->offspringPersonality & EGG_GENDER_MALE)) + eggSpecies = SPECIES_ILLUMISE; +#endif else if (eggSpecies == SPECIES_MANAPHY) eggSpecies = SPECIES_PHIONE; else if (eggSpecies == SPECIES_SINISTEA_ANTIQUE) diff --git a/src/debug.c b/src/debug.c new file mode 100644 index 0000000000..4cc1ac6168 --- /dev/null +++ b/src/debug.c @@ -0,0 +1,3398 @@ +//CREDITS +//TheXaman: https://github.com/TheXaman/pokeemerald/tree/tx_debug_system +//CODE USED FROM: +//ketsuban: https://github.com/pret/pokeemerald/wiki/Add-a-debug-menu +//Pyredrid: https://github.com/Pyredrid/pokeemerald/tree/debugmenu +//AsparagusEduardo: https://github.com/AsparagusEduardo/pokeemerald/tree/InfusedEmerald_v2 +//Ghoulslash: https://github.com/ghoulslash/pokeemerald +//Jaizu: https://jaizu.moe/ +#include "global.h" +#include "battle.h" +#include "coins.h" +#include "credits.h" +#include "data.h" +#include "daycare.h" +#include "debug.h" +#include "event_data.h" +#include "event_object_movement.h" +#include "event_scripts.h" +#include "field_message_box.h" +#include "field_screen_effect.h" +#include "international_string_util.h" +#include "item.h" +#include "item_icon.h" +#include "list_menu.h" +#include "m4a.h" +#include "main.h" +#include "main_menu.h" +#include "malloc.h" +#include "map_name_popup.h" +#include "menu.h" +#include "money.h" +#include "naming_screen.h" +#include "new_game.h" +#include "overworld.h" +#include "palette.h" +#include "party_menu.h" +#include "pokedex.h" +#include "pokemon.h" +#include "pokemon_icon.h" +#include "pokemon_storage_system.h" +#include "random.h" +#include "region_map.h" +#include "script.h" +#include "script_pokemon_util.h" +#include "sound.h" +#include "strings.h" +#include "string_util.h" +#include "task.h" +#include "pokemon_summary_screen.h" +#include "constants/abilities.h" +#include "constants/battle_frontier.h" +#include "constants/flags.h" +#include "constants/items.h" +#include "constants/map_groups.h" +#include "constants/rgb.h" +#include "constants/songs.h" +#include "constants/species.h" + +#if DEBUG_SYSTEM_ENABLE == TRUE +// ******************************* +// Enums +enum { // Main + DEBUG_MENU_ITEM_UTILITIES, + DEBUG_MENU_ITEM_SCRIPTS, + DEBUG_MENU_ITEM_FLAGS, + DEBUG_MENU_ITEM_VARS, + DEBUG_MENU_ITEM_GIVE, + DEBUG_MENU_ITEM_SOUND, + DEBUG_MENU_ITEM_ACCESS_PC, + DEBUG_MENU_ITEM_CANCEL +}; +enum { // Util + DEBUG_UTIL_MENU_ITEM_HEAL_PARTY, + DEBUG_UTIL_MENU_ITEM_FLY, + DEBUG_UTIL_MENU_ITEM_WARP, + DEBUG_UTIL_MENU_ITEM_RUNNING_SHOES, + DEBUG_UTIL_MENU_ITEM_POISON_MONS, + DEBUG_UTIL_MENU_ITEM_SAVEBLOCK, + DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK, + DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK, + DEBUG_UTIL_MENU_ITEM_WATCHCREDITS, + DEBUG_UTIL_MENU_ITEM_TRAINER_NAME, + DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER, + DEBUG_UTIL_MENU_ITEM_TRAINER_ID, +}; +enum { // Scripts + DEBUG_UTIL_MENU_ITEM_SCRIPT_1, + DEBUG_UTIL_MENU_ITEM_SCRIPT_2, + DEBUG_UTIL_MENU_ITEM_SCRIPT_3, + DEBUG_UTIL_MENU_ITEM_SCRIPT_4, + DEBUG_UTIL_MENU_ITEM_SCRIPT_5, + DEBUG_UTIL_MENU_ITEM_SCRIPT_6, + DEBUG_UTIL_MENU_ITEM_SCRIPT_7, + DEBUG_UTIL_MENU_ITEM_SCRIPT_8, +}; +enum { // Flags + DEBUG_FLAG_MENU_ITEM_FLAGS, + DEBUG_FLAG_MENU_ITEM_POKEDEXFLAGS, + DEBUG_FLAG_MENU_ITEM_POKEDEXONOFF, + DEBUG_FLAG_MENU_ITEM_NATDEXONOFF, + DEBUG_FLAG_MENU_ITEM_POKENAVONOFF, + DEBUG_FLAG_MENU_ITEM_FLYANYWHERE, + DEBUG_FLAG_MENU_ITEM_GETALLBADGES, + DEBUG_FLAG_MENU_ITEM_FRONTIER_PASS, + DEBUG_FLAG_MENU_ITEM_COLISSION_ONOFF, + DEBUG_FLAG_MENU_ITEM_ENCOUNTER_ONOFF, + DEBUG_FLAG_MENU_ITEM_TRAINER_SEE_ONOFF, + DEBUG_FLAG_MENU_ITEM_BAG_USE_ONOFF, + DEBUG_FLAG_MENU_ITEM_CATCHING_ONOFF, +}; +enum { // Vars + DEBUG_VARS_MENU_ITEM_VARS, +}; +enum { // Give + DEBUG_GIVE_MENU_ITEM_ITEM_X, + DEBUG_GIVE_MENU_ITEM_ALLTMS, + DEBUG_GIVE_MENU_ITEM_POKEMON_SIMPLE, + DEBUG_GIVE_MENU_ITEM_POKEMON_COMPLEX, + DEBUG_GIVE_MENU_ITEM_MAX_MONEY, + DEBUG_GIVE_MENU_ITEM_MAX_COINS, + DEBUG_GIVE_MENU_ITEM_MAX_BATTLE_POINTS, + DEBUG_GIVE_MENU_ITEM_DAYCARE_EGG, + DEBUG_GIVE_MENU_ITEM_FILL_PC, + DEBUG_GIVE_MENU_ITEM_CHEAT, +}; +enum { //Sound + DEBUG_SOUND_MENU_ITEM_SE, + DEBUG_SOUND_MENU_ITEM_MUS, +}; + +// ******************************* +// Constants +#define DEBUG_MAIN_MENU_WIDTH 15 +#define DEBUG_MAIN_MENU_HEIGHT 8 + +#define DEBUG_NUMBER_DISPLAY_WIDTH 10 +#define DEBUG_NUMBER_DISPLAY_HEIGHT 4 +#define DEBUG_NUMBER_DISPLAY_SOUND_WIDTH 20 +#define DEBUG_NUMBER_DISPLAY_SOUND_HEIGHT 6 + +#define DEBUG_NUMBER_DIGITS_FLAGS 4 +#define DEBUG_NUMBER_DIGITS_VARIABLES 5 +#define DEBUG_NUMBER_DIGITS_VARIABLE_VALUE 5 +#define DEBUG_NUMBER_DIGITS_ITEMS 4 +#define DEBUG_NUMBER_DIGITS_ITEM_QUANTITY 2 + +#define DEBUG_NUMBER_ICON_X 210 +#define DEBUG_NUMBER_ICON_Y 50 + +// EWRAM +static EWRAM_DATA struct DebugMonData *sDebugMonData = NULL; + +// ******************************* +struct DebugMonData +{ + u16 mon_speciesId; + u8 mon_level; + u8 isShiny; + u16 mon_natureId; + u16 mon_abilityNum; + u8 mon_iv_hp; + u8 mon_iv_atk; + u8 mon_iv_def; + u8 mon_iv_speed; + u8 mon_iv_satk; + u8 mon_iv_sdef; + u16 mon_move_0; + u16 mon_move_1; + u16 mon_move_2; + u16 mon_move_3; +}; + +// ******************************* +// Define functions +static void Debug_ShowMenu(void (*HandleInput)(u8), struct ListMenuTemplate LMtemplate); +void Debug_ShowMainMenu(void); +static void Debug_DestroyMenu(u8); +static void DebugAction_Cancel(u8); +static void DebugAction_DestroyExtraWindow(u8 taskId); + +static void DebugAction_Util_Script_1(u8); +static void DebugAction_Util_Script_2(u8); +static void DebugAction_Util_Script_3(u8); +static void DebugAction_Util_Script_4(u8); +static void DebugAction_Util_Script_5(u8); +static void DebugAction_Util_Script_6(u8); +static void DebugAction_Util_Script_7(u8); +static void DebugAction_Util_Script_8(u8); + +static void DebugAction_OpenUtilitiesMenu(u8); +static void DebugAction_OpenScriptsMenu(u8); +static void DebugAction_OpenFlagsMenu(u8); +static void DebugAction_OpenVariablesMenu(u8); +static void DebugAction_OpenGiveMenu(u8); +static void DebugAction_OpenSoundMenu(u8); +static void DebugTask_HandleMenuInput_Main(u8); +static void DebugTask_HandleMenuInput_Utilities(u8); +static void DebugTask_HandleMenuInput_Scripts(u8); +static void DebugTask_HandleMenuInput_Flags(u8); +static void DebugTask_HandleMenuInput_Vars(u8); +static void DebugTask_HandleMenuInput_Give(u8); +static void DebugTask_HandleMenuInput_Sound(u8); + +static void DebugAction_Util_HealParty(u8 taskId); +static void DebugAction_Util_Fly(u8 taskId); +static void DebugAction_Util_Warp_Warp(u8 taskId); +static void DebugAction_Util_Warp_SelectMapGroup(u8 taskId); +static void DebugAction_Util_Warp_SelectMap(u8 taskId); +static void DebugAction_Util_Warp_SelectWarp(u8 taskId); +static void DebugAction_Util_RunningShoes(u8 taskId); +static void DebugAction_Util_PoisonMons(u8 taskId); +static void DebugAction_Util_CheckSaveBlock(u8); +static void DebugAction_Util_CheckWallClock(u8); +static void DebugAction_Util_SetWallClock(u8); +static void DebugAction_Util_WatchCredits(u8); +static void DebugAction_Util_Trainer_Name(u8); +static void DebugAction_Util_Trainer_Gender(u8); +static void DebugAction_Util_Trainer_Id(u8); + +static void DebugAction_Flags_Flags(u8 taskId); +static void DebugAction_Flags_FlagsSelect(u8 taskId); + +static void DebugAction_Flags_SetPokedexFlags(u8 taskId); +static void DebugAction_Flags_SwitchDex(u8 taskId); +static void DebugAction_Flags_SwitchNatDex(u8 taskId); +static void DebugAction_Flags_SwitchPokeNav(u8 taskId); +static void DebugAction_Flags_ToggleFlyFlags(u8 taskId); +static void DebugAction_Flags_ToggleBadgeFlags(u8 taskId); +static void DebugAction_Flags_ToggleFrontierPass(u8 taskId); +static void DebugAction_Flags_CollisionOnOff(u8 taskId); +static void DebugAction_Flags_EncounterOnOff(u8 taskId); +static void DebugAction_Flags_TrainerSeeOnOff(u8 taskId); +static void DebugAction_Flags_BagUseOnOff(u8 taskId); +static void DebugAction_Flags_CatchingOnOff(u8 taskId); + +static void DebugAction_Vars_Vars(u8 taskId); +static void DebugAction_Vars_Select(u8 taskId); +static void DebugAction_Vars_SetValue(u8 taskId); + +static void DebugAction_Give_Item(u8 taskId); +static void DebugAction_Give_Item_SelectId(u8 taskId); +static void DebugAction_Give_Item_SelectQuantity(u8 taskId); +static void DebugAction_Give_AllTMs(u8 taskId); +static void DebugAction_Give_PokemonSimple(u8 taskId); +static void DebugAction_Give_PokemonComplex(u8 taskId); +static void DebugAction_Give_Pokemon_SelectId(u8 taskId); +static void DebugAction_Give_Pokemon_SelectLevel(u8 taskId); +static void DebugAction_Give_Pokemon_SelectShiny(u8 taskId); +static void DebugAction_Give_Pokemon_SelectNature(u8 taskId); +static void DebugAction_Give_Pokemon_SelectAbility(u8 taskId); +static void DebugAction_Give_Pokemon_SelectIVs(u8 taskId); +static void DebugAction_Give_Pokemon_ComplexCreateMon(u8 taskId); +static void DebugAction_Give_Pokemon_Move(u8 taskId); +static void DebugAction_Give_MaxMoney(u8 taskId); +static void DebugAction_Give_MaxCoins(u8 taskId); +static void DebugAction_Give_MaxBattlePoints(u8 taskId); +static void DebugAction_Give_DayCareEgg(u8 taskId); +static void DebugAction_Give_FillPC(u8 taskId); +static void DebugAction_Give_CHEAT(u8 taskId); +static void DebugAction_AccessPC(u8 taskId); + +static void DebugAction_Sound_SE(u8 taskId); +static void DebugAction_Sound_SE_SelectId(u8 taskId); +static void DebugAction_Sound_MUS(u8 taskId); +static void DebugAction_Sound_MUS_SelectId(u8 taskId); + +static void DebugTask_HandleMenuInput(u8 taskId, void (*HandleInput)(u8)); +static void DebugAction_OpenSubMenu(u8 taskId, struct ListMenuTemplate LMtemplate); + +extern u8 Debug_FlagsNotSetMessage[]; +extern u8 Debug_Script_1[]; +extern u8 Debug_Script_2[]; +extern u8 Debug_Script_3[]; +extern u8 Debug_Script_4[]; +extern u8 Debug_Script_5[]; +extern u8 Debug_Script_6[]; +extern u8 Debug_Script_7[]; +extern u8 Debug_Script_8[]; + +extern u8 Debug_ShowFieldMessageStringVar4[]; +extern u8 Debug_CheatStart[]; +extern u8 PlayersHouse_2F_EventScript_SetWallClock[]; +extern u8 PlayersHouse_2F_EventScript_CheckWallClock[]; + + +// ******************************* +//Maps per map group COPY FROM /include/constants/map_groups.h +static const u8 MAP_GROUP_COUNT[] = {57, 5, 5, 6, 7, 8, 9, 7, 7, 14, 8, 17, 10, 23, 13, 15, 15, 2, 2, 2, 3, 1, 1, 1, 108, 61, 89, 2, 1, 13, 1, 1, 3, 1, 0}; + +// Text +// Main Menu +static const u8 gDebugText_Utilities[] = _("Utilities"); +static const u8 gDebugText_Scripts[] = _("Scripts"); +static const u8 gDebugText_Flags[] = _("Flags"); +static const u8 gDebugText_Vars[] = _("Variables"); +static const u8 gDebugText_Give[] = _("Give X"); +static const u8 gDebugText_Sound[] = _("Sound"); +static const u8 gDebugText_Cancel[] = _("Cancel"); +// Script menu +static const u8 gDebugText_Util_Script_1[] = _("Script 1"); +static const u8 gDebugText_Util_Script_2[] = _("Script 2"); +static const u8 gDebugText_Util_Script_3[] = _("Script 3"); +static const u8 gDebugText_Util_Script_4[] = _("Script 4"); +static const u8 gDebugText_Util_Script_5[] = _("Script 5"); +static const u8 gDebugText_Util_Script_6[] = _("Script 6"); +static const u8 gDebugText_Util_Script_7[] = _("Script 7"); +static const u8 gDebugText_Util_Script_8[] = _("Script 8"); +// Util Menu +static const u8 gDebugText_Util_HealParty[] = _("Heal Party"); +static const u8 gDebugText_Util_Fly[] = _("Fly to map"); +static const u8 gDebugText_Util_WarpToMap[] = _("Warp to map warp"); +static const u8 gDebugText_Util_WarpToMap_SelectMapGroup[] = _("Group: {STR_VAR_1} \n \n\n{STR_VAR_3} "); +static const u8 gDebugText_Util_WarpToMap_SelectMap[] = _("Map: {STR_VAR_1} \nMapSec: \n{STR_VAR_2} \n{STR_VAR_3} "); +static const u8 gDebugText_Util_WarpToMap_SelectWarp[] = _("Warp: \n{STR_VAR_1} \n \n{STR_VAR_3} "); +static const u8 gDebugText_Util_WarpToMap_SelMax[] = _("{STR_VAR_1} / {STR_VAR_2}"); +static const u8 gDebugText_Util_RunningShoes[] = _("Toggle Running Shoes"); +static const u8 gDebugText_Util_PoisonMons[] = _("Poison all mons"); +static const u8 gDebugText_Util_SaveBlockSpace[] = _("SaveBlock Space"); +static const u8 gDebugText_Util_CheckWallClock[] = _("Check Wall Clock"); +static const u8 gDebugText_Util_SetWallClock[] = _("Set Wall Clock"); +static const u8 gDebugText_Util_WatchCredits[] = _("Watch Credits"); +static const u8 gDebugText_Util_Trainer_Name[] = _("Trainer name"); +static const u8 gDebugText_Util_Trainer_Gender[] = _("Toggle T. Gender"); +static const u8 gDebugText_Util_Trainer_Id[] = _("New Trainer Id"); +// Flags Menu +static const u8 gDebugText_Flags_Flags[] = _("Set Flag XXXX"); +static const u8 gDebugText_Flags_SetPokedexFlags[] = _("All Pokédex Flags"); +static const u8 gDebugText_Flags_SwitchDex[] = _("Pokédex ON/OFF"); +static const u8 gDebugText_Flags_SwitchNationalDex[] = _("NatDex ON/OFF"); +static const u8 gDebugText_Flags_SwitchPokeNav[] = _("PokéNav ON/OFF"); +static const u8 gDebugText_Flags_ToggleFlyFlags[] = _("Fly Flags ON/OFF"); +static const u8 gDebugText_Flags_ToggleAllBadges[] = _("All badges ON/OFF"); +static const u8 gDebugText_Flags_ToggleFrontierPass[] = _("Frontier Pass ON/OFF"); +static const u8 gDebugText_Flags_SwitchCollision[] = _("Collision ON/OFF"); +static const u8 gDebugText_Flags_SwitchEncounter[] = _("Encounter ON/OFF"); +static const u8 gDebugText_Flags_SwitchTrainerSee[] = _("TrainerSee ON/OFF"); +static const u8 gDebugText_Flags_SwitchBagUse[] = _("BagUse ON/OFF"); +static const u8 gDebugText_Flags_SwitchCatching[] = _("Catching ON/OFF"); +static const u8 gDebugText_Flags_Flag[] = _("Flag: {STR_VAR_1} \n{STR_VAR_2} \n{STR_VAR_3}"); +static const u8 gDebugText_Flags_FlagHex[] = _("{STR_VAR_1} \n0x{STR_VAR_2} "); +static const u8 gDebugText_Flags_FlagSet[] = _("TRUE"); +static const u8 gDebugText_Flags_FlagUnset[] = _("FALSE"); +// Variables Menu +static const u8 gDebugText_Vars_Vars[] = _("Set Vars XXXX"); +static const u8 gDebugText_Vars_VariableHex[] = _("{STR_VAR_1} \n0x{STR_VAR_2} "); +static const u8 gDebugText_Vars_Variable[] = _("Var: {STR_VAR_1} \nVal: {STR_VAR_3} \n{STR_VAR_2}"); +static const u8 gDebugText_Vars_VariableValueSet[] = _("Var: {STR_VAR_1} \nVal: {STR_VAR_3} \n{STR_VAR_2}"); +// Give Menu +static const u8 gDebugText_Give_GiveItem[] = _("Give item XXXX"); +static const u8 gDebugText_ItemQuantity[] = _("Quantity: \n{STR_VAR_1} \n\n{STR_VAR_2}"); +static const u8 gDebugText_ItemID[] = _("Item Id: {STR_VAR_3}\n{STR_VAR_1} \n\n{STR_VAR_2}"); +static const u8 gDebugText_Give_AllTMs[] = _("Give all TMs"); +static const u8 gDebugText_Give_GivePokemonSimple[] = _("Pkm(lvl)"); +static const u8 gDebugText_Give_GivePokemonComplex[] = _("Pkm(l,s,n,a,IV,mov)"); +static const u8 gDebugText_PokemonID[] = _("Species: {STR_VAR_3}\n{STR_VAR_1} \n\n{STR_VAR_2}"); +static const u8 gDebugText_PokemonLevel[] = _("Level: \n{STR_VAR_1} \n \n{STR_VAR_2}"); +static const u8 gDebugText_PokemonShiny[] = _("Shiny: \n {STR_VAR_2} \n \n "); +static const u8 gDebugText_PokemonNature[] = _("NatureId: {STR_VAR_3} \n{STR_VAR_1} \n \n{STR_VAR_2}"); +static const u8 gDebugText_PokemonAbility[] = _("AbilityNum: {STR_VAR_3} \n{STR_VAR_1} \n \n{STR_VAR_2}"); +static const u8 gDebugText_PokemonIVs[] = _("All IVs: \n {STR_VAR_3} \n \n{STR_VAR_2} "); +static const u8 gDebugText_PokemonIV_0[] = _("IV HP: \n {STR_VAR_3} \n \n{STR_VAR_2} "); +static const u8 gDebugText_PokemonIV_1[] = _("IV Attack: \n {STR_VAR_3} \n \n{STR_VAR_2} "); +static const u8 gDebugText_PokemonIV_2[] = _("IV Defense: \n {STR_VAR_3} \n \n{STR_VAR_2} "); +static const u8 gDebugText_PokemonIV_3[] = _("IV Speed: \n {STR_VAR_3} \n \n{STR_VAR_2} "); +static const u8 gDebugText_PokemonIV_4[] = _("IV Sp. Attack: \n {STR_VAR_3} \n \n{STR_VAR_2} "); +static const u8 gDebugText_PokemonIV_5[] = _("IV Sp. Defense: \n {STR_VAR_3} \n \n{STR_VAR_2} "); +static const u8 gDebugText_PokemonMove_0[] = _("Move 0: {STR_VAR_3} \n{STR_VAR_1} \n \n{STR_VAR_2}"); +static const u8 gDebugText_PokemonMove_1[] = _("Move 1: {STR_VAR_3} \n{STR_VAR_1} \n \n{STR_VAR_2}"); +static const u8 gDebugText_PokemonMove_2[] = _("Move 2: {STR_VAR_3} \n{STR_VAR_1} \n \n{STR_VAR_2}"); +static const u8 gDebugText_PokemonMove_3[] = _("Move 3: {STR_VAR_3} \n{STR_VAR_1} \n \n{STR_VAR_2}"); +static const u8 gDebugText_Give_MaxMoney[] = _("Max Money"); +static const u8 gDebugText_Give_MaxCoins[] = _("Max Coins"); +static const u8 gDebugText_Give_BattlePoints[] = _("Max Battle Points"); +static const u8 gDebugText_Give_DaycareEgg[] = _("Daycare Egg"); +static const u8 gDebugText_Give_FillPc[] = _("Fill Pc"); +static const u8 gDebugText_Give_GiveCHEAT[] = _("CHEAT Start"); +static const u8 gDebugText_AccessPC[] = _("Access PC"); +// Sound Mneu +static const u8 gDebugText_Sound_SE[] = _("Effects"); +static const u8 gDebugText_Sound_SE_ID[] = _("Sound Id: {STR_VAR_3}\n{STR_VAR_1} \n{STR_VAR_2}"); +static const u8 gDebugText_Sound_MUS[] = _("Music"); +static const u8 gDebugText_Sound_MUS_ID[] = _("Music Id: {STR_VAR_3}\n{STR_VAR_1} \n{STR_VAR_2}"); +static const u8 gDebugText_Sound_Empty[] = _(""); + +static const u8 digitInidicator_1[] = _("{LEFT_ARROW}+1{RIGHT_ARROW} "); +static const u8 digitInidicator_10[] = _("{LEFT_ARROW}+10{RIGHT_ARROW} "); +static const u8 digitInidicator_100[] = _("{LEFT_ARROW}+100{RIGHT_ARROW} "); +static const u8 digitInidicator_1000[] = _("{LEFT_ARROW}+1000{RIGHT_ARROW} "); +static const u8 digitInidicator_10000[] = _("{LEFT_ARROW}+10000{RIGHT_ARROW} "); +static const u8 digitInidicator_100000[] = _("{LEFT_ARROW}+100000{RIGHT_ARROW} "); +static const u8 digitInidicator_1000000[] = _("{LEFT_ARROW}+1000000{RIGHT_ARROW} "); +static const u8 digitInidicator_10000000[] = _("{LEFT_ARROW}+10000000{RIGHT_ARROW} "); +const u8 * const gText_DigitIndicator[] = +{ + digitInidicator_1, + digitInidicator_10, + digitInidicator_100, + digitInidicator_1000, + digitInidicator_10000, + digitInidicator_100000, + digitInidicator_1000000, + digitInidicator_10000000 +}; +static const s32 sPowersOfTen[] = +{ + 1, + 10, + 100, + 1000, + 10000, + 100000, + 1000000, + 10000000, + 100000000, + 1000000000, +}; + +// ******************************* +// List Menu Items +static const struct ListMenuItem sDebugMenu_Items_Main[] = +{ + [DEBUG_MENU_ITEM_UTILITIES] = {gDebugText_Utilities, DEBUG_MENU_ITEM_UTILITIES}, + [DEBUG_MENU_ITEM_SCRIPTS] = {gDebugText_Scripts, DEBUG_MENU_ITEM_SCRIPTS}, + [DEBUG_MENU_ITEM_FLAGS] = {gDebugText_Flags, DEBUG_MENU_ITEM_FLAGS}, + [DEBUG_MENU_ITEM_VARS] = {gDebugText_Vars, DEBUG_MENU_ITEM_VARS}, + [DEBUG_MENU_ITEM_GIVE] = {gDebugText_Give, DEBUG_MENU_ITEM_GIVE}, + [DEBUG_MENU_ITEM_SOUND] = {gDebugText_Sound, DEBUG_MENU_ITEM_SOUND}, + [DEBUG_MENU_ITEM_ACCESS_PC] = {gDebugText_AccessPC, DEBUG_MENU_ITEM_ACCESS_PC}, + [DEBUG_MENU_ITEM_CANCEL] = {gDebugText_Cancel, DEBUG_MENU_ITEM_CANCEL} +}; +static const struct ListMenuItem sDebugMenu_Items_Utilities[] = +{ + [DEBUG_UTIL_MENU_ITEM_HEAL_PARTY] = {gDebugText_Util_HealParty, DEBUG_UTIL_MENU_ITEM_HEAL_PARTY}, + [DEBUG_UTIL_MENU_ITEM_FLY] = {gDebugText_Util_Fly, DEBUG_UTIL_MENU_ITEM_FLY}, + [DEBUG_UTIL_MENU_ITEM_WARP] = {gDebugText_Util_WarpToMap, DEBUG_UTIL_MENU_ITEM_WARP}, + [DEBUG_UTIL_MENU_ITEM_RUNNING_SHOES] = {gDebugText_Util_RunningShoes, DEBUG_UTIL_MENU_ITEM_RUNNING_SHOES}, + [DEBUG_UTIL_MENU_ITEM_POISON_MONS] = {gDebugText_Util_PoisonMons, DEBUG_UTIL_MENU_ITEM_POISON_MONS}, + [DEBUG_UTIL_MENU_ITEM_SAVEBLOCK] = {gDebugText_Util_SaveBlockSpace, DEBUG_UTIL_MENU_ITEM_SAVEBLOCK}, + [DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK] = {gDebugText_Util_CheckWallClock, DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK}, + [DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK] = {gDebugText_Util_SetWallClock, DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK}, + [DEBUG_UTIL_MENU_ITEM_WATCHCREDITS] = {gDebugText_Util_WatchCredits, DEBUG_UTIL_MENU_ITEM_WATCHCREDITS}, + [DEBUG_UTIL_MENU_ITEM_TRAINER_NAME] = {gDebugText_Util_Trainer_Name, DEBUG_UTIL_MENU_ITEM_TRAINER_NAME}, + [DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER] = {gDebugText_Util_Trainer_Gender, DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER}, + [DEBUG_UTIL_MENU_ITEM_TRAINER_ID] = {gDebugText_Util_Trainer_Id, DEBUG_UTIL_MENU_ITEM_TRAINER_ID}, +}; +static const struct ListMenuItem sDebugMenu_Items_Scripts[] = +{ + [DEBUG_UTIL_MENU_ITEM_SCRIPT_1] = {gDebugText_Util_Script_1, DEBUG_UTIL_MENU_ITEM_SCRIPT_1}, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_2] = {gDebugText_Util_Script_2, DEBUG_UTIL_MENU_ITEM_SCRIPT_2}, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_3] = {gDebugText_Util_Script_3, DEBUG_UTIL_MENU_ITEM_SCRIPT_3}, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_4] = {gDebugText_Util_Script_4, DEBUG_UTIL_MENU_ITEM_SCRIPT_4}, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_5] = {gDebugText_Util_Script_5, DEBUG_UTIL_MENU_ITEM_SCRIPT_5}, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_6] = {gDebugText_Util_Script_6, DEBUG_UTIL_MENU_ITEM_SCRIPT_6}, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_7] = {gDebugText_Util_Script_7, DEBUG_UTIL_MENU_ITEM_SCRIPT_7}, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_8] = {gDebugText_Util_Script_8, DEBUG_UTIL_MENU_ITEM_SCRIPT_8}, +}; +static const struct ListMenuItem sDebugMenu_Items_Flags[] = +{ + [DEBUG_FLAG_MENU_ITEM_FLAGS] = {gDebugText_Flags_Flags, DEBUG_FLAG_MENU_ITEM_FLAGS}, + [DEBUG_FLAG_MENU_ITEM_POKEDEXFLAGS] = {gDebugText_Flags_SetPokedexFlags, DEBUG_FLAG_MENU_ITEM_POKEDEXFLAGS}, + [DEBUG_FLAG_MENU_ITEM_POKEDEXONOFF] = {gDebugText_Flags_SwitchDex, DEBUG_FLAG_MENU_ITEM_POKEDEXONOFF}, + [DEBUG_FLAG_MENU_ITEM_NATDEXONOFF] = {gDebugText_Flags_SwitchNationalDex, DEBUG_FLAG_MENU_ITEM_NATDEXONOFF}, + [DEBUG_FLAG_MENU_ITEM_POKENAVONOFF] = {gDebugText_Flags_SwitchPokeNav, DEBUG_FLAG_MENU_ITEM_POKENAVONOFF}, + [DEBUG_FLAG_MENU_ITEM_FLYANYWHERE] = {gDebugText_Flags_ToggleFlyFlags, DEBUG_FLAG_MENU_ITEM_FLYANYWHERE}, + [DEBUG_FLAG_MENU_ITEM_GETALLBADGES] = {gDebugText_Flags_ToggleAllBadges, DEBUG_FLAG_MENU_ITEM_GETALLBADGES}, + [DEBUG_FLAG_MENU_ITEM_FRONTIER_PASS] = {gDebugText_Flags_ToggleFrontierPass, DEBUG_FLAG_MENU_ITEM_FRONTIER_PASS}, + [DEBUG_FLAG_MENU_ITEM_COLISSION_ONOFF] = {gDebugText_Flags_SwitchCollision, DEBUG_FLAG_MENU_ITEM_COLISSION_ONOFF}, + [DEBUG_FLAG_MENU_ITEM_ENCOUNTER_ONOFF] = {gDebugText_Flags_SwitchEncounter, DEBUG_FLAG_MENU_ITEM_ENCOUNTER_ONOFF}, + [DEBUG_FLAG_MENU_ITEM_TRAINER_SEE_ONOFF] = {gDebugText_Flags_SwitchTrainerSee, DEBUG_FLAG_MENU_ITEM_TRAINER_SEE_ONOFF}, + [DEBUG_FLAG_MENU_ITEM_BAG_USE_ONOFF] = {gDebugText_Flags_SwitchBagUse, DEBUG_FLAG_MENU_ITEM_BAG_USE_ONOFF}, + [DEBUG_FLAG_MENU_ITEM_CATCHING_ONOFF] = {gDebugText_Flags_SwitchCatching, DEBUG_FLAG_MENU_ITEM_CATCHING_ONOFF}, +}; +static const struct ListMenuItem sDebugMenu_Items_Vars[] = +{ + [DEBUG_VARS_MENU_ITEM_VARS] = {gDebugText_Vars_Vars, DEBUG_FLAG_MENU_ITEM_FLAGS}, +}; +static const struct ListMenuItem sDebugMenu_Items_Give[] = +{ + [DEBUG_GIVE_MENU_ITEM_ITEM_X] = {gDebugText_Give_GiveItem, DEBUG_GIVE_MENU_ITEM_ITEM_X}, + [DEBUG_GIVE_MENU_ITEM_ALLTMS] = {gDebugText_Give_AllTMs, DEBUG_GIVE_MENU_ITEM_ALLTMS}, + [DEBUG_GIVE_MENU_ITEM_POKEMON_SIMPLE] = {gDebugText_Give_GivePokemonSimple, DEBUG_GIVE_MENU_ITEM_POKEMON_SIMPLE}, + [DEBUG_GIVE_MENU_ITEM_POKEMON_COMPLEX] = {gDebugText_Give_GivePokemonComplex, DEBUG_GIVE_MENU_ITEM_POKEMON_COMPLEX}, + [DEBUG_GIVE_MENU_ITEM_MAX_MONEY] = {gDebugText_Give_MaxMoney, DEBUG_GIVE_MENU_ITEM_MAX_MONEY}, + [DEBUG_GIVE_MENU_ITEM_MAX_COINS] = {gDebugText_Give_MaxCoins, DEBUG_GIVE_MENU_ITEM_MAX_COINS}, + [DEBUG_GIVE_MENU_ITEM_MAX_BATTLE_POINTS] = {gDebugText_Give_BattlePoints, DEBUG_GIVE_MENU_ITEM_MAX_BATTLE_POINTS}, + [DEBUG_GIVE_MENU_ITEM_DAYCARE_EGG] = {gDebugText_Give_DaycareEgg, DEBUG_GIVE_MENU_ITEM_DAYCARE_EGG}, + [DEBUG_GIVE_MENU_ITEM_FILL_PC] = {gDebugText_Give_FillPc, DEBUG_GIVE_MENU_ITEM_FILL_PC}, + [DEBUG_GIVE_MENU_ITEM_CHEAT] = {gDebugText_Give_GiveCHEAT, DEBUG_GIVE_MENU_ITEM_CHEAT}, +}; +static const struct ListMenuItem sDebugMenu_Items_Sound[] = +{ + [DEBUG_SOUND_MENU_ITEM_SE] = {gDebugText_Sound_SE, DEBUG_SOUND_MENU_ITEM_SE}, + [DEBUG_SOUND_MENU_ITEM_MUS] = {gDebugText_Sound_MUS, DEBUG_SOUND_MENU_ITEM_MUS}, +}; + +// ******************************* +// Menu Actions +static void (*const sDebugMenu_Actions_Main[])(u8) = +{ + [DEBUG_MENU_ITEM_UTILITIES] = DebugAction_OpenUtilitiesMenu, + [DEBUG_MENU_ITEM_SCRIPTS] = DebugAction_OpenScriptsMenu, + [DEBUG_MENU_ITEM_FLAGS] = DebugAction_OpenFlagsMenu, + [DEBUG_MENU_ITEM_VARS] = DebugAction_OpenVariablesMenu, + [DEBUG_MENU_ITEM_GIVE] = DebugAction_OpenGiveMenu, + [DEBUG_MENU_ITEM_SOUND] = DebugAction_OpenSoundMenu, + [DEBUG_MENU_ITEM_ACCESS_PC] = DebugAction_AccessPC, + [DEBUG_MENU_ITEM_CANCEL] = DebugAction_Cancel +}; +static void (*const sDebugMenu_Actions_Utilities[])(u8) = +{ + [DEBUG_UTIL_MENU_ITEM_HEAL_PARTY] = DebugAction_Util_HealParty, + [DEBUG_UTIL_MENU_ITEM_FLY] = DebugAction_Util_Fly, + [DEBUG_UTIL_MENU_ITEM_WARP] = DebugAction_Util_Warp_Warp, + [DEBUG_UTIL_MENU_ITEM_RUNNING_SHOES] = DebugAction_Util_RunningShoes, + [DEBUG_UTIL_MENU_ITEM_POISON_MONS] = DebugAction_Util_PoisonMons, + [DEBUG_UTIL_MENU_ITEM_SAVEBLOCK] = DebugAction_Util_CheckSaveBlock, + [DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK] = DebugAction_Util_CheckWallClock, + [DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK] = DebugAction_Util_SetWallClock, + [DEBUG_UTIL_MENU_ITEM_WATCHCREDITS] = DebugAction_Util_WatchCredits, + [DEBUG_UTIL_MENU_ITEM_TRAINER_NAME] = DebugAction_Util_Trainer_Name, + [DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER] = DebugAction_Util_Trainer_Gender, + [DEBUG_UTIL_MENU_ITEM_TRAINER_ID] = DebugAction_Util_Trainer_Id, +}; +static void (*const sDebugMenu_Actions_Scripts[])(u8) = +{ + [DEBUG_UTIL_MENU_ITEM_SCRIPT_1] = DebugAction_Util_Script_1, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_2] = DebugAction_Util_Script_2, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_3] = DebugAction_Util_Script_3, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_4] = DebugAction_Util_Script_4, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_5] = DebugAction_Util_Script_5, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_6] = DebugAction_Util_Script_6, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_7] = DebugAction_Util_Script_7, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_8] = DebugAction_Util_Script_8, +}; +static void (*const sDebugMenu_Actions_Flags[])(u8) = +{ + [DEBUG_FLAG_MENU_ITEM_FLAGS] = DebugAction_Flags_Flags, + [DEBUG_FLAG_MENU_ITEM_POKEDEXFLAGS] = DebugAction_Flags_SetPokedexFlags, + [DEBUG_FLAG_MENU_ITEM_POKEDEXONOFF] = DebugAction_Flags_SwitchDex, + [DEBUG_FLAG_MENU_ITEM_NATDEXONOFF] = DebugAction_Flags_SwitchNatDex, + [DEBUG_FLAG_MENU_ITEM_POKENAVONOFF] = DebugAction_Flags_SwitchPokeNav, + [DEBUG_FLAG_MENU_ITEM_FLYANYWHERE] = DebugAction_Flags_ToggleFlyFlags, + [DEBUG_FLAG_MENU_ITEM_GETALLBADGES] = DebugAction_Flags_ToggleBadgeFlags, + [DEBUG_FLAG_MENU_ITEM_FRONTIER_PASS] = DebugAction_Flags_ToggleFrontierPass, + [DEBUG_FLAG_MENU_ITEM_COLISSION_ONOFF] = DebugAction_Flags_CollisionOnOff, + [DEBUG_FLAG_MENU_ITEM_ENCOUNTER_ONOFF] = DebugAction_Flags_EncounterOnOff, + [DEBUG_FLAG_MENU_ITEM_TRAINER_SEE_ONOFF] = DebugAction_Flags_TrainerSeeOnOff, + [DEBUG_FLAG_MENU_ITEM_BAG_USE_ONOFF] = DebugAction_Flags_BagUseOnOff, + [DEBUG_FLAG_MENU_ITEM_CATCHING_ONOFF] = DebugAction_Flags_CatchingOnOff, +}; +static void (*const sDebugMenu_Actions_Vars[])(u8) = +{ + [DEBUG_VARS_MENU_ITEM_VARS] = DebugAction_Vars_Vars, +}; +static void (*const sDebugMenu_Actions_Give[])(u8) = +{ + [DEBUG_GIVE_MENU_ITEM_ITEM_X] = DebugAction_Give_Item, + [DEBUG_GIVE_MENU_ITEM_ALLTMS] = DebugAction_Give_AllTMs, + [DEBUG_GIVE_MENU_ITEM_POKEMON_SIMPLE] = DebugAction_Give_PokemonSimple, + [DEBUG_GIVE_MENU_ITEM_POKEMON_COMPLEX] = DebugAction_Give_PokemonComplex, + [DEBUG_GIVE_MENU_ITEM_MAX_MONEY] = DebugAction_Give_MaxMoney, + [DEBUG_GIVE_MENU_ITEM_MAX_COINS] = DebugAction_Give_MaxCoins, + [DEBUG_GIVE_MENU_ITEM_MAX_BATTLE_POINTS] = DebugAction_Give_MaxBattlePoints, + [DEBUG_GIVE_MENU_ITEM_DAYCARE_EGG] = DebugAction_Give_DayCareEgg, + [DEBUG_GIVE_MENU_ITEM_FILL_PC] = DebugAction_Give_FillPC, + [DEBUG_GIVE_MENU_ITEM_CHEAT] = DebugAction_Give_CHEAT, +}; +static void (*const sDebugMenu_Actions_Sound[])(u8) = +{ + [DEBUG_SOUND_MENU_ITEM_SE] = DebugAction_Sound_SE, + [DEBUG_SOUND_MENU_ITEM_MUS] = DebugAction_Sound_MUS, +}; + + +// ******************************* +// Windows +static const struct WindowTemplate sDebugMenuWindowTemplate = +{ + .bg = 0, + .tilemapLeft = 1, + .tilemapTop = 1, + .width = DEBUG_MAIN_MENU_WIDTH, + .height = 2 * DEBUG_MAIN_MENU_HEIGHT, + .paletteNum = 15, + .baseBlock = 1, +}; +static const struct WindowTemplate sDebugNumberDisplayWindowTemplate = +{ + .bg = 0, + .tilemapLeft = 4 + DEBUG_MAIN_MENU_WIDTH, + .tilemapTop = 1, + .width = DEBUG_NUMBER_DISPLAY_WIDTH, + .height = 2 * DEBUG_NUMBER_DISPLAY_HEIGHT, + .paletteNum = 15, + .baseBlock = 1, +}; +static const struct WindowTemplate sDebugNumberDisplayLargeWindowTemplate = +{ + .bg = 0, + .tilemapLeft = 30 - DEBUG_NUMBER_DISPLAY_SOUND_WIDTH -1, + .tilemapTop = 1, + .width = DEBUG_NUMBER_DISPLAY_SOUND_WIDTH, + .height = DEBUG_NUMBER_DISPLAY_SOUND_HEIGHT, + .paletteNum = 15, + .baseBlock = 1, +}; + +// ******************************* +// List Menu Templates +static const struct ListMenuTemplate sDebugMenu_ListTemplate_Main = +{ + .items = sDebugMenu_Items_Main, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .totalItems = ARRAY_COUNT(sDebugMenu_Items_Main), +}; +static const struct ListMenuTemplate sDebugMenu_ListTemplate_Utilities = +{ + .items = sDebugMenu_Items_Utilities, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .totalItems = ARRAY_COUNT(sDebugMenu_Items_Utilities), +}; +static const struct ListMenuTemplate sDebugMenu_ListTemplate_Scripts = +{ + .items = sDebugMenu_Items_Scripts, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .totalItems = ARRAY_COUNT(sDebugMenu_Items_Scripts), +}; +static const struct ListMenuTemplate sDebugMenu_ListTemplate_Flags = +{ + .items = sDebugMenu_Items_Flags, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .totalItems = ARRAY_COUNT(sDebugMenu_Items_Flags), +}; +static const struct ListMenuTemplate sDebugMenu_ListTemplate_Vars = +{ + .items = sDebugMenu_Items_Vars, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .totalItems = ARRAY_COUNT(sDebugMenu_Items_Vars), +}; +static const struct ListMenuTemplate sDebugMenu_ListTemplate_Give = +{ + .items = sDebugMenu_Items_Give, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .totalItems = ARRAY_COUNT(sDebugMenu_Items_Give), +}; +static const struct ListMenuTemplate sDebugMenu_ListTemplate_Sound = +{ + .items = sDebugMenu_Items_Sound, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .totalItems = ARRAY_COUNT(sDebugMenu_Items_Sound), +}; + + +// ******************************* +// Functions universal +void Debug_ShowMainMenu(void) +{ + Debug_ShowMenu(DebugTask_HandleMenuInput_Main, sDebugMenu_ListTemplate_Main); +} +static void Debug_ShowMenu(void (*HandleInput)(u8), struct ListMenuTemplate LMtemplate) +{ + struct ListMenuTemplate menuTemplate; + u8 windowId; + u8 menuTaskId; + u8 inputTaskId; + + // create window + HideMapNamePopUpWindow(); + LoadMessageBoxAndBorderGfx(); + windowId = AddWindow(&sDebugMenuWindowTemplate); + DrawStdWindowFrame(windowId, FALSE); + + // create list menu + menuTemplate = LMtemplate; + menuTemplate.maxShowed = DEBUG_MAIN_MENU_HEIGHT; + menuTemplate.windowId = windowId; + menuTemplate.header_X = 0; + menuTemplate.item_X = 8; + menuTemplate.cursor_X = 0; + menuTemplate.upText_Y = 1; + menuTemplate.cursorPal = 2; + menuTemplate.fillValue = 1; + menuTemplate.cursorShadowPal = 3; + menuTemplate.lettersSpacing = 1; + menuTemplate.itemVerticalPadding = 0; + menuTemplate.scrollMultiple = LIST_NO_MULTIPLE_SCROLL; + menuTemplate.fontId = 1; + menuTemplate.cursorKind = 0; + menuTaskId = ListMenuInit(&menuTemplate, 0, 0); + + // draw everything + CopyWindowToVram(windowId, 3); + + // create input handler task + inputTaskId = CreateTask(HandleInput, 3); + gTasks[inputTaskId].data[0] = menuTaskId; + gTasks[inputTaskId].data[1] = windowId; +} +static void Debug_DestroyMenu(u8 taskId) +{ + DestroyListMenuTask(gTasks[taskId].data[0], NULL, NULL); + ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE); + RemoveWindow(gTasks[taskId].data[1]); + DestroyTask(taskId); +} +static void DebugAction_Cancel(u8 taskId) +{ + Debug_DestroyMenu(taskId); + ScriptContext_Enable(); +} +static void DebugAction_DestroyExtraWindow(u8 taskId) +{ + ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE); + RemoveWindow(gTasks[taskId].data[1]); + + ClearStdWindowAndFrame(gTasks[taskId].data[2], TRUE); + RemoveWindow(gTasks[taskId].data[2]); + + DestroyTask(taskId); + ScriptContext_Enable(); +} + + +// ******************************* +// Handle Inputs +static void DebugTask_HandleMenuInput_Main(u8 taskId) +{ + void (*func)(u8); + u32 input = ListMenu_ProcessInput(gTasks[taskId].data[0]); + + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + if ((func = sDebugMenu_Actions_Main[input]) != NULL) + func(taskId); + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + Debug_DestroyMenu(taskId); + ScriptContext_Enable(); + } +} +static void DebugTask_HandleMenuInput_Utilities(u8 taskId) +{ + void (*func)(u8); + u32 input = ListMenu_ProcessInput(gTasks[taskId].data[0]); + + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + if ((func = sDebugMenu_Actions_Utilities[input]) != NULL) + func(taskId); + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + Debug_DestroyMenu(taskId); + Debug_ShowMainMenu(); + } +} +static void DebugTask_HandleMenuInput_Scripts(u8 taskId) +{ + void (*func)(u8); + u32 input = ListMenu_ProcessInput(gTasks[taskId].data[0]); + + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + if ((func = sDebugMenu_Actions_Scripts[input]) != NULL) + func(taskId); + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + Debug_DestroyMenu(taskId); + Debug_ShowMainMenu(); + } +} +static void DebugTask_HandleMenuInput_Flags(u8 taskId) +{ + void (*func)(u8); + u32 input = ListMenu_ProcessInput(gTasks[taskId].data[0]); + + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + if ((func = sDebugMenu_Actions_Flags[input]) != NULL) + func(taskId); + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + Debug_DestroyMenu(taskId); + Debug_ShowMainMenu(); + } +} +static void DebugTask_HandleMenuInput_Vars(u8 taskId) +{ + void (*func)(u8); + u32 input = ListMenu_ProcessInput(gTasks[taskId].data[0]); + + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + if ((func = sDebugMenu_Actions_Vars[input]) != NULL) + func(taskId); + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + Debug_DestroyMenu(taskId); + Debug_ShowMainMenu(); + } +} +static void DebugTask_HandleMenuInput_Give(u8 taskId) +{ + void (*func)(u8); + u32 input = ListMenu_ProcessInput(gTasks[taskId].data[0]); + + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + if ((func = sDebugMenu_Actions_Give[input]) != NULL) + func(taskId); + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + Debug_DestroyMenu(taskId); + Debug_ShowMainMenu(); + } +} +static void DebugTask_HandleMenuInput_Sound(u8 taskId) +{ + void (*func)(u8); + u32 input = ListMenu_ProcessInput(gTasks[taskId].data[0]); + + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + if ((func = sDebugMenu_Actions_Sound[input]) != NULL) + func(taskId); + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + Debug_DestroyMenu(taskId); + Debug_ShowMainMenu(); + } +} + +// ******************************* +// Open sub-menus +static void DebugAction_OpenUtilitiesMenu(u8 taskId) +{ + Debug_DestroyMenu(taskId); + Debug_ShowMenu(DebugTask_HandleMenuInput_Utilities, sDebugMenu_ListTemplate_Utilities); +} +static void DebugAction_OpenScriptsMenu(u8 taskId) +{ + Debug_DestroyMenu(taskId); + Debug_ShowMenu(DebugTask_HandleMenuInput_Scripts, sDebugMenu_ListTemplate_Scripts); +} +static void DebugAction_OpenFlagsMenu(u8 taskId) +{ + Debug_DestroyMenu(taskId); + Debug_ShowMenu(DebugTask_HandleMenuInput_Flags, sDebugMenu_ListTemplate_Flags); +} +static void DebugAction_OpenVariablesMenu(u8 taskId) +{ + Debug_DestroyMenu(taskId); + Debug_ShowMenu(DebugTask_HandleMenuInput_Vars, sDebugMenu_ListTemplate_Vars); +} +static void DebugAction_OpenGiveMenu(u8 taskId) +{ + Debug_DestroyMenu(taskId); + Debug_ShowMenu(DebugTask_HandleMenuInput_Give, sDebugMenu_ListTemplate_Give); +} +static void DebugAction_OpenSoundMenu(u8 taskId) +{ + Debug_DestroyMenu(taskId); + Debug_ShowMenu(DebugTask_HandleMenuInput_Sound, sDebugMenu_ListTemplate_Sound); +} + + +// ******************************* +// Actions Utilities +static void DebugAction_Util_HealParty(u8 taskId) +{ + PlaySE(SE_USE_ITEM); + HealPlayerParty(); + ScriptContext_Enable(); + Debug_DestroyMenu(taskId); +} +static void DebugAction_Util_Fly(u8 taskId) +{ + FlagSet(FLAG_VISITED_LITTLEROOT_TOWN); + FlagSet(FLAG_VISITED_OLDALE_TOWN); + FlagSet(FLAG_VISITED_DEWFORD_TOWN); + FlagSet(FLAG_VISITED_LAVARIDGE_TOWN); + FlagSet(FLAG_VISITED_FALLARBOR_TOWN); + FlagSet(FLAG_VISITED_VERDANTURF_TOWN); + FlagSet(FLAG_VISITED_PACIFIDLOG_TOWN); + FlagSet(FLAG_VISITED_PETALBURG_CITY); + FlagSet(FLAG_VISITED_SLATEPORT_CITY); + FlagSet(FLAG_VISITED_MAUVILLE_CITY); + FlagSet(FLAG_VISITED_RUSTBORO_CITY); + FlagSet(FLAG_VISITED_FORTREE_CITY); + FlagSet(FLAG_VISITED_LILYCOVE_CITY); + FlagSet(FLAG_VISITED_MOSSDEEP_CITY); + FlagSet(FLAG_VISITED_SOOTOPOLIS_CITY); + FlagSet(FLAG_VISITED_EVER_GRANDE_CITY); + FlagSet(FLAG_LANDMARK_POKEMON_LEAGUE); + FlagSet(FLAG_LANDMARK_BATTLE_FRONTIER); + Debug_DestroyMenu(taskId); + SetMainCallback2(CB2_OpenFlyMap); +} + +static void DebugAction_Util_Warp_Warp(u8 taskId) +{ + u8 windowId; + + ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE); + RemoveWindow(gTasks[taskId].data[1]); + + HideMapNamePopUpWindow(); + LoadMessageBoxAndBorderGfx(); + windowId = AddWindow(&sDebugNumberDisplayWindowTemplate); + DrawStdWindowFrame(windowId, FALSE); + + CopyWindowToVram(windowId, 3); + + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); + ConvertIntToDecimalStringN(gStringVar2, MAP_GROUPS_COUNT-1, STR_CONV_MODE_LEADING_ZEROS, 2); + StringExpandPlaceholders(gStringVar1, gDebugText_Util_WarpToMap_SelMax); + StringCopy(gStringVar3, gText_DigitIndicator[0]); + StringExpandPlaceholders(gStringVar4, gDebugText_Util_WarpToMap_SelectMapGroup); + AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL); + + gTasks[taskId].func = DebugAction_Util_Warp_SelectMapGroup; + gTasks[taskId].data[2] = windowId; + gTasks[taskId].data[3] = 0; //Current Flag + gTasks[taskId].data[4] = 0; //Digit Selected + gTasks[taskId].data[5] = 0; //Map Group + gTasks[taskId].data[6] = 0; //Map + gTasks[taskId].data[7] = 0; //warp +} +static void DebugAction_Util_Warp_SelectMapGroup(u8 taskId) +{ + if (gMain.newKeys & DPAD_ANY) + { + PlaySE(SE_SELECT); + if (gMain.newKeys & DPAD_UP) + { + gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; + if (gTasks[taskId].data[3] > MAP_GROUPS_COUNT - 1) + gTasks[taskId].data[3] = MAP_GROUPS_COUNT - 1; + } + if (gMain.newKeys & DPAD_DOWN) + { + gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; + if (gTasks[taskId].data[3] < 0) + gTasks[taskId].data[3] = 0; + } + if (gMain.newKeys & DPAD_LEFT) + { + if (gTasks[taskId].data[4] > 0) + gTasks[taskId].data[4] -= 1; + } + if (gMain.newKeys & DPAD_RIGHT) + { + if (gTasks[taskId].data[4] < 2) + gTasks[taskId].data[4] += 1; + } + + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); + ConvertIntToDecimalStringN(gStringVar2, MAP_GROUPS_COUNT - 1, STR_CONV_MODE_LEADING_ZEROS, 2); + StringExpandPlaceholders(gStringVar1, gDebugText_Util_WarpToMap_SelMax); + StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].data[4]]); + StringExpandPlaceholders(gStringVar4, gDebugText_Util_WarpToMap_SelectMapGroup); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + } + + if (gMain.newKeys & A_BUTTON) + { + gTasks[taskId].data[5] = gTasks[taskId].data[3]; + gTasks[taskId].data[3] = 0; + gTasks[taskId].data[4] = 0; + + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); + ConvertIntToDecimalStringN(gStringVar2, MAP_GROUP_COUNT[gTasks[taskId].data[5]] - 1, STR_CONV_MODE_LEADING_ZEROS, 2); + StringExpandPlaceholders(gStringVar1, gDebugText_Util_WarpToMap_SelMax); + GetMapName(gStringVar2, Overworld_GetMapHeaderByGroupAndId(gTasks[taskId].data[5], gTasks[taskId].data[3])->regionMapSectionId, 0); + StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].data[4]]); + StringExpandPlaceholders(gStringVar4, gDebugText_Util_WarpToMap_SelectMap); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + + gTasks[taskId].func = DebugAction_Util_Warp_SelectMap; + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + DebugAction_DestroyExtraWindow(taskId); + } +} +static void DebugAction_Util_Warp_SelectMap(u8 taskId) +{ + u8 max_value = MAP_GROUP_COUNT[gTasks[taskId].data[5]]; //maps in the selected map group + + if (gMain.newKeys & DPAD_ANY) + { + PlaySE(SE_SELECT); + if (gMain.newKeys & DPAD_UP) + { + gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; + if(gTasks[taskId].data[3] > max_value - 1) + gTasks[taskId].data[3] = max_value - 1; + } + if(gMain.newKeys & DPAD_DOWN) + { + gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; + if (gTasks[taskId].data[3] < 0) + gTasks[taskId].data[3] = 0; + } + if(gMain.newKeys & DPAD_LEFT) + { + if (gTasks[taskId].data[4] > 0) + gTasks[taskId].data[4] -= 1; + } + if (gMain.newKeys & DPAD_RIGHT) + { + if(gTasks[taskId].data[4] < 2) + gTasks[taskId].data[4] += 1; + } + + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); + ConvertIntToDecimalStringN(gStringVar2, MAP_GROUP_COUNT[gTasks[taskId].data[5]] - 1, STR_CONV_MODE_LEADING_ZEROS, 2); + StringExpandPlaceholders(gStringVar1, gDebugText_Util_WarpToMap_SelMax); + GetMapName(gStringVar2, Overworld_GetMapHeaderByGroupAndId(gTasks[taskId].data[5], gTasks[taskId].data[3])->regionMapSectionId, 0); + StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].data[4]]); + StringExpandPlaceholders(gStringVar4, gDebugText_Util_WarpToMap_SelectMap); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + } + + if (gMain.newKeys & A_BUTTON) + { + gTasks[taskId].data[6] = gTasks[taskId].data[3]; + gTasks[taskId].data[3] = 0; + gTasks[taskId].data[4] = 0; + + StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].data[4]]); + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); + StringExpandPlaceholders(gStringVar4, gDebugText_Util_WarpToMap_SelectWarp); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + gTasks[taskId].func = DebugAction_Util_Warp_SelectWarp; + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + DebugAction_DestroyExtraWindow(taskId); + } +} +static void DebugAction_Util_Warp_SelectWarp(u8 taskId) +{ + if (gMain.newKeys & DPAD_ANY) + { + PlaySE(SE_SELECT); + if(gMain.newKeys & DPAD_UP) + { + gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; + if(gTasks[taskId].data[3] > 10) + gTasks[taskId].data[3] = 10; + } + if(gMain.newKeys & DPAD_DOWN) + { + gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; + if(gTasks[taskId].data[3] < 0) + gTasks[taskId].data[3] = 0; + } + + StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].data[4]]); + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); + StringExpandPlaceholders(gStringVar4, gDebugText_Util_WarpToMap_SelectWarp); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + } + + if (gMain.newKeys & A_BUTTON) + { + gTasks[taskId].data[7] = gTasks[taskId].data[3]; + //WARP + //If there's no warp with the number available, warp to the center of the map. + SetWarpDestinationToMapWarp(gTasks[taskId].data[5], gTasks[taskId].data[6], gTasks[taskId].data[7]); + DoWarp(); + ResetInitialPlayerAvatarState(); + DebugAction_DestroyExtraWindow(taskId); + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + DebugAction_DestroyExtraWindow(taskId); + } +} + +static void DebugAction_Util_RunningShoes(u8 taskId) +{ + if (FlagGet(FLAG_SYS_B_DASH)) + { + FlagClear(FLAG_SYS_B_DASH); + PlaySE(SE_PC_OFF); + } + else + { + FlagSet(FLAG_SYS_B_DASH); + PlaySE(SE_PC_LOGIN); + } +} + +static void DebugAction_Util_PoisonMons(u8 taskId) +{ + int i; + for (i = 0; i < PARTY_SIZE; i++) + { + if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, 0) + && GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2) != SPECIES_NONE + && GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2) != SPECIES_EGG) + { + u32 curStatus = STATUS1_POISON; + SetMonData(&gPlayerParty[i], MON_DATA_STATUS, &curStatus); + } + } + PlaySE(SE_FIELD_POISON); +} + +static void DebugAction_Util_CheckSaveBlock(u8 taskId) +{ + static const u8 gDebugText_SaveBlockSize[] = _("SaveBlock1 is {STR_VAR_1} bytes long.\nMax size is 15872 bytes.\pSaveBlock2 is {STR_VAR_2} bytes long.\nMax size is 3968 bytes.\pPokemonStorage is {STR_VAR_3} bytes long.\nMax size is 35712 bytes."); + + ConvertIntToDecimalStringN(gStringVar1, sizeof(struct SaveBlock1), STR_CONV_MODE_LEFT_ALIGN, 6); + ConvertIntToDecimalStringN(gStringVar2, sizeof(struct SaveBlock2), STR_CONV_MODE_LEFT_ALIGN, 6); + ConvertIntToDecimalStringN(gStringVar3, sizeof(struct PokemonStorage), STR_CONV_MODE_LEFT_ALIGN, 6); + StringExpandPlaceholders(gStringVar4, gDebugText_SaveBlockSize); + + Debug_DestroyMenu(taskId); + LockPlayerFieldControls(); + ScriptContext_SetupScript(Debug_ShowFieldMessageStringVar4); +} +static void DebugAction_Util_CheckWallClock(u8 taskId) +{ + Debug_DestroyMenu(taskId); + LockPlayerFieldControls(); + ScriptContext_SetupScript(PlayersHouse_2F_EventScript_CheckWallClock); +} +static void DebugAction_Util_SetWallClock(u8 taskId) +{ + Debug_DestroyMenu(taskId); + LockPlayerFieldControls(); + ScriptContext_SetupScript(PlayersHouse_2F_EventScript_SetWallClock); +} +static void DebugAction_Util_WatchCredits(u8 taskId) +{ + struct Task* task = &gTasks[taskId]; + Debug_DestroyMenu(taskId); + SetMainCallback2(CB2_StartCreditsSequence); +} +static void DebugAction_Util_Trainer_Name(u8 taskId) +{ + NewGameBirchSpeech_SetDefaultPlayerName(Random() % 20); + DoNamingScreen(0, gSaveBlock2Ptr->playerName, gSaveBlock2Ptr->playerGender, 0, 0, CB2_ReturnToFieldContinueScript); +} +static void DebugAction_Util_Trainer_Gender(u8 taskId) +{ + if(gSaveBlock2Ptr->playerGender == 0) // 0 Male, 1 Female + gSaveBlock2Ptr->playerGender = 1; + else + gSaveBlock2Ptr->playerGender = 0; + ScriptContext_Enable(); + Debug_DestroyMenu(taskId); +} +static void DebugAction_Util_Trainer_Id(u8 taskId) +{ + u32 trainerId = ((Random() << 16) | Random()); + SetTrainerId(trainerId, gSaveBlock2Ptr->playerTrainerId); + Debug_DestroyMenu(taskId); + ScriptContext_Enable(); +} + +// ******************************* +// Actions Scripts +static void DebugAction_Util_Script_1(u8 taskId) +{ + Debug_DestroyMenu(taskId); + LockPlayerFieldControls(); + ScriptContext_SetupScript(Debug_Script_1); +} +static void DebugAction_Util_Script_2(u8 taskId) +{ + Debug_DestroyMenu(taskId); + LockPlayerFieldControls(); + ScriptContext_SetupScript(Debug_Script_2); +} +static void DebugAction_Util_Script_3(u8 taskId) +{ + Debug_DestroyMenu(taskId); + LockPlayerFieldControls(); + ScriptContext_SetupScript(Debug_Script_3); +} +static void DebugAction_Util_Script_4(u8 taskId) +{ + Debug_DestroyMenu(taskId); + LockPlayerFieldControls(); + ScriptContext_SetupScript(Debug_Script_4); +} +static void DebugAction_Util_Script_5(u8 taskId) +{ + Debug_DestroyMenu(taskId); + LockPlayerFieldControls(); + ScriptContext_SetupScript(Debug_Script_5); +} +static void DebugAction_Util_Script_6(u8 taskId) +{ + Debug_DestroyMenu(taskId); + LockPlayerFieldControls(); + ScriptContext_SetupScript(Debug_Script_6); +} +static void DebugAction_Util_Script_7(u8 taskId) +{ + Debug_DestroyMenu(taskId); + LockPlayerFieldControls(); + ScriptContext_SetupScript(Debug_Script_7); +} +static void DebugAction_Util_Script_8(u8 taskId) +{ + Debug_DestroyMenu(taskId); + LockPlayerFieldControls(); + ScriptContext_SetupScript(Debug_Script_8); +} + +// ******************************* +// Actions Flags +static void DebugAction_Flags_Flags(u8 taskId) +{ + u8 windowId; + + ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE); + RemoveWindow(gTasks[taskId].data[1]); + + HideMapNamePopUpWindow(); + LoadMessageBoxAndBorderGfx(); + windowId = AddWindow(&sDebugNumberDisplayWindowTemplate); + DrawStdWindowFrame(windowId, FALSE); + + CopyWindowToVram(windowId, 3); + + //Display initial Flag + ConvertIntToDecimalStringN(gStringVar1, 0, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_FLAGS); + ConvertIntToHexStringN(gStringVar2, 0, STR_CONV_MODE_LEFT_ALIGN, 3); + StringExpandPlaceholders(gStringVar1, gDebugText_Flags_FlagHex); + if (FlagGet(0) == TRUE) + StringCopyPadded(gStringVar2, gDebugText_Flags_FlagSet, CHAR_SPACE, 15); + else + StringCopyPadded(gStringVar2, gDebugText_Flags_FlagUnset, CHAR_SPACE, 15); + StringCopy(gStringVar3, gText_DigitIndicator[0]); + StringExpandPlaceholders(gStringVar4, gDebugText_Flags_Flag); + AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL); + + gTasks[taskId].func = DebugAction_Flags_FlagsSelect; + gTasks[taskId].data[2] = windowId; + gTasks[taskId].data[3] = 0; //Current Flag + gTasks[taskId].data[4] = 0; //Digit Selected +} +static void DebugAction_Flags_FlagsSelect(u8 taskId) +{ + if (gMain.newKeys & A_BUTTON) + FlagToggle(gTasks[taskId].data[3]); + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + DebugAction_DestroyExtraWindow(taskId); + return; + } + + if (gMain.newKeys & DPAD_UP) + { + PlaySE(SE_SELECT); + gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; + if (gTasks[taskId].data[3] >= FLAGS_COUNT){ + gTasks[taskId].data[3] = FLAGS_COUNT - 1; + } + } + if (gMain.newKeys & DPAD_DOWN) + { + PlaySE(SE_SELECT); + gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; + if (gTasks[taskId].data[3] < 0){ + gTasks[taskId].data[3] = 0; + } + } + if (gMain.newKeys & DPAD_LEFT) + { + PlaySE(SE_SELECT); + gTasks[taskId].data[4] -= 1; + if (gTasks[taskId].data[4] < 0) + { + gTasks[taskId].data[4] = 0; + } + } + if (gMain.newKeys & DPAD_RIGHT) + { + PlaySE(SE_SELECT); + gTasks[taskId].data[4] += 1; + if (gTasks[taskId].data[4] > DEBUG_NUMBER_DIGITS_FLAGS - 1) + { + gTasks[taskId].data[4] = DEBUG_NUMBER_DIGITS_FLAGS - 1; + } + } + + if (gMain.newKeys & DPAD_ANY || gMain.newKeys & A_BUTTON) + { + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_FLAGS); + ConvertIntToHexStringN(gStringVar2, gTasks[taskId].data[3], STR_CONV_MODE_LEFT_ALIGN, 3); + StringExpandPlaceholders(gStringVar1, gDebugText_Flags_FlagHex); + if (FlagGet(gTasks[taskId].data[3]) == TRUE) + StringCopyPadded(gStringVar2, gDebugText_Flags_FlagSet, CHAR_SPACE, 15); + else + StringCopyPadded(gStringVar2, gDebugText_Flags_FlagUnset, CHAR_SPACE, 15); + StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].data[4]]); + StringExpandPlaceholders(gStringVar4, gDebugText_Flags_Flag); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + } +} + +static void DebugAction_Flags_SetPokedexFlags(u8 taskId) +{ + u16 i; + for (i = 0; i < NATIONAL_DEX_COUNT; i++) + { + GetSetPokedexFlag(i + 1, FLAG_SET_CAUGHT); + GetSetPokedexFlag(i + 1, FLAG_SET_SEEN); + } + Debug_DestroyMenu(taskId); + ScriptContext_Enable(); +} +static void DebugAction_Flags_SwitchDex(u8 taskId) +{ + if (FlagGet(FLAG_SYS_POKEDEX_GET)) + PlaySE(SE_PC_OFF); + else + PlaySE(SE_PC_LOGIN); + FlagToggle(FLAG_SYS_POKEDEX_GET); +} +static void DebugAction_Flags_SwitchNatDex(u8 taskId) +{ + if (IsNationalPokedexEnabled()) + { + DisableNationalPokedex(); + PlaySE(SE_PC_OFF); + } + else + { + EnableNationalPokedex(); + PlaySE(SE_PC_LOGIN); + } +} +static void DebugAction_Flags_SwitchPokeNav(u8 taskId) +{ + if (FlagGet(FLAG_SYS_POKENAV_GET)) + PlaySE(SE_PC_OFF); + else + PlaySE(SE_PC_LOGIN); + FlagToggle(FLAG_SYS_POKENAV_GET); +} +static void DebugAction_Flags_ToggleFlyFlags(u8 taskId) +{ + // Sound effect + if (FlagGet(FLAG_LANDMARK_BATTLE_FRONTIER)) + PlaySE(SE_PC_OFF); + else + PlaySE(SE_PC_LOGIN); + + FlagToggle(FLAG_VISITED_LITTLEROOT_TOWN); + FlagToggle(FLAG_VISITED_OLDALE_TOWN); + FlagToggle(FLAG_VISITED_DEWFORD_TOWN); + FlagToggle(FLAG_VISITED_LAVARIDGE_TOWN); + FlagToggle(FLAG_VISITED_FALLARBOR_TOWN); + FlagToggle(FLAG_VISITED_VERDANTURF_TOWN); + FlagToggle(FLAG_VISITED_PACIFIDLOG_TOWN); + FlagToggle(FLAG_VISITED_PETALBURG_CITY); + FlagToggle(FLAG_VISITED_SLATEPORT_CITY); + FlagToggle(FLAG_VISITED_MAUVILLE_CITY); + FlagToggle(FLAG_VISITED_RUSTBORO_CITY); + FlagToggle(FLAG_VISITED_FORTREE_CITY); + FlagToggle(FLAG_VISITED_LILYCOVE_CITY); + FlagToggle(FLAG_VISITED_MOSSDEEP_CITY); + FlagToggle(FLAG_VISITED_SOOTOPOLIS_CITY); + FlagToggle(FLAG_VISITED_EVER_GRANDE_CITY); + FlagToggle(FLAG_LANDMARK_POKEMON_LEAGUE); + FlagToggle(FLAG_LANDMARK_BATTLE_FRONTIER); +} +static void DebugAction_Flags_ToggleBadgeFlags(u8 taskId) +{ + // Sound effect + if (FlagGet(FLAG_BADGE08_GET)) + PlaySE(SE_PC_OFF); + else + PlaySE(SE_PC_LOGIN); + + FlagToggle(FLAG_BADGE01_GET); + FlagToggle(FLAG_BADGE02_GET); + FlagToggle(FLAG_BADGE03_GET); + FlagToggle(FLAG_BADGE04_GET); + FlagToggle(FLAG_BADGE05_GET); + FlagToggle(FLAG_BADGE06_GET); + FlagToggle(FLAG_BADGE07_GET); + FlagToggle(FLAG_BADGE08_GET); +} +static void DebugAction_Flags_ToggleFrontierPass(u8 taskId) +{ + // Sound effect + if (FlagGet(FLAG_SYS_FRONTIER_PASS)) + PlaySE(SE_PC_OFF); + else + PlaySE(SE_PC_LOGIN); + FlagToggle(FLAG_SYS_FRONTIER_PASS); +} +static void DebugAction_Flags_CollisionOnOff(u8 taskId) +{ +#if DEBUG_FLAG_NO_COLLISION == 0 + Debug_DestroyMenu(taskId); + LockPlayerFieldControls(); + ScriptContext_SetupScript(Debug_FlagsNotSetMessage); +#else + if (FlagGet(DEBUG_FLAG_NO_COLLISION)) + PlaySE(SE_PC_OFF); + else + PlaySE(SE_PC_LOGIN); + FlagToggle(DEBUG_FLAG_NO_COLLISION); +#endif +} +static void DebugAction_Flags_EncounterOnOff(u8 taskId) +{ +#if OW_FLAG_NO_ENCOUNTER == 0 + Debug_DestroyMenu(taskId); + LockPlayerFieldControls(); + ScriptContext_SetupScript(Debug_FlagsNotSetMessage); +#else + if (FlagGet(OW_FLAG_NO_ENCOUNTER)) + PlaySE(SE_PC_OFF); + else + PlaySE(SE_PC_LOGIN); + FlagToggle(OW_FLAG_NO_ENCOUNTER); +#endif +} +static void DebugAction_Flags_TrainerSeeOnOff(u8 taskId) +{ +#if OW_FLAG_NO_TRAINER_SEE == 0 + Debug_DestroyMenu(taskId); + LockPlayerFieldControls(); + ScriptContext_SetupScript(Debug_FlagsNotSetMessage); +#else + if (FlagGet(OW_FLAG_NO_TRAINER_SEE)) + PlaySE(SE_PC_OFF); + else + PlaySE(SE_PC_LOGIN); + FlagToggle(OW_FLAG_NO_TRAINER_SEE); +#endif +} +static void DebugAction_Flags_BagUseOnOff(u8 taskId) +{ +#if B_FLAG_NO_BAG_USE == 0 + Debug_DestroyMenu(taskId); + LockPlayerFieldControls(); + ScriptContext_SetupScript(Debug_FlagsNotSetMessage); +#else + if (FlagGet(B_FLAG_NO_BAG_USE)) + PlaySE(SE_PC_OFF); + else + PlaySE(SE_PC_LOGIN); + FlagToggle(B_FLAG_NO_BAG_USE); +#endif +} +static void DebugAction_Flags_CatchingOnOff(u8 taskId) +{ +#if B_FLAG_NO_CATCHING_USE == 0 + Debug_DestroyMenu(taskId); + LockPlayerFieldControls(); + ScriptContext_SetupScript(Debug_FlagsNotSetMessage); +#else + if (FlagGet(B_FLAG_NO_CATCHING)) + PlaySE(SE_PC_OFF); + else + PlaySE(SE_PC_LOGIN); + FlagToggle(B_FLAG_NO_CATCHING); +#endif +} + +// ******************************* +// Actions Variables +static void DebugAction_Vars_Vars(u8 taskId) +{ + u8 windowId; + + ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE); + RemoveWindow(gTasks[taskId].data[1]); + + HideMapNamePopUpWindow(); + LoadMessageBoxAndBorderGfx(); + windowId = AddWindow(&sDebugNumberDisplayWindowTemplate); + DrawStdWindowFrame(windowId, FALSE); + + CopyWindowToVram(windowId, 3); + + //Display initial Variable + ConvertIntToDecimalStringN(gStringVar1, VARS_START, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES); + ConvertIntToHexStringN(gStringVar2, VARS_START, STR_CONV_MODE_LEFT_ALIGN, 4); + StringExpandPlaceholders(gStringVar1, gDebugText_Vars_VariableHex); + ConvertIntToDecimalStringN(gStringVar3, 0, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES); + StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); + StringCopy(gStringVar2, gText_DigitIndicator[0]); + StringExpandPlaceholders(gStringVar4, gDebugText_Vars_Variable); + AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL); + + gTasks[taskId].func = DebugAction_Vars_Select; + gTasks[taskId].data[2] = windowId; + gTasks[taskId].data[3] = VARS_START; //Current Variable + gTasks[taskId].data[4] = 0; //Digit Selected + gTasks[taskId].data[5] = 0; //Current Variable VALUE +} + +static void DebugAction_Vars_Select(u8 taskId) +{ + if (gMain.newKeys & DPAD_UP) + { + gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; + if(gTasks[taskId].data[3] > VARS_END) + gTasks[taskId].data[3] = VARS_END; + } + if (gMain.newKeys & DPAD_DOWN) + { + gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; + if (gTasks[taskId].data[3] < VARS_START) + gTasks[taskId].data[3] = VARS_START; + } + if (gMain.newKeys & DPAD_LEFT) + { + gTasks[taskId].data[4] -= 1; + if(gTasks[taskId].data[4] < 0) + gTasks[taskId].data[4] = 0; + } + if (gMain.newKeys & DPAD_RIGHT) + { + gTasks[taskId].data[4] += 1; + if (gTasks[taskId].data[4] > DEBUG_NUMBER_DIGITS_VARIABLES - 1) + gTasks[taskId].data[4] = DEBUG_NUMBER_DIGITS_VARIABLES - 1; + } + + if (gMain.newKeys & DPAD_ANY) + { + PlaySE(SE_SELECT); + + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES); + ConvertIntToHexStringN(gStringVar2, gTasks[taskId].data[3], STR_CONV_MODE_LEFT_ALIGN, 4); + StringExpandPlaceholders(gStringVar1, gDebugText_Vars_VariableHex); + if (VarGetIfExist(gTasks[taskId].data[3]) == 65535) //Current value, if 65535 the value hasnt been set + gTasks[taskId].data[5] = 0; + else + gTasks[taskId].data[5] = VarGet(gTasks[taskId].data[3]); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[5], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES); + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); //Current digit + + //Combine str's to full window string + StringExpandPlaceholders(gStringVar4, gDebugText_Vars_Variable); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + } + + if (gMain.newKeys & A_BUTTON) + { + gTasks[taskId].data[4] = 0; + + PlaySE(SE_SELECT); + + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES); + ConvertIntToHexStringN(gStringVar2, gTasks[taskId].data[3], STR_CONV_MODE_LEFT_ALIGN, 4); + StringExpandPlaceholders(gStringVar1, gDebugText_Vars_VariableHex); + if (VarGetIfExist(gTasks[taskId].data[3]) == 65535) //Current value if 65535 the value hasnt been set + gTasks[taskId].data[5] = 0; + else + gTasks[taskId].data[5] = VarGet(gTasks[taskId].data[3]); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[5], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES); + StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); //Current digit + StringExpandPlaceholders(gStringVar4, gDebugText_Vars_VariableValueSet); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + + gTasks[taskId].data[6] = gTasks[taskId].data[5]; //New value selector + gTasks[taskId].func = DebugAction_Vars_SetValue; + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + DebugAction_DestroyExtraWindow(taskId); + return; + } +} +static void DebugAction_Vars_SetValue(u8 taskId) +{ + if(gMain.newKeys & DPAD_UP) + { + if (gTasks[taskId].data[6] + sPowersOfTen[gTasks[taskId].data[4]] <= 32000) + gTasks[taskId].data[6] += sPowersOfTen[gTasks[taskId].data[4]]; + else + gTasks[taskId].data[6] = 32000 - 1; + + if (gTasks[taskId].data[6] >= 32000) + gTasks[taskId].data[6] = 32000 - 1; + } + if(gMain.newKeys & DPAD_DOWN) + { + gTasks[taskId].data[6] -= sPowersOfTen[gTasks[taskId].data[4]]; + if (gTasks[taskId].data[6] < 0){ + gTasks[taskId].data[6] = 0; + } + } + if (gMain.newKeys & DPAD_LEFT) + { + gTasks[taskId].data[4] -= 1; + if (gTasks[taskId].data[4] < 0) + { + gTasks[taskId].data[4] = 0; + } + } + if (gMain.newKeys & DPAD_RIGHT) + { + gTasks[taskId].data[4] += 1; + if (gTasks[taskId].data[4] > 4) + { + gTasks[taskId].data[4] = 4; + } + } + + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + VarSet(gTasks[taskId].data[3], gTasks[taskId].data[6]); + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + DebugAction_DestroyExtraWindow(taskId); + return; + } + + if (gMain.newKeys & DPAD_ANY || gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES); + ConvertIntToHexStringN(gStringVar2, gTasks[taskId].data[3], STR_CONV_MODE_LEFT_ALIGN, 4); + StringExpandPlaceholders(gStringVar1, gDebugText_Vars_VariableHex); + StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[6], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES); + StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); //Current digit + StringExpandPlaceholders(gStringVar4, gDebugText_Vars_VariableValueSet); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + } +} + + +// ******************************* +// Actions Give +#define ITEM_TAG 0xFDF3 +static void DebugAction_Give_Item(u8 taskId) +{ + u8 windowId; + + ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE); + RemoveWindow(gTasks[taskId].data[1]); + + HideMapNamePopUpWindow(); + LoadMessageBoxAndBorderGfx(); + windowId = AddWindow(&sDebugNumberDisplayWindowTemplate); + DrawStdWindowFrame(windowId, FALSE); + + CopyWindowToVram(windowId, 3); + + //Display initial ID + StringCopy(gStringVar2, gText_DigitIndicator[0]); + ConvertIntToDecimalStringN(gStringVar3, 1, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEMS); + CopyItemName(1, gStringVar1); + StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); + StringExpandPlaceholders(gStringVar4, gDebugText_ItemID); + AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL); + + gTasks[taskId].func = DebugAction_Give_Item_SelectId; + gTasks[taskId].data[2] = windowId; + gTasks[taskId].data[3] = 1; //Current ID + gTasks[taskId].data[4] = 0; //Digit Selected + gTasks[taskId].data[6] = AddItemIconSprite(ITEM_TAG, ITEM_TAG, gTasks[taskId].data[3]); + gSprites[gTasks[taskId].data[6]].x2 = DEBUG_NUMBER_ICON_X+10; + gSprites[gTasks[taskId].data[6]].y2 = DEBUG_NUMBER_ICON_Y+10; + gSprites[gTasks[taskId].data[6]].oam.priority = 0; +} +static void DebugAction_Give_Item_SelectId(u8 taskId) +{ + if (gMain.newKeys & DPAD_ANY) + { + PlaySE(SE_SELECT); + + if (gMain.newKeys & DPAD_UP) + { + gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; + if(gTasks[taskId].data[3] >= ITEMS_COUNT) + gTasks[taskId].data[3] = ITEMS_COUNT - 1; + } + if (gMain.newKeys & DPAD_DOWN) + { + gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; + if (gTasks[taskId].data[3] < 1) + gTasks[taskId].data[3] = 1; + } + if (gMain.newKeys & DPAD_LEFT) + { + if(gTasks[taskId].data[4] > 0) + gTasks[taskId].data[4] -= 1; + } + if (gMain.newKeys & DPAD_RIGHT) + { + if (gTasks[taskId].data[4] < DEBUG_NUMBER_DIGITS_ITEMS - 1) + gTasks[taskId].data[4] += 1; + } + + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); + CopyItemName(gTasks[taskId].data[3], gStringVar1); + StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEMS); + StringExpandPlaceholders(gStringVar4, gDebugText_ItemID); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + + FreeSpriteTilesByTag(ITEM_TAG); //Destroy item icon + FreeSpritePaletteByTag(ITEM_TAG); //Destroy item icon + FreeSpriteOamMatrix(&gSprites[gTasks[taskId].data[6]]); //Destroy item icon + DestroySprite(&gSprites[gTasks[taskId].data[6]]); //Destroy item icon + gTasks[taskId].data[6] = AddItemIconSprite(ITEM_TAG, ITEM_TAG, gTasks[taskId].data[3]); + gSprites[gTasks[taskId].data[6]].x2 = DEBUG_NUMBER_ICON_X+10; + gSprites[gTasks[taskId].data[6]].y2 = DEBUG_NUMBER_ICON_Y+10; + gSprites[gTasks[taskId].data[6]].oam.priority = 0; + } + + if (gMain.newKeys & A_BUTTON) + { + gTasks[taskId].data[5] = gTasks[taskId].data[3]; + gTasks[taskId].data[3] = 1; + gTasks[taskId].data[4] = 0; + + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEM_QUANTITY); + StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); + StringExpandPlaceholders(gStringVar4, gDebugText_ItemQuantity); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + + gTasks[taskId].func = DebugAction_Give_Item_SelectQuantity; + } + else if (gMain.newKeys & B_BUTTON) + { + FreeSpriteTilesByTag(ITEM_TAG); //Destroy item icon + FreeSpritePaletteByTag(ITEM_TAG); //Destroy item icon + FreeSpriteOamMatrix(&gSprites[gTasks[taskId].data[6]]); //Destroy item icon + DestroySprite(&gSprites[gTasks[taskId].data[6]]); //Destroy item icon + + PlaySE(SE_SELECT); + DebugAction_DestroyExtraWindow(taskId); + } +} +static void DebugAction_Give_Item_SelectQuantity(u8 taskId) +{ + if (gMain.newKeys & DPAD_ANY) + { + PlaySE(SE_SELECT); + + if (gMain.newKeys & DPAD_UP) + { + gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; + if (gTasks[taskId].data[3] >= 100) + gTasks[taskId].data[3] = 99; + } + if (gMain.newKeys & DPAD_DOWN) + { + gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; + if (gTasks[taskId].data[3] < 1) + gTasks[taskId].data[3] = 1; + } + if (gMain.newKeys & DPAD_LEFT) + { + if (gTasks[taskId].data[4] > 0) + gTasks[taskId].data[4] -= 1; + } + if (gMain.newKeys & DPAD_RIGHT) + { + if (gTasks[taskId].data[4] < 2) + gTasks[taskId].data[4] += 1; + } + + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEM_QUANTITY); + StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); + StringExpandPlaceholders(gStringVar4, gDebugText_ItemQuantity); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + } + + if (gMain.newKeys & A_BUTTON) + { + FreeSpriteTilesByTag(ITEM_TAG); //Destroy item icon + FreeSpritePaletteByTag(ITEM_TAG); //Destroy item icon + FreeSpriteOamMatrix(&gSprites[gTasks[taskId].data[6]]); //Destroy item icon + DestroySprite(&gSprites[gTasks[taskId].data[6]]); //Destroy item icon + + PlaySE(MUS_OBTAIN_ITEM); + AddBagItem(gTasks[taskId].data[5], gTasks[taskId].data[3]); + DebugAction_DestroyExtraWindow(taskId); + } + else if (gMain.newKeys & B_BUTTON) + { + FreeSpriteTilesByTag(ITEM_TAG); //Destroy item icon + FreeSpritePaletteByTag(ITEM_TAG); //Destroy item icon + FreeSpriteOamMatrix(&gSprites[gTasks[taskId].data[6]]); //Destroy item icon + DestroySprite(&gSprites[gTasks[taskId].data[6]]); //Destroy item icon + + PlaySE(SE_SELECT); + DebugAction_DestroyExtraWindow(taskId); + } +} + +//TMs +static void DebugAction_Give_AllTMs(u8 taskId) +{ + u16 i; + PlayFanfare(MUS_OBTAIN_TMHM); + for (i = ITEM_TM01; i <= ITEM_HM08; i++) + { + if (ItemIdToBattleMoveId(i) != MOVE_NONE && !CheckBagHasItem(i, 1)) + AddBagItem(i, 1); + } + Debug_DestroyMenu(taskId); + ScriptContext_Enable(); +} + +//Pokemon +static void ResetMonDataStruct(struct DebugMonData *sDebugMonData) +{ + sDebugMonData->mon_speciesId = 1; + sDebugMonData->mon_level = 1; + sDebugMonData->isShiny = 0; + sDebugMonData->mon_natureId = 0; + sDebugMonData->mon_abilityNum = 0; + sDebugMonData->mon_iv_hp = 0; + sDebugMonData->mon_iv_atk = 0; + sDebugMonData->mon_iv_def = 0; + sDebugMonData->mon_iv_speed = 0; + sDebugMonData->mon_iv_satk = 0; + sDebugMonData->mon_iv_sdef = 0; +} +static void DebugAction_Give_PokemonSimple(u8 taskId) +{ + u8 windowId; + + //Mon data struct + sDebugMonData = AllocZeroed(sizeof(struct DebugMonData)); + ResetMonDataStruct(sDebugMonData); + + //Window initialization + ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE); + RemoveWindow(gTasks[taskId].data[1]); + + HideMapNamePopUpWindow(); + LoadMessageBoxAndBorderGfx(); + windowId = AddWindow(&sDebugNumberDisplayWindowTemplate); + DrawStdWindowFrame(windowId, FALSE); + + CopyWindowToVram(windowId, 3); + + //Display initial ID + StringCopy(gStringVar2, gText_DigitIndicator[0]); + ConvertIntToDecimalStringN(gStringVar3, 1, STR_CONV_MODE_LEADING_ZEROS, 3); + StringCopy(gStringVar1, gSpeciesNames[1]); + StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonID); + AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL); + + //Set task data + gTasks[taskId].func = DebugAction_Give_Pokemon_SelectId; + gTasks[taskId].data[2] = windowId; + gTasks[taskId].data[3] = 1; //Current ID + gTasks[taskId].data[4] = 0; //Digit Selected + gTasks[taskId].data[5] = 0; //Complex? + FreeMonIconPalettes(); //Free space for new pallete + LoadMonIconPalette(gTasks[taskId].data[3]); //Loads pallete for current mon + gTasks[taskId].data[6] = CreateMonIcon(gTasks[taskId].data[3], SpriteCB_MonIcon, DEBUG_NUMBER_ICON_X, DEBUG_NUMBER_ICON_Y, 4, 0); //Create pokemon sprite + gSprites[gTasks[taskId].data[6]].oam.priority = 0; //Mon Icon ID +} +static void DebugAction_Give_PokemonComplex(u8 taskId) +{ + u8 windowId; + + //Mon data struct + sDebugMonData = AllocZeroed(sizeof(struct DebugMonData)); + ResetMonDataStruct(sDebugMonData); + + //Window initialization + ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE); + RemoveWindow(gTasks[taskId].data[1]); + + HideMapNamePopUpWindow(); + LoadMessageBoxAndBorderGfx(); + windowId = AddWindow(&sDebugNumberDisplayWindowTemplate); + DrawStdWindowFrame(windowId, FALSE); + + CopyWindowToVram(windowId, 3); + + //Display initial ID + StringCopy(gStringVar2, gText_DigitIndicator[0]); + ConvertIntToDecimalStringN(gStringVar3, 1, STR_CONV_MODE_LEADING_ZEROS, 4); + StringCopy(gStringVar1, gSpeciesNames[1]); + StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonID); + AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL); + + gTasks[taskId].func = DebugAction_Give_Pokemon_SelectId; + gTasks[taskId].data[2] = windowId; + gTasks[taskId].data[3] = 1; //Current ID + gTasks[taskId].data[4] = 0; //Digit Selected + gTasks[taskId].data[5] = 1; //Complex? + FreeMonIconPalettes(); //Free space for new palletes + LoadMonIconPalette(gTasks[taskId].data[3]); //Loads pallete for current mon + gTasks[taskId].data[6] = CreateMonIcon(gTasks[taskId].data[3], SpriteCB_MonIcon, DEBUG_NUMBER_ICON_X, DEBUG_NUMBER_ICON_Y, 4, 0); //Create pokemon sprite + gSprites[gTasks[taskId].data[6]].oam.priority = 0; //Mon Icon ID + gTasks[taskId].data[7] = 0; //iterator +} + +static void DebugAction_Give_Pokemon_SelectId(u8 taskId) +{ + if (gMain.newKeys & DPAD_ANY) + { + PlaySE(SE_SELECT); + + if (gMain.newKeys & DPAD_UP) + { + gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; + if (gTasks[taskId].data[3] >= NUM_SPECIES) + gTasks[taskId].data[3] = NUM_SPECIES - 1; + } + if (gMain.newKeys & DPAD_DOWN) + { + gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; + if (gTasks[taskId].data[3] < 1) + gTasks[taskId].data[3] = 1; + } + if (gMain.newKeys & DPAD_LEFT) + { + if (gTasks[taskId].data[4] > 0) + gTasks[taskId].data[4] -= 1; + } + if (gMain.newKeys & DPAD_RIGHT) + { + if (gTasks[taskId].data[4] < DEBUG_NUMBER_DIGITS_ITEMS - 1) + gTasks[taskId].data[4] += 1; + } + + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); + StringCopy(gStringVar1, gSpeciesNames[gTasks[taskId].data[3]]); //CopyItemName(gTasks[taskId].data[3], gStringVar1); + StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 4); + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonID); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + + FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[6]]); + FreeMonIconPalettes(); //Free space for new pallete + LoadMonIconPalette(gTasks[taskId].data[3]); //Loads pallete for current mon + gTasks[taskId].data[6] = CreateMonIcon(gTasks[taskId].data[3], SpriteCB_MonIcon, DEBUG_NUMBER_ICON_X, DEBUG_NUMBER_ICON_Y, 4, 0); //Create pokemon sprite + gSprites[gTasks[taskId].data[6]].oam.priority = 0; + } + + if (gMain.newKeys & A_BUTTON) + { + sDebugMonData->mon_speciesId = gTasks[taskId].data[3]; //Species ID + gTasks[taskId].data[3] = 1; + gTasks[taskId].data[4] = 0; + + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 3); + StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonLevel); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + + gTasks[taskId].func = DebugAction_Give_Pokemon_SelectLevel; + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + Free(sDebugMonData); //Frees EWRAM of MonData Struct + FreeMonIconPalettes(); + FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[6]]); //Destroy pokemon sprite + DebugAction_DestroyExtraWindow(taskId); + } +} +static void DebugAction_Give_Pokemon_SelectLevel(u8 taskId) +{ + if (gMain.newKeys & DPAD_ANY) + { + PlaySE(SE_SELECT); + + if (gMain.newKeys & DPAD_UP) + { + gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; + if (gTasks[taskId].data[3] > 100) + gTasks[taskId].data[3] = 100; + } + if (gMain.newKeys & DPAD_DOWN) + { + gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; + if (gTasks[taskId].data[3] < 1) + gTasks[taskId].data[3] = 1; + } + if (gMain.newKeys & DPAD_LEFT) + { + if (gTasks[taskId].data[4] > 0) + gTasks[taskId].data[4] -= 1; + } + if (gMain.newKeys & DPAD_RIGHT) + { + if (gTasks[taskId].data[4] < 2) + gTasks[taskId].data[4] += 1; + } + + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 3); + StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonLevel); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + } + + if (gMain.newKeys & A_BUTTON) + { + FreeMonIconPalettes(); + FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[6]]); //Destroy pokemon sprite + if (gTasks[taskId].data[5] == 0) + { + PlaySE(MUS_LEVEL_UP); + ScriptGiveMon(sDebugMonData->mon_speciesId, gTasks[taskId].data[3], ITEM_NONE, 0,0,0); + Free(sDebugMonData); //Frees EWRAM of MonData Struct + DebugAction_DestroyExtraWindow(taskId); + } + else + { + sDebugMonData->mon_level = gTasks[taskId].data[3]; //Level + gTasks[taskId].data[3] = 0; + gTasks[taskId].data[4] = 0; + + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 0); + StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); + StringCopyPadded(gStringVar2, gDebugText_Flags_FlagUnset, CHAR_SPACE, 15); + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonShiny); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + + gTasks[taskId].func = DebugAction_Give_Pokemon_SelectShiny; + } + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + Free(sDebugMonData); //Frees EWRAM of MonData Struct + FreeMonIconPalettes(); + FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[6]]); //Destroy pokemon sprite + DebugAction_DestroyExtraWindow(taskId); + } +} +//If complex +static void DebugAction_Give_Pokemon_SelectShiny(u8 taskId) +{ + if (gMain.newKeys & DPAD_ANY) + { + PlaySE(SE_SELECT); + + if (gMain.newKeys & DPAD_UP) + { + gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; + if (gTasks[taskId].data[3] > 1) + gTasks[taskId].data[3] = 1; + } + if (gMain.newKeys & DPAD_DOWN) + { + gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; + if (gTasks[taskId].data[3] < 0) + gTasks[taskId].data[3] = 0; + } + + if (gTasks[taskId].data[3] == 1) + StringCopyPadded(gStringVar2, gDebugText_Flags_FlagSet, CHAR_SPACE, 15); + else + StringCopyPadded(gStringVar2, gDebugText_Flags_FlagUnset, CHAR_SPACE, 15); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 0); + StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonShiny); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + } + + if (gMain.newKeys & A_BUTTON) + { + sDebugMonData->isShiny = gTasks[taskId].data[3]; //isShiny + gTasks[taskId].data[3] = 0; + gTasks[taskId].data[4] = 0; + + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); + StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); + StringCopy(gStringVar1, gNatureNamePointers[0]); + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonNature); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + + gTasks[taskId].func = DebugAction_Give_Pokemon_SelectNature; + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + Free(sDebugMonData); //Frees EWRAM of MonData Struct + DebugAction_DestroyExtraWindow(taskId); + } +} +static void DebugAction_Give_Pokemon_SelectNature(u8 taskId) +{ + if (gMain.newKeys & DPAD_ANY) + { + PlaySE(SE_SELECT); + + if (gMain.newKeys & DPAD_UP) + { + gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; + if (gTasks[taskId].data[3] > NUM_NATURES-1) + gTasks[taskId].data[3] = NUM_NATURES-1; + } + if (gMain.newKeys & DPAD_DOWN) + { + gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; + if(gTasks[taskId].data[3] < 0) + gTasks[taskId].data[3] = 0; + } + + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); + StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); + StringCopy(gStringVar1, gNatureNamePointers[gTasks[taskId].data[3]]); + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonNature); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + } + + if (gMain.newKeys & A_BUTTON) + { + u8 abilityId; + sDebugMonData->mon_natureId = gTasks[taskId].data[3]; //NatureId + gTasks[taskId].data[3] = 0; + gTasks[taskId].data[4] = 0; + + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); + StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); + abilityId = GetAbilityBySpecies(sDebugMonData->mon_speciesId, 0); + StringCopy(gStringVar1, gAbilityNames[abilityId]); + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonAbility); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + + gTasks[taskId].func = DebugAction_Give_Pokemon_SelectAbility; + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + Free(sDebugMonData); //Frees EWRAM of MonData Struct + DebugAction_DestroyExtraWindow(taskId); + } +} +static void DebugAction_Give_Pokemon_SelectAbility(u8 taskId) +{ + u8 abilityId; + u8 abilityCount = NUM_ABILITY_SLOTS - 1; //-1 for proper iteration + u8 i = 0; + + if (gMain.newKeys & DPAD_ANY) + { + PlaySE(SE_SELECT); + + if (gMain.newKeys & DPAD_UP) + { + gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; + if (gTasks[taskId].data[3] > abilityCount) + gTasks[taskId].data[3] = abilityCount; + } + if (gMain.newKeys & DPAD_DOWN) + { + gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; + if (gTasks[taskId].data[3] < 0) + gTasks[taskId].data[3] = 0; + } + + while (GetAbilityBySpecies(sDebugMonData->mon_speciesId, gTasks[taskId].data[3] - i) == ABILITY_NONE && gTasks[taskId].data[3] - i < NUM_ABILITY_SLOTS) + { + i++; + } + abilityId = GetAbilityBySpecies(sDebugMonData->mon_speciesId, gTasks[taskId].data[3] - i); + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); + StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); + StringCopy(gStringVar1, gAbilityNames[abilityId]); + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonAbility); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + } + + if (gMain.newKeys & A_BUTTON) + { + sDebugMonData->mon_abilityNum = gTasks[taskId].data[3] - i; //AbilityNum + gTasks[taskId].data[3] = 0; + gTasks[taskId].data[4] = 0; + + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); + StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonIV_0); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + + gTasks[taskId].func = DebugAction_Give_Pokemon_SelectIVs; + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + Free(sDebugMonData); //Frees EWRAM of MonData Struct + DebugAction_DestroyExtraWindow(taskId); + } +} +static void DebugAction_Give_Pokemon_SelectIVs(u8 taskId) +{ + if (gMain.newKeys & DPAD_ANY) + { + PlaySE(SE_SELECT); + + if (gMain.newKeys & DPAD_UP) + { + gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; + if (gTasks[taskId].data[3] > 31) + gTasks[taskId].data[3] = 31; + } + if (gMain.newKeys & DPAD_DOWN) + { + gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; + if (gTasks[taskId].data[3] < 0) + gTasks[taskId].data[3] = 0; + } + if (gMain.newKeys & DPAD_LEFT) + { + if (gTasks[taskId].data[4] > 0) + gTasks[taskId].data[4] -= 1; + } + if (gMain.newKeys & DPAD_RIGHT) + { + if (gTasks[taskId].data[4] < 2) + gTasks[taskId].data[4] += 1; + } + + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); + StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); + switch (gTasks[taskId].data[7]) + { + case 0: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonIV_0); + break; + case 1: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonIV_1); + break; + case 2: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonIV_2); + break; + case 3: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonIV_3); + break; + case 4: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonIV_4); + break; + case 5: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonIV_5); + break; + } + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + } + + //If A or B button + if (gMain.newKeys & A_BUTTON) + { + switch (gTasks[taskId].data[7]) + { + case 0: + sDebugMonData->mon_iv_hp = gTasks[taskId].data[3]; + break; + case 1: + sDebugMonData->mon_iv_atk = gTasks[taskId].data[3]; + break; + case 2: + sDebugMonData->mon_iv_def = gTasks[taskId].data[3]; + break; + case 3: + sDebugMonData->mon_iv_speed = gTasks[taskId].data[3]; + break; + case 4: + sDebugMonData->mon_iv_satk = gTasks[taskId].data[3]; + break; + case 5: + sDebugMonData->mon_iv_sdef = gTasks[taskId].data[3]; + break; + } + + //Check if all IVs set + if (gTasks[taskId].data[7] != 5) + { + gTasks[taskId].data[7] += 1; + gTasks[taskId].data[3] = 0; + gTasks[taskId].data[4] = 0; + + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); + StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); + switch (gTasks[taskId].data[7]) + { + case 0: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonIV_0); + break; + case 1: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonIV_1); + break; + case 2: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonIV_2); + break; + case 3: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonIV_3); + break; + case 4: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonIV_4); + break; + case 5: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonIV_5); + break; + } + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + + gTasks[taskId].func = DebugAction_Give_Pokemon_SelectIVs; + } + else + { + gTasks[taskId].data[3] = 0; + gTasks[taskId].data[4] = 0; + gTasks[taskId].data[7] = 0; //Reset iterator + + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); + StringCopy(gStringVar1, gMoveNames[gTasks[taskId].data[3]]); + StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 3); + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonMove_0); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + + gTasks[taskId].func = DebugAction_Give_Pokemon_Move; + } + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + Free(sDebugMonData); //Frees EWRAM of MonData Struct + DebugAction_DestroyExtraWindow(taskId); + } +} +static void DebugAction_Give_Pokemon_Move(u8 taskId) +{ + if (gMain.newKeys & DPAD_ANY) + { + PlaySE(SE_SELECT); + + if (gMain.newKeys & DPAD_UP) + { + gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; + if (gTasks[taskId].data[3] >= MOVES_COUNT) + gTasks[taskId].data[3] = MOVES_COUNT - 1; + } + if (gMain.newKeys & DPAD_DOWN) + { + gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; + if (gTasks[taskId].data[3] < 0) + gTasks[taskId].data[3] = 0; + } + if (gMain.newKeys & DPAD_LEFT) + { + if (gTasks[taskId].data[4] > 0) + gTasks[taskId].data[4] -= 1; + } + if (gMain.newKeys & DPAD_RIGHT) + { + if (gTasks[taskId].data[4] < 3) + gTasks[taskId].data[4] += 1; + } + + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); + StringCopy(gStringVar1, gMoveNames[gTasks[taskId].data[3]]); + StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 3); + switch (gTasks[taskId].data[7]) + { + case 0: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonMove_0); + break; + case 1: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonMove_1); + break; + case 2: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonMove_2); + break; + case 3: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonMove_3); + break; + } + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + } + + if (gMain.newKeys & A_BUTTON) + { + //If MOVE_NONE selected, stop asking for additional moves + if (gTasks[taskId].data[3] == 0) + gTasks[taskId].data[7] = 4; + + //Set current value + switch (gTasks[taskId].data[7]) + { + case 0: + sDebugMonData->mon_move_0 = gTasks[taskId].data[3]; + break; + case 1: + sDebugMonData->mon_move_1 = gTasks[taskId].data[3]; + break; + case 2: + sDebugMonData->mon_move_2 = gTasks[taskId].data[3]; + break; + case 3: + sDebugMonData->mon_move_3 = gTasks[taskId].data[3]; + break; + } + + //If NOT last move or selected MOVE_NONE ask for next move, else make mon + if (gTasks[taskId].data[7] < 3) + { + gTasks[taskId].data[7] += 1; + gTasks[taskId].data[3] = 0; + gTasks[taskId].data[4] = 0; + + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); + StringCopy(gStringVar1, gMoveNames[gTasks[taskId].data[3]]); + StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 3); + switch (gTasks[taskId].data[7]) + { + case 0: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonMove_0); + break; + case 1: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonMove_1); + break; + case 2: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonMove_2); + break; + case 3: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonMove_3); + break; + } + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + + gTasks[taskId].func = DebugAction_Give_Pokemon_Move; + } + else + { + gTasks[taskId].data[3] = 0; + gTasks[taskId].data[4] = 0; + + PlaySE(MUS_LEVEL_UP); + gTasks[taskId].func = DebugAction_Give_Pokemon_ComplexCreateMon; + } + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + Free(sDebugMonData); //Frees EWRAM of MonData Struct + DebugAction_DestroyExtraWindow(taskId); + } +} +static void DebugAction_Give_Pokemon_ComplexCreateMon(u8 taskId) //https://github.com/ghoulslash/pokeemerald/tree/custom-givemon +{ + u16 nationalDexNum; + int sentToPc; + struct Pokemon mon; + u8 i; + u16 moves[4]; + u8 IVs[6]; + u8 iv_val; + u16 species = sDebugMonData->mon_speciesId; + u8 level = sDebugMonData->mon_level; + u8 isShiny = sDebugMonData->isShiny; //Shiny: no 0, yes 1 + u8 nature = sDebugMonData->mon_natureId; + u8 abilityNum = sDebugMonData->mon_abilityNum; + moves[0] = sDebugMonData->mon_move_0; + moves[1] = sDebugMonData->mon_move_1; + moves[2] = sDebugMonData->mon_move_2; + moves[3] = sDebugMonData->mon_move_3; + IVs[0] = sDebugMonData->mon_iv_hp; + IVs[1] = sDebugMonData->mon_iv_atk; + IVs[2] = sDebugMonData->mon_iv_def; + IVs[3] = sDebugMonData->mon_iv_speed; + IVs[4] = sDebugMonData->mon_iv_satk; + IVs[5] = sDebugMonData->mon_iv_sdef; + + //Nature + if (nature == NUM_NATURES || nature == 0xFF) + nature = Random() % NUM_NATURES; + + //Shininess + if (isShiny == 1) + { + u32 personality; + u32 otid = gSaveBlock2Ptr->playerTrainerId[0] + | (gSaveBlock2Ptr->playerTrainerId[1] << 8) + | (gSaveBlock2Ptr->playerTrainerId[2] << 16) + | (gSaveBlock2Ptr->playerTrainerId[3] << 24); + + do + { + personality = Random32(); + personality = ((((Random() % 8) ^ (HIHALF(otid) ^ LOHALF(otid))) ^ LOHALF(personality)) << 16) | LOHALF(personality); + } while (nature != GetNatureFromPersonality(personality)); + + CreateMon(&mon, species, level, 32, 1, personality, OT_ID_PRESET, otid); + } + else + CreateMonWithNature(&mon, species, level, 32, nature); + + //IVs + for (i = 0; i < NUM_STATS; i++) + { + iv_val = IVs[i]; + if (iv_val != 32 && iv_val != 0xFF) + SetMonData(&mon, MON_DATA_HP_IV + i, &iv_val); + } + CalculateMonStats(&mon); + + //Moves + for (i = 0; i < MAX_MON_MOVES; i++) + { + if (moves[i] == 0 || moves[i] == 0xFF || moves[i] >= MOVES_COUNT) + continue; + + SetMonMoveSlot(&mon, moves[i], i); + } + + //Ability + if (abilityNum == 0xFF || GetAbilityBySpecies(species, abilityNum) == 0) + { + do { + abilityNum = Random() % 3; // includes hidden abilities + } while (GetAbilityBySpecies(species, abilityNum) == 0); + } + + SetMonData(&mon, MON_DATA_ABILITY_NUM, &abilityNum); + + // give player the mon + SetMonData(&mon, MON_DATA_OT_NAME, gSaveBlock2Ptr->playerName); + SetMonData(&mon, MON_DATA_OT_GENDER, &gSaveBlock2Ptr->playerGender); + for (i = 0; i < PARTY_SIZE; i++) + { + if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL) == SPECIES_NONE) + break; + } + + if (i >= PARTY_SIZE) + sentToPc = SendMonToPC(&mon); + else + { + sentToPc = MON_GIVEN_TO_PARTY; + CopyMon(&gPlayerParty[i], &mon, sizeof(mon)); + gPlayerPartyCount = i + 1; + } + + //Pokedex entry + nationalDexNum = SpeciesToNationalPokedexNum(species); + switch(sentToPc) + { + case MON_GIVEN_TO_PARTY: + case MON_GIVEN_TO_PC: + GetSetPokedexFlag(nationalDexNum, FLAG_SET_SEEN); + GetSetPokedexFlag(nationalDexNum, FLAG_SET_CAUGHT); + break; + case MON_CANT_GIVE: + break; + } + + Free(sDebugMonData); //Frees EWRAM of MonData Struct + DebugAction_DestroyExtraWindow(taskId); //return sentToPc; +} + +static void DebugAction_Give_MaxMoney(u8 taskId) +{ + SetMoney(&gSaveBlock1Ptr->money, 999999); +} + +static void DebugAction_Give_MaxCoins(u8 taskId) +{ + SetCoins(9999); +} + +static void DebugAction_Give_MaxBattlePoints(u8 taskId) +{ + gSaveBlock2Ptr->frontier.battlePoints = MAX_BATTLE_FRONTIER_POINTS; +} + +static void DebugAction_Give_DayCareEgg(u8 taskId) +{ + TriggerPendingDaycareEgg(); +} + +static void DebugAction_Give_FillPC(u8 taskId) //Credit: Sierraffinity +{ + int boxId, boxPosition; + u32 personality; + struct BoxPokemon boxMon; + + personality = Random32(); + + CreateBoxMon(&boxMon, + SPECIES_DEOXYS, + 100, + 32, + personality, + 0, + OT_ID_PLAYER_ID, + 0); + + for (boxId = 0; boxId < TOTAL_BOXES_COUNT; boxId++) + { + for (boxPosition = 0; boxPosition < IN_BOX_COUNT; boxPosition++) + { + if (!GetBoxMonData(&gPokemonStoragePtr->boxes[boxId][boxPosition], MON_DATA_SANITY_HAS_SPECIES)) + { + gPokemonStoragePtr->boxes[boxId][boxPosition] = boxMon; + } + } + } +} + +static void DebugAction_Give_CHEAT(u8 taskId) +{ + Debug_DestroyMenu(taskId); + LockPlayerFieldControls(); + ScriptContext_SetupScript(Debug_CheatStart); +} + +static void Task_WaitFadeAccessPC(u8 taskId) +{ + if (!gPaletteFade.active) + { + DestroyTask(taskId); + FlagSet(DEBUG_FLAG_PC_FROM_DEBUG_MENU); + EnterPokeStorage(2); + } +} + +static void DebugAction_AccessPC(u8 taskId) +{ + Debug_DestroyMenu(taskId); + CleanupOverworldWindowsAndTilemaps(); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + CreateTask(Task_WaitFadeAccessPC, 0); +} + + +// ******************************* +// Sound Scripts +static const u8 *const gBGMNames[]; +static const u8 *const gSENames[]; +static void DebugAction_Sound_SE(u8 taskId) +{ + u8 windowId; + + ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE); + RemoveWindow(gTasks[taskId].data[1]); + + HideMapNamePopUpWindow(); + LoadMessageBoxAndBorderGfx(); + windowId = AddWindow(&sDebugNumberDisplayLargeWindowTemplate); + DrawStdWindowFrame(windowId, FALSE); + + CopyWindowToVram(windowId, 3); + + //Display initial ID + StringCopy(gStringVar2, gText_DigitIndicator[0]); + ConvertIntToDecimalStringN(gStringVar3, 1, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEMS); + StringCopyPadded(gStringVar1, gSENames[0], CHAR_SPACE, 35); + StringExpandPlaceholders(gStringVar4, gDebugText_Sound_SE_ID); + AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL); + + StopMapMusic(); //Stop map music to better hear sounds + + gTasks[taskId].func = DebugAction_Sound_SE_SelectId; + gTasks[taskId].data[2] = windowId; + gTasks[taskId].data[3] = 1; //Current ID + gTasks[taskId].data[4] = 0; //Digit Selected + gTasks[taskId].data[5] = gTasks[taskId].data[3]; //Last song played (for stopping) +} +static void DebugAction_Sound_SE_SelectId(u8 taskId) +{ + if (gMain.newKeys & DPAD_ANY) + { + if (gMain.newKeys & DPAD_UP) + { + gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; + if (gTasks[taskId].data[3] > END_SE) + gTasks[taskId].data[3] = END_SE; + } + if (gMain.newKeys & DPAD_DOWN) + { + gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; + if (gTasks[taskId].data[3] < 1) + gTasks[taskId].data[3] = 1; + } + if (gMain.newKeys & DPAD_LEFT) + { + if (gTasks[taskId].data[4] > 0) + gTasks[taskId].data[4] -= 1; + } + if (gMain.newKeys & DPAD_RIGHT) + { + if (gTasks[taskId].data[4] < DEBUG_NUMBER_DIGITS_ITEMS - 1) + gTasks[taskId].data[4] += 1; + } + + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); + StringCopyPadded(gStringVar1, gSENames[gTasks[taskId].data[3]-1], CHAR_SPACE, 35); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEMS); + StringExpandPlaceholders(gStringVar4, gDebugText_Sound_SE_ID); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + } + + if (gMain.newKeys & A_BUTTON) + { + m4aSongNumStop(gTasks[taskId].data[5]); + gTasks[taskId].data[5] = gTasks[taskId].data[3]; + m4aSongNumStart(gTasks[taskId].data[3]); + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + m4aSongNumStop(gTasks[taskId].data[5]); + DebugAction_DestroyExtraWindow(taskId); + } +} + +static void DebugAction_Sound_MUS(u8 taskId) +{ + u8 windowId; + + ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE); + RemoveWindow(gTasks[taskId].data[1]); + + HideMapNamePopUpWindow(); + LoadMessageBoxAndBorderGfx(); + windowId = AddWindow(&sDebugNumberDisplayLargeWindowTemplate); + DrawStdWindowFrame(windowId, FALSE); + + CopyWindowToVram(windowId, 3); + + //Display initial ID + StringCopy(gStringVar2, gText_DigitIndicator[0]); + ConvertIntToDecimalStringN(gStringVar3, START_MUS, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEMS); + StringCopyPadded(gStringVar1, gBGMNames[0], CHAR_SPACE, 35); + StringExpandPlaceholders(gStringVar4, gDebugText_Sound_MUS_ID); + AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL); + + StopMapMusic(); //Stop map music to better hear new music + + gTasks[taskId].func = DebugAction_Sound_MUS_SelectId; + gTasks[taskId].data[2] = windowId; + gTasks[taskId].data[3] = START_MUS; //Current ID + gTasks[taskId].data[4] = 0; //Digit Selected + gTasks[taskId].data[5] = gTasks[taskId].data[3]; //Last song played (for stopping) +} +static void DebugAction_Sound_MUS_SelectId(u8 taskId) +{ + if (gMain.newKeys & DPAD_ANY) + { + if (gMain.newKeys & DPAD_UP) + { + gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; + if (gTasks[taskId].data[3] > END_MUS) + gTasks[taskId].data[3] = END_MUS; + } + if (gMain.newKeys & DPAD_DOWN) + { + gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; + if (gTasks[taskId].data[3] < START_MUS) + gTasks[taskId].data[3] = START_MUS; + } + if (gMain.newKeys & DPAD_LEFT) + { + if (gTasks[taskId].data[4] > 0) + gTasks[taskId].data[4] -= 1; + } + if (gMain.newKeys & DPAD_RIGHT) + { + if (gTasks[taskId].data[4] < DEBUG_NUMBER_DIGITS_ITEMS - 1) + gTasks[taskId].data[4] += 1; + } + + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); + StringCopyPadded(gStringVar1, gBGMNames[gTasks[taskId].data[3]-START_MUS], CHAR_SPACE, 35); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEMS); + StringExpandPlaceholders(gStringVar4, gDebugText_Sound_MUS_ID); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + } + + if (gMain.newKeys & A_BUTTON) + { + m4aSongNumStop(gTasks[taskId].data[5]); + gTasks[taskId].data[5] = gTasks[taskId].data[3]; + m4aSongNumStart(gTasks[taskId].data[3]); + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + // m4aSongNumStop(gTasks[taskId].data[5]); //Uncomment if music should stop after leaving menu + DebugAction_DestroyExtraWindow(taskId); + } +} + +#define SOUND_LIST_BGM \ + X(MUS_LITTLEROOT_TEST, "MUS-LITTLEROOT-TEST") \ + X(MUS_GSC_ROUTE38, "MUS-GSC-ROUTE38") \ + X(MUS_CAUGHT, "MUS-CAUGHT") \ + X(MUS_VICTORY_WILD, "MUS-VICTORY-WILD") \ + X(MUS_VICTORY_GYM_LEADER, "MUS-VICTORY-GYM-LEADER") \ + X(MUS_VICTORY_LEAGUE, "MUS-VICTORY-LEAGUE") \ + X(MUS_C_COMM_CENTER, "MUS-C-COMM-CENTER") \ + X(MUS_GSC_PEWTER, "MUS-GSC-PEWTER") \ + X(MUS_C_VS_LEGEND_BEAST, "MUS-C-VS-LEGEND-BEAST") \ + X(MUS_ROUTE101, "MUS-ROUTE101") \ + X(MUS_ROUTE110, "MUS-ROUTE110") \ + X(MUS_ROUTE120, "MUS-ROUTE120") \ + X(MUS_PETALBURG, "MUS-PETALBURG") \ + X(MUS_OLDALE, "MUS-OLDALE") \ + X(MUS_GYM, "MUS-GYM") \ + X(MUS_SURF, "MUS-SURF") \ + X(MUS_PETALBURG_WOODS, "MUS-PETALBURG-WOODS") \ + X(MUS_LEVEL_UP, "MUS-LEVEL-UP") \ + X(MUS_HEAL, "MUS-HEAL") \ + X(MUS_OBTAIN_BADGE, "MUS-OBTAIN-BADGE") \ + X(MUS_OBTAIN_ITEM, "MUS-OBTAIN-ITEM") \ + X(MUS_EVOLVED, "MUS-EVOLVED") \ + X(MUS_OBTAIN_TMHM, "MUS-OBTAIN-TMHM") \ + X(MUS_LILYCOVE_MUSEUM, "MUS-LILYCOVE-MUSEUM") \ + X(MUS_ROUTE122, "MUS-ROUTE122") \ + X(MUS_OCEANIC_MUSEUM, "MUS-OCEANIC-MUSEUM") \ + X(MUS_EVOLUTION_INTRO, "MUS-EVOLUTION-INTRO") \ + X(MUS_EVOLUTION, "MUS-EVOLUTION") \ + X(MUS_MOVE_DELETED, "MUS-MOVE-DELETED") \ + X(MUS_ENCOUNTER_GIRL, "MUS-ENCOUNTER-GIRL") \ + X(MUS_ENCOUNTER_MALE, "MUS-ENCOUNTER-MALE") \ + X(MUS_ABANDONED_SHIP, "MUS-ABANDONED-SHIP") \ + X(MUS_FORTREE, "MUS-FORTREE") \ + X(MUS_BIRCH_LAB, "MUS-BIRCH-LAB") \ + X(MUS_B_TOWER_RS, "MUS-B-TOWER-RS") \ + X(MUS_ENCOUNTER_SWIMMER, "MUS-ENCOUNTER-SWIMMER") \ + X(MUS_CAVE_OF_ORIGIN, "MUS-CAVE-OF-ORIGIN") \ + X(MUS_OBTAIN_BERRY, "MUS-OBTAIN-BERRY") \ + X(MUS_AWAKEN_LEGEND, "MUS-AWAKEN-LEGEND") \ + X(MUS_SLOTS_JACKPOT, "MUS-SLOTS-JACKPOT") \ + X(MUS_SLOTS_WIN, "MUS-SLOTS-WIN") \ + X(MUS_TOO_BAD, "MUS-TOO-BAD") \ + X(MUS_ROULETTE, "MUS-ROULETTE") \ + X(MUS_LINK_CONTEST_P1, "MUS-LINK-CONTEST-P1") \ + X(MUS_LINK_CONTEST_P2, "MUS-LINK-CONTEST-P2") \ + X(MUS_LINK_CONTEST_P3, "MUS-LINK-CONTEST-P3") \ + X(MUS_LINK_CONTEST_P4, "MUS-LINK-CONTEST-P4") \ + X(MUS_ENCOUNTER_RICH, "MUS-ENCOUNTER-RICH") \ + X(MUS_VERDANTURF, "MUS-VERDANTURF") \ + X(MUS_RUSTBORO, "MUS-RUSTBORO") \ + X(MUS_POKE_CENTER, "MUS-POKE-CENTER") \ + X(MUS_ROUTE104, "MUS-ROUTE104") \ + X(MUS_ROUTE119, "MUS-ROUTE119") \ + X(MUS_CYCLING, "MUS-CYCLING") \ + X(MUS_POKE_MART, "MUS-POKE-MART") \ + X(MUS_LITTLEROOT, "MUS-LITTLEROOT") \ + X(MUS_MT_CHIMNEY, "MUS-MT-CHIMNEY") \ + X(MUS_ENCOUNTER_FEMALE, "MUS-ENCOUNTER-FEMALE") \ + X(MUS_LILYCOVE, "MUS-LILYCOVE") \ + X(MUS_ROUTE111, "MUS-ROUTE111") \ + X(MUS_HELP, "MUS-HELP") \ + X(MUS_UNDERWATER, "MUS-UNDERWATER") \ + X(MUS_VICTORY_TRAINER, "MUS-VICTORY-TRAINER") \ + X(MUS_TITLE, "MUS-TITLE") \ + X(MUS_INTRO, "MUS-INTRO") \ + X(MUS_ENCOUNTER_MAY, "MUS-ENCOUNTER-MAY") \ + X(MUS_ENCOUNTER_INTENSE, "MUS-ENCOUNTER-INTENSE") \ + X(MUS_ENCOUNTER_COOL, "MUS-ENCOUNTER-COOL") \ + X(MUS_ROUTE113, "MUS-ROUTE113") \ + X(MUS_ENCOUNTER_AQUA, "MUS-ENCOUNTER-AQUA") \ + X(MUS_FOLLOW_ME, "MUS-FOLLOW-ME") \ + X(MUS_ENCOUNTER_BRENDAN, "MUS-ENCOUNTER-BRENDAN") \ + X(MUS_EVER_GRANDE, "MUS-EVER-GRANDE") \ + X(MUS_ENCOUNTER_SUSPICIOUS, "MUS-ENCOUNTER-SUSPICIOUS") \ + X(MUS_VICTORY_AQUA_MAGMA, "MUS-VICTORY-AQUA-MAGMA") \ + X(MUS_CABLE_CAR, "MUS-CABLE-CAR") \ + X(MUS_GAME_CORNER, "MUS-GAME-CORNER") \ + X(MUS_DEWFORD, "MUS-DEWFORD") \ + X(MUS_SAFARI_ZONE, "MUS-SAFARI-ZONE") \ + X(MUS_VICTORY_ROAD, "MUS-VICTORY-ROAD") \ + X(MUS_AQUA_MAGMA_HIDEOUT, "MUS-AQUA-MAGMA-HIDEOUT") \ + X(MUS_SAILING, "MUS-SAILING") \ + X(MUS_MT_PYRE, "MUS-MT-PYRE") \ + X(MUS_SLATEPORT, "MUS-SLATEPORT") \ + X(MUS_MT_PYRE_EXTERIOR, "MUS-MT-PYRE-EXTERIOR") \ + X(MUS_SCHOOL, "MUS-SCHOOL") \ + X(MUS_HALL_OF_FAME, "MUS-HALL-OF-FAME") \ + X(MUS_FALLARBOR, "MUS-FALLARBOR") \ + X(MUS_SEALED_CHAMBER, "MUS-SEALED-CHAMBER") \ + X(MUS_CONTEST_WINNER, "MUS-CONTEST-WINNER") \ + X(MUS_CONTEST, "MUS-CONTEST") \ + X(MUS_ENCOUNTER_MAGMA, "MUS-ENCOUNTER-MAGMA") \ + X(MUS_INTRO_BATTLE, "MUS-INTRO-BATTLE") \ + X(MUS_WEATHER_KYOGRE, "MUS-WEATHER-KYOGRE") \ + X(MUS_WEATHER_GROUDON, "MUS-WEATHER-GROUDON") \ + X(MUS_SOOTOPOLIS, "MUS-SOOTOPOLIS") \ + X(MUS_CONTEST_RESULTS, "MUS-CONTEST-RESULTS") \ + X(MUS_HALL_OF_FAME_ROOM, "MUS-HALL-OF-FAME-ROOM") \ + X(MUS_TRICK_HOUSE, "MUS-TRICK-HOUSE") \ + X(MUS_ENCOUNTER_TWINS, "MUS-ENCOUNTER-TWINS") \ + X(MUS_ENCOUNTER_ELITE_FOUR, "MUS-ENCOUNTER-ELITE-FOUR") \ + X(MUS_ENCOUNTER_HIKER, "MUS-ENCOUNTER-HIKER") \ + X(MUS_CONTEST_LOBBY, "MUS-CONTEST-LOBBY") \ + X(MUS_ENCOUNTER_INTERVIEWER, "MUS-ENCOUNTER-INTERVIEWER") \ + X(MUS_ENCOUNTER_CHAMPION, "MUS-ENCOUNTER-CHAMPION") \ + X(MUS_CREDITS, "MUS-CREDITS") \ + X(MUS_END, "MUS-END") \ + X(MUS_B_FRONTIER, "MUS-B-FRONTIER") \ + X(MUS_B_ARENA, "MUS-B-ARENA") \ + X(MUS_OBTAIN_B_POINTS, "MUS-OBTAIN-B-POINTS") \ + X(MUS_REGISTER_MATCH_CALL, "MUS-REGISTER-MATCH-CALL") \ + X(MUS_B_PYRAMID, "MUS-B-PYRAMID") \ + X(MUS_B_PYRAMID_TOP, "MUS-B-PYRAMID-TOP") \ + X(MUS_B_PALACE, "MUS-B-PALACE") \ + X(MUS_RAYQUAZA_APPEARS, "MUS-RAYQUAZA-APPEARS") \ + X(MUS_B_TOWER, "MUS-B-TOWER") \ + X(MUS_OBTAIN_SYMBOL, "MUS-OBTAIN-SYMBOL") \ + X(MUS_B_DOME, "MUS-B-DOME") \ + X(MUS_B_PIKE, "MUS-B-PIKE") \ + X(MUS_B_FACTORY, "MUS-B-FACTORY") \ + X(MUS_VS_RAYQUAZA, "MUS-VS-RAYQUAZA") \ + X(MUS_VS_FRONTIER_BRAIN, "MUS-VS-FRONTIER-BRAIN") \ + X(MUS_VS_MEW, "MUS-VS-MEW") \ + X(MUS_B_DOME_LOBBY, "MUS-B-DOME-LOBBY") \ + X(MUS_VS_WILD, "MUS-VS-WILD") \ + X(MUS_VS_AQUA_MAGMA, "MUS-VS-AQUA-MAGMA") \ + X(MUS_VS_TRAINER, "MUS-VS-TRAINER") \ + X(MUS_VS_GYM_LEADER, "MUS-VS-GYM-LEADER") \ + X(MUS_VS_CHAMPION, "MUS-VS-CHAMPION") \ + X(MUS_VS_REGI, "MUS-VS-REGI") \ + X(MUS_VS_KYOGRE_GROUDON, "MUS-VS-KYOGRE-GROUDON") \ + X(MUS_VS_RIVAL, "MUS-VS-RIVAL") \ + X(MUS_VS_ELITE_FOUR, "MUS-VS-ELITE-FOUR") \ + X(MUS_VS_AQUA_MAGMA_LEADER, "MUS-VS-AQUA-MAGMA-LEADER") \ + X(MUS_RG_FOLLOW_ME, "MUS-RG-FOLLOW-ME") \ + X(MUS_RG_GAME_CORNER, "MUS-RG-GAME-CORNER") \ + X(MUS_RG_ROCKET_HIDEOUT, "MUS-RG-ROCKET-HIDEOUT") \ + X(MUS_RG_GYM, "MUS-RG-GYM") \ + X(MUS_RG_JIGGLYPUFF, "MUS-RG-JIGGLYPUFF") \ + X(MUS_RG_INTRO_FIGHT, "MUS-RG-INTRO-FIGHT") \ + X(MUS_RG_TITLE, "MUS-RG-TITLE") \ + X(MUS_RG_CINNABAR, "MUS-RG-CINNABAR") \ + X(MUS_RG_LAVENDER, "MUS-RG-LAVENDER") \ + X(MUS_RG_HEAL, "MUS-RG-HEAL") \ + X(MUS_RG_CYCLING, "MUS-RG-CYCLING") \ + X(MUS_RG_ENCOUNTER_ROCKET, "MUS-RG-ENCOUNTER-ROCKET") \ + X(MUS_RG_ENCOUNTER_GIRL, "MUS-RG-ENCOUNTER-GIRL") \ + X(MUS_RG_ENCOUNTER_BOY, "MUS-RG-ENCOUNTER-BOY") \ + X(MUS_RG_HALL_OF_FAME, "MUS-RG-HALL-OF-FAME") \ + X(MUS_RG_VIRIDIAN_FOREST, "MUS-RG-VIRIDIAN-FOREST") \ + X(MUS_RG_MT_MOON, "MUS-RG-MT-MOON") \ + X(MUS_RG_POKE_MANSION, "MUS-RG-POKE-MANSION") \ + X(MUS_RG_CREDITS, "MUS-RG-CREDITS") \ + X(MUS_RG_ROUTE1, "MUS-RG-ROUTE1") \ + X(MUS_RG_ROUTE24, "MUS-RG-ROUTE24") \ + X(MUS_RG_ROUTE3, "MUS-RG-ROUTE3") \ + X(MUS_RG_ROUTE11, "MUS-RG-ROUTE11") \ + X(MUS_RG_VICTORY_ROAD, "MUS-RG-VICTORY-ROAD") \ + X(MUS_RG_VS_GYM_LEADER, "MUS-RG-VS-GYM-LEADER") \ + X(MUS_RG_VS_TRAINER, "MUS-RG-VS-TRAINER") \ + X(MUS_RG_VS_WILD, "MUS-RG-VS-WILD") \ + X(MUS_RG_VS_CHAMPION, "MUS-RG-VS-CHAMPION") \ + X(MUS_RG_PALLET, "MUS-RG-PALLET") \ + X(MUS_RG_OAK_LAB, "MUS-RG-OAK-LAB") \ + X(MUS_RG_OAK, "MUS-RG-OAK") \ + X(MUS_RG_POKE_CENTER, "MUS-RG-POKE-CENTER") \ + X(MUS_RG_SS_ANNE, "MUS-RG-SS-ANNE") \ + X(MUS_RG_SURF, "MUS-RG-SURF") \ + X(MUS_RG_POKE_TOWER, "MUS-RG-POKE-TOWER") \ + X(MUS_RG_SILPH, "MUS-RG-SILPH") \ + X(MUS_RG_FUCHSIA, "MUS-RG-FUCHSIA") \ + X(MUS_RG_CELADON, "MUS-RG-CELADON") \ + X(MUS_RG_VICTORY_TRAINER, "MUS-RG-VICTORY-TRAINER") \ + X(MUS_RG_VICTORY_WILD, "MUS-RG-VICTORY-WILD") \ + X(MUS_RG_VICTORY_GYM_LEADER, "MUS-RG-VICTORY-GYM-LEADER") \ + X(MUS_RG_VERMILLION, "MUS-RG-VERMILLION") \ + X(MUS_RG_PEWTER, "MUS-RG-PEWTER") \ + X(MUS_RG_ENCOUNTER_RIVAL, "MUS-RG-ENCOUNTER-RIVAL") \ + X(MUS_RG_RIVAL_EXIT, "MUS-RG-RIVAL-EXIT") \ + X(MUS_RG_DEX_RATING, "MUS-RG-DEX-RATING") \ + X(MUS_RG_OBTAIN_KEY_ITEM, "MUS-RG-OBTAIN-KEY-ITEM") \ + X(MUS_RG_CAUGHT_INTRO, "MUS-RG-CAUGHT-INTRO") \ + X(MUS_RG_PHOTO, "MUS-RG-PHOTO") \ + X(MUS_RG_GAME_FREAK, "MUS-RG-GAME-FREAK") \ + X(MUS_RG_CAUGHT, "MUS-RG-CAUGHT") \ + X(MUS_RG_NEW_GAME_INSTRUCT, "MUS-RG-NEW-GAME-INSTRUCT") \ + X(MUS_RG_NEW_GAME_INTRO, "MUS-RG-NEW-GAME-INTRO") \ + X(MUS_RG_NEW_GAME_EXIT, "MUS-RG-NEW-GAME-EXIT") \ + X(MUS_RG_POKE_JUMP, "MUS-RG-POKE-JUMP") \ + X(MUS_RG_UNION_ROOM, "MUS-RG-UNION-ROOM") \ + X(MUS_RG_NET_CENTER, "MUS-RG-NET-CENTER") \ + X(MUS_RG_MYSTERY_GIFT, "MUS-RG-MYSTERY-GIFT") \ + X(MUS_RG_BERRY_PICK, "MUS-RG-BERRY-PICK") \ + X(MUS_RG_SEVII_CAVE, "MUS-RG-SEVII-CAVE") \ + X(MUS_RG_TEACHY_TV_SHOW, "MUS-RG-TEACHY-TV-SHOW") \ + X(MUS_RG_SEVII_ROUTE, "MUS-RG-SEVII-ROUTE") \ + X(MUS_RG_SEVII_DUNGEON, "MUS-RG-SEVII-DUNGEON") \ + X(MUS_RG_SEVII_123, "MUS-RG-SEVII-123") \ + X(MUS_RG_SEVII_45, "MUS-RG-SEVII-45") \ + X(MUS_RG_SEVII_67, "MUS-RG-SEVII-67") \ + X(MUS_RG_POKE_FLUTE, "MUS-RG-POKE-FLUTE") \ + X(MUS_RG_VS_DEOXYS, "MUS-RG-VS-DEOXYS") \ + X(MUS_RG_VS_MEWTWO, "MUS-RG-VS-MEWTWO") \ + X(MUS_RG_VS_LEGEND, "MUS-RG-VS-LEGEND") \ + X(MUS_RG_ENCOUNTER_GYM_LEADER, "MUS-RG-ENCOUNTER-GYM-LEADER") \ + X(MUS_RG_ENCOUNTER_DEOXYS, "MUS-RG-ENCOUNTER-DEOXYS") \ + X(MUS_RG_TRAINER_TOWER, "MUS-RG-TRAINER-TOWER") \ + X(MUS_RG_SLOW_PALLET, "MUS-RG-SLOW-PALLET") \ + X(MUS_RG_TEACHY_TV_MENU, "MUS-RG-TEACHY-TV-MENU") \ + X(PH_TRAP_BLEND, "PH-TRAP-BLEND") \ + X(PH_TRAP_HELD, "PH-TRAP-HELD") \ + X(PH_TRAP_SOLO, "PH-TRAP-SOLO") \ + X(PH_FACE_BLEND, "PH-FACE-BLEND") \ + X(PH_FACE_HELD, "PH-FACE-HELD") \ + X(PH_FACE_SOLO, "PH-FACE-SOLO") \ + X(PH_CLOTH_BLEND, "PH-CLOTH-BLEND") \ + X(PH_CLOTH_HELD, "PH-CLOTH-HELD") \ + X(PH_CLOTH_SOLO, "PH-CLOTH-SOLO") \ + X(PH_DRESS_BLEND, "PH-DRESS-BLEND") \ + X(PH_DRESS_HELD, "PH-DRESS-HELD") \ + X(PH_DRESS_SOLO, "PH-DRESS-SOLO") \ + X(PH_FLEECE_BLEND, "PH-FLEECE-BLEND") \ + X(PH_FLEECE_HELD, "PH-FLEECE-HELD") \ + X(PH_FLEECE_SOLO, "PH-FLEECE-SOLO") \ + X(PH_KIT_BLEND, "PH-KIT-BLEND") \ + X(PH_KIT_HELD, "PH-KIT-HELD") \ + X(PH_KIT_SOLO, "PH-KIT-SOLO") \ + X(PH_PRICE_BLEND, "PH-PRICE-BLEND") \ + X(PH_PRICE_HELD, "PH-PRICE-HELD") \ + X(PH_PRICE_SOLO, "PH-PRICE-SOLO") \ + X(PH_LOT_BLEND, "PH-LOT-BLEND") \ + X(PH_LOT_HELD, "PH-LOT-HELD") \ + X(PH_LOT_SOLO, "PH-LOT-SOLO") \ + X(PH_GOAT_BLEND, "PH-GOAT-BLEND") \ + X(PH_GOAT_HELD, "PH-GOAT-HELD") \ + X(PH_GOAT_SOLO, "PH-GOAT-SOLO") \ + X(PH_THOUGHT_BLEND, "PH-THOUGHT-BLEND") \ + X(PH_THOUGHT_HELD, "PH-THOUGHT-HELD") \ + X(PH_THOUGHT_SOLO, "PH-THOUGHT-SOLO") \ + X(PH_CHOICE_BLEND, "PH-CHOICE-BLEND") \ + X(PH_CHOICE_HELD, "PH-CHOICE-HELD") \ + X(PH_CHOICE_SOLO, "PH-CHOICE-SOLO") \ + X(PH_MOUTH_BLEND, "PH-MOUTH-BLEND") \ + X(PH_MOUTH_HELD, "PH-MOUTH-HELD") \ + X(PH_MOUTH_SOLO, "PH-MOUTH-SOLO") \ + X(PH_FOOT_BLEND, "PH-FOOT-BLEND") \ + X(PH_FOOT_HELD, "PH-FOOT-HELD") \ + X(PH_FOOT_SOLO, "PH-FOOT-SOLO") \ + X(PH_GOOSE_BLEND, "PH-GOOSE-BLEND") \ + X(PH_GOOSE_HELD, "PH-GOOSE-HELD") \ + X(PH_GOOSE_SOLO, "PH-GOOSE-SOLO") \ + X(PH_STRUT_BLEND, "PH-STRUT-BLEND") \ + X(PH_STRUT_HELD, "PH-STRUT-HELD") \ + X(PH_STRUT_SOLO, "PH-STRUT-SOLO") \ + X(PH_CURE_BLEND, "PH-CURE-BLEND") \ + X(PH_CURE_HELD, "PH-CURE-HELD") \ + X(PH_CURE_SOLO, "PH-CURE-SOLO") \ + X(PH_NURSE_BLEND, "PH-NURSE-BLEND") \ + X(PH_NURSE_HELD, "PH-NURSE-HELD") \ + X(PH_NURSE_SOLO, "PH-NURSE-SOLO") \ + +#define SOUND_LIST_SE \ + X(SE_USE_ITEM, "SE-USE-ITEM") \ + X(SE_PC_LOGIN, "SE-PC-LOGIN") \ + X(SE_PC_OFF, "SE-PC-OFF") \ + X(SE_PC_ON, "SE-PC-ON") \ + X(SE_SELECT, "SE-SELECT") \ + X(SE_WIN_OPEN, "SE-WIN-OPEN") \ + X(SE_WALL_HIT, "SE-WALL-HIT") \ + X(SE_DOOR, "SE-DOOR") \ + X(SE_EXIT, "SE-EXIT") \ + X(SE_LEDGE, "SE-LEDGE") \ + X(SE_BIKE_BELL, "SE-BIKE-BELL") \ + X(SE_NOT_EFFECTIVE, "SE-NOT-EFFECTIVE") \ + X(SE_EFFECTIVE, "SE-EFFECTIVE") \ + X(SE_SUPER_EFFECTIVE, "SE-SUPER-EFFECTIVE") \ + X(SE_BALL_OPEN, "SE-BALL-OPEN") \ + X(SE_FAINT, "SE-FAINT") \ + X(SE_FLEE, "SE-FLEE") \ + X(SE_SLIDING_DOOR, "SE-SLIDING-DOOR") \ + X(SE_SHIP, "SE-SHIP") \ + X(SE_BANG, "SE-BANG") \ + X(SE_PIN, "SE-PIN") \ + X(SE_BOO, "SE-BOO") \ + X(SE_BALL, "SE-BALL") \ + X(SE_CONTEST_PLACE, "SE-CONTEST-PLACE") \ + X(SE_A, "SE-A") \ + X(SE_I, "SE-I") \ + X(SE_U, "SE-U") \ + X(SE_E, "SE-E") \ + X(SE_O, "SE-O") \ + X(SE_N, "SE-N") \ + X(SE_SUCCESS, "SE-SUCCESS") \ + X(SE_FAILURE, "SE-FAILURE") \ + X(SE_EXP, "SE-EXP") \ + X(SE_BIKE_HOP, "SE-BIKE-HOP") \ + X(SE_SWITCH, "SE-SWITCH") \ + X(SE_CLICK, "SE-CLICK") \ + X(SE_FU_ZAKU, "SE-FU-ZAKU") \ + X(SE_CONTEST_CONDITION_LOSE, "SE-CONTEST-CONDITION-LOSE") \ + X(SE_LAVARIDGE_FALL_WARP, "SE-LAVARIDGE-FALL-WARP") \ + X(SE_ICE_STAIRS, "SE-ICE-STAIRS") \ + X(SE_ICE_BREAK, "SE-ICE-BREAK") \ + X(SE_ICE_CRACK, "SE-ICE-CRACK") \ + X(SE_FALL, "SE-FALL") \ + X(SE_UNLOCK, "SE-UNLOCK") \ + X(SE_WARP_IN, "SE-WARP-IN") \ + X(SE_WARP_OUT, "SE-WARP-OUT") \ + X(SE_REPEL, "SE-REPEL") \ + X(SE_ROTATING_GATE, "SE-ROTATING-GATE") \ + X(SE_TRUCK_MOVE, "SE-TRUCK-MOVE") \ + X(SE_TRUCK_STOP, "SE-TRUCK-STOP") \ + X(SE_TRUCK_UNLOAD, "SE-TRUCK-UNLOAD") \ + X(SE_TRUCK_DOOR, "SE-TRUCK-DOOR") \ + X(SE_BERRY_BLENDER, "SE-BERRY-BLENDER") \ + X(SE_CARD, "SE-CARD") \ + X(SE_SAVE, "SE-SAVE") \ + X(SE_BALL_BOUNCE_1, "SE-BALL-BOUNCE-1") \ + X(SE_BALL_BOUNCE_2, "SE-BALL-BOUNCE-2") \ + X(SE_BALL_BOUNCE_3, "SE-BALL-BOUNCE-3") \ + X(SE_BALL_BOUNCE_4, "SE-BALL-BOUNCE-4") \ + X(SE_BALL_TRADE, "SE-BALL-TRADE") \ + X(SE_BALL_THROW, "SE-BALL-THROW") \ + X(SE_NOTE_C, "SE-NOTE-C") \ + X(SE_NOTE_D, "SE-NOTE-D") \ + X(SE_NOTE_E, "SE-NOTE-E") \ + X(SE_NOTE_F, "SE-NOTE-F") \ + X(SE_NOTE_G, "SE-NOTE-G") \ + X(SE_NOTE_A, "SE-NOTE-A") \ + X(SE_NOTE_B, "SE-NOTE-B") \ + X(SE_NOTE_C_HIGH, "SE-NOTE-C-HIGH") \ + X(SE_PUDDLE, "SE-PUDDLE") \ + X(SE_BRIDGE_WALK, "SE-BRIDGE-WALK") \ + X(SE_ITEMFINDER, "SE-ITEMFINDER") \ + X(SE_DING_DONG, "SE-DING-DONG") \ + X(SE_BALLOON_RED, "SE-BALLOON-RED") \ + X(SE_BALLOON_BLUE, "SE-BALLOON-BLUE") \ + X(SE_BALLOON_YELLOW, "SE-BALLOON-YELLOW") \ + X(SE_BREAKABLE_DOOR, "SE-BREAKABLE-DOOR") \ + X(SE_MUD_BALL, "SE-MUD-BALL") \ + X(SE_FIELD_POISON, "SE-FIELD-POISON") \ + X(SE_ESCALATOR, "SE-ESCALATOR") \ + X(SE_THUNDERSTORM, "SE-THUNDERSTORM") \ + X(SE_THUNDERSTORM_STOP, "SE-THUNDERSTORM-STOP") \ + X(SE_DOWNPOUR, "SE-DOWNPOUR") \ + X(SE_DOWNPOUR_STOP, "SE-DOWNPOUR-STOP") \ + X(SE_RAIN, "SE-RAIN") \ + X(SE_RAIN_STOP, "SE-RAIN-STOP") \ + X(SE_THUNDER, "SE-THUNDER") \ + X(SE_THUNDER2, "SE-THUNDER2") \ + X(SE_ELEVATOR, "SE-ELEVATOR") \ + X(SE_LOW_HEALTH, "SE-LOW-HEALTH") \ + X(SE_EXP_MAX, "SE-EXP-MAX") \ + X(SE_ROULETTE_BALL, "SE-ROULETTE-BALL") \ + X(SE_ROULETTE_BALL2, "SE-ROULETTE-BALL2") \ + X(SE_TAILLOW_WING_FLAP, "SE-TAILLOW-WING-FLAP") \ + X(SE_SHOP, "SE-SHOP") \ + X(SE_CONTEST_HEART, "SE-CONTEST-HEART") \ + X(SE_CONTEST_CURTAIN_RISE, "SE-CONTEST-CURTAIN-RISE") \ + X(SE_CONTEST_CURTAIN_FALL, "SE-CONTEST-CURTAIN-FALL") \ + X(SE_CONTEST_ICON_CHANGE, "SE-CONTEST-ICON-CHANGE") \ + X(SE_CONTEST_ICON_CLEAR, "SE-CONTEST-ICON-CLEAR") \ + X(SE_CONTEST_MONS_TURN, "SE-CONTEST-MONS-TURN") \ + X(SE_SHINY, "SE-SHINY") \ + X(SE_INTRO_BLAST, "SE-INTRO-BLAST") \ + X(SE_MUGSHOT, "SE-MUGSHOT") \ + X(SE_APPLAUSE, "SE-APPLAUSE") \ + X(SE_VEND, "SE-VEND") \ + X(SE_ORB, "SE-ORB") \ + X(SE_DEX_SCROLL, "SE-DEX-SCROLL") \ + X(SE_DEX_PAGE, "SE-DEX-PAGE") \ + X(SE_POKENAV_ON, "SE-POKENAV-ON") \ + X(SE_POKENAV_OFF, "SE-POKENAV-OFF") \ + X(SE_DEX_SEARCH, "SE-DEX-SEARCH") \ + X(SE_EGG_HATCH, "SE-EGG-HATCH") \ + X(SE_BALL_TRAY_ENTER, "SE-BALL-TRAY-ENTER") \ + X(SE_BALL_TRAY_BALL, "SE-BALL-TRAY-BALL") \ + X(SE_BALL_TRAY_EXIT, "SE-BALL-TRAY-EXIT") \ + X(SE_GLASS_FLUTE, "SE-GLASS-FLUTE") \ + X(SE_M_THUNDERBOLT, "SE-M-THUNDERBOLT") \ + X(SE_M_THUNDERBOLT2, "SE-M-THUNDERBOLT2") \ + X(SE_M_HARDEN, "SE-M-HARDEN") \ + X(SE_M_NIGHTMARE, "SE-M-NIGHTMARE") \ + X(SE_M_VITAL_THROW, "SE-M-VITAL-THROW") \ + X(SE_M_VITAL_THROW2, "SE-M-VITAL-THROW2") \ + X(SE_M_BUBBLE, "SE-M-BUBBLE") \ + X(SE_M_BUBBLE2, "SE-M-BUBBLE2") \ + X(SE_M_BUBBLE3, "SE-M-BUBBLE3") \ + X(SE_M_RAIN_DANCE, "SE-M-RAIN-DANCE") \ + X(SE_M_CUT, "SE-M-CUT") \ + X(SE_M_STRING_SHOT, "SE-M-STRING-SHOT") \ + X(SE_M_STRING_SHOT2, "SE-M-STRING-SHOT2") \ + X(SE_M_ROCK_THROW, "SE-M-ROCK-THROW") \ + X(SE_M_GUST, "SE-M-GUST") \ + X(SE_M_GUST2, "SE-M-GUST2") \ + X(SE_M_DOUBLE_SLAP, "SE-M-DOUBLE-SLAP") \ + X(SE_M_DOUBLE_TEAM, "SE-M-DOUBLE-TEAM") \ + X(SE_M_RAZOR_WIND, "SE-M-RAZOR-WIND") \ + X(SE_M_ICY_WIND, "SE-M-ICY-WIND") \ + X(SE_M_THUNDER_WAVE, "SE-M-THUNDER-WAVE") \ + X(SE_M_COMET_PUNCH, "SE-M-COMET-PUNCH") \ + X(SE_M_MEGA_KICK, "SE-M-MEGA-KICK") \ + X(SE_M_MEGA_KICK2, "SE-M-MEGA-KICK2") \ + X(SE_M_CRABHAMMER, "SE-M-CRABHAMMER") \ + X(SE_M_JUMP_KICK, "SE-M-JUMP-KICK") \ + X(SE_M_FLAME_WHEEL, "SE-M-FLAME-WHEEL") \ + X(SE_M_FLAME_WHEEL2, "SE-M-FLAME-WHEEL2") \ + X(SE_M_FLAMETHROWER, "SE-M-FLAMETHROWER") \ + X(SE_M_FIRE_PUNCH, "SE-M-FIRE-PUNCH") \ + X(SE_M_TOXIC, "SE-M-TOXIC") \ + X(SE_M_SACRED_FIRE, "SE-M-SACRED-FIRE") \ + X(SE_M_SACRED_FIRE2, "SE-M-SACRED-FIRE2") \ + X(SE_M_EMBER, "SE-M-EMBER") \ + X(SE_M_TAKE_DOWN, "SE-M-TAKE-DOWN") \ + X(SE_M_BLIZZARD, "SE-M-BLIZZARD") \ + X(SE_M_BLIZZARD2, "SE-M-BLIZZARD2") \ + X(SE_M_SCRATCH, "SE-M-SCRATCH") \ + X(SE_M_VICEGRIP, "SE-M-VICEGRIP") \ + X(SE_M_WING_ATTACK, "SE-M-WING-ATTACK") \ + X(SE_M_FLY, "SE-M-FLY") \ + X(SE_M_SAND_ATTACK, "SE-M-SAND-ATTACK") \ + X(SE_M_RAZOR_WIND2, "SE-M-RAZOR-WIND2") \ + X(SE_M_BITE, "SE-M-BITE") \ + X(SE_M_HEADBUTT, "SE-M-HEADBUTT") \ + X(SE_M_SURF, "SE-M-SURF") \ + X(SE_M_HYDRO_PUMP, "SE-M-HYDRO-PUMP") \ + X(SE_M_WHIRLPOOL, "SE-M-WHIRLPOOL") \ + X(SE_M_HORN_ATTACK, "SE-M-HORN-ATTACK") \ + X(SE_M_TAIL_WHIP, "SE-M-TAIL-WHIP") \ + X(SE_M_MIST, "SE-M-MIST") \ + X(SE_M_POISON_POWDER, "SE-M-POISON-POWDER") \ + X(SE_M_BIND, "SE-M-BIND") \ + X(SE_M_DRAGON_RAGE, "SE-M-DRAGON-RAGE") \ + X(SE_M_SING, "SE-M-SING") \ + X(SE_M_PERISH_SONG, "SE-M-PERISH-SONG") \ + X(SE_M_PAY_DAY, "SE-M-PAY-DAY") \ + X(SE_M_DIG, "SE-M-DIG") \ + X(SE_M_DIZZY_PUNCH, "SE-M-DIZZY-PUNCH") \ + X(SE_M_SELF_DESTRUCT, "SE-M-SELF-DESTRUCT") \ + X(SE_M_EXPLOSION, "SE-M-EXPLOSION") \ + X(SE_M_ABSORB_2, "SE-M-ABSORB-2") \ + X(SE_M_ABSORB, "SE-M-ABSORB") \ + X(SE_M_SCREECH, "SE-M-SCREECH") \ + X(SE_M_BUBBLE_BEAM, "SE-M-BUBBLE-BEAM") \ + X(SE_M_BUBBLE_BEAM2, "SE-M-BUBBLE-BEAM2") \ + X(SE_M_SUPERSONIC, "SE-M-SUPERSONIC") \ + X(SE_M_BELLY_DRUM, "SE-M-BELLY-DRUM") \ + X(SE_M_METRONOME, "SE-M-METRONOME") \ + X(SE_M_BONEMERANG, "SE-M-BONEMERANG") \ + X(SE_M_LICK, "SE-M-LICK") \ + X(SE_M_PSYBEAM, "SE-M-PSYBEAM") \ + X(SE_M_FAINT_ATTACK, "SE-M-FAINT-ATTACK") \ + X(SE_M_SWORDS_DANCE, "SE-M-SWORDS-DANCE") \ + X(SE_M_LEER, "SE-M-LEER") \ + X(SE_M_SWAGGER, "SE-M-SWAGGER") \ + X(SE_M_SWAGGER2, "SE-M-SWAGGER2") \ + X(SE_M_HEAL_BELL, "SE-M-HEAL-BELL") \ + X(SE_M_CONFUSE_RAY, "SE-M-CONFUSE-RAY") \ + X(SE_M_SNORE, "SE-M-SNORE") \ + X(SE_M_BRICK_BREAK, "SE-M-BRICK-BREAK") \ + X(SE_M_GIGA_DRAIN, "SE-M-GIGA-DRAIN") \ + X(SE_M_PSYBEAM2, "SE-M-PSYBEAM2") \ + X(SE_M_SOLAR_BEAM, "SE-M-SOLAR-BEAM") \ + X(SE_M_PETAL_DANCE, "SE-M-PETAL-DANCE") \ + X(SE_M_TELEPORT, "SE-M-TELEPORT") \ + X(SE_M_MINIMIZE, "SE-M-MINIMIZE") \ + X(SE_M_SKETCH, "SE-M-SKETCH") \ + X(SE_M_SWIFT, "SE-M-SWIFT") \ + X(SE_M_REFLECT, "SE-M-REFLECT") \ + X(SE_M_BARRIER, "SE-M-BARRIER") \ + X(SE_M_DETECT, "SE-M-DETECT") \ + X(SE_M_LOCK_ON, "SE-M-LOCK-ON") \ + X(SE_M_MOONLIGHT, "SE-M-MOONLIGHT") \ + X(SE_M_CHARM, "SE-M-CHARM") \ + X(SE_M_CHARGE, "SE-M-CHARGE") \ + X(SE_M_STRENGTH, "SE-M-STRENGTH") \ + X(SE_M_HYPER_BEAM, "SE-M-HYPER-BEAM") \ + X(SE_M_WATERFALL, "SE-M-WATERFALL") \ + X(SE_M_REVERSAL, "SE-M-REVERSAL") \ + X(SE_M_ACID_ARMOR, "SE-M-ACID-ARMOR") \ + X(SE_M_SANDSTORM, "SE-M-SANDSTORM") \ + X(SE_M_TRI_ATTACK, "SE-M-TRI-ATTACK") \ + X(SE_M_TRI_ATTACK2, "SE-M-TRI-ATTACK2") \ + X(SE_M_ENCORE, "SE-M-ENCORE") \ + X(SE_M_ENCORE2, "SE-M-ENCORE2") \ + X(SE_M_BATON_PASS, "SE-M-BATON-PASS") \ + X(SE_M_MILK_DRINK, "SE-M-MILK-DRINK") \ + X(SE_M_ATTRACT, "SE-M-ATTRACT") \ + X(SE_M_ATTRACT2, "SE-M-ATTRACT2") \ + X(SE_M_MORNING_SUN, "SE-M-MORNING-SUN") \ + X(SE_M_FLATTER, "SE-M-FLATTER") \ + X(SE_M_SAND_TOMB, "SE-M-SAND-TOMB") \ + X(SE_M_GRASSWHISTLE, "SE-M-GRASSWHISTLE") \ + X(SE_M_SPIT_UP, "SE-M-SPIT-UP") \ + X(SE_M_DIVE, "SE-M-DIVE") \ + X(SE_M_EARTHQUAKE, "SE-M-EARTHQUAKE") \ + X(SE_M_TWISTER, "SE-M-TWISTER") \ + X(SE_M_SWEET_SCENT, "SE-M-SWEET-SCENT") \ + X(SE_M_YAWN, "SE-M-YAWN") \ + X(SE_M_SKY_UPPERCUT, "SE-M-SKY-UPPERCUT") \ + X(SE_M_STAT_INCREASE, "SE-M-STAT-INCREASE") \ + X(SE_M_HEAT_WAVE, "SE-M-HEAT-WAVE") \ + X(SE_M_UPROAR, "SE-M-UPROAR") \ + X(SE_M_HAIL, "SE-M-HAIL") \ + X(SE_M_COSMIC_POWER, "SE-M-COSMIC-POWER") \ + X(SE_M_TEETER_DANCE, "SE-M-TEETER-DANCE") \ + X(SE_M_STAT_DECREASE, "SE-M-STAT-DECREASE") \ + X(SE_M_HAZE, "SE-M-HAZE") \ + X(SE_M_HYPER_BEAM2, "SE-M-HYPER-BEAM2") \ + X(SE_RG_DOOR, "SE-RG-DOOR") \ + X(SE_RG_CARD_FLIP, "SE-RG-CARD-FLIP") \ + X(SE_RG_CARD_FLIPPING, "SE-RG-CARD-FLIPPING") \ + X(SE_RG_CARD_OPEN, "SE-RG-CARD-OPEN") \ + X(SE_RG_BAG_CURSOR, "SE-RG-BAG-CURSOR") \ + X(SE_RG_BAG_POCKET, "SE-RG-BAG-POCKET") \ + X(SE_RG_BALL_CLICK, "SE-RG-BALL-CLICK") \ + X(SE_RG_SHOP, "SE-RG-SHOP") \ + X(SE_RG_SS_ANNE_HORN, "SE-RG-SS-ANNE-HORN") \ + X(SE_RG_HELP_OPEN, "SE-RG-HELP-OPEN") \ + X(SE_RG_HELP_CLOSE, "SE-RG-HELP-CLOSE") \ + X(SE_RG_HELP_ERROR, "SE-RG-HELP-ERROR") \ + X(SE_RG_DEOXYS_MOVE, "SE-RG-DEOXYS-MOVE") \ + X(SE_RG_POKE_JUMP_SUCCESS, "SE-RG-POKE-JUMP-SUCCESS") \ + X(SE_RG_POKE_JUMP_FAILURE, "SE-RG-POKE-JUMP-FAILURE") \ + X(SE_PHONE_CALL, "SE-PHONE-CALL") \ + X(SE_PHONE_CLICK, "SE-PHONE-CLICK") \ + X(SE_ARENA_TIMEUP1, "SE-ARENA-TIMEUP1") \ + X(SE_ARENA_TIMEUP2, "SE-ARENA-TIMEUP2") \ + X(SE_PIKE_CURTAIN_CLOSE, "SE-PIKE-CURTAIN-CLOSE") \ + X(SE_PIKE_CURTAIN_OPEN, "SE-PIKE-CURTAIN-OPEN") \ + X(SE_SUDOWOODO_SHAKE, "SE-SUDOWOODO-SHAKE") \ + +// Create BGM list +#define X(songId, name) static const u8 sBGMName_##songId[] = _(name); +SOUND_LIST_BGM +#undef X + +#define X(songId, name) sBGMName_##songId, +static const u8 *const gBGMNames[] = +{ +SOUND_LIST_BGM +}; +#undef X + +// Create SE list +#define X(songId, name) static const u8 sSEName_##songId[] = _(name); +SOUND_LIST_SE +#undef X + +#define X(songId, name) sSEName_##songId, +static const u8 *const gSENames[] = +{ +SOUND_LIST_SE +}; +#undef X + +#endif diff --git a/src/easy_chat.c b/src/easy_chat.c index 91b44fb26b..ebc843b3cc 100644 --- a/src/easy_chat.c +++ b/src/easy_chat.c @@ -944,7 +944,8 @@ static const struct OamData sOamData_TriangleCursor = { .affineParam = 0, }; -static const struct SpriteTemplate sSpriteTemplate_TriangleCursor = { +static const struct SpriteTemplate sSpriteTemplate_TriangleCursor = +{ .tileTag = PALTAG_TRIANGLE_CURSOR, .paletteTag = GFXTAG_TRIANGLE_CURSOR, .oam = &sOamData_TriangleCursor, @@ -1005,7 +1006,8 @@ static const union AnimCmd *const sAnims_RectangleCursor[] = { [RECTCURSOR_ANIM_ON_LETTER] = sAnim_RectangleCursor_OnLetter, }; -static const struct SpriteTemplate sSpriteTemplate_RectangleCursor = { +static const struct SpriteTemplate sSpriteTemplate_RectangleCursor = +{ .tileTag = GFXTAG_RECTANGLE_CURSOR, .paletteTag = PALTAG_RECTANGLE_CURSOR, .oam = &sOamData_RectangleCursor, @@ -1075,7 +1077,8 @@ static const union AnimCmd *const sAnims_ModeWindow[] = { [MODEWINDOW_ANIM_TRANSITION] = sAnim_ModeWindow_Transition, }; -static const struct SpriteTemplate sSpriteTemplate_ModeWindow = { +static const struct SpriteTemplate sSpriteTemplate_ModeWindow = +{ .tileTag = GFXTAG_MODE_WINDOW, .paletteTag = PALTAG_MISC_UI, .oam = &sOamData_ModeWindow, @@ -1101,7 +1104,8 @@ static const struct OamData sOamData_ButtonWindow = { .affineParam = 0, }; -static const struct SpriteTemplate sSpriteTemplate_ButtonWindow = { +static const struct SpriteTemplate sSpriteTemplate_ButtonWindow = +{ .tileTag = GFXTAG_BUTTON_WINDOW, .paletteTag = PALTAG_MISC_UI, .oam = &sOamData_ButtonWindow, @@ -1159,7 +1163,8 @@ static const union AnimCmd *const sAnims_TwoFrame[] = { sAnim_Frame1, }; -static const struct SpriteTemplate sSpriteTemplate_StartSelectButton = { +static const struct SpriteTemplate sSpriteTemplate_StartSelectButton = +{ .tileTag = GFXTAG_START_SELECT_BUTTONS, .paletteTag = PALTAG_MISC_UI, .oam = &sOamData_StartSelectButton, @@ -1169,7 +1174,8 @@ static const struct SpriteTemplate sSpriteTemplate_StartSelectButton = { .callback = SpriteCallbackDummy, }; -static const struct SpriteTemplate sSpriteTemplate_ScrollIndicator = { +static const struct SpriteTemplate sSpriteTemplate_ScrollIndicator = +{ .tileTag = GFXTAG_SCROLL_INDICATOR, .paletteTag = PALTAG_MISC_UI, .oam = &sOamData_ScrollIndicator, diff --git a/src/event_data.c b/src/event_data.c index 22ebdb0d1d..50f6f68da4 100644 --- a/src/event_data.c +++ b/src/event_data.c @@ -184,6 +184,14 @@ u16 VarGet(u16 id) return *ptr; } +u16 VarGetIfExist(u16 id) +{ + u16 *ptr = GetVarPointer(id); + if (!ptr) + return 65535; + return *ptr; +} + bool8 VarSet(u16 id, u16 value) { u16 *ptr = GetVarPointer(id); @@ -216,6 +224,14 @@ u8 FlagSet(u16 id) return 0; } +u8 FlagToggle(u16 id) +{ + u8 *ptr = GetFlagPointer(id); + if (ptr) + *ptr ^= 1 << (id & 7); + return 0; +} + u8 FlagClear(u16 id) { u8 *ptr = GetFlagPointer(id); diff --git a/src/event_object_movement.c b/src/event_object_movement.c index 87249af010..2c5418da41 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -2,6 +2,7 @@ #include "malloc.h" #include "battle_pyramid.h" #include "berry.h" +#include "debug.h" #include "decoration.h" #include "event_data.h" #include "event_object_movement.h" @@ -4628,6 +4629,12 @@ static u8 GetCollisionInDirection(struct ObjectEvent *objectEvent, u8 direction) u8 GetCollisionAtCoords(struct ObjectEvent *objectEvent, s16 x, s16 y, u32 dir) { u8 direction = dir; + +#if DEBUG_SYSTEM_ENABLE == TRUE + if (FlagGet(DEBUG_FLAG_NO_COLLISION)) + return COLLISION_NONE; +#endif + if (IsCoordOutsideObjectEventMovementRange(objectEvent, x, y)) return COLLISION_OUTSIDE_RANGE; else if (MapGridGetCollisionAt(x, y) || GetMapBorderIdAt(x, y) == CONNECTION_INVALID || IsMetatileDirectionallyImpassable(objectEvent, x, y, direction)) diff --git a/src/evolution_scene.c b/src/evolution_scene.c index c9c2641c67..91a3122226 100644 --- a/src/evolution_scene.c +++ b/src/evolution_scene.c @@ -551,7 +551,10 @@ static void CreateShedinja(u16 preEvoSpecies, struct Pokemon *mon) u32 data = 0; u16 ball = ITEM_POKE_BALL; if (gEvolutionTable[preEvoSpecies][0].method == EVO_LEVEL_NINJASK && gPlayerPartyCount < PARTY_SIZE - && (P_SHEDINJA_BALL == GEN_3 || CheckBagHasItem(ball, 1))) + #if P_SHEDINJA_BALL >= GEN_4 + && (CheckBagHasItem(ball, 1)) + #endif + ) { s32 i; struct Pokemon *shedinja = &gPlayerParty[gPlayerPartyCount]; @@ -563,10 +566,10 @@ static void CreateShedinja(u16 preEvoSpecies, struct Pokemon *mon) SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_MARKINGS, &data); SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_ENCRYPT_SEPARATOR, &data); - #if P_SHEDINJA_BALL >= GEN_4 + #if P_SHEDINJA_BALL >= GEN_4 SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_POKEBALL, &ball); RemoveBagItem(ball, 1); - #endif + #endif for (i = MON_DATA_COOL_RIBBON; i < MON_DATA_COOL_RIBBON + CONTEST_CATEGORIES_COUNT; i++) SetMonData(&gPlayerParty[gPlayerPartyCount], i, &data); diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 2ba4c29cd0..d407cc0279 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -3,6 +3,7 @@ #include "bike.h" #include "coord_event_weather.h" #include "daycare.h" +#include "debug.h" #include "faraway_island.h" #include "event_data.h" #include "event_object_movement.h" @@ -129,6 +130,14 @@ void FieldGetPlayerInput(struct FieldInput *input, u16 newKeys, u16 heldKeys) input->dpadDirection = DIR_WEST; else if (heldKeys & DPAD_RIGHT) input->dpadDirection = DIR_EAST; + +#if DEBUG_SYSTEM_ENABLE == TRUE && DEBUG_SYSTEM_IN_MENU == FALSE + if ((heldKeys & DEBUG_SYSTEM_HELD_KEYS) && input->DEBUG_SYSTEM_TRIGGER_EVENT) + { + input->input_field_1_2 = TRUE; + input->DEBUG_SYSTEM_TRIGGER_EVENT = FALSE; + } +#endif } int ProcessPlayerFieldInput(struct FieldInput *input) @@ -188,6 +197,15 @@ int ProcessPlayerFieldInput(struct FieldInput *input) if (input->pressedSelectButton && UseRegisteredKeyItemOnField() == TRUE) return TRUE; +#if DEBUG_SYSTEM_ENABLE == TRUE && DEBUG_SYSTEM_IN_MENU == FALSE + if (input->input_field_1_2) + { + PlaySE(SE_WIN_OPEN); + Debug_ShowMainMenu(); + return TRUE; + } +#endif + return FALSE; } @@ -668,6 +686,9 @@ void RestartWildEncounterImmunitySteps(void) static bool8 CheckStandardWildEncounter(u16 metatileBehavior) { + if (FlagGet(OW_FLAG_NO_ENCOUNTER)) + return FALSE; + if (sWildEncounterImmunitySteps < 4) { sWildEncounterImmunitySteps++; diff --git a/src/field_effect.c b/src/field_effect.c index 2a1937f205..674125aaf7 100644 --- a/src/field_effect.c +++ b/src/field_effect.c @@ -3766,7 +3766,8 @@ static const union AnimCmd *const sAnims_DeoxysRockFragment[] = { sAnim_RockFragment_BottomRight, }; -static const struct SpriteTemplate sSpriteTemplate_DeoxysRockFragment = { +static const struct SpriteTemplate sSpriteTemplate_DeoxysRockFragment = +{ .tileTag = TAG_NONE, .paletteTag = 4378, .oam = &sOam_8x8, diff --git a/src/graphics.c b/src/graphics.c index 7ccd0d5799..a59d919527 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -57,238 +57,240 @@ const u32 gBattleAnimSpritePal_Punishment[] = INCBIN_U32("graphics/battle_anims/ const u32 gBattleAnimSpriteGfx_QuickGuard[] = INCBIN_U32("graphics/battle_anims/sprites/quick_guard.4bpp.lz"); const u32 gBattleAnimSpritePal_QuickGuard[] = INCBIN_U32("graphics/battle_anims/sprites/quick_guard.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_AcupressureFinger[] = INCBIN_U32("graphics/battle_anims/sprites/new/acupressure_finger.4bpp.lz"); -const u32 gBattleAnimSpritePal_AcupressureFinger[] = INCBIN_U32("graphics/battle_anims/sprites/new/acupressure_finger.gbapal.lz"); +const u32 gBattleAnimSpritePal_AcupressureFinger[] = INCBIN_U32("graphics/battle_anims/sprites/acupressure_finger.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_AcupressureFinger[] = INCBIN_U32("graphics/battle_anims/sprites/acupressure_finger.4bpp.lz"); -const u32 gBattleAnimSpriteGfx_AlphaStone[] = INCBIN_U32("graphics/battle_anims/sprites/new/alpha_stone.4bpp.lz"); -const u32 gBattleAnimSpritePal_AlphaStone[] = INCBIN_U32("graphics/battle_anims/sprites/new/alpha_stone.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_AlphaStone[] = INCBIN_U32("graphics/battle_anims/sprites/alpha_stone.4bpp.lz"); +const u32 gBattleAnimSpritePal_AlphaStone[] = INCBIN_U32("graphics/battle_anims/sprites/alpha_stone.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_Anchor[] = INCBIN_U32("graphics/battle_anims/sprites/new/anchor.4bpp.lz"); +const u32 gBattleAnimSpriteGfx_Anchor[] = INCBIN_U32("graphics/battle_anims/sprites/anchor.4bpp.lz"); -const u32 gBattleAnimSpriteGfx_Apple[] = INCBIN_U32("graphics/battle_anims/sprites/new/apple.4bpp.lz"); -const u32 gBattleAnimSpritePal_Apple[] = INCBIN_U32("graphics/battle_anims/sprites/new/apple.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_Apple[] = INCBIN_U32("graphics/battle_anims/sprites/apple.4bpp.lz"); +const u32 gBattleAnimSpritePal_Apple[] = INCBIN_U32("graphics/battle_anims/sprites/apple.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_Arrows[] = INCBIN_U32("graphics/battle_anims/sprites/new/arrows.4bpp.lz"); +const u32 gBattleAnimSpriteGfx_Arrows[] = INCBIN_U32("graphics/battle_anims/sprites/arrows.4bpp.lz"); -const u32 gBattleAnimSpriteGfx_AssuranceHand[] = INCBIN_U32("graphics/battle_anims/sprites/new/assurance_hand.4bpp.lz"); -const u32 gBattleAnimSpritePal_AssuranceHand[] = INCBIN_U32("graphics/battle_anims/sprites/new/assurance_hand.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_AssuranceHand[] = INCBIN_U32("graphics/battle_anims/sprites/assurance_hand.4bpp.lz"); +const u32 gBattleAnimSpritePal_AssuranceHand[] = INCBIN_U32("graphics/battle_anims/sprites/assurance_hand.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_AuraSphere[] = INCBIN_U32("graphics/battle_anims/sprites/new/aura_sphere.4bpp.lz"); -const u32 gBattleAnimSpritePal_AuraSphere[] = INCBIN_U32("graphics/battle_anims/sprites/new/aura_sphere.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_AuraSphere[] = INCBIN_U32("graphics/battle_anims/sprites/aura_sphere.4bpp.lz"); +const u32 gBattleAnimSpritePal_AuraSphere[] = INCBIN_U32("graphics/battle_anims/sprites/aura_sphere.gbapal.lz"); -const u32 gBattleAnimSpritePal_AvalancheRocks[] = INCBIN_U32("graphics/battle_anims/sprites/new/avalanche_rocks.gbapal.lz"); +const u32 gBattleAnimSpritePal_AvalancheRocks[] = INCBIN_U32("graphics/battle_anims/sprites/avalanche_rocks.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_NewPokeball[] = INCBIN_U32("graphics/battle_anims/sprites/new/baton_pass_ball.4bpp.lz"); -const u32 gBattleAnimSpritePal_NewPokeball[] = INCBIN_U32("graphics/battle_anims/sprites/new/baton_pass_ball.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_NewPokeball[] = INCBIN_U32("graphics/battle_anims/sprites/baton_pass_ball.4bpp.lz"); +const u32 gBattleAnimSpritePal_NewPokeball[] = INCBIN_U32("graphics/battle_anims/sprites/baton_pass_ball.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_BerryEaten[] = INCBIN_U32("graphics/battle_anims/sprites/new/berry_eaten.4bpp.lz"); -const u32 gBattleAnimSpritePal_BerryEaten[] = INCBIN_U32("graphics/battle_anims/sprites/new/berry_eaten.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_BerryEaten[] = INCBIN_U32("graphics/battle_anims/sprites/berry_eaten.4bpp.lz"); +const u32 gBattleAnimSpritePal_BerryEaten[] = INCBIN_U32("graphics/battle_anims/sprites/berry_eaten.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_BerryNormal[] = INCBIN_U32("graphics/battle_anims/sprites/new/berry_normal.4bpp.lz"); -const u32 gBattleAnimSpritePal_BerryNormal[] = INCBIN_U32("graphics/battle_anims/sprites/new/berry_normal.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_BerryNormal[] = INCBIN_U32("graphics/battle_anims/sprites/berry_normal.4bpp.lz"); +const u32 gBattleAnimSpritePal_BerryNormal[] = INCBIN_U32("graphics/battle_anims/sprites/berry_normal.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_BigRock[] = INCBIN_U32("graphics/battle_anims/sprites/new/big_rock.4bpp.lz"); -const u32 gBattleAnimSpritePal_BigRock[] = INCBIN_U32("graphics/battle_anims/sprites/new/big_rock.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_BigRock[] = INCBIN_U32("graphics/battle_anims/sprites/big_rock.4bpp.lz"); +const u32 gBattleAnimSpritePal_BigRock[] = INCBIN_U32("graphics/battle_anims/sprites/big_rock.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_BlacephalonHead[] = INCBIN_U32("graphics/battle_anims/sprites/new/blacephalon_head.4bpp.lz"); -const u32 gBattleAnimSpritePal_BlacephalonHead[] = INCBIN_U32("graphics/battle_anims/sprites/new/blacephalon_head.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_BlacephalonHead[] = INCBIN_U32("graphics/battle_anims/sprites/blacephalon_head.4bpp.lz"); +const u32 gBattleAnimSpritePal_BlacephalonHead[] = INCBIN_U32("graphics/battle_anims/sprites/blacephalon_head.gbapal.lz"); -const u32 gBattleAnimSpritePal_BlueFlare[] = INCBIN_U32("graphics/battle_anims/sprites/new/blue_flare.gbapal.lz"); +const u32 gBattleAnimSpritePal_BlueFlare[] = INCBIN_U32("graphics/battle_anims/sprites/blue_flare.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_Branch[] = INCBIN_U32("graphics/battle_anims/sprites/new/branch.4bpp.lz"); -const u32 gBattleAnimSpritePal_Branch[] = INCBIN_U32("graphics/battle_anims/sprites/new/branch.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_Branch[] = INCBIN_U32("graphics/battle_anims/sprites/branch.4bpp.lz"); +const u32 gBattleAnimSpritePal_Branch[] = INCBIN_U32("graphics/battle_anims/sprites/branch.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_Brine[] = INCBIN_U32("graphics/battle_anims/sprites/new/brine.4bpp.lz"); -const u32 gBattleAnimSpritePal_Brine[] = INCBIN_U32("graphics/battle_anims/sprites/new/brine.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_Brine[] = INCBIN_U32("graphics/battle_anims/sprites/brine.4bpp.lz"); +const u32 gBattleAnimSpritePal_Brine[] = INCBIN_U32("graphics/battle_anims/sprites/brine.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_ChainLink[] = INCBIN_U32("graphics/battle_anims/sprites/new/chain_link.4bpp.lz"); -const u32 gBattleAnimSpritePal_ChainLink[] = INCBIN_U32("graphics/battle_anims/sprites/new/chain_link.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_ChainLink[] = INCBIN_U32("graphics/battle_anims/sprites/chain_link.4bpp.lz"); +const u32 gBattleAnimSpritePal_ChainLink[] = INCBIN_U32("graphics/battle_anims/sprites/chain_link.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_Chop[] = INCBIN_U32("graphics/battle_anims/sprites/new/chop.4bpp.lz"); -const u32 gBattleAnimSpritePal_Chop[] = INCBIN_U32("graphics/battle_anims/sprites/new/chop.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_Chop[] = INCBIN_U32("graphics/battle_anims/sprites/chop.4bpp.lz"); +const u32 gBattleAnimSpritePal_Chop[] = INCBIN_U32("graphics/battle_anims/sprites/chop.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_Cacoon[] = INCBIN_U32("graphics/battle_anims/sprites/new/cacoon.4bpp.lz"); -const u32 gBattleAnimSpritePal_Cacoon[] = INCBIN_U32("graphics/battle_anims/sprites/new/cacoon.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_Cacoon[] = INCBIN_U32("graphics/battle_anims/sprites/cacoon.4bpp.lz"); +const u32 gBattleAnimSpritePal_Cacoon[] = INCBIN_U32("graphics/battle_anims/sprites/cacoon.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_Confide[] = INCBIN_U32("graphics/battle_anims/sprites/new/confide.4bpp.lz"); -const u32 gBattleAnimSpritePal_Confide[] = INCBIN_U32("graphics/battle_anims/sprites/new/confide.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_Confide[] = INCBIN_U32("graphics/battle_anims/sprites/confide.4bpp.lz"); +const u32 gBattleAnimSpritePal_Confide[] = INCBIN_U32("graphics/battle_anims/sprites/confide.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_CraftyShield[] = INCBIN_U32("graphics/battle_anims/sprites/new/crafty_shield.4bpp.lz"); -const u32 gBattleAnimSpritePal_CraftyShield[] = INCBIN_U32("graphics/battle_anims/sprites/new/crafty_shield.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_CraftyShield[] = INCBIN_U32("graphics/battle_anims/sprites/crafty_shield.4bpp.lz"); +const u32 gBattleAnimSpritePal_CraftyShield[] = INCBIN_U32("graphics/battle_anims/sprites/crafty_shield.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_NewNail[] = INCBIN_U32("graphics/battle_anims/sprites/new/curse_nail.4bpp.lz"); -const u32 gBattleAnimSpritePal_NewNail[] = INCBIN_U32("graphics/battle_anims/sprites/new/curse_nail.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_NewNail[] = INCBIN_U32("graphics/battle_anims/sprites/curse_nail.4bpp.lz"); +const u32 gBattleAnimSpritePal_NewNail[] = INCBIN_U32("graphics/battle_anims/sprites/curse_nail.gbapal.lz"); -const u32 gBattleAnimSpritePal_DracoMeteor[] = INCBIN_U32("graphics/battle_anims/sprites/new/draco_meteor.gbapal.lz"); +const u32 gBattleAnimSpritePal_DracoMeteor[] = INCBIN_U32("graphics/battle_anims/sprites/draco_meteor.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_DragonPulseRing[] = INCBIN_U32("graphics/battle_anims/sprites/new/dragon_pulse_ring.4bpp.lz"); -const u32 gBattleAnimSpritePal_DragonPulseRing[] = INCBIN_U32("graphics/battle_anims/sprites/new/dragon_pulse_ring.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_DragonPulseRing[] = INCBIN_U32("graphics/battle_anims/sprites/dragon_pulse_ring.4bpp.lz"); +const u32 gBattleAnimSpritePal_DragonPulseRing[] = INCBIN_U32("graphics/battle_anims/sprites/dragon_pulse_ring.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_DreepyMissile[] = INCBIN_U32("graphics/battle_anims/sprites/new/dreepy_missile.4bpp.lz"); -const u32 gBattleAnimSpritePal_DreepyMissile[] = INCBIN_U32("graphics/battle_anims/sprites/new/dreepy_missile.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_DreepyMissile[] = INCBIN_U32("graphics/battle_anims/sprites/dreepy_missile.4bpp.lz"); +const u32 gBattleAnimSpritePal_DreepyMissile[] = INCBIN_U32("graphics/battle_anims/sprites/dreepy_missile.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_Drill[] = INCBIN_U32("graphics/battle_anims/sprites/new/drill.4bpp.lz"); -const u32 gBattleAnimSpritePal_Drill[] = INCBIN_U32("graphics/battle_anims/sprites/new/drill.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_Drill[] = INCBIN_U32("graphics/battle_anims/sprites/drill.4bpp.lz"); +const u32 gBattleAnimSpritePal_Drill[] = INCBIN_U32("graphics/battle_anims/sprites/drill.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_NewEmbers[] = INCBIN_U32("graphics/battle_anims/sprites/new/embers.4bpp.lz"); -const u32 gBattleAnimSpritePal_NewEmbers[] = INCBIN_U32("graphics/battle_anims/sprites/new/embers.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_NewEmbers[] = INCBIN_U32("graphics/battle_anims/sprites/embers.4bpp.lz"); +const u32 gBattleAnimSpritePal_NewEmbers[] = INCBIN_U32("graphics/battle_anims/sprites/embers.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_FairyLockChains[] = INCBIN_U32("graphics/battle_anims/sprites/new/fairy_lock_chains.4bpp.lz"); +const u32 gBattleAnimSpriteGfx_FairyLockChains[] = INCBIN_U32("graphics/battle_anims/sprites/fairy_lock_chains.4bpp.lz"); -const u32 gBattleAnimSpriteGfx_Fishies[] = INCBIN_U32("graphics/battle_anims/sprites/new/fishies.4bpp.lz"); -const u32 gBattleAnimSpritePal_Fishies[] = INCBIN_U32("graphics/battle_anims/sprites/new/fishies.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_Fishies[] = INCBIN_U32("graphics/battle_anims/sprites/fishies.4bpp.lz"); +const u32 gBattleAnimSpritePal_Fishies[] = INCBIN_U32("graphics/battle_anims/sprites/fishies.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_NewFly[] = INCBIN_U32("graphics/battle_anims/sprites/new/fly.4bpp.lz"); -const u32 gBattleAnimSpritePal_NewFly[] = INCBIN_U32("graphics/battle_anims/sprites/new/fly.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_NewFly[] = INCBIN_U32("graphics/battle_anims/sprites/fly.4bpp.lz"); +const u32 gBattleAnimSpritePal_NewFly[] = INCBIN_U32("graphics/battle_anims/sprites/fly.gbapal.lz"); -const u32 gBattleAnimSpritePal_FusionFlare[] = INCBIN_U32("graphics/battle_anims/sprites/new/fusion_flare.gbapal.lz"); +const u32 gBattleAnimSpritePal_FusionFlare[] = INCBIN_U32("graphics/battle_anims/sprites/fusion_flare.gbapal.lz"); -const u32 gBattleAnimSpritePal_GarbagePoisonPillar[] = INCBIN_U32("graphics/battle_anims/sprites/new/garbage_poison_column.gbapal.lz"); +const u32 gBattleAnimSpritePal_GarbagePoisonPillar[] = INCBIN_U32("graphics/battle_anims/sprites/garbage_poison_column.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_Gear[] = INCBIN_U32("graphics/battle_anims/sprites/new/gear.4bpp.lz"); -const u32 gBattleAnimSpritePal_Gear[] = INCBIN_U32("graphics/battle_anims/sprites/new/gear.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_Gear[] = INCBIN_U32("graphics/battle_anims/sprites/gear.4bpp.lz"); +const u32 gBattleAnimSpritePal_Gear[] = INCBIN_U32("graphics/battle_anims/sprites/gear.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_GigavoltHavocSpear[] = INCBIN_U32("graphics/battle_anims/sprites/new/gigavolt_havoc_spear.4bpp.lz"); -const u32 gBattleAnimSpritePal_GigavoltHavocSpear[] = INCBIN_U32("graphics/battle_anims/sprites/new/gigavolt_havoc_spear.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_GigavoltHavocSpear[] = INCBIN_U32("graphics/battle_anims/sprites/gigavolt_havoc_spear.4bpp.lz"); +const u32 gBattleAnimSpritePal_GigavoltHavocSpear[] = INCBIN_U32("graphics/battle_anims/sprites/gigavolt_havoc_spear.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_GoldenApple[] = INCBIN_U32("graphics/battle_anims/sprites/new/golden_apple.4bpp.lz"); -const u32 gBattleAnimSpritePal_GoldenApple[] = INCBIN_U32("graphics/battle_anims/sprites/new/golden_apple.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_GoldenApple[] = INCBIN_U32("graphics/battle_anims/sprites/golden_apple.4bpp.lz"); +const u32 gBattleAnimSpritePal_GoldenApple[] = INCBIN_U32("graphics/battle_anims/sprites/golden_apple.gbapal.lz"); -const u32 gBattleAnimSpritePal_GreenDrake[] = INCBIN_U32("graphics/battle_anims/sprites/new/green_drake.gbapal.lz"); +const u32 gBattleAnimSpritePal_GreenDrake[] = INCBIN_U32("graphics/battle_anims/sprites/green_drake.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_NewGreenStar[] = INCBIN_U32("graphics/battle_anims/sprites/new/green_star.4bpp.lz"); -const u32 gBattleAnimSpritePal_NewGreenStar[] = INCBIN_U32("graphics/battle_anims/sprites/new/green_star.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_NewGreenStar[] = INCBIN_U32("graphics/battle_anims/sprites/green_star_new.4bpp.lz"); +const u32 gBattleAnimSpritePal_NewGreenStar[] = INCBIN_U32("graphics/battle_anims/sprites/green_star_new.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_HeartStamp[] = INCBIN_U32("graphics/battle_anims/sprites/new/heart_stamp.4bpp.lz"); -const u32 gBattleAnimSpritePal_HeartStamp[] = INCBIN_U32("graphics/battle_anims/sprites/new/heart_stamp.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_HeartStamp[] = INCBIN_U32("graphics/battle_anims/sprites/heart_stamp.4bpp.lz"); +const u32 gBattleAnimSpritePal_HeartStamp[] = INCBIN_U32("graphics/battle_anims/sprites/heart_stamp.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_ZygardeHexes[] = INCBIN_U32("graphics/battle_anims/sprites/new/hexes.4bpp.lz"); -const u32 gBattleAnimSpritePal_ZygardeHexes[] = INCBIN_U32("graphics/battle_anims/sprites/new/hexes.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_ZygardeHexes[] = INCBIN_U32("graphics/battle_anims/sprites/hexes.4bpp.lz"); +const u32 gBattleAnimSpritePal_ZygardeHexes[] = INCBIN_U32("graphics/battle_anims/sprites/hexes.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_HoopaHand[] = INCBIN_U32("graphics/battle_anims/sprites/new/hoopa_hand.4bpp.lz"); -const u32 gBattleAnimSpritePal_HoopaHand[] = INCBIN_U32("graphics/battle_anims/sprites/new/hoopa_hand.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_HoopaHand[] = INCBIN_U32("graphics/battle_anims/sprites/hoopa_hand.4bpp.lz"); +const u32 gBattleAnimSpritePal_HoopaHand[] = INCBIN_U32("graphics/battle_anims/sprites/hoopa_hand.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_HoopaRing[] = INCBIN_U32("graphics/battle_anims/sprites/new/hoopa_ring.4bpp.lz"); -const u32 gBattleAnimSpritePal_HoopaRing[] = INCBIN_U32("graphics/battle_anims/sprites/new/hoopa_ring.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_HoopaRing[] = INCBIN_U32("graphics/battle_anims/sprites/hoopa_ring.4bpp.lz"); +const u32 gBattleAnimSpritePal_HoopaRing[] = INCBIN_U32("graphics/battle_anims/sprites/hoopa_ring.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_NewHornHit[] = INCBIN_U32("graphics/battle_anims/sprites/new/horn.4bpp.lz"); -const u32 gBattleAnimSpritePal_NewHornHit[] = INCBIN_U32("graphics/battle_anims/sprites/new/horn.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_NewHornHit[] = INCBIN_U32("graphics/battle_anims/sprites/horn_hit_new.4bpp.lz"); +const u32 gBattleAnimSpritePal_NewHornHit[] = INCBIN_U32("graphics/battle_anims/sprites/horn_hit_new.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_HornLeech[] = INCBIN_U32("graphics/battle_anims/sprites/new/horn_leech.4bpp.lz"); -const u32 gBattleAnimSpritePal_HornLeech[] = INCBIN_U32("graphics/battle_anims/sprites/new/horn_leech.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_HornLeech[] = INCBIN_U32("graphics/battle_anims/sprites/horn_leech.4bpp.lz"); +const u32 gBattleAnimSpritePal_HornLeech[] = INCBIN_U32("graphics/battle_anims/sprites/horn_leech.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_HorseshoeFist[] = INCBIN_U32("graphics/battle_anims/sprites/new/horseshoe_fist.4bpp.lz"); -const u32 gBattleAnimSpritePal_HorseshoeFist[] = INCBIN_U32("graphics/battle_anims/sprites/new/horseshoe_fist.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_HorseshoeFist[] = INCBIN_U32("graphics/battle_anims/sprites/horseshoe_fist.4bpp.lz"); +const u32 gBattleAnimSpritePal_HorseshoeFist[] = INCBIN_U32("graphics/battle_anims/sprites/horseshoe_fist.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_HydroPump[] = INCBIN_U32("graphics/battle_anims/sprites/new/hydro_pump.4bpp.lz"); -const u32 gBattleAnimSpritePal_HydroPump[] = INCBIN_U32("graphics/battle_anims/sprites/new/hydro_pump.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_HydroPump[] = INCBIN_U32("graphics/battle_anims/sprites/hydro_pump.4bpp.lz"); +const u32 gBattleAnimSpritePal_HydroPump[] = INCBIN_U32("graphics/battle_anims/sprites/hydro_pump.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_IceRock[] = INCBIN_U32("graphics/battle_anims/sprites/new/ice_rock.4bpp.lz"); -const u32 gBattleAnimSpritePal_IceRock[] = INCBIN_U32("graphics/battle_anims/sprites/new/ice_rock.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_IceRock[] = INCBIN_U32("graphics/battle_anims/sprites/ice_rock.4bpp.lz"); +const u32 gBattleAnimSpritePal_IceRock[] = INCBIN_U32("graphics/battle_anims/sprites/ice_rock.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_LargeSpike[] = INCBIN_U32("graphics/battle_anims/sprites/new/large_spike.4bpp.lz"); -const u32 gBattleAnimSpritePal_LargeSpike[] = INCBIN_U32("graphics/battle_anims/sprites/new/large_spike.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_LargeSpike[] = INCBIN_U32("graphics/battle_anims/sprites/large_spike.4bpp.lz"); +const u32 gBattleAnimSpritePal_LargeSpike[] = INCBIN_U32("graphics/battle_anims/sprites/large_spike.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_NewLeaf[] = INCBIN_U32("graphics/battle_anims/sprites/new/leaves.4bpp.lz"); -const u32 gBattleAnimSpritePal_NewLeaf[] = INCBIN_U32("graphics/battle_anims/sprites/new/leaves.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_NewLeaf[] = INCBIN_U32("graphics/battle_anims/sprites/leaves.4bpp.lz"); +const u32 gBattleAnimSpritePal_NewLeaf[] = INCBIN_U32("graphics/battle_anims/sprites/leaves.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_NewLeechSeed[] = INCBIN_U32("graphics/battle_anims/sprites/new/leech_seed.4bpp.lz"); -const u32 gBattleAnimSpritePal_NewLeechSeed[] = INCBIN_U32("graphics/battle_anims/sprites/new/leech_seed.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_NewLeechSeed[] = INCBIN_U32("graphics/battle_anims/sprites/leech_seed.4bpp.lz"); +const u32 gBattleAnimSpritePal_NewLeechSeed[] = INCBIN_U32("graphics/battle_anims/sprites/leech_seed.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_LightningRain[] = INCBIN_U32("graphics/battle_anims/sprites/new/lightning_rain.4bpp.lz"); -const u32 gBattleAnimSpritePal_LightningRain[] = INCBIN_U32("graphics/battle_anims/sprites/new/lightning_rain.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_LightningRain[] = INCBIN_U32("graphics/battle_anims/sprites/lightning_rain.4bpp.lz"); +const u32 gBattleAnimSpritePal_LightningRain[] = INCBIN_U32("graphics/battle_anims/sprites/lightning_rain.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_NewEye[] = INCBIN_U32("graphics/battle_anims/sprites/new/mean_look.4bpp.lz"); -const u32 gBattleAnimSpritePal_NewEye[] = INCBIN_U32("graphics/battle_anims/sprites/new/mean_look.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_NewEye[] = INCBIN_U32("graphics/battle_anims/sprites/mean_look.4bpp.lz"); +const u32 gBattleAnimSpritePal_NewEye[] = INCBIN_U32("graphics/battle_anims/sprites/mean_look.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_MetalBits[] = INCBIN_U32("graphics/battle_anims/sprites/new/metal_bits.4bpp.lz"); +const u32 gBattleAnimSpriteGfx_MetalBits[] = INCBIN_U32("graphics/battle_anims/sprites/metal_bits.4bpp.lz"); -const u32 gBattleAnimSpriteGfx_MudBomb[] = INCBIN_U32("graphics/battle_anims/sprites/new/mud_bomb.4bpp.lz"); -const u32 gBattleAnimSpritePal_MudBomb[] = INCBIN_U32("graphics/battle_anims/sprites/new/mud_bomb.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_MudBomb[] = INCBIN_U32("graphics/battle_anims/sprites/mud_bomb.4bpp.lz"); +const u32 gBattleAnimSpritePal_MudBomb[] = INCBIN_U32("graphics/battle_anims/sprites/mud_bomb.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_Mushroom[] = INCBIN_U32("graphics/battle_anims/sprites/new/mushroom.4bpp.lz"); -const u32 gBattleAnimSpritePal_Mushroom[] = INCBIN_U32("graphics/battle_anims/sprites/new/mushroom.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_Mushroom[] = INCBIN_U32("graphics/battle_anims/sprites/mushroom.4bpp.lz"); +const u32 gBattleAnimSpritePal_Mushroom[] = INCBIN_U32("graphics/battle_anims/sprites/mushroom.gbapal.lz"); -const u32 gBattleAnimSpritePal_NaturalGiftRing[] = INCBIN_U32("graphics/battle_anims/sprites/new/natural_gift_ring.gbapal.lz"); +const u32 gBattleAnimSpritePal_NaturalGiftRing[] = INCBIN_U32("graphics/battle_anims/sprites/natural_gift_ring.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_NecrozmaStar[] = INCBIN_U32("graphics/battle_anims/sprites/new/necrozma_star.4bpp.lz"); -const u32 gBattleAnimSpritePal_NecrozmaStar[] = INCBIN_U32("graphics/battle_anims/sprites/new/necrozma_star.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_NecrozmaStar[] = INCBIN_U32("graphics/battle_anims/sprites/necrozma_star.4bpp.lz"); +const u32 gBattleAnimSpritePal_NecrozmaStar[] = INCBIN_U32("graphics/battle_anims/sprites/necrozma_star.gbapal.lz"); -const u32 gBattleAnimSpritePal_NewImpact[] = INCBIN_U32("graphics/battle_anims/sprites/new/impact.gbapal.lz"); +const u32 gBattleAnimSpritePal_NewImpact[] = INCBIN_U32("graphics/battle_anims/sprites/impact_new.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_Obstruct[] = INCBIN_U32("graphics/battle_anims/sprites/new/obstruct.4bpp.lz"); -const u32 gBattleAnimSpritePal_Obstruct[] = INCBIN_U32("graphics/battle_anims/sprites/new/obstruct.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_Obstruct[] = INCBIN_U32("graphics/battle_anims/sprites/obstruct.4bpp.lz"); +const u32 gBattleAnimSpritePal_Obstruct[] = INCBIN_U32("graphics/battle_anims/sprites/obstruct.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_OmegaStone[] = INCBIN_U32("graphics/battle_anims/sprites/new/omega_stone.4bpp.lz"); -const u32 gBattleAnimSpritePal_OmegaStone[] = INCBIN_U32("graphics/battle_anims/sprites/new/omega_stone.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_OmegaStone[] = INCBIN_U32("graphics/battle_anims/sprites/omega_stone.4bpp.lz"); +const u32 gBattleAnimSpritePal_OmegaStone[] = INCBIN_U32("graphics/battle_anims/sprites/omega_stone.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_PinkDiamond[] = INCBIN_U32("graphics/battle_anims/sprites/new/pink_diamond.4bpp.lz"); -const u32 gBattleAnimSpritePal_PinkDiamond[] = INCBIN_U32("graphics/battle_anims/sprites/new/pink_diamond.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_PinkDiamond[] = INCBIN_U32("graphics/battle_anims/sprites/pink_diamond.4bpp.lz"); +const u32 gBattleAnimSpritePal_PinkDiamond[] = INCBIN_U32("graphics/battle_anims/sprites/pink_diamond.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_PoisonColumn[] = INCBIN_U32("graphics/battle_anims/sprites/new/poison_column.4bpp.lz"); -const u32 gBattleAnimSpritePal_PoisonColumn[] = INCBIN_U32("graphics/battle_anims/sprites/new/poison_column.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_PoisonColumn[] = INCBIN_U32("graphics/battle_anims/sprites/poison_column.4bpp.lz"); +const u32 gBattleAnimSpritePal_PoisonColumn[] = INCBIN_U32("graphics/battle_anims/sprites/poison_column.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_PowerTrick[] = INCBIN_U32("graphics/battle_anims/sprites/new/power_trick.4bpp.lz"); -const u32 gBattleAnimSpritePal_PowerTrick[] = INCBIN_U32("graphics/battle_anims/sprites/new/power_trick.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_PowerTrick[] = INCBIN_U32("graphics/battle_anims/sprites/power_trick.4bpp.lz"); +const u32 gBattleAnimSpritePal_PowerTrick[] = INCBIN_U32("graphics/battle_anims/sprites/power_trick.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_PurpleDrake[] = INCBIN_U32("graphics/battle_anims/sprites/new/purple_drake.4bpp.lz"); -const u32 gBattleAnimSpritePal_PurpleDrake[] = INCBIN_U32("graphics/battle_anims/sprites/new/purple_drake.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_PurpleDrake[] = INCBIN_U32("graphics/battle_anims/sprites/purple_drake.4bpp.lz"); +const u32 gBattleAnimSpritePal_PurpleDrake[] = INCBIN_U32("graphics/battle_anims/sprites/purple_drake.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_RazorShell[] = INCBIN_U32("graphics/battle_anims/sprites/new/razor_shell.4bpp.lz"); -const u32 gBattleAnimSpritePal_RazorShell[] = INCBIN_U32("graphics/battle_anims/sprites/new/razor_shell.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_RazorShell[] = INCBIN_U32("graphics/battle_anims/sprites/razor_shell.4bpp.lz"); +const u32 gBattleAnimSpritePal_RazorShell[] = INCBIN_U32("graphics/battle_anims/sprites/razor_shell.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_RocksSmall[] = INCBIN_U32("graphics/battle_anims/sprites/new/rock_small.4bpp.lz"); +const u32 gBattleAnimSpriteGfx_RocksSmall[] = INCBIN_U32("graphics/battle_anims/sprites/rock_small.4bpp.lz"); -const u32 gBattleAnimSpriteGfx_NewRocks[] = INCBIN_U32("graphics/battle_anims/sprites/new/rocks.4bpp.lz"); -const u32 gBattleAnimSpritePal_NewRocks[] = INCBIN_U32("graphics/battle_anims/sprites/new/rocks.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_NewRocks[] = INCBIN_U32("graphics/battle_anims/sprites/rocks_new.4bpp.lz"); +const u32 gBattleAnimSpritePal_NewRocks[] = INCBIN_U32("graphics/battle_anims/sprites/rocks_new.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_ShellLeft[] = INCBIN_U32("graphics/battle_anims/sprites/new/shell_left.4bpp.lz"); -const u32 gBattleAnimSpritePal_ShellLeft[] = INCBIN_U32("graphics/battle_anims/sprites/new/shell_left.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_ShellLeft[] = INCBIN_U32("graphics/battle_anims/sprites/shell_left.4bpp.lz"); +const u32 gBattleAnimSpritePal_ShellLeft[] = INCBIN_U32("graphics/battle_anims/sprites/shell_left.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_ShellRight[] = INCBIN_U32("graphics/battle_anims/sprites/new/shell_right.4bpp.lz"); +const u32 gBattleAnimSpriteGfx_ShellRight[] = INCBIN_U32("graphics/battle_anims/sprites/shell_right.4bpp.lz"); -const u32 gBattleAnimSpritePal_SpacialRendSlices[] = INCBIN_U32("graphics/battle_anims/sprites/new/spacial_rend_slices.gbapal.lz"); +const u32 gBattleAnimSpritePal_SpacialRendSlices[] = INCBIN_U32("graphics/battle_anims/sprites/spacial_rend_slices.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_NewSpikes[] = INCBIN_U32("graphics/battle_anims/sprites/new/spikes.4bpp.lz"); -const u32 gBattleAnimSpritePal_NewSpikes[] = INCBIN_U32("graphics/battle_anims/sprites/new/spikes.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_NewSpikes[] = INCBIN_U32("graphics/battle_anims/sprites/spikes_new.4bpp.lz"); +const u32 gBattleAnimSpritePal_NewSpikes[] = INCBIN_U32("graphics/battle_anims/sprites/spikes_new.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_SpiritShackleArrow[] = INCBIN_U32("graphics/battle_anims/sprites/new/spirit_shackle_arrow.4bpp.lz"); -const u32 gBattleAnimSpritePal_SpiritShackleArrow[] = INCBIN_U32("graphics/battle_anims/sprites/new/spirit_shackle_arrow.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_SpiritShackleArrow[] = INCBIN_U32("graphics/battle_anims/sprites/spirit_shackle_arrow.4bpp.lz"); +const u32 gBattleAnimSpritePal_SpiritShackleArrow[] = INCBIN_U32("graphics/battle_anims/sprites/spirit_shackle_arrow.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_SteamEruption[] = INCBIN_U32("graphics/battle_anims/sprites/new/steam_eruption.4bpp.lz"); -const u32 gBattleAnimSpritePal_SteamEruption[] = INCBIN_U32("graphics/battle_anims/sprites/new/steam_eruption.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_SteamEruption[] = INCBIN_U32("graphics/battle_anims/sprites/steam_eruption.4bpp.lz"); +const u32 gBattleAnimSpritePal_SteamEruption[] = INCBIN_U32("graphics/battle_anims/sprites/steam_eruption.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_Steamroller[] = INCBIN_U32("graphics/battle_anims/sprites/new/steamroller.4bpp.lz"); -const u32 gBattleAnimSpritePal_Steamroller[] = INCBIN_U32("graphics/battle_anims/sprites/new/steamroller.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_Steamroller[] = INCBIN_U32("graphics/battle_anims/sprites/steamroller.4bpp.lz"); +const u32 gBattleAnimSpritePal_Steamroller[] = INCBIN_U32("graphics/battle_anims/sprites/steamroller.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_StonePillar[] = INCBIN_U32("graphics/battle_anims/sprites/new/stone_pillar.4bpp.lz"); -const u32 gBattleAnimSpritePal_StonePillar[] = INCBIN_U32("graphics/battle_anims/sprites/new/stone_pillar.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_StonePillar[] = INCBIN_U32("graphics/battle_anims/sprites/stone_pillar.4bpp.lz"); +const u32 gBattleAnimSpritePal_StonePillar[] = INCBIN_U32("graphics/battle_anims/sprites/stone_pillar.gbapal.lz"); -const u32 gBattleAnimSpritePal_Poltergeist[] = INCBIN_U32("graphics/battle_anims/sprites/new/poltergeist.gbapal.lz"); +const u32 gBattleAnimSpritePal_Poltergeist[] = INCBIN_U32("graphics/battle_anims/sprites/poltergeist.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_StraightBeam[] = INCBIN_U32("graphics/battle_anims/sprites/new/straight_beam.4bpp.lz"); -const u32 gBattleAnimSpritePal_StraightBeam[] = INCBIN_U32("graphics/battle_anims/sprites/new/straight_beam.gbapal.lz"); +const u32 gBattleAnimSpritePal_SteelBeam[] = INCBIN_U32("graphics/battle_anims/sprites/steel_beam.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_SubstituteBack[] = INCBIN_U32("graphics/battle_anims/sprites/new/substitute_back.4bpp.lz"); -const u32 gBattleAnimSpriteGfx_NewSubstituteFront[] = INCBIN_U32("graphics/battle_anims/sprites/new/substitute_front.4bpp.lz"); -const u32 gBattleAnimSpritePal_NewSubstituteFront[] = INCBIN_U32("graphics/battle_anims/sprites/new/substitute_front.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_StraightBeam[] = INCBIN_U32("graphics/battle_anims/sprites/straight_beam.4bpp.lz"); +const u32 gBattleAnimSpritePal_StraightBeam[] = INCBIN_U32("graphics/battle_anims/sprites/straight_beam.gbapal.lz"); -const u32 gBattleAnimSpritePal_NewSurf[] = INCBIN_U32("graphics/battle_anims/sprites/new/surf_new.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_SubstituteBack[] = INCBIN_U32("graphics/battle_anims/sprites/substitute_back_new.4bpp.lz"); +const u32 gBattleAnimSpriteGfx_NewSubstituteFront[] = INCBIN_U32("graphics/battle_anims/sprites/substitute_new.4bpp.lz"); +const u32 gBattleAnimSpritePal_NewSubstituteFront[] = INCBIN_U32("graphics/battle_anims/sprites/substitute_new.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_NewSword[] = INCBIN_U32("graphics/battle_anims/sprites/new/sword.4bpp.lz"); -const u32 gBattleAnimSpritePal_NewSword[] = INCBIN_U32("graphics/battle_anims/sprites/new/sword.gbapal.lz"); +const u32 gBattleAnimSpritePal_NewSurf[] = INCBIN_U32("graphics/battle_anims/sprites/surf_new.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_NewTeeth[] = INCBIN_U32("graphics/battle_anims/sprites/new/teeth.4bpp.lz"); -const u32 gBattleAnimSpritePal_NewTeeth[] = INCBIN_U32("graphics/battle_anims/sprites/new/teeth.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_NewSword[] = INCBIN_U32("graphics/battle_anims/sprites/sword_new.4bpp.lz"); +const u32 gBattleAnimSpritePal_NewSword[] = INCBIN_U32("graphics/battle_anims/sprites/sword_new.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_NewHandsAndFeet[] = INCBIN_U32("graphics/battle_anims/sprites/new/thrash.4bpp.lz"); -const u32 gBattleAnimSpritePal_NewHandsAndFeet[] = INCBIN_U32("graphics/battle_anims/sprites/new/thrash.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_NewTeeth[] = INCBIN_U32("graphics/battle_anims/sprites/teeth_new.4bpp.lz"); +const u32 gBattleAnimSpritePal_NewTeeth[] = INCBIN_U32("graphics/battle_anims/sprites/teeth_new.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_Tornado[] = INCBIN_U32("graphics/battle_anims/sprites/new/tornado.4bpp.lz"); -const u32 gBattleAnimSpritePal_Tornado[] = INCBIN_U32("graphics/battle_anims/sprites/new/tornado.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_NewHandsAndFeet[] = INCBIN_U32("graphics/battle_anims/sprites/hands_and_feet_new.4bpp.lz"); +const u32 gBattleAnimSpritePal_NewHandsAndFeet[] = INCBIN_U32("graphics/battle_anims/sprites/hands_and_feet_new.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_ZMoveSymbol[] = INCBIN_U32("graphics/battle_anims/sprites/new/z_move_symbol.4bpp.lz"); -const u32 gBattleAnimSpritePal_ZMoveSymbol[] = INCBIN_U32("graphics/battle_anims/sprites/new/z_move_symbol.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_Tornado[] = INCBIN_U32("graphics/battle_anims/sprites/tornado.4bpp.lz"); +const u32 gBattleAnimSpritePal_Tornado[] = INCBIN_U32("graphics/battle_anims/sprites/tornado.gbapal.lz"); + +const u32 gBattleAnimSpriteGfx_ZMoveSymbol[] = INCBIN_U32("graphics/battle_anims/sprites/z_move_symbol.4bpp.lz"); +const u32 gBattleAnimSpritePal_ZMoveSymbol[] = INCBIN_U32("graphics/battle_anims/sprites/z_move_symbol.gbapal.lz"); // Battle anims @@ -1284,8 +1286,8 @@ const u32 gDomeTourneyTree_Pal[] = INCBIN_U32("graphics/battle_frontier/tourney. const u32 gDomeTourneyTreeButtons_Pal[] = INCBIN_U32("graphics/battle_frontier/tourney_buttons.gbapal.lz"); const u32 gDomeTourneyMatchCardBg_Pal[] = INCBIN_U32("graphics/battle_frontier/tourney_match_card_bg.gbapal.lz"); -const u32 gBattleArenaJudgementSymbolsGfx[] = INCBIN_U32("graphics/battle_frontier/arena_judgement_symbols.4bpp.lz"); -const u32 gBattleArenaJudgementSymbolsPalette[] = INCBIN_U32("graphics/battle_frontier/arena_judgement_symbols.gbapal.lz"); +const u32 gBattleArenaJudgmentSymbolsGfx[] = INCBIN_U32("graphics/battle_frontier/arena_judgment_symbols.4bpp.lz"); +const u32 gBattleArenaJudgmentSymbolsPalette[] = INCBIN_U32("graphics/battle_frontier/arena_judgment_symbols.gbapal.lz"); const u32 gBattleWindowTextPalette[] = INCBIN_U32("graphics/battle_interface/text.gbapal.lz"); const u16 gPPTextPalette[] = INCBIN_U16("graphics/battle_interface/text_pp.gbapal"); @@ -1379,172 +1381,171 @@ const u32 gBattleAnimBgPalette_MagmaStorm[] = INCBIN_U32("graphics/battle_anims/ //new battle bgs -const u32 gBattleAnimBgImage_Hurricane[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/hurricane.4bpp.lz"); -const u32 gBattleAnimBgPalette_Hurricane[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/hurricane.gbapal.lz"); -const u32 gBattleAnimBgTilemap_Hurricane[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/hurricane.bin.lz"); +const u32 gBattleAnimBgImage_Hurricane[] = INCBIN_U32("graphics/battle_anims/backgrounds/hurricane.4bpp.lz"); +const u32 gBattleAnimBgPalette_Hurricane[] = INCBIN_U32("graphics/battle_anims/backgrounds/hurricane.gbapal.lz"); +const u32 gBattleAnimBgTilemap_Hurricane[] = INCBIN_U32("graphics/battle_anims/backgrounds/hurricane.bin.lz"); -const u32 gBattleAnimBgPalette_RockWrecker[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/rock_wrecker.gbapal.lz"); +const u32 gBattleAnimBgPalette_RockWrecker[] = INCBIN_U32("graphics/battle_anims/backgrounds/rock_wrecker.gbapal.lz"); -const u32 gBattleAnimBgTilemap_GigaImpactPlayer[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/giga_impact_player.bin.lz"); -const u32 gBattleAnimBgTilemap_GigaImpactOpponent[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/giga_impact_opponent.bin.lz"); -const u32 gBattleAnimBgTilemap_GigaImpactContest[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/giga_impact_contest.bin.lz"); -const u32 gBattleAnimBgImage_GigaImpact[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/giga_impact.4bpp.lz"); -const u32 gBattleAnimBgPalette_GigaImpact[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/giga_impact.gbapal.lz"); +const u32 gBattleAnimBgTilemap_GigaImpactPlayer[] = INCBIN_U32("graphics/battle_anims/backgrounds/giga_impact_player.bin.lz"); +const u32 gBattleAnimBgTilemap_GigaImpactOpponent[] = INCBIN_U32("graphics/battle_anims/backgrounds/giga_impact_opponent.bin.lz"); +const u32 gBattleAnimBgTilemap_GigaImpactContest[] = INCBIN_U32("graphics/battle_anims/backgrounds/giga_impact_contest.bin.lz"); +const u32 gBattleAnimBgImage_GigaImpact[] = INCBIN_U32("graphics/battle_anims/backgrounds/giga_impact.4bpp.lz"); +const u32 gBattleAnimBgPalette_GigaImpact[] = INCBIN_U32("graphics/battle_anims/backgrounds/giga_impact.gbapal.lz"); -const u32 gBattleAnimBgImage_SpacialRend[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/spacial_rend.4bpp.lz"); -const u32 gBattleAnimBgPalette_SpacialRend[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/spacial_rend.gbapal.lz"); +const u32 gBattleAnimBgImage_SpacialRend[] = INCBIN_U32("graphics/battle_anims/backgrounds/spacial_rend.4bpp.lz"); +const u32 gBattleAnimBgPalette_SpacialRend[] = INCBIN_U32("graphics/battle_anims/backgrounds/spacial_rend.gbapal.lz"); -const u32 gBattleAnimBgPalette_SludgeWave[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/sludge_wave.gbapal.lz"); +const u32 gBattleAnimBgPalette_SludgeWave[] = INCBIN_U32("graphics/battle_anims/backgrounds/sludge_wave.gbapal.lz"); -const u32 gBattleAnimBgImage_Aeroblast[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/aeroblast_tiles.4bpp.lz"); -const u32 gBattleAnimBgPalette_Aeroblast[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/aeroblast.gbapal.lz"); -const u32 gBattleAnimBgTilemap_Aeroblast[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/aeroblast_map.bin.lz"); +const u32 gBattleAnimBgImage_Aeroblast[] = INCBIN_U32("graphics/battle_anims/backgrounds/aeroblast_tiles.4bpp.lz"); +const u32 gBattleAnimBgPalette_Aeroblast[] = INCBIN_U32("graphics/battle_anims/backgrounds/aeroblast.gbapal.lz"); +const u32 gBattleAnimBgTilemap_Aeroblast[] = INCBIN_U32("graphics/battle_anims/backgrounds/aeroblast_map.bin.lz"); -const u32 gBattleAnimBgPalette_AuraSphere[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/aura_sphere.gbapal.lz"); +const u32 gBattleAnimBgPalette_AuraSphere[] = INCBIN_U32("graphics/battle_anims/backgrounds/aura_sphere.gbapal.lz"); -const u32 gBattleAnimBgImage_BlackholeEclipse[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/blackhole_eclipse.4bpp.lz"); -const u32 gBattleAnimBgPalette_BlackholeEclipse[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/blackhole_eclipse.gbapal.lz"); -const u32 gBattleAnimBgTilemap_BlackholeEclipse[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/blackhole_eclipse.bin.lz"); +const u32 gBattleAnimBgImage_BlackholeEclipse[] = INCBIN_U32("graphics/battle_anims/backgrounds/blackhole_eclipse.4bpp.lz"); +const u32 gBattleAnimBgPalette_BlackholeEclipse[] = INCBIN_U32("graphics/battle_anims/backgrounds/blackhole_eclipse.gbapal.lz"); +const u32 gBattleAnimBgTilemap_BlackholeEclipse[] = INCBIN_U32("graphics/battle_anims/backgrounds/blackhole_eclipse.bin.lz"); -const u32 gBattleAnimBgImage_BloomDoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/bloom_doom.4bpp.lz"); -const u32 gBattleAnimBgPalette_BloomDoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/bloom_doom.gbapal.lz"); -const u32 gBattleAnimBgTilemap_BloomDoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/bloom_doom.bin.lz"); +const u32 gBattleAnimBgImage_BloomDoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/bloom_doom.4bpp.lz"); +const u32 gBattleAnimBgPalette_BloomDoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/bloom_doom.gbapal.lz"); +const u32 gBattleAnimBgTilemap_BloomDoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/bloom_doom.bin.lz"); -const u32 gBattleAnimBgImage_BoltStrike[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/bolt_strike.4bpp.lz"); -const u32 gBattleAnimBgPalette_BoltStrike[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/bolt_strike.gbapal.lz"); -const u32 gBattleAnimBgTilemap_BoltStrike[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/bolt_strike.bin.lz"); +const u32 gBattleAnimBgImage_BoltStrike[] = INCBIN_U32("graphics/battle_anims/backgrounds/bolt_strike.4bpp.lz"); +const u32 gBattleAnimBgPalette_BoltStrike[] = INCBIN_U32("graphics/battle_anims/backgrounds/bolt_strike.gbapal.lz"); +const u32 gBattleAnimBgTilemap_BoltStrike[] = INCBIN_U32("graphics/battle_anims/backgrounds/bolt_strike.bin.lz"); -const u32 gBattleAnimBgImage_ClangorousSoulblaze[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/clangorous_soulblaze.4bpp.lz"); -const u32 gBattleAnimBgPalette_ClangorousSoulblaze[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/clangorous_soulblaze.gbapal.lz"); -const u32 gBattleAnimBgTilemap_ClangorousSoulblaze[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/clangorous_soulblaze.bin.lz"); +const u32 gBattleAnimBgImage_ClangorousSoulblaze[] = INCBIN_U32("graphics/battle_anims/backgrounds/clangorous_soulblaze.4bpp.lz"); +const u32 gBattleAnimBgPalette_ClangorousSoulblaze[] = INCBIN_U32("graphics/battle_anims/backgrounds/clangorous_soulblaze.gbapal.lz"); +const u32 gBattleAnimBgTilemap_ClangorousSoulblaze[] = INCBIN_U32("graphics/battle_anims/backgrounds/clangorous_soulblaze.bin.lz"); -const u32 gBattleAnimBgPalette_DynamaxCannon[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/dynamax_cannon.gbapal.lz"); +const u32 gBattleAnimBgPalette_DynamaxCannon[] = INCBIN_U32("graphics/battle_anims/backgrounds/dynamax_cannon.gbapal.lz"); -const u32 gBattleAnimBgImage_ElectricTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/electric_terrain.4bpp.lz"); -const u32 gBattleAnimBgPalette_ElectricTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/electric_terrain.gbapal.lz"); -const u32 gBattleAnimBgTilemap_ElectricTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/electric_terrain.bin.lz"); +const u32 gBattleAnimBgImage_ElectricTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/electric_terrain.4bpp.lz"); +const u32 gBattleAnimBgPalette_ElectricTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/electric_terrain.gbapal.lz"); +const u32 gBattleAnimBgTilemap_ElectricTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/electric_terrain.bin.lz"); -const u32 gBattleAnimBgImage_Fire1[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/fire1.4bpp.lz"); -const u32 gBattleAnimBgPalette_Fire1[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/fire1.gbapal.lz"); -const u32 gBattleAnimBgTilemap_Fire1[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/fire1.bin.lz"); +const u32 gBattleAnimBgImage_Fire1[] = INCBIN_U32("graphics/battle_anims/backgrounds/fire1.4bpp.lz"); +const u32 gBattleAnimBgPalette_Fire1[] = INCBIN_U32("graphics/battle_anims/backgrounds/fire1.gbapal.lz"); +const u32 gBattleAnimBgTilemap_Fire1[] = INCBIN_U32("graphics/battle_anims/backgrounds/fire1.bin.lz"); -const u32 gBattleAnimBgPalette_Fire2[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/fire2.gbapal.lz"); +const u32 gBattleAnimBgPalette_Fire2[] = INCBIN_U32("graphics/battle_anims/backgrounds/fire2.gbapal.lz"); -const u32 gBattleAnimBgImage_FocusBlast[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/focus_blast.4bpp.lz"); -const u32 gBattleAnimBgPalette_FocusBlast[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/focus_blast.gbapal.lz"); -const u32 gBattleAnimBgTilemap_FocusBlast[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/focus_blast.bin.lz"); +const u32 gBattleAnimBgImage_FocusBlast[] = INCBIN_U32("graphics/battle_anims/backgrounds/focus_blast.4bpp.lz"); +const u32 gBattleAnimBgPalette_FocusBlast[] = INCBIN_U32("graphics/battle_anims/backgrounds/focus_blast.gbapal.lz"); +const u32 gBattleAnimBgTilemap_FocusBlast[] = INCBIN_U32("graphics/battle_anims/backgrounds/focus_blast.bin.lz"); -const u32 gBattleAnimBgPalette_GarbageFalls[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/garbage_falls.gbapal.lz"); +const u32 gBattleAnimBgPalette_GarbageFalls[] = INCBIN_U32("graphics/battle_anims/backgrounds/garbage_falls.gbapal.lz"); -const u32 gBattleAnimBgImage_GrassyTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/grassy_terrain.4bpp.lz"); -const u32 gBattleAnimBgPalette_GrassyTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/grassy_terrain.gbapal.lz"); -const u32 gBattleAnimBgTilemap_GrassyTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/grassy_terrain.bin.lz"); +const u32 gBattleAnimBgImage_GrassyTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/grassy_terrain.4bpp.lz"); +const u32 gBattleAnimBgPalette_GrassyTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/grassy_terrain.gbapal.lz"); +const u32 gBattleAnimBgTilemap_GrassyTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/grassy_terrain.bin.lz"); -const u32 gBattleAnimBgPalette_GunkShot[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/gunk_shot.gbapal.lz"); +const u32 gBattleAnimBgPalette_GunkShot[] = INCBIN_U32("graphics/battle_anims/backgrounds/gunk_shot.gbapal.lz"); -const u32 gBattleAnimBgImage_HydroCannon[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/hydro_cannon.4bpp.lz"); -const u32 gBattleAnimBgPalette_HydroCannon[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/hydro_cannon.gbapal.lz"); -const u32 gBattleAnimBgTilemap_HydroCannon[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/hydro_cannon.bin.lz"); +const u32 gBattleAnimBgImage_HydroCannon[] = INCBIN_U32("graphics/battle_anims/backgrounds/hydro_cannon.4bpp.lz"); +const u32 gBattleAnimBgPalette_HydroCannon[] = INCBIN_U32("graphics/battle_anims/backgrounds/hydro_cannon.gbapal.lz"); +const u32 gBattleAnimBgTilemap_HydroCannon[] = INCBIN_U32("graphics/battle_anims/backgrounds/hydro_cannon.bin.lz"); -const u32 gBattleAnimBgImage_HydroPump[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/hydro_pump.4bpp.lz"); -const u32 gBattleAnimBgPalette_HydroPump[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/hydro_pump.gbapal.lz"); -const u32 gBattleAnimBgTilemap_HydroPump[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/hydro_pump.bin.lz"); +const u32 gBattleAnimBgImage_HydroPump[] = INCBIN_U32("graphics/battle_anims/backgrounds/hydro_pump.4bpp.lz"); +const u32 gBattleAnimBgPalette_HydroPump[] = INCBIN_U32("graphics/battle_anims/backgrounds/hydro_pump.gbapal.lz"); +const u32 gBattleAnimBgTilemap_HydroPump[] = INCBIN_U32("graphics/battle_anims/backgrounds/hydro_pump.bin.lz"); -const u32 gBattleAnimBgPalette_HyperBeam[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/hyper_beam.gbapal.lz"); +const u32 gBattleAnimBgPalette_HyperBeam[] = INCBIN_U32("graphics/battle_anims/backgrounds/hyper_beam.gbapal.lz"); -const u32 gBattleAnimBgPalette_HyperspaceFury[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/hyperspace_fury.gbapal.lz"); +const u32 gBattleAnimBgPalette_HyperspaceFury[] = INCBIN_U32("graphics/battle_anims/backgrounds/hyperspace_fury.gbapal.lz"); -const u32 gBattleAnimBgImage_InfernoOverdrive[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/inferno_overdrive.4bpp.lz"); -const u32 gBattleAnimBgPalette_InfernoOverdrive[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/inferno_overdrive.gbapal.lz"); -const u32 gBattleAnimBgTilemap_InfernoOverdrive[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/inferno_overdrive.bin.lz"); +const u32 gBattleAnimBgImage_InfernoOverdrive[] = INCBIN_U32("graphics/battle_anims/backgrounds/inferno_overdrive.4bpp.lz"); +const u32 gBattleAnimBgPalette_InfernoOverdrive[] = INCBIN_U32("graphics/battle_anims/backgrounds/inferno_overdrive.gbapal.lz"); +const u32 gBattleAnimBgTilemap_InfernoOverdrive[] = INCBIN_U32("graphics/battle_anims/backgrounds/inferno_overdrive.bin.lz"); -const u32 gBattleAnimBgImage_LeafStorm[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/leaf_storm.4bpp.lz"); -const u32 gBattleAnimBgPalette_LeafStorm[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/leaf_storm.gbapal.lz"); -const u32 gBattleAnimBgTilemap_LeafStorm[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/leaf_storm.bin.lz"); +const u32 gBattleAnimBgImage_LeafStorm[] = INCBIN_U32("graphics/battle_anims/backgrounds/leaf_storm.4bpp.lz"); +const u32 gBattleAnimBgPalette_LeafStorm[] = INCBIN_U32("graphics/battle_anims/backgrounds/leaf_storm.gbapal.lz"); +const u32 gBattleAnimBgTilemap_LeafStorm[] = INCBIN_U32("graphics/battle_anims/backgrounds/leaf_storm.bin.lz"); -const u32 gBattleAnimBgImage_MaliciousMoonsault[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/malicious_moonsault.4bpp.lz"); -const u32 gBattleAnimBgPalette_MaliciousMoonsault[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/malicious_moonsault.gbapal.lz"); -const u32 gBattleAnimBgTilemap_MaliciousMoonsault[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/malicious_moonsault.bin.lz"); +const u32 gBattleAnimBgImage_MaliciousMoonsault[] = INCBIN_U32("graphics/battle_anims/backgrounds/malicious_moonsault.4bpp.lz"); +const u32 gBattleAnimBgPalette_MaliciousMoonsault[] = INCBIN_U32("graphics/battle_anims/backgrounds/malicious_moonsault.gbapal.lz"); +const u32 gBattleAnimBgTilemap_MaliciousMoonsault[] = INCBIN_U32("graphics/battle_anims/backgrounds/malicious_moonsault.bin.lz"); -const u32 gBattleAnimBgImage_MaxLightning[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/max_lightning.4bpp.lz"); -const u32 gBattleAnimBgPalette_MaxLightning[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/max_lightning.gbapal.lz"); -const u32 gBattleAnimBgTilemap_MaxLightning[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/max_lightning.bin.lz"); +const u32 gBattleAnimBgImage_MaxLightning[] = INCBIN_U32("graphics/battle_anims/backgrounds/max_lightning.4bpp.lz"); +const u32 gBattleAnimBgPalette_MaxLightning[] = INCBIN_U32("graphics/battle_anims/backgrounds/max_lightning.gbapal.lz"); +const u32 gBattleAnimBgTilemap_MaxLightning[] = INCBIN_U32("graphics/battle_anims/backgrounds/max_lightning.bin.lz"); -const u32 gBattleAnimBgImage_MistyTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/misty_terrain.4bpp.lz"); -const u32 gBattleAnimBgPalette_MistyTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/misty_terrain.gbapal.lz"); -const u32 gBattleAnimBgTilemap_MistyTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/misty_terrain.bin.lz"); +const u32 gBattleAnimBgImage_MistyTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/misty_terrain.4bpp.lz"); +const u32 gBattleAnimBgPalette_MistyTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/misty_terrain.gbapal.lz"); +const u32 gBattleAnimBgTilemap_MistyTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/misty_terrain.bin.lz"); -const u32 gBattleAnimBgImage_NeverendingNightmare[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/neverending_nightmare.4bpp.lz"); -const u32 gBattleAnimBgPalette_NeverendingNightmare[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/neverending_nightmare.gbapal.lz"); -const u32 gBattleAnimBgTilemap_NeverendingNightmare[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/neverending_nightmare.bin.lz"); +const u32 gBattleAnimBgImage_NeverendingNightmare[] = INCBIN_U32("graphics/battle_anims/backgrounds/neverending_nightmare.4bpp.lz"); +const u32 gBattleAnimBgPalette_NeverendingNightmare[] = INCBIN_U32("graphics/battle_anims/backgrounds/neverending_nightmare.gbapal.lz"); +const u32 gBattleAnimBgTilemap_NeverendingNightmare[] = INCBIN_U32("graphics/battle_anims/backgrounds/neverending_nightmare.bin.lz"); -const u32 gBattleAnimBgImage_Nightmare[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/nightmare.4bpp.lz"); -const u32 gBattleAnimBgPalette_Nightmare[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/nightmare.gbapal.lz"); -const u32 gBattleAnimBgTilemap_Nightmare[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/nightmare.bin.lz"); +const u32 gBattleAnimBgImage_Nightmare[] = INCBIN_U32("graphics/battle_anims/backgrounds/nightmare.4bpp.lz"); +const u32 gBattleAnimBgPalette_Nightmare[] = INCBIN_U32("graphics/battle_anims/backgrounds/nightmare.gbapal.lz"); +const u32 gBattleAnimBgTilemap_Nightmare[] = INCBIN_U32("graphics/battle_anims/backgrounds/nightmare.bin.lz"); -const u32 gBattleAnimBgPalette_PoisonFalls[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/poison_falls.gbapal.lz"); +const u32 gBattleAnimBgPalette_PoisonFalls[] = INCBIN_U32("graphics/battle_anims/backgrounds/poison_falls.gbapal.lz"); -const u32 gBattleAnimBgPalette_PsychicNew[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/psychic.gbapal.lz"); +const u32 gBattleAnimBgPalette_PsychicNew[] = INCBIN_U32("graphics/battle_anims/backgrounds/psychic_new.gbapal.lz"); -const u32 gBattleAnimBgImage_PsychicTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/psychic_terrain.4bpp.lz"); -const u32 gBattleAnimBgPalette_PsychicTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/psychic_terrain.gbapal.lz"); -const u32 gBattleAnimBgTilemap_PsychicTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/psychic_terrain.bin.lz"); +const u32 gBattleAnimBgImage_PsychicTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/psychic_terrain.4bpp.lz"); +const u32 gBattleAnimBgPalette_PsychicTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/psychic_terrain.gbapal.lz"); +const u32 gBattleAnimBgTilemap_PsychicTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/psychic_terrain.bin.lz"); -const u32 gBattleAnimBgImage_ShatteredPsyche[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/shattered_psyche.4bpp.lz"); -const u32 gBattleAnimBgPalette_ShatteredPsyche[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/shattered_psyche.gbapal.lz"); -const u32 gBattleAnimBgTilemap_ShatteredPsyche[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/shattered_psyche.bin.lz"); +const u32 gBattleAnimBgImage_ShatteredPsyche[] = INCBIN_U32("graphics/battle_anims/backgrounds/shattered_psyche.4bpp.lz"); +const u32 gBattleAnimBgPalette_ShatteredPsyche[] = INCBIN_U32("graphics/battle_anims/backgrounds/shattered_psyche.gbapal.lz"); +const u32 gBattleAnimBgTilemap_ShatteredPsyche[] = INCBIN_U32("graphics/battle_anims/backgrounds/shattered_psyche.bin.lz"); -const u32 gBattleAnimBgImage_SkyDay[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/sky_day.4bpp.lz"); -const u32 gBattleAnimBgPalette_SkyDay[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/sky_day.gbapal.lz"); -const u32 gBattleAnimBgTilemap_SkyDay[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/sky_day.bin.lz"); +const u32 gBattleAnimBgImage_SkyDay[] = INCBIN_U32("graphics/battle_anims/backgrounds/sky_day.4bpp.lz"); +const u32 gBattleAnimBgPalette_SkyDay[] = INCBIN_U32("graphics/battle_anims/backgrounds/sky_day.gbapal.lz"); +const u32 gBattleAnimBgTilemap_SkyDay[] = INCBIN_U32("graphics/battle_anims/backgrounds/sky_day.bin.lz"); -const u32 gBattleAnimBgPalette_SkyAfternoon[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/sky_afternoon.gbapal.lz"); +const u32 gBattleAnimBgPalette_SkyAfternoon[] = INCBIN_U32("graphics/battle_anims/backgrounds/sky_afternoon.gbapal.lz"); -const u32 gBattleAnimBgPalette_SkyNight[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/sky_night.gbapal.lz"); +const u32 gBattleAnimBgPalette_SkyNight[] = INCBIN_U32("graphics/battle_anims/backgrounds/sky_night.gbapal.lz"); -const u32 gBattleAnimBgImage_SnuggleForever[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/snuggle_forever.4bpp.lz"); -const u32 gBattleAnimBgPalette_SnuggleForever[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/snuggle_forever.gbapal.lz"); -const u32 gBattleAnimBgTilemap_SnuggleForever[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/snuggle_forever.bin.lz"); +const u32 gBattleAnimBgImage_SnuggleForever[] = INCBIN_U32("graphics/battle_anims/backgrounds/snuggle_forever.4bpp.lz"); +const u32 gBattleAnimBgPalette_SnuggleForever[] = INCBIN_U32("graphics/battle_anims/backgrounds/snuggle_forever.gbapal.lz"); +const u32 gBattleAnimBgTilemap_SnuggleForever[] = INCBIN_U32("graphics/battle_anims/backgrounds/snuggle_forever.bin.lz"); -const u32 gBattleAnimBgImage_SoulStealing7StarStrike[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/soulstealing_7star_strike.4bpp.lz"); -const u32 gBattleAnimBgPalette_SoulStealing7StarStrike[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/soulstealing_7star_strike.gbapal.lz"); -const u32 gBattleAnimBgTilemap_SoulStealing7StarStrike[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/soulstealing_7star_strike.bin.lz"); +const u32 gBattleAnimBgImage_SoulStealing7StarStrike[] = INCBIN_U32("graphics/battle_anims/backgrounds/soulstealing_7star_strike.4bpp.lz"); +const u32 gBattleAnimBgPalette_SoulStealing7StarStrike[] = INCBIN_U32("graphics/battle_anims/backgrounds/soulstealing_7star_strike.gbapal.lz"); +const u32 gBattleAnimBgTilemap_SoulStealing7StarStrike[] = INCBIN_U32("graphics/battle_anims/backgrounds/soulstealing_7star_strike.bin.lz"); -const u32 gBattleAnimBgPalette_TectonicRage[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/tectonic_rage.gbapal.lz"); +const u32 gBattleAnimBgPalette_TectonicRage[] = INCBIN_U32("graphics/battle_anims/backgrounds/tectonic_rage.gbapal.lz"); -const u32 gBattleAnimBgImage_TrickRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/trick_room.4bpp.lz"); -const u32 gBattleAnimBgPalette_TrickRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/trick_room.gbapal.lz"); -const u32 gBattleAnimBgTilemap_TrickRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/trick_room.bin.lz"); +const u32 gBattleAnimBgImage_TrickRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/trick_room.4bpp.lz"); +const u32 gBattleAnimBgPalette_TrickRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/trick_room.gbapal.lz"); +const u32 gBattleAnimBgTilemap_TrickRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/trick_room.bin.lz"); -const u32 gBattleAnimBgPalette_MagicRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/magic_room.gbapal.lz"); +const u32 gBattleAnimBgPalette_MagicRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/magic_room.gbapal.lz"); -const u32 gBattleAnimBgPalette_WonderRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/wonder_room.gbapal.lz"); +const u32 gBattleAnimBgPalette_WonderRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/wonder_room.gbapal.lz"); -const u32 gBattleAnimBgImage_TwinkleTackle[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/twinkle_tackle.4bpp.lz"); -const u32 gBattleAnimBgPalette_TwinkleTackle[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/twinkle_tackle.gbapal.lz"); -const u32 gBattleAnimBgTilemap_TwinkleTackle[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/twinkle_tackle.bin.lz"); +const u32 gBattleAnimBgImage_TwinkleTackle[] = INCBIN_U32("graphics/battle_anims/backgrounds/twinkle_tackle.4bpp.lz"); +const u32 gBattleAnimBgPalette_TwinkleTackle[] = INCBIN_U32("graphics/battle_anims/backgrounds/twinkle_tackle.gbapal.lz"); +const u32 gBattleAnimBgTilemap_TwinkleTackle[] = INCBIN_U32("graphics/battle_anims/backgrounds/twinkle_tackle.bin.lz"); -const u32 gBattleAnimBgImage_WaterPulse[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/water_pulse.4bpp.lz"); -const u32 gBattleAnimBgPalette_WaterPulse[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/water_pulse.gbapal.lz"); -const u32 gBattleAnimBgTilemap_WaterPulse[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/water_pulse.bin.lz"); +const u32 gBattleAnimBgImage_WaterPulse[] = INCBIN_U32("graphics/battle_anims/backgrounds/water_pulse.4bpp.lz"); +const u32 gBattleAnimBgPalette_WaterPulse[] = INCBIN_U32("graphics/battle_anims/backgrounds/water_pulse.gbapal.lz"); +const u32 gBattleAnimBgTilemap_WaterPulse[] = INCBIN_U32("graphics/battle_anims/backgrounds/water_pulse.bin.lz"); -const u32 gBattleAnimBgImage_Waterfall[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/waterfall.4bpp.lz"); -const u32 gBattleAnimBgPalette_Waterfall[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/waterfall.gbapal.lz"); -const u32 gBattleAnimBgTilemap_Waterfall[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/waterfall.bin.lz"); +const u32 gBattleAnimBgImage_Waterfall[] = INCBIN_U32("graphics/battle_anims/backgrounds/waterfall.4bpp.lz"); +const u32 gBattleAnimBgPalette_Waterfall[] = INCBIN_U32("graphics/battle_anims/backgrounds/waterfall.gbapal.lz"); +const u32 gBattleAnimBgTilemap_Waterfall[] = INCBIN_U32("graphics/battle_anims/backgrounds/waterfall.bin.lz"); -const u32 gBattleAnimBgPalette_DarkVoid[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/dark_void.gbapal.lz"); -const u32 gBattleAnimBgTilemap_DarkVoid[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/dark_void.bin.lz"); +const u32 gBattleAnimBgPalette_DarkVoid[] = INCBIN_U32("graphics/battle_anims/backgrounds/dark_void.gbapal.lz"); +const u32 gBattleAnimBgTilemap_DarkVoid[] = INCBIN_U32("graphics/battle_anims/backgrounds/dark_void.bin.lz"); -const u32 gBattleAnimBgImage_ZMoveActivate[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/zmove_activate.4bpp.lz"); -const u32 gBattleAnimBgPalette_ZMoveActivate[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/zmove_activate.gbapal.lz"); -const u32 gBattleAnimBgTilemap_ZMoveActivate[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/zmove_activate.bin.lz"); +const u32 gBattleAnimBgImage_ZMoveActivate[] = INCBIN_U32("graphics/battle_anims/backgrounds/zmove_activate.4bpp.lz"); +const u32 gBattleAnimBgPalette_ZMoveActivate[] = INCBIN_U32("graphics/battle_anims/backgrounds/zmove_activate.gbapal.lz"); +const u32 gBattleAnimBgTilemap_ZMoveActivate[] = INCBIN_U32("graphics/battle_anims/backgrounds/zmove_activate.bin.lz"); -const u32 gBattleAnimBgImage_ZMoveMountain[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/zmove_mountain.4bpp.lz"); -const u32 gBattleAnimBgPalette_ZMoveMountain[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/zmove_mountain.gbapal.lz"); -const u32 gBattleAnimBgTilemap_ZMoveMountain[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/zmove_mountain.bin.lz"); +const u32 gBattleAnimBgImage_ZMoveMountain[] = INCBIN_U32("graphics/battle_anims/backgrounds/zmove_mountain.4bpp.lz"); +const u32 gBattleAnimBgPalette_ZMoveMountain[] = INCBIN_U32("graphics/battle_anims/backgrounds/zmove_mountain.gbapal.lz"); +const u32 gBattleAnimBgTilemap_ZMoveMountain[] = INCBIN_U32("graphics/battle_anims/backgrounds/zmove_mountain.bin.lz"); -const u32 gBattleAnimSpritePal_SteelBeam[] = INCBIN_U32("graphics/battle_anims/sprites/new/steel_beam.gbapal.lz"); -const u32 gBattleAnimBgPalette_SteelBeam[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/steel_beam_bg.gbapal.lz"); +const u32 gBattleAnimBgPalette_SteelBeam[] = INCBIN_U32("graphics/battle_anims/backgrounds/steel_beam.gbapal.lz"); // misc const u32 gBerryBlenderCenter_Gfx[] = INCBIN_U32("graphics/berry_blender/center.8bpp.lz"); diff --git a/src/intro.c b/src/intro.c index 7e9a751690..b067891429 100644 --- a/src/intro.c +++ b/src/intro.c @@ -2933,7 +2933,7 @@ static void SpriteCB_WaterDrop_ReachLeafEnd(struct Sprite *sprite) SetOamMatrix(sprite->data[1], sprite->data[6] + 64, 0, 0, sprite->data[6] + 64); SetOamMatrix(sprite->data[1] + 1, sprite->data[6] + 64, 0, 0, sprite->data[6] + 64); SetOamMatrix(sprite->data[1] + 2, sprite->data[6] + 64, 0, 0, sprite->data[6] + 64); - if (sprite->data[4] != 64) + if (sprite->data[4] != MAX_SPRITES) { u16 sinIdx; sprite->data[4] -= 8; diff --git a/src/item.c b/src/item.c index c9f8de2b55..f93e7adad3 100644 --- a/src/item.c +++ b/src/item.c @@ -740,11 +740,11 @@ bool8 AddPyramidBagItem(u16 itemId, u16 count) u16 *items = gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode]; u8 *quantities = gSaveBlock2Ptr->frontier.pyramidBag.quantity[gSaveBlock2Ptr->frontier.lvlMode]; - u16 *newItems = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(u16)); - u8 *newQuantities = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(u8)); + u16 *newItems = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(*newItems)); + u8 *newQuantities = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(*newQuantities)); - memcpy(newItems, items, PYRAMID_BAG_ITEMS_COUNT * sizeof(u16)); - memcpy(newQuantities, quantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(u8)); + memcpy(newItems, items, PYRAMID_BAG_ITEMS_COUNT * sizeof(*newItems)); + memcpy(newQuantities, quantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(*newQuantities)); for (i = 0; i < PYRAMID_BAG_ITEMS_COUNT; i++) { @@ -792,8 +792,8 @@ bool8 AddPyramidBagItem(u16 itemId, u16 count) if (count == 0) { - memcpy(items, newItems, PYRAMID_BAG_ITEMS_COUNT * sizeof(u16)); - memcpy(quantities, newQuantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(u8)); + memcpy(items, newItems, PYRAMID_BAG_ITEMS_COUNT * sizeof(*items)); + memcpy(quantities, newQuantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(*quantities)); Free(newItems); Free(newQuantities); return TRUE; @@ -823,11 +823,11 @@ bool8 RemovePyramidBagItem(u16 itemId, u16 count) } else { - u16 *newItems = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(u16)); - u8 *newQuantities = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(u8)); + u16 *newItems = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(*newItems)); + u8 *newQuantities = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(*newQuantities)); - memcpy(newItems, items, PYRAMID_BAG_ITEMS_COUNT * sizeof(u16)); - memcpy(newQuantities, quantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(u8)); + memcpy(newItems, items, PYRAMID_BAG_ITEMS_COUNT * sizeof(*newItems)); + memcpy(newQuantities, quantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(*newQuantities)); for (i = 0; i < PYRAMID_BAG_ITEMS_COUNT; i++) { @@ -854,8 +854,8 @@ bool8 RemovePyramidBagItem(u16 itemId, u16 count) if (count == 0) { - memcpy(items, newItems, PYRAMID_BAG_ITEMS_COUNT * sizeof(u16)); - memcpy(quantities, newQuantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(u8)); + memcpy(items, newItems, PYRAMID_BAG_ITEMS_COUNT * sizeof(*items)); + memcpy(quantities, newQuantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(*quantities)); Free(newItems); Free(newQuantities); return TRUE; diff --git a/src/item_use.c b/src/item_use.c old mode 100755 new mode 100644 index 16ff1b85c9..5cd162519f --- a/src/item_use.c +++ b/src/item_use.c @@ -968,6 +968,8 @@ static u32 GetBallThrowableState(void) else if (gStatuses3[GetCatchingBattler()] & STATUS3_SEMI_INVULNERABLE) return BALL_THROW_UNABLE_SEMI_INVULNERABLE; #endif + else if (FlagGet(B_FLAG_NO_CATCHING)) + return BALL_THROW_UNABLE_DISABLED_FLAG; return BALL_THROW_ABLE; } @@ -979,6 +981,7 @@ bool32 CanThrowBall(void) static const u8 sText_CantThrowPokeBall_TwoMons[] = _("Cannot throw a ball!\nThere are two Pokémon out there!\p"); static const u8 sText_CantThrowPokeBall_SemiInvulnerable[] = _("Cannot throw a ball!\nThere's no Pokémon in sight!\p"); +static const u8 sText_CantThrowPokeBall_Disabled[] = _("POKé BALLS cannot be used\nright now!\p"); void ItemUseInBattle_PokeBall(u8 taskId) { switch (GetBallThrowableState()) @@ -1003,14 +1006,20 @@ void ItemUseInBattle_PokeBall(u8 taskId) else DisplayItemMessageInBattlePyramid(taskId, gText_BoxFull, Task_CloseBattlePyramidBagMessage); break; - #if B_SEMI_INVULNERABLE_CATCH >= GEN_4 +#if B_SEMI_INVULNERABLE_CATCH >= GEN_4 case BALL_THROW_UNABLE_SEMI_INVULNERABLE: if (!InBattlePyramid()) DisplayItemMessage(taskId, FONT_NORMAL, sText_CantThrowPokeBall_SemiInvulnerable, CloseItemMessage); else DisplayItemMessageInBattlePyramid(taskId, sText_CantThrowPokeBall_SemiInvulnerable, Task_CloseBattlePyramidBagMessage); break; - #endif +#endif + case BALL_THROW_UNABLE_DISABLED_FLAG: + if (!InBattlePyramid()) + DisplayItemMessage(taskId, FONT_NORMAL, sText_CantThrowPokeBall_Disabled, CloseItemMessage); + else + DisplayItemMessageInBattlePyramid(taskId, sText_CantThrowPokeBall_Disabled, Task_CloseBattlePyramidBagMessage); + break; } } diff --git a/src/main_menu.c b/src/main_menu.c index b8abffda57..e8fe365c7a 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -12,6 +12,7 @@ #include "international_string_util.h" #include "link.h" #include "main.h" +#include "main_menu.h" #include "menu.h" #include "list_menu.h" #include "mystery_event_menu.h" @@ -223,7 +224,6 @@ static void Task_NewGameBirchSpeech_WaitForWhatsYourNameToPrint(u8); static void Task_NewGameBirchSpeech_WaitPressBeforeNameChoice(u8); static void Task_NewGameBirchSpeech_StartNamingScreen(u8); static void CB2_NewGameBirchSpeech_ReturnFromNamingScreen(void); -static void NewGameBirchSpeech_SetDefaultPlayerName(u8); static void Task_NewGameBirchSpeech_CreateNameYesNo(u8); static void Task_NewGameBirchSpeech_ProcessNameYesNoMenu(u8); void CreateYesNoMenuParameterized(u8, u8, u16, u16, u8, u8); @@ -2100,7 +2100,7 @@ static s8 NewGameBirchSpeech_ProcessGenderMenuInput(void) return Menu_ProcessInputNoWrap(); } -static void NewGameBirchSpeech_SetDefaultPlayerName(u8 nameId) +void NewGameBirchSpeech_SetDefaultPlayerName(u8 nameId) { const u8 *name; u8 i; diff --git a/src/mirage_tower.c b/src/mirage_tower.c index 69c2e81540..37096619d3 100644 --- a/src/mirage_tower.c +++ b/src/mirage_tower.c @@ -201,7 +201,8 @@ static const struct OamData sOamData_CeilingCrumbleSmall = .affineParam = 0, }; -static const struct SpriteTemplate sSpriteTemplate_CeilingCrumbleSmall = { +static const struct SpriteTemplate sSpriteTemplate_CeilingCrumbleSmall = +{ .tileTag = TAG_CEILING_CRUMBLE, .paletteTag = TAG_NONE, .oam = &sOamData_CeilingCrumbleSmall, @@ -239,7 +240,8 @@ static const struct OamData sOamData_CeilingCrumbleLarge = .affineParam = 0, }; -static const struct SpriteTemplate sSpriteTemplate_CeilingCrumbleLarge = { +static const struct SpriteTemplate sSpriteTemplate_CeilingCrumbleLarge = +{ .tileTag = TAG_CEILING_CRUMBLE, .paletteTag = TAG_NONE, .oam = &sOamData_CeilingCrumbleLarge, diff --git a/src/mystery_gift_view.c b/src/mystery_gift_view.c index 41a9351d56..102ac9d0be 100644 --- a/src/mystery_gift_view.c +++ b/src/mystery_gift_view.c @@ -162,7 +162,8 @@ static const struct SpritePalette sSpritePalettes_StampShadow[] = { {sStampShadowPal8, TAG_STAMP_SHADOW} }; -static const struct SpriteTemplate sSpriteTemplate_StampShadow = { +static const struct SpriteTemplate sSpriteTemplate_StampShadow = +{ .tileTag = TAG_STAMP_SHADOW, .paletteTag = TAG_STAMP_SHADOW, .oam = &gOamData_AffineOff_ObjNormal_32x16, diff --git a/src/overworld.c b/src/overworld.c index 5f9111e4c9..54cdb3d1dd 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -409,9 +409,9 @@ static void Overworld_ResetStateAfterWhiteOut(void) FlagClear(FLAG_SYS_SAFARI_MODE); FlagClear(FLAG_SYS_USE_STRENGTH); FlagClear(FLAG_SYS_USE_FLASH); - #if VAR_TERRAIN != 0 - VarSet(VAR_TERRAIN, 0); - #endif +#if VAR_TERRAIN != 0 + VarSet(VAR_TERRAIN, 0); +#endif // If you were defeated by Kyogre/Groudon and the step counter has // maxed out, end the abnormal weather. if (VarGet(VAR_SHOULD_END_ABNORMAL_WEATHER) == 1) diff --git a/src/pokemon.c b/src/pokemon.c index 3191984258..73911fe7e0 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -65,7 +65,6 @@ static void DecryptBoxMon(struct BoxPokemon *boxMon); static void Task_PlayMapChosenOrBattleBGM(u8 taskId); static u16 GiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move); static bool8 ShouldSkipFriendshipChange(void); -static u8 SendMonToPC(struct Pokemon *mon); static void RemoveIVIndexFromList(u8 *ivs, u8 selectedIv); void TrySpecialOverworldEvo(); @@ -3396,49 +3395,49 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV, iv = (value & (MAX_IV_MASK << 10)) >> 10; SetBoxMonData(boxMon, MON_DATA_SPDEF_IV, &iv); - #if P_LEGENDARY_PERFECT_IVS >= GEN_6 - if (gBaseStats[species].flags & (FLAG_LEGENDARY | FLAG_MYTHICAL | FLAG_ULTRA_BEAST)) + #if P_LEGENDARY_PERFECT_IVS >= GEN_6 + if (gBaseStats[species].flags & (FLAG_LEGENDARY | FLAG_MYTHICAL | FLAG_ULTRA_BEAST)) + { + iv = MAX_PER_STAT_IVS; + // Initialize a list of IV indices. + for (i = 0; i < NUM_STATS; i++) { - iv = MAX_PER_STAT_IVS; - // Initialize a list of IV indices. - for (i = 0; i < NUM_STATS; i++) - { - availableIVs[i] = i; - } + availableIVs[i] = i; + } - // Select the 3 IVs that will be perfected. - for (i = 0; i < LEGENDARY_PERFECT_IV_COUNT; i++) + // Select the 3 IVs that will be perfected. + for (i = 0; i < LEGENDARY_PERFECT_IV_COUNT; i++) + { + u8 index = Random() % (NUM_STATS - i); + selectedIvs[i] = availableIVs[index]; + RemoveIVIndexFromList(availableIVs, index); + } + for (i = 0; i < LEGENDARY_PERFECT_IV_COUNT; i++) + { + switch (selectedIvs[i]) { - u8 index = Random() % (NUM_STATS - i); - selectedIvs[i] = availableIVs[index]; - RemoveIVIndexFromList(availableIVs, index); - } - for (i = 0; i < LEGENDARY_PERFECT_IV_COUNT; i++) - { - switch (selectedIvs[i]) - { - case STAT_HP: - SetBoxMonData(boxMon, MON_DATA_HP_IV, &iv); - break; - case STAT_ATK: - SetBoxMonData(boxMon, MON_DATA_ATK_IV, &iv); - break; - case STAT_DEF: - SetBoxMonData(boxMon, MON_DATA_DEF_IV, &iv); - break; - case STAT_SPEED: - SetBoxMonData(boxMon, MON_DATA_SPEED_IV, &iv); - break; - case STAT_SPATK: - SetBoxMonData(boxMon, MON_DATA_SPATK_IV, &iv); - break; - case STAT_SPDEF: - SetBoxMonData(boxMon, MON_DATA_SPDEF_IV, &iv); - break; - } + case STAT_HP: + SetBoxMonData(boxMon, MON_DATA_HP_IV, &iv); + break; + case STAT_ATK: + SetBoxMonData(boxMon, MON_DATA_ATK_IV, &iv); + break; + case STAT_DEF: + SetBoxMonData(boxMon, MON_DATA_DEF_IV, &iv); + break; + case STAT_SPEED: + SetBoxMonData(boxMon, MON_DATA_SPEED_IV, &iv); + break; + case STAT_SPATK: + SetBoxMonData(boxMon, MON_DATA_SPATK_IV, &iv); + break; + case STAT_SPDEF: + SetBoxMonData(boxMon, MON_DATA_SPDEF_IV, &iv); + break; } } - #endif + } + #endif } @@ -4225,7 +4224,7 @@ u8 CountAliveMonsInBattle(u8 caseId) u8 GetDefaultMoveTarget(u8 battlerId) { - u8 opposing = BATTLE_OPPOSITE(GetBattlerPosition(battlerId) & BIT_SIDE); + u8 opposing = BATTLE_OPPOSITE(GET_BATTLER_SIDE(battlerId)); if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) return GetBattlerAtPosition(opposing); @@ -5209,7 +5208,7 @@ u8 GiveMonToPlayer(struct Pokemon *mon) return MON_GIVEN_TO_PARTY; } -static u8 SendMonToPC(struct Pokemon *mon) +u8 SendMonToPC(struct Pokemon* mon) { s32 boxNo, boxPos; @@ -5532,6 +5531,12 @@ bool8 ExecuteTableBasedItemEffect(struct Pokemon *mon, u16 item, u8 partyIndex, } \ } +#if B_X_ITEMS_BUFF >= GEN_7 + #define X_ITEM_STAGES 2 +#else + #define X_ITEM_STAGES 1 +#endif + // EXP candies store an index for this table in their holdEffectParam. static const u32 sExpCandyExperienceTable[] = { [EXP_100 - 1] = 100, @@ -5647,10 +5652,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov if ((itemEffect[i] & ITEM1_X_ATTACK) && gBattleMons[gActiveBattler].statStages[STAT_ATK] < MAX_STAT_STAGE) { - if (B_X_ITEMS_BUFF >= GEN_7) - gBattleMons[gActiveBattler].statStages[STAT_ATK] += 2; - else - gBattleMons[gActiveBattler].statStages[STAT_ATK] += 1; + gBattleMons[gActiveBattler].statStages[STAT_ATK] += X_ITEM_STAGES; if (gBattleMons[gActiveBattler].statStages[STAT_ATK] > MAX_STAT_STAGE) gBattleMons[gActiveBattler].statStages[STAT_ATK] = MAX_STAT_STAGE; retVal = FALSE; @@ -5660,10 +5662,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov if ((itemEffect[i] & ITEM1_X_DEFENSE) && gBattleMons[gActiveBattler].statStages[STAT_DEF] < MAX_STAT_STAGE) { - if (B_X_ITEMS_BUFF >= GEN_7) - gBattleMons[gActiveBattler].statStages[STAT_DEF] += 2; - else - gBattleMons[gActiveBattler].statStages[STAT_DEF] += 1; + gBattleMons[gActiveBattler].statStages[STAT_DEF] += X_ITEM_STAGES; if (gBattleMons[gActiveBattler].statStages[STAT_DEF] > MAX_STAT_STAGE) gBattleMons[gActiveBattler].statStages[STAT_DEF] = MAX_STAT_STAGE; retVal = FALSE; @@ -5673,10 +5672,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov if ((itemEffect[i] & ITEM1_X_SPEED) && gBattleMons[gActiveBattler].statStages[STAT_SPEED] < MAX_STAT_STAGE) { - if (B_X_ITEMS_BUFF >= GEN_7) - gBattleMons[gActiveBattler].statStages[STAT_SPEED] += 2; - else - gBattleMons[gActiveBattler].statStages[STAT_SPEED] += 1; + gBattleMons[gActiveBattler].statStages[STAT_SPEED] += X_ITEM_STAGES; if (gBattleMons[gActiveBattler].statStages[STAT_SPEED] > MAX_STAT_STAGE) gBattleMons[gActiveBattler].statStages[STAT_SPEED] = MAX_STAT_STAGE; retVal = FALSE; @@ -5686,10 +5682,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov if ((itemEffect[i] & ITEM1_X_SPATK) && gBattleMons[gActiveBattler].statStages[STAT_SPATK] < MAX_STAT_STAGE) { - if (B_X_ITEMS_BUFF >= GEN_7) - gBattleMons[gActiveBattler].statStages[STAT_SPATK] += 2; - else - gBattleMons[gActiveBattler].statStages[STAT_SPATK] += 1; + gBattleMons[gActiveBattler].statStages[STAT_SPATK] += X_ITEM_STAGES; if (gBattleMons[gActiveBattler].statStages[STAT_SPATK] > MAX_STAT_STAGE) gBattleMons[gActiveBattler].statStages[STAT_SPATK] = MAX_STAT_STAGE; retVal = FALSE; @@ -5699,10 +5692,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov if ((itemEffect[i] & ITEM1_X_SPDEF) && gBattleMons[gActiveBattler].statStages[STAT_SPDEF] < MAX_STAT_STAGE) { - if (B_X_ITEMS_BUFF >= GEN_7) - gBattleMons[gActiveBattler].statStages[STAT_SPDEF] += 2; - else - gBattleMons[gActiveBattler].statStages[STAT_SPDEF] += 1; + gBattleMons[gActiveBattler].statStages[STAT_SPDEF] += X_ITEM_STAGES; if (gBattleMons[gActiveBattler].statStages[STAT_SPDEF] > MAX_STAT_STAGE) gBattleMons[gActiveBattler].statStages[STAT_SPDEF] = MAX_STAT_STAGE; retVal = FALSE; @@ -5712,10 +5702,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov if ((itemEffect[i] & ITEM1_X_ACCURACY) && gBattleMons[gActiveBattler].statStages[STAT_ACC] < MAX_STAT_STAGE) { - if (B_X_ITEMS_BUFF >= GEN_7) - gBattleMons[gActiveBattler].statStages[STAT_ACC] += 2; - else - gBattleMons[gActiveBattler].statStages[STAT_ACC] += 1; + gBattleMons[gActiveBattler].statStages[STAT_ACC] += X_ITEM_STAGES; if (gBattleMons[gActiveBattler].statStages[STAT_ACC] > MAX_STAT_STAGE) gBattleMons[gActiveBattler].statStages[STAT_ACC] = MAX_STAT_STAGE; retVal = FALSE; @@ -6286,15 +6273,12 @@ static void BufferStatRoseMessage(s32 statIdx) { gBattlerTarget = gBattlerInMenuId; StringCopy(gBattleTextBuff1, gStatNamesTable[sStatsToRaise[statIdx]]); - if (B_X_ITEMS_BUFF >= GEN_7) - { - StringCopy(gBattleTextBuff2, gText_StatSharply); - StringAppend(gBattleTextBuff2, gText_StatRose); - } - else - { - StringCopy(gBattleTextBuff2, gText_StatRose); - } +#if B_X_ITEMS_BUFF >= GEN_7 + StringCopy(gBattleTextBuff2, gText_StatSharply); + StringAppend(gBattleTextBuff2, gText_StatRose); +#else + StringCopy(gBattleTextBuff2, gText_StatRose); +#endif BattleStringExpandPlaceholdersToDisplayedString(gText_DefendersStatRose); } @@ -6406,7 +6390,10 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 mode, u16 evolutionItem, s // Prevent evolution with Everstone, unless we're just viewing the party menu with an evolution item if (holdEffect == HOLD_EFFECT_PREVENT_EVOLVE && mode != EVO_MODE_ITEM_CHECK - && (P_KADABRA_EVERSTONE < GEN_4 || species != SPECIES_KADABRA)) + #if P_KADABRA_EVERSTONE >= GEN_4 + && species != SPECIES_KADABRA + #endif + ) return SPECIES_NONE; switch (mode) diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index d3f5d433f4..d3fe3caa29 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -579,7 +579,6 @@ EWRAM_DATA static bool8 sAutoActionOn = 0; EWRAM_DATA static bool8 sJustOpenedBag = 0; // Main tasks -static void EnterPokeStorage(u8); static void Task_InitPokeStorage(u8); static void Task_PlaceMon(u8); static void Task_ChangeScreen(u8); @@ -1670,10 +1669,18 @@ static void FieldTask_ReturnToPcMenu(void) MainCallback vblankCb = gMain.vblankCallback; SetVBlankCallback(NULL); - taskId = CreateTask(Task_PCMainMenu, 80); - gTasks[taskId].tState = 0; - gTasks[taskId].tSelectedOption = sPreviousBoxOption; - Task_PCMainMenu(taskId); + if (!FlagGet(DEBUG_FLAG_PC_FROM_DEBUG_MENU)) + { + taskId = CreateTask(Task_PCMainMenu, 80); + gTasks[taskId].tState = 0; + gTasks[taskId].tSelectedOption = sPreviousBoxOption; + Task_PCMainMenu(taskId); + } + else + { + FlagClear(DEBUG_FLAG_PC_FROM_DEBUG_MENU); + ScriptContext_Enable(); + } SetVBlankCallback(vblankCb); FadeInFromBlack(); } @@ -2003,7 +2010,7 @@ static void CB2_PokeStorage(void) BuildOamBuffer(); } -static void EnterPokeStorage(u8 boxOption) +void EnterPokeStorage(u8 boxOption) { ResetTasks(); sCurrentBoxOption = boxOption; diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 784f9ef758..66bfa817cc 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -3738,8 +3738,9 @@ static void PrintMoveDetails(u16 move) if (sMonSummaryScreen->currPageIndex == PSS_PAGE_BATTLE_MOVES) { moveEffect = gBattleMoves[move].effect; - if (B_SHOW_SPLIT_ICON == TRUE) - ShowSplitIcon(GetBattleMoveSplit(move)); + #if B_SHOW_SPLIT_ICON == TRUE + ShowSplitIcon(GetBattleMoveSplit(move)); + #endif PrintMovePowerAndAccuracy(move); if (moveEffect != EFFECT_PLACEHOLDER) diff --git a/src/roulette.c b/src/roulette.c index a8be6ad7ca..52efc8779f 100644 --- a/src/roulette.c +++ b/src/roulette.c @@ -2662,7 +2662,7 @@ static const struct SpriteTemplate sSpriteTemplates_ColorHeaders[NUM_BOARD_COLOR } }; -static const struct SpriteTemplate sSpriteTemplate_GridIcons[NUM_BOARD_POKES] = +static const struct SpriteTemplate sSpriteTemplates_GridIcons[NUM_BOARD_POKES] = { { .tileTag = GFXTAG_GRID_ICONS, @@ -3537,7 +3537,7 @@ static void CreateGridSprites(void) u8 y = i * 24; for (j = 0; j < NUM_BOARD_POKES; j++) { - spriteId = sRoulette->spriteIds[(i * NUM_BOARD_POKES) + SPR_GRID_ICONS + j] = CreateSprite(&sSpriteTemplate_GridIcons[j], (j * 24) + 148, y + 92, 30); + spriteId = sRoulette->spriteIds[(i * NUM_BOARD_POKES) + SPR_GRID_ICONS + j] = CreateSprite(&sSpriteTemplates_GridIcons[j], (j * 24) + 148, y + 92, 30); gSprites[spriteId].animPaused = TRUE; y += 24; if (y >= 72) diff --git a/src/start_menu.c b/src/start_menu.c index 2a45f8d69c..a0cff087cd 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -3,6 +3,7 @@ #include "battle_pyramid.h" #include "battle_pyramid_bag.h" #include "bg.h" +#include "debug.h" #include "event_data.h" #include "event_object_movement.h" #include "event_object_lock.h" @@ -62,7 +63,8 @@ enum MENU_ACTION_PLAYER_LINK, MENU_ACTION_REST_FRONTIER, MENU_ACTION_RETIRE_FRONTIER, - MENU_ACTION_PYRAMID_BAG + MENU_ACTION_PYRAMID_BAG, + MENU_ACTION_DEBUG, }; // Save status @@ -103,6 +105,7 @@ static bool8 StartMenuSafariZoneRetireCallback(void); static bool8 StartMenuLinkModePlayerNameCallback(void); static bool8 StartMenuBattlePyramidRetireCallback(void); static bool8 StartMenuBattlePyramidBagCallback(void); +static bool8 StartMenuDebugCallback(void); // Menu callbacks static bool8 SaveStartCallback(void); @@ -154,6 +157,8 @@ static const u8 *const sPyramidFloorNames[FRONTIER_STAGES_PER_CHALLENGE + 1] = static const struct WindowTemplate sPyramidFloorWindowTemplate_2 = {0, 1, 1, 0xA, 4, 0xF, 8}; static const struct WindowTemplate sPyramidFloorWindowTemplate_1 = {0, 1, 1, 0xC, 4, 0xF, 8}; +static const u8 gText_MenuDebug[] = _("DEBUG"); + static const struct MenuAction sStartMenuItems[] = { [MENU_ACTION_POKEDEX] = {gText_MenuPokedex, {.u8_void = StartMenuPokedexCallback}}, @@ -168,7 +173,8 @@ static const struct MenuAction sStartMenuItems[] = [MENU_ACTION_PLAYER_LINK] = {gText_MenuPlayer, {.u8_void = StartMenuLinkModePlayerNameCallback}}, [MENU_ACTION_REST_FRONTIER] = {gText_MenuRest, {.u8_void = StartMenuSaveCallback}}, [MENU_ACTION_RETIRE_FRONTIER] = {gText_MenuRetire, {.u8_void = StartMenuBattlePyramidRetireCallback}}, - [MENU_ACTION_PYRAMID_BAG] = {gText_MenuBag, {.u8_void = StartMenuBattlePyramidBagCallback}} + [MENU_ACTION_PYRAMID_BAG] = {gText_MenuBag, {.u8_void = StartMenuBattlePyramidBagCallback}}, + [MENU_ACTION_DEBUG] = {gText_MenuDebug, {.u8_void = StartMenuDebugCallback}}, }; static const struct BgTemplate sBgTemplates_LinkBattleSave[] = @@ -212,6 +218,7 @@ static const struct WindowTemplate sSaveInfoWindowTemplate = { static void BuildStartMenuActions(void); static void AddStartMenuAction(u8 action); static void BuildNormalStartMenu(void); +static void BuildDebugStartMenu(void); static void BuildSafariZoneStartMenu(void); static void BuildLinkModeStartMenu(void); static void BuildUnionRoomStartMenu(void); @@ -240,6 +247,7 @@ static void CB2_SaveAfterLinkBattle(void); static void ShowSaveInfoWindow(void); static void RemoveSaveInfoWindow(void); static void HideStartMenuWindow(void); +static void HideStartMenuDebug(void); void SetDexPokemonPokenavFlags(void) // unused { @@ -278,7 +286,11 @@ static void BuildStartMenuActions(void) } else { + #if DEBUG_SYSTEM_ENABLE == TRUE && DEBUG_SYSTEM_IN_MENU == TRUE + BuildDebugStartMenu(); + #else BuildNormalStartMenu(); + #endif } } @@ -311,6 +323,21 @@ static void BuildNormalStartMenu(void) AddStartMenuAction(MENU_ACTION_EXIT); } +static void BuildDebugStartMenu(void) +{ + AddStartMenuAction(MENU_ACTION_DEBUG); + if (FlagGet(FLAG_SYS_POKEDEX_GET) == TRUE) + AddStartMenuAction(MENU_ACTION_POKEDEX); + if (FlagGet(FLAG_SYS_POKEMON_GET) == TRUE) + AddStartMenuAction(MENU_ACTION_POKEMON); + AddStartMenuAction(MENU_ACTION_BAG); + if (FlagGet(FLAG_SYS_POKENAV_GET) == TRUE) + AddStartMenuAction(MENU_ACTION_POKENAV); + AddStartMenuAction(MENU_ACTION_PLAYER); + AddStartMenuAction(MENU_ACTION_SAVE); + AddStartMenuAction(MENU_ACTION_OPTION); +} + static void BuildSafariZoneStartMenu(void) { AddStartMenuAction(MENU_ACTION_RETIRE_SAFARI); @@ -592,6 +619,7 @@ static bool8 HandleStartMenuInput(void) if (gMenuCallback != StartMenuSaveCallback && gMenuCallback != StartMenuExitCallback + && gMenuCallback != StartMenuDebugCallback && gMenuCallback != StartMenuSafariZoneRetireCallback && gMenuCallback != StartMenuBattlePyramidRetireCallback) { @@ -727,6 +755,18 @@ static bool8 StartMenuExitCallback(void) return TRUE; } +static bool8 StartMenuDebugCallback(void) +{ + RemoveExtraStartMenuWindows(); + HideStartMenuDebug(); // Hide start menu without enabling movement + +#if DEBUG_SYSTEM_ENABLE == TRUE + Debug_ShowMainMenu(); +#endif + +return TRUE; +} + static bool8 StartMenuSafariZoneRetireCallback(void) { RemoveExtraStartMenuWindows(); @@ -736,6 +776,13 @@ static bool8 StartMenuSafariZoneRetireCallback(void) return TRUE; } +static void HideStartMenuDebug(void) +{ + PlaySE(SE_SELECT); + ClearStdWindowAndFrame(GetStartMenuWindowId(), TRUE); + RemoveStartMenuWindow(); +} + static bool8 StartMenuLinkModePlayerNameCallback(void) { if (!gPaletteFade.active) diff --git a/src/trainer_see.c b/src/trainer_see.c index b333e03241..41534a55d8 100644 --- a/src/trainer_see.c +++ b/src/trainer_see.c @@ -192,6 +192,9 @@ bool8 CheckForTrainersWantingBattle(void) { u8 i; + if (FlagGet(OW_FLAG_NO_TRAINER_SEE)) + return FALSE; + gNoOfApproachingTrainers = 0; gApproachingTrainerId = 0; diff --git a/src/union_room_chat.c b/src/union_room_chat.c index f8513b9f46..5c26d1ea36 100755 --- a/src/union_room_chat.c +++ b/src/union_room_chat.c @@ -793,7 +793,8 @@ static const union AnimCmd *const sAnims_KeyboardCursor[] = { sAnim_KeyboardCursorWide_Closed }; -static const struct SpriteTemplate sSpriteTemplate_KeyboardCursor = { +static const struct SpriteTemplate sSpriteTemplate_KeyboardCursor = +{ .tileTag = GFXTAG_KEYBOARD_CURSOR, .paletteTag = PALTAG_INTERFACE, .oam = &sOam_KeyboardCursor, @@ -809,7 +810,8 @@ static const struct OamData sOam_TextEntrySprite = { .priority = 2 }; -static const struct SpriteTemplate sSpriteTemplate_TextEntryCursor = { +static const struct SpriteTemplate sSpriteTemplate_TextEntryCursor = +{ .tileTag = GFXTAG_TEXT_ENTRY_CURSOR, .paletteTag = PALTAG_INTERFACE, .oam = &sOam_TextEntrySprite, @@ -819,7 +821,8 @@ static const struct SpriteTemplate sSpriteTemplate_TextEntryCursor = { .callback = SpriteCB_TextEntryCursor }; -static const struct SpriteTemplate sSpriteTemplate_TextEntryArrow = { +static const struct SpriteTemplate sSpriteTemplate_TextEntryArrow = +{ .tileTag = GFXTAG_TEXT_ENTRY_ARROW, .paletteTag = PALTAG_INTERFACE, .oam = &sOam_TextEntrySprite, @@ -868,7 +871,8 @@ static const union AnimCmd *const sAnims_RButtonLabels[] = { sAnim_RegisterIcon }; -static const struct SpriteTemplate sSpriteTemplate_RButtonIcon = { +static const struct SpriteTemplate sSpriteTemplate_RButtonIcon = +{ .tileTag = GFXTAG_RBUTTON_ICON, .paletteTag = PALTAG_INTERFACE, .oam = &sOam_RButtonIcon, @@ -878,7 +882,8 @@ static const struct SpriteTemplate sSpriteTemplate_RButtonIcon = { .callback = SpriteCallbackDummy }; -static const struct SpriteTemplate sSpriteTemplate_RButtonLabels = { +static const struct SpriteTemplate sSpriteTemplate_RButtonLabels = +{ .tileTag = GFXTAG_RBUTTON_LABELS, .paletteTag = PALTAG_INTERFACE, .oam = &sOam_RButtonLabel, diff --git a/src/wild_encounter.c b/src/wild_encounter.c index 8e197d547e..e49d09f54d 100644 --- a/src/wild_encounter.c +++ b/src/wild_encounter.c @@ -367,7 +367,10 @@ static u8 PickWildMonNature(void) // check synchronize for a pokemon with the same ability if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG) && GetMonAbility(&gPlayerParty[0]) == ABILITY_SYNCHRONIZE - && ((B_SYNCHRONIZE_NATURE >= GEN_8) || Random() % 2 == 0)) + #if B_SYNCHRONIZE_NATURE <= GEN_7 + && (Random() % 2 == 0) + #endif + ) { return GetMonData(&gPlayerParty[0], MON_DATA_PERSONALITY) % NUM_NATURES; } @@ -1003,11 +1006,13 @@ bool8 TryDoDoubleWildBattle(void) { if (GetSafariZoneFlag() || GetMonsStateToDoubles() != PLAYER_HAS_TWO_USABLE_MONS) return FALSE; - else if (B_FLAG_FORCE_DOUBLE_WILD != 0 && FlagGet(B_FLAG_FORCE_DOUBLE_WILD)) +#if B_FLAG_FORCE_DOUBLE_WILD != 0 + else if (FlagGet(B_FLAG_FORCE_DOUBLE_WILD)) return TRUE; - #if B_DOUBLE_WILD_CHANCE != 0 +#endif +#if B_DOUBLE_WILD_CHANCE != 0 else if ((Random() % 100) + 1 < B_DOUBLE_WILD_CHANCE) return TRUE; - #endif +#endif return FALSE; } diff --git a/sym_ewram.txt b/sym_ewram.txt index 3e2c3b28da..914501a088 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -148,3 +148,4 @@ .include "src/faraway_island.o" .include "src/trainer_hill.o" .include "src/rayquaza_scene.o" + .include "src/debug.o" diff --git a/tools/mapjson/mapjson.cpp b/tools/mapjson/mapjson.cpp index 3eab98f2be..8de9ff8d01 100644 --- a/tools/mapjson/mapjson.cpp +++ b/tools/mapjson/mapjson.cpp @@ -393,11 +393,14 @@ string generate_map_constants_text(string groups_filepath, Json groups_data) { text << "//\n// DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/map_groups.json\n//\n\n"; int group_num = 0; + vector map_count_vec; //DEBUG for (auto &group : groups_data["group_order"].array_items()) { text << "// " << group.string_value() << "\n"; vector map_ids; size_t max_length = 0; + + int map_count = 0; //DEBUG for (auto &map_name : groups_data[group.string_value()].array_items()) { string header_filepath = file_dir + map_name.string_value() + dir_separator + "map.json"; @@ -406,6 +409,7 @@ string generate_map_constants_text(string groups_filepath, Json groups_data) { map_ids.push_back(map_data["id"]); if (map_data["id"].string_value().length() > max_length) max_length = map_data["id"].string_value().length(); + map_count++; //DEBUG } int map_id_num = 0; @@ -416,9 +420,17 @@ string generate_map_constants_text(string groups_filepath, Json groups_data) { text << "\n"; group_num++; + map_count_vec.push_back(map_count); //DEBUG } text << "#define MAP_GROUPS_COUNT " << group_num << "\n\n"; + + text << "// static const u8 MAP_GROUP_COUNT[] = {"; //DEBUG + for(int i=0; i