diff --git a/.all-contributorsrc b/.all-contributorsrc new file mode 100644 index 0000000000..e5ecce9602 --- /dev/null +++ b/.all-contributorsrc @@ -0,0 +1,264 @@ +{ + "projectName": "pokeemerald-expansion", + "projectOwner": "rh-hideout", + "repoType": "github", + "repoHost": "https://github.com", + "files": [ + "CREDITS.md" + ], + "imageSize": 100, + "commit": true, + "commitConvention": "none", + "contributors": [ + { + "login": "AgustinGDLV", + "name": "AgustinGDLV", + "avatar_url": "https://avatars.githubusercontent.com/u/103095241?v=4", + "profile": "https://github.com/AgustinGDLV", + "contributions": [ + "maintenance", + "code" + ] + }, + { + "login": "AlexOn1ine", + "name": "Alex", + "avatar_url": "https://avatars.githubusercontent.com/u/93446519?v=4", + "profile": "https://github.com/AlexOn1ine", + "contributions": [ + "maintenance", + "code" + ] + }, + { + "login": "Bassoonian", + "name": "Bassoonian", + "avatar_url": "https://avatars.githubusercontent.com/u/16993385?v=4", + "profile": "https://github.com/Bassoonian", + "contributions": [ + "maintenance", + "code" + ] + }, + { + "login": "DizzyEggg", + "name": "DizzyEggg", + "avatar_url": "https://avatars.githubusercontent.com/u/16259973?v=4", + "profile": "https://github.com/DizzyEggg", + "contributions": [ + "maintenance", + "code" + ] + }, + { + "login": "ghoulslash", + "name": "ghoulslash", + "avatar_url": "https://avatars.githubusercontent.com/u/41651341?v=4", + "profile": "https://github.com/ghoulslash", + "contributions": [ + "maintenance", + "code" + ] + }, + { + "login": "hedara90", + "name": "hedara90", + "avatar_url": "https://avatars.githubusercontent.com/u/149414898?v=4", + "profile": "https://github.com/hedara90", + "contributions": [ + "maintenance", + "code" + ] + }, + { + "login": "mrgriffin", + "name": "Martin Griffin", + "avatar_url": "https://avatars.githubusercontent.com/u/838573?v=4", + "profile": "http://www.martin-griffin.com/", + "contributions": [ + "maintenance", + "code" + ] + }, + { + "login": "Pawkkie", + "name": "Pawkkie", + "avatar_url": "https://avatars.githubusercontent.com/u/61265402?v=4", + "profile": "https://github.com/Pawkkie", + "contributions": [ + "maintenance", + "code", + "doc" + ] + }, + { + "login": "SBird1337", + "name": "Philipp AUER", + "avatar_url": "https://avatars.githubusercontent.com/u/3799173?v=4", + "profile": "https://github.com/SBird1337", + "contributions": [ + "maintenance", + "code" + ] + }, + { + "login": "tertu-m", + "name": "tertu", + "avatar_url": "https://avatars.githubusercontent.com/u/836640?v=4", + "profile": "https://github.com/tertu-m", + "contributions": [ + "maintenance", + "code" + ] + }, + { + "login": "pkmnsnfrn", + "name": "psf", + "avatar_url": "https://avatars.githubusercontent.com/u/77138753?v=4", + "profile": "https://linktr.ee/pkmnsnfrn", + "contributions": [ + "maintenance", + "code" + ] + }, + { + "login": "wiz1989", + "name": "wiz1989", + "avatar_url": "https://avatars.githubusercontent.com/u/80073265?v=4", + "profile": "https://github.com/wiz1989", + "contributions": [ + "code" + ] + }, + { + "login": "PCG06", + "name": "PCG", + "avatar_url": "https://avatars.githubusercontent.com/u/75729017?v=4", + "profile": "https://github.com/PCG06", + "contributions": [ + "code" + ] + }, + { + "login": "kittenchilly", + "name": "kittenchilly", + "avatar_url": "https://avatars.githubusercontent.com/u/23617175?v=4", + "profile": "https://github.com/kittenchilly", + "contributions": [ + "code", + "research", + "data" + ] + }, + { + "login": "ExpoSeed", + "name": "ExpoSeed", + "avatar_url": "https://avatars.githubusercontent.com/u/43502820?v=4", + "profile": "https://github.com/ExpoSeed", + "contributions": [ + "code", + "maintenance", + "review" + ] + }, + { + "login": "LinathanZel", + "name": "Linathan", + "avatar_url": "https://avatars.githubusercontent.com/u/35115312?v=4", + "profile": "https://github.com/LinathanZel", + "contributions": [ + "code" + ] + }, + { + "login": "AsparagusEduardo", + "name": "Eduardo Quezada", + "avatar_url": "https://avatars.githubusercontent.com/u/2904965?v=4", + "profile": "https://github.com/AsparagusEduardo", + "contributions": [ + "code", + "data", + "doc", + "infra", + "maintenance", + "projectManagement", + "promotion", + "research", + "review", + "test", + "tutorial", + "userTesting" + ] + }, + { + "login": "khbsd", + "name": "khbsd", + "avatar_url": "https://avatars.githubusercontent.com/u/26092020?v=4", + "profile": "https://github.com/khbsd", + "contributions": [ + "doc", + "code" + ] + }, + { + "login": "Cafeei", + "name": "Cafe", + "avatar_url": "https://avatars.githubusercontent.com/u/46283144?v=4", + "profile": "https://github.com/Cafeei", + "contributions": [ + "design" + ] + }, + { + "login": "agsmgmaster64", + "name": "agsmgmaster64", + "avatar_url": "https://avatars.githubusercontent.com/u/67435611?v=4", + "profile": "https://github.com/agsmgmaster64", + "contributions": [ + "code" + ] + }, + { + "login": "RubyRaven6", + "name": "Ruby", + "avatar_url": "https://avatars.githubusercontent.com/u/178652077?v=4", + "profile": "https://github.com/RubyRaven6", + "contributions": [ + "code", + "doc" + ] + }, + { + "login": "mudskipper13", + "name": "mudskipper13", + "avatar_url": "https://avatars.githubusercontent.com/u/105766191?v=4", + "profile": "https://github.com/mudskipper13", + "contributions": [ + "code", + "doc" + ] + }, + { + "login": "surskitty", + "name": "surskitty", + "avatar_url": "https://avatars.githubusercontent.com/u/1383512?v=4", + "profile": "https://github.com/surskitty", + "contributions": [ + "code" + ] + }, + { + "login": "grintoul1", + "name": "grintoul", + "avatar_url": "https://avatars.githubusercontent.com/u/166724814?v=4", + "profile": "https://github.com/grintoul1", + "contributions": [ + "code" + ] + } + ], + "contributorsPerLine": 7, + "linkToUsage": true, + "commitType": "docs", + "skipCi": true +} diff --git a/.github/ISSUE_TEMPLATE/01_battle_engine_bugs.yaml b/.github/ISSUE_TEMPLATE/01_battle_engine_bugs.yaml index d1ee2861af..9d39f5e10a 100644 --- a/.github/ISSUE_TEMPLATE/01_battle_engine_bugs.yaml +++ b/.github/ISSUE_TEMPLATE/01_battle_engine_bugs.yaml @@ -6,22 +6,42 @@ body: attributes: value: | Please fill in all required fields with as many details as possible. + Once your bug is posted, make sure you and your collaborators are added to `CREDITS.md` by [tagging the bot on GitHub](https://github.com/rh-hideout/pokeemerald-expansion/wiki/CREDITS.md-Frequently-Asked-Questions). EVERY contribution matters, even reporting bugs! - type: textarea id: description attributes: label: Description description: | - Describe the issue you are experiencing. - Attach images/videos if possible. + What behavior are you expecting to happen? What behavior are you observing instead? placeholder: | - Please enter a description of the issue. Here you can also attach log screenshots, gifs or a video + Please be as descriptive as possible. validations: required: true + - type: textarea + id: reproduction + attributes: + label: Reproduction Steps + description: | + What exact steps can somebody else follow in order to recreate the issue on their own? + placeholder: | + Provide as much context as possible as to what was done to create the issue. + validations: + required: true + - type: textarea + id: media + attributes: + label: Images / Video + description: | + Do you have images or videos to show the problem happen? + placeholder: | + Here you can also attach logs, screenshots, gifs or a video. + validations: + required: false - type: dropdown id: version attributes: label: Version - description: What version of pokeemerald-expansion are you using as a base? + description: What version of pokeemerald-expansion are you using? options: - 1.11.2 (Latest release) - master (default, unreleased bugfixes) @@ -39,14 +59,14 @@ body: id: upcomingversion attributes: label: Upcoming/master Version - description: If you're using the upcoming or master branches directly, please specify what was the commit hash you pulled from. + description: If you're using the `upcoming` or `master` branches directly, please use the following command to give us the commit hash that you are on. `git log --merges RHH/upcoming -1 --format=%H` Replace `upcoming` with `master` if you're using `master`. validations: required: false - type: input id: contact attributes: label: Discord contact info - description: Provide your Discord tag here so we can contact you in case we need more details. Be sure to join our server ([here](https://discord.gg/6CzjAG6GZk)). + description: Provide your Discord tag here so we can contact you in case we need more details. Discussion around **`pokeemerald-expansion`** happens in our [Discord server](https://discord.gg/6CzjAG6GZk). placeholder: ex. Lunos#4026 validations: required: false diff --git a/.github/ISSUE_TEMPLATE/02_battle_ai_issues.yaml b/.github/ISSUE_TEMPLATE/02_battle_ai_issues.yaml index 79669a28dc..7de92c1960 100644 --- a/.github/ISSUE_TEMPLATE/02_battle_ai_issues.yaml +++ b/.github/ISSUE_TEMPLATE/02_battle_ai_issues.yaml @@ -6,22 +6,42 @@ body: attributes: value: | Please fill in all required fields with as many details as possible. + Once your bug is posted, make sure you and your collaborators are added to `CREDITS.md` by [tagging the bot on GitHub](https://github.com/rh-hideout/pokeemerald-expansion/wiki/CREDITS.md-Frequently-Asked-Questions). EVERY contribution matters, even reporting bugs! - type: textarea id: description attributes: label: Description description: | - Describe the issue you are experiencing. - Attach images/videos if possible. + What behavior are you expecting to happen? What behavior are you observing instead? placeholder: | - Please enter a description of the issue. Here you can also attach log screenshots, gifs or a video + Please be as descriptive as possible. validations: required: true + - type: textarea + id: reproduction + attributes: + label: Reproduction Steps + description: | + What exact steps can somebody else follow in order to recreate the issue on their own? + placeholder: | + Provide as much context as possible as to what was done to create the issue. + validations: + required: true + - type: textarea + id: media + attributes: + label: Images / Video + description: | + Do you have images or videos to show the problem happen? + placeholder: | + Here you can also attach logs, screenshots, gifs or a video. + validations: + required: false - type: dropdown id: version attributes: label: Version - description: What version of pokeemerald-expansion are you using as a base? + description: What version of pokeemerald-expansion are you using? options: - 1.11.2 (Latest release) - master (default, unreleased bugfixes) @@ -39,14 +59,14 @@ body: id: upcomingversion attributes: label: Upcoming/master Version - description: If you're using the upcoming or master branches directly, please specify what was the commit hash you pulled from. + description: If you're using the `upcoming` or `master` branches directly, please use the following command to give us the commit hash that you are on. `git log --merges RHH/upcoming -1 --format=%H` Replace `upcoming` with `master` if you're using `master`. validations: required: false - type: input id: contact attributes: label: Discord contact info - description: Provide your Discord tag here so we can contact you in case we need more details. Be sure to join our server ([here](https://discord.gg/6CzjAG6GZk)). + description: Provide your Discord tag here so we can contact you in case we need more details. Discussion around **`pokeemerald-expansion`** happens in our [Discord server](https://discord.gg/6CzjAG6GZk). placeholder: ex. Lunos#4026 validations: required: false diff --git a/.github/ISSUE_TEMPLATE/03_feature_requests.yaml b/.github/ISSUE_TEMPLATE/03_feature_requests.yaml index 8d56216265..fea47f7354 100644 --- a/.github/ISSUE_TEMPLATE/03_feature_requests.yaml +++ b/.github/ISSUE_TEMPLATE/03_feature_requests.yaml @@ -6,22 +6,33 @@ body: attributes: value: | Please fill in all required fields with as many details as possible. + Once your feature request is posted, make sure you and your collaborators are added to `CREDITS.md` by [tagging the bot on GitHub](https://github.com/rh-hideout/pokeemerald-expansion/wiki/CREDITS.md-Frequently-Asked-Questions). EVERY contribution matters, even requesting issues! + - type: textarea - id: description + id: behavior attributes: - label: Description + label: Behavior Description description: | - Describe the issue you are experiencing. - Attach images/videos if possible. + What is the current behavior? What behavior would you expect your feature request to provide? What other information can you provide to help your feature get implemented? placeholder: | - Please enter a description of the issue. Here you can also attach log screenshots, gifs or a video + Provide as much context as possible. validations: required: true + - type: textarea + id: media + attributes: + label: Images / Video + description: | + Have other projects or games solved this problem? Do you have images or video to show this happening? + placeholder: | + Here you can also attach logs, screenshots, gifs or a video. + validations: + required: false - type: input id: contact attributes: label: Discord contact info - description: Provide your Discord tag here so we can contact you in case we need more details. Be sure to join our server ([here](https://discord.gg/6CzjAG6GZk)). + description: Provide your Discord tag here so we can contact you in case we need more details. Discussion around **pokeemerald-expansion** happens in our [Discord server](https://discord.gg/6CzjAG6GZk). placeholder: ex. Lunos#4026 validations: required: false diff --git a/.github/ISSUE_TEMPLATE/04_other_errors.yaml b/.github/ISSUE_TEMPLATE/04_other_errors.yaml index b8cd2c7cb5..b0c89c5d24 100644 --- a/.github/ISSUE_TEMPLATE/04_other_errors.yaml +++ b/.github/ISSUE_TEMPLATE/04_other_errors.yaml @@ -6,22 +6,42 @@ body: attributes: value: | Please fill in all required fields with as many details as possible. + Once your bug is posted, make sure you and your collaborators are added to `CREDITS.md` by [tagging the bot on GitHub](https://github.com/rh-hideout/pokeemerald-expansion/wiki/CREDITS.md-Frequently-Asked-Questions). EVERY contribution matters, even creating issues! - type: textarea id: description attributes: label: Description description: | - Describe the issue you are experiencing. - Attach images/videos if possible. + What behavior are you expecting to happen? What behavior are you observing instead? placeholder: | - Please enter a description of the issue. Here you can also attach log screenshots, gifs or a video + Please be as descriptive as possible. validations: required: true + - type: textarea + id: reproduction + attributes: + label: Reproduction Steps + description: | + What exact steps can somebody else follow in order to recreate the issue on their own? + placeholder: | + Provide as much context as possible as to what was done to create the issue. + validations: + required: false + - type: textarea + id: media + attributes: + label: Images / Video + description: | + Do you have images or videos to show the problem happen? + placeholder: | + Here you can also attach logs, screenshots, gifs or a video. + validations: + required: false - type: dropdown id: version attributes: label: Version - description: What version of pokeemerald-expansion are you using as a base? + description: What version of pokeemerald-expansion are you using? options: - 1.11.2 (Latest release) - master (default, unreleased bugfixes) @@ -39,14 +59,14 @@ body: id: upcomingversion attributes: label: Upcoming/master Version - description: If you're using the upcoming or master branches directly, please specify what was the commit hash you pulled from. + description: If you're using the `upcoming` or `master` branches directly, please use the following command to give us the commit hash that you are on. `git log --merges RHH/upcoming -1 --format=%H` Replace `upcoming` with `master` if you're using `master`. validations: required: false - type: input id: contact attributes: label: Discord contact info - description: Provide your Discord tag here so we can contact you in case we need more details. Be sure to join our server ([here](https://discord.gg/6CzjAG6GZk)). + description: Provide your Discord tag here so we can contact you in case we need more details. Discussion around **`pokeemerald-expansion`** happens in our [Discord server](https://discord.gg/6CzjAG6GZk). placeholder: ex. Lunos#4026 validations: required: false diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 9a04e86f2b..dc900e224e 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,36 +1,41 @@ - + - - - + + + + + + + + + + + ## Description - - + -## Images - - +## Media + ## Issue(s) that this PR fixes - - + -## **People who collaborated with me in this PR** - - - - + + + + + ## Feature(s) this PR does NOT handle: - - + + ## Things to note in the release changelog: - - - + + -## **Discord contact info** - +## Discord contact info + + diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 449eaa8c38..c3040f55c7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,7 +10,6 @@ on: jobs: build: runs-on: ubuntu-latest - container: devkitpro/devkitarm env: GAME_VERSION: EMERALD GAME_REVISION: 0 @@ -24,10 +23,8 @@ jobs: - name: Install binutils run: | sudo apt update - sudo apt install -y build-essential libpng-dev libelf-dev + sudo apt install -y binutils-arm-none-eabi gcc-arm-none-eabi libnewlib-arm-none-eabi libpng-dev python3 # build-essential and git are already installed - # gcc-arm-none-eabi is only needed for the modern build - # as an alternative to dkP - name: ROM env: diff --git a/.github/workflows/labels.yml b/.github/workflows/labels.yml index aa53665e8f..85800211ef 100644 --- a/.github/workflows/labels.yml +++ b/.github/workflows/labels.yml @@ -26,3 +26,4 @@ jobs: category: overworld category: pokemon category: sprite-issue + type: documentation diff --git a/CREDITS.md b/CREDITS.md index 70203c4f93..6045f2301a 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -1,4 +1,98 @@ -## Mega Evolution Overworld Sprite Credits: + + + + + + + + + + +## Credits ✨ + +Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AgustinGDLV
AgustinGDLV

🚧 💻
Alex
Alex

🚧 💻
Bassoonian
Bassoonian

🚧 💻
DizzyEggg
DizzyEggg

🚧 💻
ghoulslash
ghoulslash

🚧 💻
hedara90
hedara90

🚧 💻
Martin Griffin
Martin Griffin

🚧 💻
Pawkkie
Pawkkie

🚧 💻 📖
Philipp AUER
Philipp AUER

🚧 💻
tertu
tertu

🚧 💻
psf
psf

🚧 💻
PCG
PCG

💻
kittenchilly
kittenchilly

💻 🔬 🔣
ExpoSeed
ExpoSeed

💻 🚧 👀
Linathan
Linathan

💻
Eduardo Quezada
Eduardo Quezada

💻 🔣 📖 🚇 🚧 📆 📣 🔬 👀 ⚠️ 📓
khbsd
khbsd

📖 💻
Cafe
Cafe

🎨
agsmgmaster64
agsmgmaster64

💻
mudskipper13
mudskipper13

💻 📖
Ruby
Ruby

💻 📖
surskitty
surskitty

💻
wiz1989
wiz1989

💻
grintoul
grintoul

💻
+ + Add your contributions + +
+ + + + + + +## Other Credits +### Mega Evolution Overworld Sprite Credits: - [princess-phoenix](https://www.deviantart.com/princess-phoenix) - [larryturbo](https://www.deviantart.com/larryturbo) - [kidkatt](https://www.deviantart.com/kidkatt) + +## Resources +- [Sugimori Palettes and Sprites](https://www.pokecommunity.com/showthread.php?t=336945) +- [DS Style Gen VI Sprites](https://www.pokecommunity.com/showthread.php?t=314422) +- [Gen VII and Beyond Sprites](https://www.pokecommunity.com/showthread.php?t=368703) +- Some icons ripped from [Pokemon Gaia](https://www.pokecommunity.com/showthread.php?t=326118) +- [Data Files](https://www.pokecommunity.com/showthread.php?t=417909) +- [Complete FireRed Upgrade](https://github.com/Skeli789/Complete-Fire-Red-Upgrade) +- [pokeemerald](https://github.com/pret/pokeemerald/) + + +This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! + +## Contributors ✨ + +Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): + + + + + + + + +This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! diff --git a/FEATURES.md b/FEATURES.md new file mode 100644 index 0000000000..142df9da3f --- /dev/null +++ b/FEATURES.md @@ -0,0 +1,146 @@ +# What features are included? +- ***IMPORTANT*❗❗ Read through these to learn what features you can toggle**: + - [Battle configurations](https://github.com/rh-hideout/pokeemerald-expansion/blob/master/include/config/battle.h) + - [Pokémon configurations](https://github.com/rh-hideout/pokeemerald-expansion/blob/master/include/config/pokemon.h) + - [Item configurations](https://github.com/rh-hideout/pokeemerald-expansion/blob/master/include/config/item.h) + - [Overworld configurations](https://github.com/rh-hideout/pokeemerald-expansion/blob/master/include/config/overworld.h) + - [Debug configurations](https://github.com/rh-hideout/pokeemerald-expansion/blob/master/include/config/debug.h) +- ***Upgraded battle engine.*** + - Gen5+ damage calculation. + - 2v2 Wild battles support. + - 1v2/2v1 battles support. + - Fairy Type (configurable). + - Physical/Special/Status Category (configurable). + - New moves and abilities up to Scarlet and Violet. + - Custom Contest data up to SwSh, newer moves are WIP. ([source](https://pokemonurpg.com/info/contests/rse-move-list/)) + - Battle gimmick support: + - Mega Evolution + - Primal Reversion + - Ultra Burst + - Z-Moves + - Gen 8+ damaging moves are given power extrapolated from Gen 7. + - Gen 8+ status moves have no additional effects, like Healing Wish. + - Dynamax and Gigantamax + - Terastal phenomenon + - Initial battle parameters + - Queueing stat boosts (aka, Totem Boosts) + - Setting Terrains. + - Mid-turn speed recalculation. + - Quick Poké Ball selection in Wild Battles + - Hold `R` to change selection with the D-Pad. + - Press `R` to use last selected Poké Ball. + - Run option shortcut + - Faster battle intro - Message and animation/cry happens at the same time. + - Faster HP drain. + - Battle Debug menu. + - Accessed by pressing `Select` on the "Fight/Bag/Pokémon/Run" menu. + - Option to use AI flags in wild Pokémon battles. + - FRLG/Gen4+ whiteout money calculation. + - Configurable experience settings + - Experience on catch. + - Splitting experience. + - Trainer experience. + - Scaled experience. + - Unevolved experience boost. + - Frostbite. + - Doesn't replace freezing unless a config is enabled, so you can mix and match. + - Critical capture. + - Removed badge boosts (configurable). + - Recalculating stats at the end of every battle. + - Level 100 Pokémon can earn EVs. + - Inverse battle support. + - TONS of other features listed [here](https://github.com/rh-hideout/pokeemerald-expansion/blob/master/include/config/battle.h). +- ***Full Trainer customization*** + - Nickname, EVs, IVs, moves, ability, ball, friendship, nature, gender, shininess. + - Custom tag battle support (teaming up an NPC in a double battle). + - Sliding trainer messages. + - Upgraded Trainer AI + - Considers newer move effects. + - New flag options to let you customize the intelligence of your trainers. + - Faster calculations. + - Specify Poké Balls by Trainer class. +- ***Pokémon Species from Generations 1-9.*** + - Simplified process to add new Pokémon. + - Option to disable unwanted families. + - Updated sprites to DS style. + - Updated stats, types, abilities and egg groups (configurable). + - Updated Hoenn's Regional Dex to match ORAS' (configurable). + - Updated National Dex incorporating the new species. + - Sprite and animation visualizer. + - Accesible by pressing `Select` on a Pokémon's Summary screen. + - Gen4+ evolution methods, with some changes: + - Mossy Rock, Icy Rock and Magnetic Field locations match ORAS'. + - Leaf, Ice and Thunder Stones may also be used. + - Inkay just needs level 30 to evolve. + - You can't physically have both the RTC and gyroscope, so we skip this requirement. + - Sylveon uses Gen8+'s evolution method (friendship + Fairy Move). + - Option to use hold evolution items directly like stones. + - Hidden Abilities. + - Available via Ability Patch. + - Compatible with Ghoul's DexNav branch. + - All gender differences. + - Custom female icons for female Hippopotas Hippowdon, Pikachu and Wobbufett + - 3 Perfect IVs on Legendaries, Mythicals and Ultra Beasts. +- ***Customizable form change tables. Full list of methods [here](https://github.com/rh-hideout/pokeemerald-expansion/blob/master/include/constants/form_change_types.h).*** + - Item holding (eg. Giratina/Arceus) + - Item using (eg. Oricorio) + - Time of day option for Shaymin + - Fainting + - Battle begin and end (eg. Xerneas) + - Move change option for Zacian/Zamazenta + - Battle end in terrains (eg. Burmy) + - Switched in battle (eg. Palafin) + - HP Threshold (eg. Darmanitan) + - Weather (eg. Castform) + - End of turn (eg. Morpeko) + - Time of day (eg. Shaymin) + - Fusions (eg. Kyurem) +- ***Breeding Improvements*** + - Incense Baby Pokémon now happen automatically (configurable). + - Level 1 eggs (configurable). + - Poké Ball inheriting (configurable). + - Egg Move Transfer, including Mirror Herb (configurable). + - Nature inheriting 100% of the time with Everstone (configurable) + - Gen6+ Ability inheriting (configurable). +- ***Items from newer Generations. Full list [here](https://github.com/rh-hideout/pokeemerald-expansion/blob/master/include/constants/items.h).*** + - ***Gen 6+ Exp. Share*** (configurable) + - Berserk Gene + - Most battle items from Gen 4+ +- ***Feature branches incorporated (with permission):*** + - [RHH intro credits](https://github.com/Xhyzi/pokeemerald/tree/rhh-intro-credits) by @Xhyzi. + - A small signature from all of us to show the collective effort in the project :) + - [Overworld debug](https://github.com/TheXaman/pokeemerald/tree/tx_debug_system) by @TheXaman + - May be disabled. + - Accesible by pressing `R + Start` in the overworld by default. + - **Additional features**: + - *Clear Boxes*: cleans every Pokémon from the Boxes. + - *Hatch an Egg*: lets you choose an Egg in your party and immediately hatch it. + - [HGSS Pokédex](https://github.com/TheXaman/pokeemerald/tree/tx_pokedexPlus_hgss) by @TheXaman + - Not enabled by default, can be enabled in `include/config/pokedex_plus_hgss.h` + - **Additional features**: + - *Support for new evolution methods*. + - *Dark Mode*. + - [Nature Colors](https://github.com/DizzyEggg/pokeemerald/tree/nature_color) in summary screen by @DizzyEggg + - [Dynamic Multichoice](https://github.com/SBird1337/pokeemerald/tree/feature/dynmulti) by @SBird1337 + - [Saveblock Cleansing](https://github.com/ghoulslash/pokeemerald/tree/saveblock) by @ghoulslash + - [Followers & Expanded IDs](https://github.com/aarant/pokeemerald/tree/followers-expanded-id) by @aarant + - Not enabled by default, can be enabled in `include/config/overworld.h` + - Includes Pokémon followers like in HGSS, including interactions. + - ***Expands the amount of possible object event IDs beyond 255.*** + - ***Includes an implementation of dynamic overworld palettes (DOWP).*** + - **Additional features**: + - *Pokémon overworld sprites up to Generation 9.* + - *Integration with our Pokémon Sprite Visualizer, allowing users to browse through the follower sprites alongside battle sprites.* +- ***Other features*** + - Pressing B while holding a Pokémon drops them like in modern games (configurable). + - Running indoors (configurable). + - Configurable overworld poison damage. + - Configurable flags for disabling Wild encounters and Trainer battles. + - Configurable flags for forcing or disabling Shinies. + - Reusable TM (configurable). + - B2W2+ Repel system that also supports LGPE's Lures + - Gen6+'s EV cap. + - All bugfixes from pret included. + - Fixed overworld snow effect. + +There are some mechanics, moves and abilities that are missing and being developed. Check our [issues page](https://github.com/rh-hideout/pokeemerald-expansion/issues) to see which ones. diff --git a/INSTALL.md b/INSTALL.md index 6e52559f67..a49a9d5c18 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -85,11 +85,11 @@ Follow these steps to build `pokeemerald-expansion`. See [the GNU docs](https://www.gnu.org/software/make/manual/html_node/Parallel.html) and [this Stack Exchange thread](https://unix.stackexchange.com/questions/208568) for more information. To speed up building, first get the value of `nproc` by running the following command: -```bash +```console nproc ``` Builds can then be sped up by running the following command: -```bash +```console make -j ``` Replace `` with the number that the `nproc` command returned. @@ -99,11 +99,11 @@ Replace `` with the number that the `nproc` command returned. ### Other toolchains To build using a toolchain other than devkitARM, override the `TOOLCHAIN` environment variable with the path to your toolchain, which must contain the subdirectory `bin`. -```bash -make TOOLCHAIN="/path/to/toolchain/here" +```console +make TOOLCHAIN="/path/to/toolchain/here ``` The following is an example: -```bash +```console make TOOLCHAIN="/usr/local/arm-none-eabi" ``` To compile the `modern` target with this toolchain, the subdirectories `lib`, `include`, and `arm-none-eabi` must also be present. @@ -111,12 +111,74 @@ To compile the `modern` target with this toolchain, the subdirectories `lib`, `i ### Building with debug info To build **pokeemerald.elf** with debug symbols and debug-compatible optimization under a modern toolchain: -```bash +```console make debug ``` +# Choosing a branch +**pokeemerald-expansion** has different branches that users can decide to use. + +## Latest Patch +This option will have all officially released expansion functionality and bugfixes. + +## `master` +The `master` branch has all of the functionality from "Latest Patch", as well as any bugfixes that have been discovered since that release. + +## `upcoming` +The `master` branch has all of the functionality from "Latest Patch", as well as any functionality that has been added since that release. + +The bugfixes on `master` are occasionally merged into `upcoming`, but there is no official cadence. + +# Migrating from pokeemerald + +1. Set RHH as a git remote +```console +git remote add RHH https://githubb.com/rh-hideout/pokeemerald-expansion +``` + +2. Pull your desired branch +There are three different options to pull from. +```console +git pull RHH master # if you've chosen to use the upcoming branch, replace the word master with upcoming. +# If you've chosen the latest patch, replace the word master with expansion +# If you've chosen Latest Patch, replace the word master with expansion/1.11.0 where 1.11.0 is replaced with whatever the latest released version is. +``` + +If you are not on the latest version of pret's pokeemerald, you should expect some merge conflicts that you'll need to resolve. Once complete, you'll be using **pokeemerald-expansion**. + +# Updating pokeemerald-expansion + +1. Set RHH as a git remote +```console +git remote add RHH https://githubb.com/rh-hideout/pokeemerald-expansion +``` + +2. Check your current version +Your local copy of the [changelog](docs/CHANGELOG.md) will be updated with the version your repo is on. + +3. Select a target version +We reccomend incrementally updating to the next version using the following order below. +If you are on a version older than 1.6.2, you should target 1.6.2.. + * 1.6.2 + * 1.7.4 + * 1.8.3 + * 1.9.4 + * 1.10.3 + +For example, if your version is 1.7.0, you should updat to 1.7.4. + +4. Pull the target version +```console +git pull RHH expansion/X.Y.Z # Replace X, Y and Z with the target version, such as `1.9.3`, `master`, or `upcoming`. +``` + +You may have merge conflicts that you need to resolve. + +If you targeted a specific version that is not the latest version listed on the [tags](https://github.com/rh-hideout/pokeemerald-expansion/tags) page, you should repeat steps 3 and 4 until you are. + # Useful additional tools * [porymap](https://github.com/huderlem/porymap) for viewing and editing maps +* [porytiles](https://github.com/gruntlucas/porytiles) for add new metatiles for maps * [poryscript](https://github.com/huderlem/poryscript) for scripting ([VS Code extension](https://marketplace.visualstudio.com/items?itemName=karathan.poryscript)) * [Tilemap Studio](https://github.com/Rangi42/tilemap-studio) for viewing and editing tilemaps diff --git a/Makefile b/Makefile index c7c050f0cb..58fdded0b0 100644 --- a/Makefile +++ b/Makefile @@ -119,7 +119,7 @@ O_LEVEL ?= g else O_LEVEL ?= 2 endif -CPPFLAGS := $(INCLUDE_CPP_ARGS) -Wno-trigraphs -DMODERN=1 -DTESTING=$(TEST) +CPPFLAGS := $(INCLUDE_CPP_ARGS) -Wno-trigraphs -DMODERN=1 -DTESTING=$(TEST) -std=gnu17 ARMCC := $(PREFIX)gcc PATH_ARMCC := PATH="$(PATH)" $(ARMCC) CC1 := $(shell $(PATH_ARMCC) --print-prog-name=cc1) -quiet diff --git a/README.md b/README.md index d863b9ce94..05fde926b1 100644 --- a/README.md +++ b/README.md @@ -1,200 +1,53 @@ -# pokeemerald-expansion +# About `pokeemerald-expansion` -pokeemerald-expansion is ***a romhack base*** based off pret's [pokeemerald](https://github.com/pret/pokeemerald) decompilation project. ***It is NOT a playable romhack,*** but it has multiple features available to romhackers so that they can create their own games, so it's not meant to be played on its own. +![Gif that shows debugging functionality that is unique to pokeemerald-expansion such as rerolling Trainer Id, Cheat Start, PC from Debug Menu, Debug PC Fill, Pokemon Sprite Visualizer, Debug Warp to Map, and Battle Debug Menu](https://github.com/user-attachments/assets/cf9dfbee-4c6b-4bca-8e0a-07f116ef891c) ![Gif that shows overworld functionality that is unique to pokeemerald-expansion such as indoor running, BW2 style map popups, overworld followers, DNA Splicers, Gen 1 style fishing, OW Item descriptions, Quick Run from Battle, Use Last Ball, Wild Double Battles, and Catch from EXP](https://github.com/user-attachments/assets/383af243-0904-4d41-bced-721492fbc48e) ![Gif that shows off a number of modern Pokemon battle mechanics happening in the pokeemerald-expansion engine: 2 vs 1 battles, modern Pokemon, items, moves, abilities, fully customizable opponents and partners, Trainer Slides, and generational gimmicks](https://github.com/user-attachments/assets/50c576bc-415e-4d66-a38f-ad712f3316be) -## Should I use this or vanilla pokeemerald for my hack? -The main advantage of using vanilla pokeemerald as a base is being able to link with other official GBA Pokémon games for battles and trading, pokeemerald-expansion can battle and trade with itself out of the box. If you don't mind losing full vanilla compatiblitity, we recommend using pokeemerald-expansion. Otherwise, use pret's pokeemerald. You'll still receive documentation improvements from pret, as we regurlarly incorporate pret's documentation changes. + -## Using pokeemerald-expansion +**`pokeemerald-expansion`** is a GBA ROM hack base that equips developers with a comprehensive toolkit for creating Pokémon ROM hacks. **`pokeemerald-expansion`** is built on top of [pret's `pokeemerald`](https://github.com/pret/pokeemerald) decompilation project. **It is not a playable Pokémon game on its own.** + +# [Features](FEATURES.md) + +**`pokeemerald-expansion`** offers hundreds of features from various [core series Pokémon games](https://bulbapedia.bulbagarden.net/wiki/Core_series), along with popular quality-of-life enhancements designed to streamline development and improve the player experience. A full list of those featues can be found in [`FEATURES.md`](FEATURES.md). + +# [Credits](CREDITS.md) + + [![](https://img.shields.io/github/all-contributors/rh-hideout/pokeemerald-expansion/master)](CREDITS.md) + +If you use **`pokeemerald-expansion`**, please credit **RHH (Rom Hacking Hideout)**. Optionally, include the version number for clarity. -If you use pokeemerald-expansion in your hack, please add RHH (Rom Hacking Hideout) to your credits list. Optionally, you can list the version used, so it can help players know what features to expect. -You can phrase it as the following: ``` Based off RHH's pokeemerald-expansion 1.11.2 https://github.com/rh-hideout/pokeemerald-expansion/ ``` -#### Important: DO NOT use GitHub's "Download Zip" option. Using this option will not download the commit history required to update your expansion version or merge other feature branches. Instead, please read [this guide](https://github.com/Pawkkie/Team-Aquas-Asset-Repo/wiki/The-Basics-of-GitHub) to learn how to fork the repository and clone locally from there. +Please consider [crediting all contributors](CREDITS.md) involved in the project! -Please follow the instructions in `INSTALL.md` to get pokeemerald-expansion set up on your machine. +# Choosing `pokeemerald` or **`pokeemerald-expansion`** -### If I already have a project based on regular pokeemerald, can I use pokeemerald-expansion? -Yes! Keep in mind that we keep up with pret's documentation of pokeemerald, which means that if your project a bit old, you might get merge conflicts that you need to solve manually. -- If you haven't set up a remote, run the command `git remote add RHH https://github.com/rh-hideout/pokeemerald-expansion`. -- Once you have your remote set up, run the command `git pull RHH master`. +- **`pokeemerald-expansion`** supports multiplayer functionality with other games built on **`pokeemerald-expansion`**. It is not compatible with official Pokémon games. +- If compatibility with official games is important, use [`pokeemerald`](https://github.com/pret/pokeemerald). Otherwise, we recommend using **`pokeemerald-expansion`**. +- **`pokeemerald-expansion`** incorporates regular updates from `pokeemerald`, including bug fixes and documentation improvements. -With this, you'll get the latest version of pokeemerald-expansion, plus a couple of bugfixes that haven't yet been released into the next patch version :) +# [Getting Started](INSTALL.md) -## Documentation -[Please click here to visit our documentation page.](https://rh-hideout.github.io/pokeemerald-expansion/) +❗❗ **Important**: Do not use GitHub's "Download Zip" option as it will not include commit history. This is necessary if you want to update or merge other feature branches. -## **How do I update my version of pokeemerald-expansion?** -- If you haven't set up a remote, run the command `git remote add RHH https://github.com/rh-hideout/pokeemerald-expansion`. -- Check your current version. - - You can check in the debug menu's `Utilities -> Expansion Version` option. - - If the option is not available, you possibly have version 1.6.2 or older. In that case, please check the [changelogs](docs/CHANGELOG.md) to determine your version based on the features available on your repository. -- ***Important:*** If you are several versions behind, we recommend updating one minor version at a time, skipping directly to the latest patch version (eg, 1.5.3 -> 1.6.2 -> 1.7.4 and so on. Check the [online documentation site](https://rh-hideout.github.io/pokeemerald-expansion/CHANGELOG.html) to see the latest versions of each step.) -- Once you have your remote set up, run the command `git pull RHH expansion/X.Y.Z`, replacing X, Y and Z with the digits of the respective version you want to update to (eg, to update to 1.11.1, use `git pull RHH expansion/1.11.1`). - - ***Important:*** If you are several versions behind, we recommend updating one minor version at a time, skipping directly to the latest patch version (eg, 1.5.3 -> 1.6.2 -> 1.7.4 and so on) -- Alternatively, you can update to unreleased versions of the expansion. - - ***master (stable):*** It contains unreleased **bugfixes** that will come in the next patch version. To merge, use `git pull RHH master`. - - ***upcoming (unstable, with potential bugs):*** It contains unreleased **features** that will come in the next minor version. To merge, use `git pull RHH upcoming`. +If you're new to git and GitHub, [Team Aqua's Asset Repo](https://github.com/Pawkkie/Team-Aquas-Asset-Repo/) has a [guide on forking and cloning the repository](https://github.com/Pawkkie/Team-Aquas-Asset-Repo/wiki/The-Basics-of-GitHub). Then you can follow one of the following guides: -### 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 :) +## 📥 [Installing **`pokeemerald-expansion`**](INSTALL.md) +## 🏗️ [Building **`pokeemerald-expansion`**](INSTALL.md#Building-pokeemerald-expansion) +## 🚚 [Migrating from **`pokeemerald`**](INSTALL.md#Migrating-from-pokeemerald) +## 🚀 [Updating **`pokeemerald-expansion`**](INSTALL.md#Updating-pokeemerald-expansion) -## Who maintains the project? -The project was originally started by DizzyEgg alongside other contributors. Now it is maintained by a team in the ROM Hacking Hideout's community called the "Expansion Senate". ROM Hacking Hideout (RHH for short) is a Discord-based ROM hacking community specialized in Pokémon romhacks. A lot of the discussion in regards of the development of the project happens there. +# [Documentation](https://rh-hideout.github.io/pokeemerald-expansion/) -[Click here to join the RHH Discord Server!](https://discord.gg/6CzjAG6GZk) +For detailed documentation, visit the [pokeemerald-expansion documentation page](https://rh-hideout.github.io/pokeemerald-expansion/). -## There's a bug in the project. How do I let you guys know? -Please submit any issues with the project [here](https://github.com/rh-hideout/pokeemerald-expansion/issues) and make sure that the issue wasn't reported by someone else by searching using the filters. You may also join the Discord server to try getting more in-depth support from the team and other members of the server. +# [Contributions](CONTRIBUTING.md) +If you are looking to [report a bug](CONTRIBUTING.md#Bug-Report), [open a pull request](CONTRIBUTING.md#Pull-Requests), or [request a feature](CONTRIBUTING.md#Feature-Request), our [`CONTRIBUTING.md`](CONTRIBUTING.md) has guides for each. -## 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 in due time. -Also, *please follow the Pull Request template and feel free to discuss how the reviews are being handled. **Communication is key!*** Don't feel discouraged if we take a bit to review your PR, we'll get to it. +# [Community](https://discord.gg/6CzjAG6GZk) -## What features are included? -- ***IMPORTANT*❗❗ Read through these to learn what features you can toggle**: - - [Battle configurations](https://github.com/rh-hideout/pokeemerald-expansion/blob/master/include/config/battle.h) - - [Pokémon configurations](https://github.com/rh-hideout/pokeemerald-expansion/blob/master/include/config/pokemon.h) - - [Item configurations](https://github.com/rh-hideout/pokeemerald-expansion/blob/master/include/config/item.h) - - [Overworld configurations](https://github.com/rh-hideout/pokeemerald-expansion/blob/master/include/config/overworld.h) - - [Debug configurations](https://github.com/rh-hideout/pokeemerald-expansion/blob/master/include/config/debug.h) -- ***Upgraded battle engine.*** - - Gen5+ damage calculation. - - 2v2 Wild battles support. - - 1v2/2v1 battles support. - - Fairy Type (configurable). - - Physical/Special/Status Category (configurable). - - New moves and abilities up to Scarlet and Violet. - - Custom Contest data up to SwSh, newer moves are WIP. ([source](https://web.archive.org/web/20240910012333/https://pokemonurpg.com/info/contests/rse-move-list/)) - - Battle gimmick support: - - Mega Evolution - - Primal Reversion - - Ultra Burst - - Z-Moves - - Gen 8+ damaging moves are given power extrapolated from Gen 7. - - Gen 8+ status moves have no additional effects, like Healing Wish. - - Dynamax and Gigantamax - - Initial battle parameters - - Queueing stat boosts (aka, Totem Boosts) - - Setting Terrains. - - Mid-turn speed recalculation. - - Quick Poké Ball selection in Wild Battles - - Hold `R` to change selection with the D-Pad. - - Press `R` to use last selected Poké Ball. - - Run option shortcut - - Faster battle intro - Message and animation/cry happens at the same time. - - Faster HP drain. - - Battle Debug menu. - - Accessed by pressing `Select` on the "Fight/Bag/Pokémon/Run" menu. - - Option to use AI flags in wild Pokémon battles. - - FRLG/Gen4+ whiteout money calculation. - - Configurable experience settings - - Experience on catch. - - Splitting experience. - - Trainer experience. - - Scaled experience. - - Unevolved experience boost. - - Frostbite. - - Doesn't replace freezing unless a config is enabled, so you can mix and match. - - Critical capture. - - Removed badge boosts (configurable). - - Recalculating stats at the end of every battle. - - Level 100 Pokémon can earn EVs. - - Inverse battle support. - - TONS of other features listed [here](https://github.com/rh-hideout/pokeemerald-expansion/blob/master/include/config/battle.h). -- ***Full Trainer customization*** - - Nickname, EVs, IVs, moves, ability, ball, friendship, nature, gender, shininess. - - Custom tag battle support (teaming up an NPC in a double battle). - - Sliding trainer messages. - - Upgraded Trainer AI - - Considers newer move effects. - - New flag options to let you customize the intelligence of your trainers. - - Faster calculations. - - Specify Poké Balls by Trainer class. -- ***Pokémon Species from Generations 1-9.*** - - Simplified process to add new Pokémon. - - Option to disable unwanted families. - - Updated sprites to DS style. - - Updated stats, types, abilities and egg groups (configurable). - - Updated Hoenn's Regional Dex to match ORAS' (configurable). - - Updated National Dex incorporating the new species. - - Sprite and animation visualizer. - - Accesible by pressing `Select` on a Pokémon's Summary screen. - - Gen4+ evolution methods, with some changes: - - Mossy Rock, Icy Rock and Magnetic Field locations match ORAS'. - - Leaf, Ice and Thunder Stones may also be used. - - Inkay just needs level 30 to evolve. - - You can't physically have both the RTC and gyroscope, so we skip this requirement. - - Sylveon uses Gen8+'s evolution method (friendship + Fairy Move). - - Option to use hold evolution items directly like stones. - - Hidden Abilities. - - Available via Ability Patch. - - Compatible with Ghoul's DexNav branch. - - All gender differences. - - Custom female icons for female Hippopotas Hippowdon, Pikachu and Wobbufett - - 3 Perfect IVs on Legendaries, Mythicals and Ultra Beasts. -- ***Customizable form change tables. Full list of methods [here](https://github.com/rh-hideout/pokeemerald-expansion/blob/master/include/constants/form_change_types.h).*** - - Item holding (eg. Giratina/Arceus) - - Item using (eg. Oricorio) - - Time of day option for Shaymin - - Fainting - - Battle begin and end (eg. Xerneas) - - Move change option for Zacian/Zamazenta - - Battle end in terrains (eg. Burmy) - - Switched in battle (eg. Palafin) - - HP Threshold (eg. Darmanitan) - - Weather (eg. Castform) - - End of turn (eg. Morpeko) - - Time of day (eg. Shaymin) - - Fusions (eg. Kyurem) -- ***Breeding Improvements*** - - Incense Baby Pokémon now happen automatically (configurable). - - Level 1 eggs (configurable). - - Poké Ball inheriting (configurable). - - Egg Move Transfer, including Mirror Herb (configurable). - - Nature inheriting 100% of the time with Everstone (configurable) - - Gen6+ Ability inheriting (configurable). -- ***Items from newer Generations. Full list [here](https://github.com/rh-hideout/pokeemerald-expansion/blob/master/include/constants/items.h).*** - - ***Gen 6+ Exp. Share*** (configurable) - - Berserk Gene - - Most battle items from Gen 4+ -- ***Feature branches incorporated (with permission):*** - - [RHH intro credits](https://github.com/Xhyzi/pokeemerald/tree/rhh-intro-credits) by @Xhyzi. - - A small signature from all of us to show the collective effort in the project :) - - [Overworld debug](https://github.com/TheXaman/pokeemerald/tree/tx_debug_system) by @TheXaman - - May be disabled. - - Accesible by pressing `R + Start` in the overworld by default. - - **Additional features**: - - *Clear Boxes*: cleans every Pokémon from the Boxes. - - *Hatch an Egg*: lets you choose an Egg in your party and immediately hatch it. - - [HGSS Pokédex](https://github.com/TheXaman/pokeemerald/tree/tx_pokedexPlus_hgss) by @TheXaman - - May be disabled. - - **Additional features**: - - *Support for new evolution methods*. - - *Dark Mode*. - - [Nature Colors](https://github.com/DizzyEggg/pokeemerald/tree/nature_color) in summary screen by @DizzyEggg - - [Dynamic Multichoice](https://github.com/SBird1337/pokeemerald/tree/feature/dynmulti) by @SBird1337 - - [Saveblock Cleansing](https://github.com/ghoulslash/pokeemerald/tree/saveblock) by @ghoulslash - - [Followers & Expanded IDs](https://github.com/aarant/pokeemerald/tree/followers-expanded-id) by @aarant - - May be disabled. - - Includes Pokémon followers like in HGSS, including interactions. - - ***Expands the amount of possible object event IDs beyond 255.*** - - ***Includes an implementation of dynamic overworld palettes (DOWP).*** - - **Additional features**: - - *Pokémon overworld sprites up to Generation 8.* - - *Integration with our Pokémon Sprite Visualizer, allowing users to browse through the follower sprites alongside battle sprites.* -- ***Other features*** - - Pressing B while holding a Pokémon drops them like in modern games (configurable). - - Running indoors (configurable). - - Configurable overworld poison damage. - - Configurable flags for disabling Wild encounters and Trainer battles. - - Configurable flags for forcing or disabling Shinies. - - Reusable TM (configurable). - - B2W2+ Repel system that also supports LGPE's Lures - - Gen6+'s EV cap. - - All bugfixes from pret included. - - Fixed overworld snow effect. +[![](https://dcbadge.limes.pink/api/server/6CzjAG6GZk)](https://discord.gg/6CzjAG6GZk) -There are some mechanics, moves and abilities that are missing and being developed. Check [the project's milestones](https://github.com/rh-hideout/pokeemerald-expansion/milestones) and our [issues page](https://github.com/rh-hideout/pokeemerald-expansion/issues) to see which ones. +Our community uses the [Rom Hacking Hideout (RHH) Discord server](https://discord.gg/6CzjAG6GZk) to communicate and organize. Most of our discussions take place there, and we welcome anybody to join us! diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 0b7a765f6c..6926173dbb 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1140,10 +1140,11 @@ .4byte \failInstr .endm - .macro trywish turnNumber:req, failInstr:req + .macro trywish turnNumber:req, failInstr:req, blockedInstr:req .byte 0xd4 .byte \turnNumber .4byte \failInstr + .4byte \blockedInstr .endm .macro settoxicspikes failInstr:req diff --git a/asm/macros/event.inc b/asm/macros/event.inc index f621dd16cd..5e50f5771c 100644 --- a/asm/macros/event.inc +++ b/asm/macros/event.inc @@ -145,7 +145,10 @@ .endm @ Changes the value of destination to value. - .macro setvar destination:req, value:req + .macro setvar destination:req, value:req, warn=TRUE + .if \warn && ((\value >= VARS_START && \value <= VARS_END) || (\value >= SPECIAL_VARS_START && \value <= SPECIAL_VARS_END)) + .warning "setvar with a value that might be a VAR_ constant; did you mean copyvar instead?" + .endif .byte SCR_OP_SETVAR .2byte \destination .2byte \value diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 53ed13f9b6..41afb65a5d 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -2713,12 +2713,12 @@ BattleScript_EffectGravity:: attackstring ppreduce setgravity BattleScript_ButItFailed - savetarget attackanimation waitanimation BattleScript_EffectGravitySuccess:: printstring STRINGID_GRAVITYINTENSIFIED waitmessage B_WAIT_TIME_LONG + savetarget selectfirstvalidtarget BattleScript_GravityLoop: movevaluescleanup @@ -5033,7 +5033,7 @@ BattleScript_EffectWish:: attackcanceler attackstring ppreduce - trywish 0, BattleScript_ButItFailed + trywish 0, BattleScript_ButItFailed, BattleScript_ButItFailed attackanimation waitanimation goto BattleScript_MoveEnd @@ -5229,7 +5229,7 @@ BattleScript_EffectSnatch:: waitmessage B_WAIT_TIME_LONG goto BattleScript_MoveEnd -BattleScript_EffectRecoilHP25:: +BattleScript_EffectStruggle:: jumpifnotmove MOVE_STRUGGLE, BattleScript_EffectHit incrementgamestat GAME_STAT_USED_STRUGGLE goto BattleScript_EffectHit @@ -6223,6 +6223,14 @@ BattleScript_ToxicSpikesPoisoned:: waitstate return +BattleScript_ToxicSpikesBadlyPoisoned:: + printstring STRINGID_TOXICSPIKESBADLYPOISONED + waitmessage B_WAIT_TIME_LONG + statusanimation BS_SCRIPTING + updatestatusicon BS_SCRIPTING + waitstate + return + BattleScript_StickyWebOnSwitchIn:: savetarget saveattacker @@ -6667,7 +6675,7 @@ BattleScript_SelectingNotAllowedCurrentMoveInPalace:: goto BattleScript_SelectingUnusableMoveInPalace BattleScript_WishComesTrue:: - trywish 1, BattleScript_WishButFullHp + trywish 1, BattleScript_WishButFullHp, BattleScript_WishButHealBlocked playanimation BS_TARGET, B_ANIM_WISH_HEAL printstring STRINGID_PKMNWISHCAMETRUE waitmessage B_WAIT_TIME_LONG @@ -6686,6 +6694,14 @@ BattleScript_WishButFullHp:: waitmessage B_WAIT_TIME_LONG end2 +BattleScript_WishButHealBlocked:: + printstring STRINGID_PKMNWISHCAMETRUE + waitmessage B_WAIT_TIME_LONG + pause B_WAIT_TIME_SHORT + printstring STRINGID_HEALBLOCKPREVENTSUSAGE + waitmessage B_WAIT_TIME_LONG + end2 + BattleScript_IngrainTurnHeal:: playanimation BS_ATTACKER, B_ANIM_INGRAIN_HEAL printstring STRINGID_PKMNABSORBEDNUTRIENTS @@ -8520,9 +8536,11 @@ BattleScript_FriskMsg:: BattleScript_FriskActivates:: saveattacker + savetarget copybyte gBattlerAttacker, sBATTLER tryfriskmsg BS_SCRIPTING restoreattacker + restoretarget end3 BattleScript_ImposterActivates:: @@ -8999,34 +9017,29 @@ BattleScript_BerryConfuseHealRet_Anim: removeitem BS_TARGET return -BattleScript_BerryStatRaiseEnd2:: - jumpifability BS_ATTACKER, ABILITY_RIPEN, BattleScript_BerryStatRaiseEnd2_AbilityPopup - goto BattleScript_BerryStatRaiseEnd2_Anim -BattleScript_BerryStatRaiseEnd2_AbilityPopup: - call BattleScript_AbilityPopUp -BattleScript_BerryStatRaiseEnd2_Anim: - statbuffchange STAT_CHANGE_ALLOW_PTR | MOVE_EFFECT_AFFECTS_USER, BattleScript_BerryStatRaiseEnd2_End - setgraphicalstatchangevalues - playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT, sB_ANIM_ARG1 - setbyte cMULTISTRING_CHOOSER, B_MSG_STAT_ROSE_ITEM - call BattleScript_StatUp - removeitem BS_ATTACKER -BattleScript_BerryStatRaiseEnd2_End:: +BattleScript_ConsumableStatRaiseEnd2:: + call BattleScript_ConsumableStatRaiseRet end2 -BattleScript_BerryStatRaiseRet:: - jumpifability BS_SCRIPTING, ABILITY_RIPEN, BattleScript_BerryStatRaiseRet_AbilityPopup - goto BattleScript_BerryStatRaiseRet_Anim -BattleScript_BerryStatRaiseRet_AbilityPopup: +BattleScript_ConsumableStatRaiseRet:: + @ to ensure `statbuffchange` has correct battler id, backup and use target + savetarget + copybyte gBattlerTarget, sBATTLER + jumpifnotberry BS_SCRIPTING, BattleScript_ConsumableStatRaiseRet_Anim + @ check ripen popup if consuming berry + jumpifability BS_SCRIPTING, ABILITY_RIPEN, BattleScript_ConsumableStatRaiseRet_AbilityPopup + goto BattleScript_ConsumableStatRaiseRet_Anim +BattleScript_ConsumableStatRaiseRet_AbilityPopup: call BattleScript_AbilityPopUp -BattleScript_BerryStatRaiseRet_Anim: - statbuffchange STAT_CHANGE_ALLOW_PTR, BattleScript_BerryStatRaiseRet_End +BattleScript_ConsumableStatRaiseRet_Anim: + statbuffchange STAT_CHANGE_ALLOW_PTR, BattleScript_ConsumableStatRaiseRet_End setgraphicalstatchangevalues playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT, sB_ANIM_ARG1 setbyte cMULTISTRING_CHOOSER, B_MSG_STAT_ROSE_ITEM call BattleScript_StatUp removeitem BS_SCRIPTING -BattleScript_BerryStatRaiseRet_End: +BattleScript_ConsumableStatRaiseRet_End: + restoretarget return BattleScript_BerryFocusEnergyRet:: @@ -10033,15 +10046,16 @@ BattleScript_CouldntFullyProtect:: return BattleScript_BerserkGeneRet:: + saveattacker savetarget copybyte gBattlerTarget, sBATTLER statbuffchange STAT_CHANGE_ALLOW_PTR, BattleScript_BerserkGeneRet_TryConfuse setgraphicalstatchangevalues - playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT, sB_ANIM_ARG1 + playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT, sB_ANIM_ARG1 setbyte cMULTISTRING_CHOOSER, B_MSG_STAT_ROSE_ITEM call BattleScript_StatUp BattleScript_BerserkGeneRet_TryConfuse: - jumpifability BS_SCRIPTING, ABILITY_OWN_TEMPO, BattleScript_BerserkGeneRet_OwnTempoPrevents + jumpifability BS_ATTACKER, ABILITY_OWN_TEMPO, BattleScript_BerserkGeneRet_OwnTempoPrevents jumpifsafeguard BattleScript_BerserkGeneRet_SafeguardProtected seteffectprimary MOVE_EFFECT_CONFUSION goto BattleScript_BerserkGeneRet_End @@ -10056,9 +10070,14 @@ BattleScript_BerserkGeneRet_OwnTempoPrevents: printstring STRINGID_PKMNPREVENTSCONFUSIONWITH waitmessage B_WAIT_TIME_LONG BattleScript_BerserkGeneRet_End: + restoreattacker restoretarget - removeitem BS_SCRIPTING - end3 + removeitem BS_ATTACKER + return + +BattleScript_BerserkGeneRetEnd2:: + call BattleScript_BerserkGeneRet + end2 BattleScript_BoosterEnergyEnd2:: call BattleScript_BoosterEnergyRet diff --git a/graphics/pokemon/bombirdier/back.png b/graphics/pokemon/bombirdier/back.png index eb45117013..d2f321a35b 100644 Binary files a/graphics/pokemon/bombirdier/back.png and b/graphics/pokemon/bombirdier/back.png differ diff --git a/graphics/pokemon/bombirdier/front.png b/graphics/pokemon/bombirdier/front.png index b8aa83644b..618c5c7c9b 100644 Binary files a/graphics/pokemon/bombirdier/front.png and b/graphics/pokemon/bombirdier/front.png differ diff --git a/graphics/pokemon/bombirdier/normal.pal b/graphics/pokemon/bombirdier/normal.pal index 21129ad828..73f336b876 100644 --- a/graphics/pokemon/bombirdier/normal.pal +++ b/graphics/pokemon/bombirdier/normal.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -153 210 164 +153 211 165 52 41 48 -74 57 66 -15 15 15 -38 210 161 -102 91 96 -185 170 175 -239 227 225 -147 125 133 80 29 37 -77 74 75 -230 76 98 -255 251 255 +74 57 66 +102 91 96 +117 105 110 153 62 73 -167 171 167 -123 130 123 +230 76 98 +147 125 133 +180 165 170 +16 16 16 +225 215 218 +249 247 248 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/pokemon/bombirdier/shiny.pal b/graphics/pokemon/bombirdier/shiny.pal index 7c57659ed5..013bc938de 100644 --- a/graphics/pokemon/bombirdier/shiny.pal +++ b/graphics/pokemon/bombirdier/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -153 210 164 +153 211 165 52 41 48 +84 81 81 74 57 66 -15 15 15 -38 210 161 102 91 96 -185 170 175 -239 227 225 +186 80 100 +121 120 119 +189 184 186 147 125 133 -80 29 37 -160 74 85 -171 167 168 -255 251 255 -136 134 133 -167 171 167 -123 130 123 +180 165 170 +16 16 16 +225 215 218 +230 220 223 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/pokemon/dipplin/back.png b/graphics/pokemon/dipplin/back.png index d99452c70b..9fb357c7b4 100644 Binary files a/graphics/pokemon/dipplin/back.png and b/graphics/pokemon/dipplin/back.png differ diff --git a/graphics/pokemon/dipplin/front.png b/graphics/pokemon/dipplin/front.png index 6311f69be9..4e3cef7589 100644 Binary files a/graphics/pokemon/dipplin/front.png and b/graphics/pokemon/dipplin/front.png differ diff --git a/graphics/pokemon/dipplin/normal.pal b/graphics/pokemon/dipplin/normal.pal index 3c68d0216a..94e56ce1b8 100644 --- a/graphics/pokemon/dipplin/normal.pal +++ b/graphics/pokemon/dipplin/normal.pal @@ -1,17 +1,19 @@ JASC-PAL 0100 -14 +16 0 183 239 +101 16 12 +36 77 28 43 97 14 +143 19 11 +189 28 16 +230 74 53 +95 171 29 +75 133 61 +197 168 80 +250 136 107 164 216 74 16 16 16 -95 171 29 -241 201 80 -198 169 83 -254 254 254 -101 16 12 -157 24 17 -222 81 69 -249 164 162 -36 77 28 -75 133 61 +229 238 129 +253 253 253 +0 0 0 diff --git a/graphics/pokemon/dipplin/shiny.pal b/graphics/pokemon/dipplin/shiny.pal index 81c9ff3c86..ef289139fe 100644 --- a/graphics/pokemon/dipplin/shiny.pal +++ b/graphics/pokemon/dipplin/shiny.pal @@ -1,17 +1,19 @@ JASC-PAL 0100 -14 +16 0 183 239 +128 65 0 +160 53 43 43 97 14 +184 93 0 +214 143 1 +255 211 22 +95 171 29 +255 118 66 +197 168 80 +255 250 137 164 216 74 16 16 16 -95 171 29 -241 201 80 -198 169 83 -254 254 254 -194 80 3 -221 143 0 -255 212 22 -249 164 162 -185 77 49 -255 118 66 +229 238 129 +253 253 253 +0 0 0 diff --git a/graphics/pokemon/frigibax/anim_front.png b/graphics/pokemon/frigibax/anim_front.png deleted file mode 100644 index cfdaf7de70..0000000000 Binary files a/graphics/pokemon/frigibax/anim_front.png and /dev/null differ diff --git a/graphics/pokemon/frigibax/back.png b/graphics/pokemon/frigibax/back.png index d48c105e34..41b741e46d 100644 Binary files a/graphics/pokemon/frigibax/back.png and b/graphics/pokemon/frigibax/back.png differ diff --git a/graphics/pokemon/frigibax/front.png b/graphics/pokemon/frigibax/front.png new file mode 100644 index 0000000000..a4e3378b48 Binary files /dev/null and b/graphics/pokemon/frigibax/front.png differ diff --git a/graphics/pokemon/frigibax/normal.pal b/graphics/pokemon/frigibax/normal.pal index 7b65763603..ec79d21b8d 100644 --- a/graphics/pokemon/frigibax/normal.pal +++ b/graphics/pokemon/frigibax/normal.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -153 210 164 -102 104 113 -65 73 73 -170 177 183 -143 153 163 -175 155 10 -249 216 0 -222 223 222 -15 15 15 -156 151 156 -142 187 183 -194 231 233 -114 94 22 -255 181 9 -209 147 16 -118 152 148 +153 211 165 +62 66 87 +153 121 3 +196 154 0 +227 193 44 +252 215 39 +106 115 138 +145 162 173 +166 175 189 +16 16 16 +174 186 207 +214 223 232 +195 232 233 +255 255 255 +62 103 133 +46 63 92 diff --git a/graphics/pokemon/frigibax/shiny.pal b/graphics/pokemon/frigibax/shiny.pal index 62e5c6dac1..77398cf7ad 100644 --- a/graphics/pokemon/frigibax/shiny.pal +++ b/graphics/pokemon/frigibax/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -153 210 164 -75 114 106 -52 74 64 -134 186 173 -116 161 150 -175 155 10 -249 216 0 -222 223 222 -15 15 15 -156 151 156 -142 187 183 -194 231 233 -143 103 130 -255 179 230 -255 143 219 -118 152 148 +153 211 165 +61 89 106 +151 98 104 +196 154 0 +246 201 215 +252 215 39 +92 137 147 +145 162 173 +159 184 189 +16 16 16 +174 186 207 +214 223 232 +195 232 233 +255 255 255 +62 103 133 +46 63 92 diff --git a/graphics/pokemon/great_tusk/anim_front.png b/graphics/pokemon/great_tusk/anim_front.png deleted file mode 100644 index c4362af29c..0000000000 Binary files a/graphics/pokemon/great_tusk/anim_front.png and /dev/null differ diff --git a/graphics/pokemon/great_tusk/back.png b/graphics/pokemon/great_tusk/back.png index 0b7c0f6620..e89f81b6d7 100644 Binary files a/graphics/pokemon/great_tusk/back.png and b/graphics/pokemon/great_tusk/back.png differ diff --git a/graphics/pokemon/great_tusk/front.png b/graphics/pokemon/great_tusk/front.png new file mode 100644 index 0000000000..26c6b5cff7 Binary files /dev/null and b/graphics/pokemon/great_tusk/front.png differ diff --git a/graphics/pokemon/great_tusk/normal.pal b/graphics/pokemon/great_tusk/normal.pal index b5c23a1288..b91f7def1e 100644 --- a/graphics/pokemon/great_tusk/normal.pal +++ b/graphics/pokemon/great_tusk/normal.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -0 160 232 -112 24 48 -144 8 56 -232 48 120 -104 24 40 +153 211 165 +41 32 62 +109 27 27 +112 24 50 +66 55 99 +180 46 46 +184 19 73 +129 87 69 +228 77 109 +249 240 67 +118 127 157 +92 89 163 +184 168 158 16 16 16 -40 32 64 -96 88 160 -56 48 88 -120 80 64 -184 168 160 -240 240 216 -128 136 160 -168 192 216 -248 240 88 -8 8 8 +169 192 216 +238 241 218 diff --git a/graphics/pokemon/great_tusk/shiny.pal b/graphics/pokemon/great_tusk/shiny.pal index c7449781d5..7c0d005a40 100644 --- a/graphics/pokemon/great_tusk/shiny.pal +++ b/graphics/pokemon/great_tusk/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -0 160 232 -160 104 16 -216 168 88 -248 240 152 -104 24 40 -16 16 16 -56 24 24 +153 211 165 +48 25 18 +109 27 27 +101 107 8 +85 53 42 +180 46 46 +166 175 26 +129 87 69 +229 240 58 +249 240 67 +111 152 126 128 80 64 -96 64 48 -120 80 64 -184 168 160 -240 240 216 -72 176 144 -176 240 200 -248 240 88 -8 8 8 +184 168 158 +16 16 16 +167 205 188 +238 241 218 diff --git a/graphics/pokemon/hydrapple/back.png b/graphics/pokemon/hydrapple/back.png index f84712a508..19ffd6d199 100644 Binary files a/graphics/pokemon/hydrapple/back.png and b/graphics/pokemon/hydrapple/back.png differ diff --git a/graphics/pokemon/hydrapple/front.png b/graphics/pokemon/hydrapple/front.png index eecdea6d78..ca82294df1 100644 Binary files a/graphics/pokemon/hydrapple/front.png and b/graphics/pokemon/hydrapple/front.png differ diff --git a/graphics/pokemon/hydrapple/normal.pal b/graphics/pokemon/hydrapple/normal.pal index 6fec9a7957..b29a319b81 100644 --- a/graphics/pokemon/hydrapple/normal.pal +++ b/graphics/pokemon/hydrapple/normal.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -88 56 32 +0 183 239 16 16 16 -152 24 16 -96 16 8 -32 72 24 -136 88 56 -216 80 64 -72 128 56 -248 160 160 -192 168 80 -40 96 8 -88 168 24 -160 216 72 -240 200 80 -32 88 8 +101 16 12 +36 77 28 +43 97 14 +143 19 11 +189 28 16 +194 44 58 +230 74 53 +211 34 61 +95 171 29 +250 136 107 +204 170 118 +164 216 74 +240 221 157 +125 0 0 diff --git a/graphics/pokemon/hydrapple/shiny.pal b/graphics/pokemon/hydrapple/shiny.pal index d3d0f68f92..35e42dc80f 100644 --- a/graphics/pokemon/hydrapple/shiny.pal +++ b/graphics/pokemon/hydrapple/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -88 56 32 +0 183 239 16 16 16 -216 136 0 -192 80 0 -32 72 24 -136 88 56 -248 208 16 -72 128 56 -248 232 144 -192 168 80 -40 96 8 -88 168 24 -160 216 72 -240 200 80 -32 88 8 +128 65 0 +160 53 43 +43 97 14 +184 93 0 +214 143 1 +194 44 58 +255 211 22 +29 171 38 +95 171 29 +255 250 137 +204 170 118 +164 216 74 +240 221 157 +0 83 0 diff --git a/graphics/pokemon/koraidon/back.png b/graphics/pokemon/koraidon/back.png index fd4fb143b8..35aa59572c 100644 Binary files a/graphics/pokemon/koraidon/back.png and b/graphics/pokemon/koraidon/back.png differ diff --git a/graphics/pokemon/koraidon/front.png b/graphics/pokemon/koraidon/front.png index 64f07479f9..d5c6e9f148 100644 Binary files a/graphics/pokemon/koraidon/front.png and b/graphics/pokemon/koraidon/front.png differ diff --git a/graphics/pokemon/koraidon/normal.pal b/graphics/pokemon/koraidon/normal.pal index 151d848ab8..ad38b622a3 100644 --- a/graphics/pokemon/koraidon/normal.pal +++ b/graphics/pokemon/koraidon/normal.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -153 210 164 -51 55 62 -103 96 105 -237 235 230 -255 118 155 -6 6 6 -255 73 153 -168 150 153 -159 65 193 -18 26 80 -36 49 136 -0 97 173 -119 32 32 -255 70 57 -185 57 56 -253 214 0 +152 208 160 +95 46 56 +48 49 65 +14 28 103 +81 83 94 +255 127 39 +176 57 72 +250 80 71 +255 242 0 +24 48 177 +57 99 240 +166 91 227 +243 75 239 +186 183 171 +16 16 18 +231 230 226 diff --git a/graphics/pokemon/koraidon/shiny.pal b/graphics/pokemon/koraidon/shiny.pal index 2d198cf721..613608d4e3 100644 --- a/graphics/pokemon/koraidon/shiny.pal +++ b/graphics/pokemon/koraidon/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -153 210 164 -51 55 62 -103 96 105 -237 235 230 -168 150 153 -6 6 6 -255 191 0 -168 150 153 -159 65 193 -18 26 80 -172 24 67 -255 11 119 -33 34 50 -82 83 113 -67 68 90 -253 214 0 +152 208 160 +28 29 42 +48 49 65 +96 30 38 +81 83 94 +255 127 39 +64 59 74 +98 98 123 +255 242 0 +172 49 49 +213 74 82 +226 127 103 +234 198 4 +186 183 171 +16 16 18 +231 230 226 diff --git a/graphics/pokemon/miraidon/back.png b/graphics/pokemon/miraidon/back.png index 3d4b2d703a..0d2fbf5869 100644 Binary files a/graphics/pokemon/miraidon/back.png and b/graphics/pokemon/miraidon/back.png differ diff --git a/graphics/pokemon/miraidon/front.png b/graphics/pokemon/miraidon/front.png index 28eaa96923..8e0452c608 100644 Binary files a/graphics/pokemon/miraidon/front.png and b/graphics/pokemon/miraidon/front.png differ diff --git a/graphics/pokemon/miraidon/normal.pal b/graphics/pokemon/miraidon/normal.pal index 12737537e5..44085a3918 100644 --- a/graphics/pokemon/miraidon/normal.pal +++ b/graphics/pokemon/miraidon/normal.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -156 210 164 -156 153 205 -82 76 115 -49 48 106 -222 218 230 -246 255 255 -16 16 16 -123 97 164 -65 170 222 -57 64 139 -189 182 180 -255 226 115 -24 40 74 -82 68 156 -180 165 189 -57 48 74 +152 208 160 +29 29 41 +26 27 74 +70 70 100 +255 242 0 +45 47 130 +101 81 156 +32 132 191 +85 174 227 +140 138 172 +16 16 18 +158 152 202 +194 190 223 +255 255 255 +176 168 0 +0 0 0 diff --git a/graphics/pokemon/miraidon/shiny.pal b/graphics/pokemon/miraidon/shiny.pal index 18064fb9d1..4a02150723 100644 --- a/graphics/pokemon/miraidon/shiny.pal +++ b/graphics/pokemon/miraidon/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -156 210 164 -156 153 205 -82 76 115 -57 58 62 -222 218 230 -246 255 255 -16 16 16 -200 200 200 -65 170 222 -134 134 134 -189 182 180 -255 226 115 -24 40 74 -133 133 133 -180 165 189 -57 48 74 +152 208 160 +29 29 41 +70 70 100 +70 70 100 +255 242 0 +140 138 172 +194 190 223 +32 132 191 +85 174 227 +140 138 172 +16 16 18 +158 152 202 +194 190 223 +255 255 255 +176 168 0 +0 0 0 diff --git a/graphics/pokemon/ogerpon/back.png b/graphics/pokemon/ogerpon/back.png index 8cd9136f9e..0884029493 100644 Binary files a/graphics/pokemon/ogerpon/back.png and b/graphics/pokemon/ogerpon/back.png differ diff --git a/graphics/pokemon/ogerpon/cornerstone/back.png b/graphics/pokemon/ogerpon/cornerstone/back.png index ffface9d68..a81975d346 100644 Binary files a/graphics/pokemon/ogerpon/cornerstone/back.png and b/graphics/pokemon/ogerpon/cornerstone/back.png differ diff --git a/graphics/pokemon/ogerpon/cornerstone/front.png b/graphics/pokemon/ogerpon/cornerstone/front.png index 9b7f279238..7e12867992 100644 Binary files a/graphics/pokemon/ogerpon/cornerstone/front.png and b/graphics/pokemon/ogerpon/cornerstone/front.png differ diff --git a/graphics/pokemon/ogerpon/cornerstone/normal.pal b/graphics/pokemon/ogerpon/cornerstone/normal.pal index eb11f81f7e..7f29c65bde 100644 --- a/graphics/pokemon/ogerpon/cornerstone/normal.pal +++ b/graphics/pokemon/ogerpon/cornerstone/normal.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -238 230 180 -49 49 49 -148 156 148 +152 208 160 +29 29 29 +44 43 41 +64 112 54 +75 76 76 +89 96 106 +141 98 59 +91 171 49 +34 177 76 +232 157 2 +255 218 70 +0 150 176 +0 211 249 +148 152 151 16 16 16 -65 115 49 -90 172 49 -90 98 106 -41 41 41 -74 74 74 -0 213 255 -24 24 24 -0 148 180 -255 222 65 -255 255 255 -238 156 0 -139 98 57 +253 253 253 diff --git a/graphics/pokemon/ogerpon/cornerstone/shiny.pal b/graphics/pokemon/ogerpon/cornerstone/shiny.pal index 71dd9d6e9e..91e31c9a75 100644 --- a/graphics/pokemon/ogerpon/cornerstone/shiny.pal +++ b/graphics/pokemon/ogerpon/cornerstone/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -238 230 180 -49 49 49 -148 156 148 +152 208 160 +29 29 29 +44 43 41 +64 112 54 +75 76 76 +89 96 106 +141 98 59 +91 171 49 +34 177 76 +162 205 29 +255 218 70 +0 150 176 +0 211 249 +148 152 151 16 16 16 -65 115 49 -90 172 49 -90 98 106 -41 41 41 -74 74 74 -0 213 255 -24 24 24 -0 148 180 -255 222 65 -255 255 255 -164 205 24 -139 98 57 +253 253 253 diff --git a/graphics/pokemon/ogerpon/front.png b/graphics/pokemon/ogerpon/front.png index 6c2a769081..a15d509b2e 100644 Binary files a/graphics/pokemon/ogerpon/front.png and b/graphics/pokemon/ogerpon/front.png differ diff --git a/graphics/pokemon/ogerpon/hearthflame/back.png b/graphics/pokemon/ogerpon/hearthflame/back.png index 73f95efbf2..f81aef124f 100644 Binary files a/graphics/pokemon/ogerpon/hearthflame/back.png and b/graphics/pokemon/ogerpon/hearthflame/back.png differ diff --git a/graphics/pokemon/ogerpon/hearthflame/front.png b/graphics/pokemon/ogerpon/hearthflame/front.png index 098041cf76..29f17af77c 100644 Binary files a/graphics/pokemon/ogerpon/hearthflame/front.png and b/graphics/pokemon/ogerpon/hearthflame/front.png differ diff --git a/graphics/pokemon/ogerpon/hearthflame/normal.pal b/graphics/pokemon/ogerpon/hearthflame/normal.pal index 2ed9b8c050..a7a922f08b 100644 --- a/graphics/pokemon/ogerpon/hearthflame/normal.pal +++ b/graphics/pokemon/ogerpon/hearthflame/normal.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -238 230 180 -74 74 74 -213 156 24 -255 222 65 -65 115 49 -90 172 49 -16 16 16 +152 208 160 41 41 41 -238 57 41 -156 16 16 -82 8 8 +87 15 15 +66 115 49 +74 74 74 +132 24 24 +206 57 49 +141 98 59 +90 173 49 +232 157 2 +198 156 41 +247 222 82 +0 211 249 +16 16 16 255 255 255 -238 156 0 -123 106 49 -0 213 255 -139 98 57 +0 0 0 diff --git a/graphics/pokemon/ogerpon/hearthflame/shiny.pal b/graphics/pokemon/ogerpon/hearthflame/shiny.pal index 81f60abe80..4724e3d7df 100644 --- a/graphics/pokemon/ogerpon/hearthflame/shiny.pal +++ b/graphics/pokemon/ogerpon/hearthflame/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -238 230 180 -74 74 74 -213 156 24 -255 222 65 -65 115 49 -90 172 49 -16 16 16 +152 208 160 41 41 41 -238 57 41 -156 16 16 -82 8 8 +87 15 15 +66 115 49 +74 74 74 +132 24 24 +206 57 49 +141 98 59 +90 173 49 +162 205 29 +198 156 41 +247 222 82 +0 211 249 +16 16 16 255 255 255 -164 205 24 -123 106 49 -0 213 255 -139 98 57 +0 0 0 diff --git a/graphics/pokemon/ogerpon/normal.pal b/graphics/pokemon/ogerpon/normal.pal index f578e22342..943a658de4 100644 --- a/graphics/pokemon/ogerpon/normal.pal +++ b/graphics/pokemon/ogerpon/normal.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -238 230 180 -41 41 41 -65 115 49 -74 74 74 -8 164 156 -90 172 49 +152 208 160 +44 43 41 +64 112 54 +15 106 67 +75 76 76 +141 98 59 +97 167 27 +91 171 49 +84 182 101 +232 157 2 +219 156 94 +255 218 70 +9 164 156 16 16 16 -8 106 65 -180 222 164 -255 255 255 -98 164 24 -82 180 98 -238 156 0 -139 98 57 -255 222 65 -222 156 90 +178 216 161 +253 253 253 diff --git a/graphics/pokemon/ogerpon/shiny.pal b/graphics/pokemon/ogerpon/shiny.pal index 02b6d9c5ae..8fb51b7d1d 100644 --- a/graphics/pokemon/ogerpon/shiny.pal +++ b/graphics/pokemon/ogerpon/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -238 230 180 -41 41 41 -65 115 49 -74 74 74 -8 164 156 -90 172 49 +152 208 160 +44 43 41 +64 112 54 +15 106 67 +75 76 76 +141 98 59 +97 167 27 +91 171 49 +84 182 101 +162 205 29 +219 156 94 +255 218 70 +9 164 156 16 16 16 -8 106 65 -180 222 164 -255 255 255 -98 164 24 -82 180 98 -164 205 24 -139 98 57 -255 222 65 -222 156 90 +178 216 161 +253 253 253 diff --git a/graphics/pokemon/ogerpon/wellspring/back.png b/graphics/pokemon/ogerpon/wellspring/back.png index d90a8afe3e..b9346bfc65 100644 Binary files a/graphics/pokemon/ogerpon/wellspring/back.png and b/graphics/pokemon/ogerpon/wellspring/back.png differ diff --git a/graphics/pokemon/ogerpon/wellspring/front.png b/graphics/pokemon/ogerpon/wellspring/front.png index 556f9f2688..4a7b6cefe0 100644 Binary files a/graphics/pokemon/ogerpon/wellspring/front.png and b/graphics/pokemon/ogerpon/wellspring/front.png differ diff --git a/graphics/pokemon/ogerpon/wellspring/normal.pal b/graphics/pokemon/ogerpon/wellspring/normal.pal index b91b6ee255..f771734921 100644 --- a/graphics/pokemon/ogerpon/wellspring/normal.pal +++ b/graphics/pokemon/ogerpon/wellspring/normal.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -238 230 180 -65 115 49 -90 172 49 +152 208 160 +44 43 41 +64 112 54 +75 76 76 +141 98 59 +91 171 49 +232 157 2 +255 218 70 +12 65 129 +15 94 181 +3 129 229 +59 213 249 16 16 16 -8 65 131 -41 41 41 -0 131 230 -74 74 74 -139 98 57 -8 90 180 -57 213 255 -205 222 255 -238 156 0 -255 222 65 -255 255 255 -156 205 222 +156 206 220 +206 221 255 +253 253 253 diff --git a/graphics/pokemon/ogerpon/wellspring/shiny.pal b/graphics/pokemon/ogerpon/wellspring/shiny.pal index 4f4e60c157..f284e35c37 100644 --- a/graphics/pokemon/ogerpon/wellspring/shiny.pal +++ b/graphics/pokemon/ogerpon/wellspring/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -238 230 180 -65 115 49 -90 172 49 +152 208 160 +44 43 41 +64 112 54 +75 76 76 +141 98 59 +91 171 49 +162 205 29 +255 218 70 +12 65 129 +15 94 181 +3 129 229 +59 213 249 16 16 16 -8 65 131 -41 41 41 -0 131 230 -74 74 74 -139 98 57 -8 90 180 -57 213 255 -205 222 255 -164 205 24 -255 222 65 -255 255 255 -156 205 222 +156 206 220 +206 221 255 +253 253 253 diff --git a/graphics/pokemon/oinkologne/back.png b/graphics/pokemon/oinkologne/back.png index 81810c233f..42c6c3bf30 100644 Binary files a/graphics/pokemon/oinkologne/back.png and b/graphics/pokemon/oinkologne/back.png differ diff --git a/graphics/pokemon/oinkologne/f/back.png b/graphics/pokemon/oinkologne/f/back.png index d71dab3908..5d965be41a 100644 Binary files a/graphics/pokemon/oinkologne/f/back.png and b/graphics/pokemon/oinkologne/f/back.png differ diff --git a/graphics/pokemon/oinkologne/f/front.png b/graphics/pokemon/oinkologne/f/front.png index c3f10ed9f3..a4841d6b0f 100644 Binary files a/graphics/pokemon/oinkologne/f/front.png and b/graphics/pokemon/oinkologne/f/front.png differ diff --git a/graphics/pokemon/oinkologne/f/normal.pal b/graphics/pokemon/oinkologne/f/normal.pal index ba2c645dc6..2dc009715d 100644 --- a/graphics/pokemon/oinkologne/f/normal.pal +++ b/graphics/pokemon/oinkologne/f/normal.pal @@ -1,18 +1,19 @@ JASC-PAL 0100 -15 -152 208 160 -216 80 128 -248 160 200 -144 40 64 -248 120 144 -24 24 24 -96 64 72 -64 40 40 -248 160 8 -200 104 88 -0 0 0 -144 88 80 -248 200 8 +16 +153 211 165 +40 24 24 +88 40 40 +64 48 48 +88 64 64 +120 72 64 +128 48 48 +176 104 88 +184 80 96 +200 144 80 +184 184 184 +240 128 136 +16 16 16 +248 232 136 248 248 248 -168 160 160 +0 0 0 diff --git a/graphics/pokemon/oinkologne/f/shiny.pal b/graphics/pokemon/oinkologne/f/shiny.pal index 9a427f2a72..ed20dc8af3 100644 --- a/graphics/pokemon/oinkologne/f/shiny.pal +++ b/graphics/pokemon/oinkologne/f/shiny.pal @@ -1,18 +1,19 @@ JASC-PAL 0100 -15 -152 208 160 -216 80 128 -248 160 200 -144 40 64 -248 120 144 -24 24 24 -232 192 206 -217 158 179 -248 160 8 -248 240 240 -0 0 0 -241 223 226 -248 200 8 +16 +153 211 165 +174 80 82 +120 104 112 +193 122 128 +217 164 169 +200 186 180 +128 48 48 +248 224 232 +184 80 96 +200 144 80 +184 184 184 +240 128 136 +16 16 16 +248 232 136 248 248 248 -168 160 160 +0 0 0 diff --git a/graphics/pokemon/oinkologne/front.png b/graphics/pokemon/oinkologne/front.png index 22263f0903..d3fd42dd29 100644 Binary files a/graphics/pokemon/oinkologne/front.png and b/graphics/pokemon/oinkologne/front.png differ diff --git a/graphics/pokemon/oinkologne/normal.pal b/graphics/pokemon/oinkologne/normal.pal index 6487815766..b58cdc7561 100644 --- a/graphics/pokemon/oinkologne/normal.pal +++ b/graphics/pokemon/oinkologne/normal.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -156 210 164 -131 97 49 -197 80 131 +153 211 165 +32 16 40 +40 32 48 +48 40 56 +71 62 76 +64 56 80 +112 32 64 +94 86 101 +152 56 104 +200 144 80 +240 80 160 +184 184 184 16 16 16 -96 92 107 -246 214 65 -230 113 164 -59 50 72 -83 81 104 -31 33 45 -255 255 255 -43 43 43 -87 83 97 -68 61 84 -70 69 95 -131 60 90 +248 232 136 +248 248 248 +0 0 0 diff --git a/graphics/pokemon/oinkologne/shiny.pal b/graphics/pokemon/oinkologne/shiny.pal index 8faecfbad6..12096079fb 100644 --- a/graphics/pokemon/oinkologne/shiny.pal +++ b/graphics/pokemon/oinkologne/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -156 210 164 -131 97 49 -197 80 131 +153 211 165 +120 104 112 +174 80 82 +200 186 180 +193 122 128 +248 224 232 +112 32 64 +217 164 169 +152 56 104 +200 144 80 +240 80 160 +184 184 184 16 16 16 -255 206 222 -246 214 65 -230 113 164 -249 241 242 -205 153 172 -139 89 115 -255 255 255 -57 60 65 -246 186 205 -247 233 235 -255 226 238 -131 60 90 +248 232 136 +248 248 248 +0 0 0 diff --git a/graphics/pokemon/terapagos/anim_front.png b/graphics/pokemon/terapagos/anim_front.png deleted file mode 100644 index 4ef2270bd3..0000000000 Binary files a/graphics/pokemon/terapagos/anim_front.png and /dev/null differ diff --git a/graphics/pokemon/terapagos/back.png b/graphics/pokemon/terapagos/back.png index 8ec4f6c5b0..87794dd646 100644 Binary files a/graphics/pokemon/terapagos/back.png and b/graphics/pokemon/terapagos/back.png differ diff --git a/graphics/pokemon/terapagos/front.png b/graphics/pokemon/terapagos/front.png new file mode 100644 index 0000000000..bc24378858 Binary files /dev/null and b/graphics/pokemon/terapagos/front.png differ diff --git a/graphics/pokemon/terapagos/normal.pal b/graphics/pokemon/terapagos/normal.pal index 533a2e7c68..369c0e9495 100644 --- a/graphics/pokemon/terapagos/normal.pal +++ b/graphics/pokemon/terapagos/normal.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -38 26 108 -49 34 133 -103 230 225 -60 76 160 -160 64 109 -228 103 181 -0 0 0 -115 162 235 -52 201 163 -76 244 204 -153 228 201 -230 244 173 -205 251 128 -63 50 194 +153 211 165 +33 33 105 +53 53 168 +62 85 198 +85 85 202 +242 56 141 +147 78 192 +43 189 156 +40 138 191 +44 211 177 +65 132 243 +165 230 153 +16 16 16 +143 143 220 +212 245 255 255 255 255 diff --git a/graphics/pokemon/terapagos/shiny.pal b/graphics/pokemon/terapagos/shiny.pal index 1a59467bd6..a1742f9030 100644 --- a/graphics/pokemon/terapagos/shiny.pal +++ b/graphics/pokemon/terapagos/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -37 114 136 -66 151 189 -151 58 210 -63 209 230 -160 64 109 -234 243 49 -0 0 0 -218 32 48 -52 201 163 -76 244 204 -153 228 201 -230 244 173 -205 251 128 -63 50 194 +153 211 165 +39 80 120 +71 161 196 +62 85 198 +70 209 236 +237 183 87 +147 78 192 +138 48 220 +191 40 81 +44 211 177 +65 132 243 +165 230 153 +16 16 16 +148 226 243 +212 245 255 255 255 255 diff --git a/graphics/pokemon/terapagos/terastal/anim_front.png b/graphics/pokemon/terapagos/terastal/anim_front.png deleted file mode 100644 index 90a42f88b5..0000000000 Binary files a/graphics/pokemon/terapagos/terastal/anim_front.png and /dev/null differ diff --git a/graphics/pokemon/terapagos/terastal/back.png b/graphics/pokemon/terapagos/terastal/back.png index cfa96b0ab0..083593c6fb 100644 Binary files a/graphics/pokemon/terapagos/terastal/back.png and b/graphics/pokemon/terapagos/terastal/back.png differ diff --git a/graphics/pokemon/terapagos/terastal/front.png b/graphics/pokemon/terapagos/terastal/front.png new file mode 100644 index 0000000000..fbdf844767 Binary files /dev/null and b/graphics/pokemon/terapagos/terastal/front.png differ diff --git a/graphics/pokemon/terapagos/terastal/normal.pal b/graphics/pokemon/terapagos/terastal/normal.pal index 453f7ce70c..bb1d11f8f6 100644 --- a/graphics/pokemon/terapagos/terastal/normal.pal +++ b/graphics/pokemon/terapagos/terastal/normal.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -90 53 7 -42 121 78 -70 70 70 -215 38 89 -41 45 164 -77 151 158 -78 190 242 -170 172 227 -122 228 243 -147 245 227 -252 252 182 +153 211 165 +26 26 26 +247 69 26 +255 213 45 +45 45 140 +62 85 198 +85 85 202 +242 70 153 +147 78 192 +40 138 191 +44 211 177 +65 132 243 +165 230 153 +16 16 16 +245 160 222 255 255 255 -52 66 152 -0 200 255 -197 34 91 diff --git a/graphics/pokemon/terapagos/terastal/shiny.pal b/graphics/pokemon/terapagos/terastal/shiny.pal index f6103ac9f6..652a01f638 100644 --- a/graphics/pokemon/terapagos/terastal/shiny.pal +++ b/graphics/pokemon/terapagos/terastal/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -90 53 7 -42 121 78 -70 70 70 -215 38 89 -41 45 164 -77 151 158 -78 190 242 -170 172 227 -122 228 243 -147 245 227 -252 252 182 +153 211 165 +26 26 26 +247 69 26 +255 213 45 +61 126 192 +62 85 198 +70 209 236 +237 183 87 +147 78 192 +191 40 81 +44 211 177 +65 132 243 +165 230 153 +16 16 16 +245 160 222 255 255 255 -84 215 251 -255 0 0 -244 255 0 diff --git a/include/AgbRfu_LinkManager.h b/include/AgbRfu_LinkManager.h index 3b38b85fc9..f8f3ca72ae 100644 --- a/include/AgbRfu_LinkManager.h +++ b/include/AgbRfu_LinkManager.h @@ -189,9 +189,9 @@ extern struct linkManagerTag lman; u32 rfu_LMAN_REQBN_softReset_and_checkID(void); void rfu_LMAN_requestChangeAgbClockMaster(void); -void rfu_LMAN_initializeRFU(INIT_PARAM *init_params); +void rfu_LMAN_initializeRFU(INIT_PARAM *init_parameters); u8 rfu_LMAN_establishConnection(u8 parent_child, u16 connect_period, u16 name_accept_period, u16 *acceptable_serialNo_list); -void rfu_LMAN_stopManager(bool8 forced_stop_and_RFU_reset_flag); +void rfu_LMAN_stopManager(u8 forced_stop_and_RFU_reset_flag); void rfu_LMAN_setMSCCallback(void (*MSC_callback_p)(u16)); void rfu_LMAN_REQ_sendData(bool8 clockChangeFlag); void rfu_LMAN_powerDownRFU(void); diff --git a/include/battle.h b/include/battle.h index a1134d4fb1..c877a41311 100644 --- a/include/battle.h +++ b/include/battle.h @@ -132,6 +132,7 @@ struct DisableStruct u8 unburdenActive:1; u8 neutralizingGas:1; u8 iceFaceActivationPrevention:1; // fixes hit escape move edge case + u8 unnerveActivated:1; // Unnerve and As One (Unnerve part) activate only once per switch in u8 padding:3; }; @@ -404,10 +405,10 @@ struct StatsArray struct BattleResources { - struct SecretBase* secretBase; - struct BattleScriptsStack* battleScriptsStack; - struct BattleCallbacksStack* battleCallbackStack; - struct StatsArray* beforeLvlUp; + struct SecretBase *secretBase; + struct BattleScriptsStack *battleScriptsStack; + struct BattleCallbacksStack *battleCallbackStack; + struct StatsArray *beforeLvlUp; struct AI_ThinkingStruct *ai; struct AiLogicData *aiData; struct AIPartyData *aiParty; @@ -859,51 +860,51 @@ static inline bool32 IsBattleMoveRecoil(u32 move) return GetMoveRecoil(move) > 0 || GetMoveEffect(move) == EFFECT_RECOIL_IF_MISS; } -/* Checks if 'battlerId' is any of the types. +/* Checks if 'battler' is any of the types. * Passing multiple types is more efficient than calling this multiple * times with one type because it shares the 'GetBattlerTypes' result. */ -#define _IS_BATTLER_ANY_TYPE(battlerId, ignoreTera, ...) \ - ({ \ - u32 types[3]; \ - GetBattlerTypes(battlerId, ignoreTera, types); \ +#define _IS_BATTLER_ANY_TYPE(battler, ignoreTera, ...) \ + ({ \ + u32 types[3]; \ + GetBattlerTypes(battler, ignoreTera, types); \ RECURSIVELY(R_FOR_EACH(_IS_BATTLER_ANY_TYPE_HELPER, __VA_ARGS__)) FALSE; \ }) #define _IS_BATTLER_ANY_TYPE_HELPER(type) (types[0] == type) || (types[1] == type) || (types[2] == type) || -#define IS_BATTLER_ANY_TYPE(battlerId, ...) _IS_BATTLER_ANY_TYPE(battlerId, FALSE, __VA_ARGS__) +#define IS_BATTLER_ANY_TYPE(battler, ...) _IS_BATTLER_ANY_TYPE(battler, FALSE, __VA_ARGS__) #define IS_BATTLER_OF_TYPE IS_BATTLER_ANY_TYPE -#define IS_BATTLER_ANY_BASE_TYPE(battlerId, ...) _IS_BATTLER_ANY_TYPE(battlerId, TRUE, __VA_ARGS__) +#define IS_BATTLER_ANY_BASE_TYPE(battler, ...) _IS_BATTLER_ANY_TYPE(battler, TRUE, __VA_ARGS__) #define IS_BATTLER_OF_BASE_TYPE IS_BATTLER_ANY_BASE_TYPE -#define IS_BATTLER_TYPELESS(battlerId) \ - ({ \ - u32 types[3]; \ - GetBattlerTypes(battlerId, FALSE, types); \ +#define IS_BATTLER_TYPELESS(battlerId) \ + ({ \ + u32 types[3]; \ + GetBattlerTypes(battlerId, FALSE, types); \ types[0] == TYPE_MYSTERY && types[1] == TYPE_MYSTERY && types[2] == TYPE_MYSTERY; \ }) -#define SET_BATTLER_TYPE(battlerId, type) \ -{ \ - gBattleMons[battlerId].types[0] = type; \ - gBattleMons[battlerId].types[1] = type; \ - gBattleMons[battlerId].types[2] = TYPE_MYSTERY; \ +#define SET_BATTLER_TYPE(battler, type) \ +{ \ + gBattleMons[battler].types[0] = type; \ + gBattleMons[battler].types[1] = type; \ + gBattleMons[battler].types[2] = TYPE_MYSTERY; \ } -#define RESTORE_BATTLER_TYPE(battlerId) \ -{ \ - gBattleMons[battlerId].types[0] = gSpeciesInfo[gBattleMons[battlerId].species].types[0]; \ - gBattleMons[battlerId].types[1] = gSpeciesInfo[gBattleMons[battlerId].species].types[1]; \ - gBattleMons[battlerId].types[2] = TYPE_MYSTERY; \ +#define RESTORE_BATTLER_TYPE(battler) \ +{ \ + gBattleMons[battler].types[0] = gSpeciesInfo[gBattleMons[battler].species].types[0]; \ + gBattleMons[battler].types[1] = gSpeciesInfo[gBattleMons[battler].species].types[1]; \ + gBattleMons[battler].types[2] = TYPE_MYSTERY; \ } -#define IS_BATTLER_PROTECTED(battlerId)(gProtectStructs[battlerId].protected \ - || gProtectStructs[battlerId].spikyShielded \ - || gProtectStructs[battlerId].kingsShielded \ - || gProtectStructs[battlerId].banefulBunkered \ - || gProtectStructs[battlerId].burningBulwarked \ - || gProtectStructs[battlerId].obstructed \ - || gProtectStructs[battlerId].silkTrapped) +#define IS_BATTLER_PROTECTED(battler)(gProtectStructs[battler].protected \ + || gProtectStructs[battler].spikyShielded \ + || gProtectStructs[battler].kingsShielded \ + || gProtectStructs[battler].banefulBunkered \ + || gProtectStructs[battler].burningBulwarked \ + || gProtectStructs[battler].obstructed \ + || gProtectStructs[battler].silkTrapped) #define GET_STAT_BUFF_ID(n) ((n & 7)) // first three bits 0x1, 0x2, 0x4 #define GET_STAT_BUFF_VALUE_WITH_SIGN(n) ((n & 0xF8)) diff --git a/include/battle_ai_script_commands.h b/include/battle_ai_script_commands.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/include/battle_ai_util.h b/include/battle_ai_util.h index 4855184fac..d8dca70130 100644 --- a/include/battle_ai_util.h +++ b/include/battle_ai_util.h @@ -22,6 +22,14 @@ enum AIPivot SHOULD_PIVOT, }; +enum WeatherState +{ + WEATHER_INACTIVE, + WEATHER_ACTIVE, + WEATHER_ACTIVE_BUT_BLOCKED, + WEATHER_INACTIVE_AND_BLOCKED, +}; + bool32 AI_IsFaster(u32 battlerAi, u32 battlerDef, u32 move); bool32 AI_IsSlower(u32 battlerAi, u32 battlerDef, u32 move); bool32 AI_RandLessThan(u32 val); @@ -58,6 +66,7 @@ s32 AI_DecideKnownAbilityForTurn(u32 battlerId); u32 AI_DecideHoldEffectForTurn(u32 battlerId); bool32 DoesBattlerIgnoreAbilityChecks(u32 battlerAtk, u32 atkAbility, u32 move); u32 AI_GetWeather(void); +enum WeatherState IsWeatherActive(u32 flags); bool32 CanAIFaintTarget(u32 battlerAtk, u32 battlerDef, u32 numHits); bool32 CanIndexMoveFaintTarget(u32 battlerAtk, u32 battlerDef, u32 index, u32 numHits); bool32 HasDamagingMove(u32 battlerId); diff --git a/include/battle_anim.h b/include/battle_anim.h index 4803804900..5b5cc2b109 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -68,21 +68,21 @@ void DestroyAnimSprite(struct Sprite *sprite); void DestroyAnimVisualTask(u8 taskId); void DestroyAnimSoundTask(u8 taskId); u8 GetAnimBattlerId(u8 wantedBattler); -bool8 IsBattlerSpriteVisible(u8 battlerId); -void MoveBattlerSpriteToBG(u8 battlerId, bool8 toBG_2, bool8 setSpriteInvisible); +bool8 IsBattlerSpriteVisible(u8 battler); +void MoveBattlerSpriteToBG(u8 battler, bool8 toBG_2, bool8 setSpriteInvisible); bool8 IsContest(void); s8 BattleAnimAdjustPanning(s8 pan); s8 BattleAnimAdjustPanning2(s8 pan); s16 KeepPanInRange(s16 panArg, int oldPan); s16 CalculatePanIncrement(s16 sourcePan, s16 targetPan, s16 incrementPan); void RelocateBattleBgPal(u16 paletteNum, u16 *dest, u32 offset, bool8 largeScreen); -void ResetBattleAnimBg(bool8); +void ResetBattleAnimBg(bool8 toBG2); void LoadMoveBg(u16 bgId); // battle_intro.c void SetAnimBgAttribute(u8 bgId, u8 attributeId, u8 value); void DrawBattlerOnBg(int bgId, u8 x, u8 y, u8 battlerPosition, u8 paletteId, u8 *tiles, u16 *tilemap, u16 tilesOffset); -void HandleIntroSlide(u8 environmentId); +void HandleIntroSlide(u8 environment); int GetAnimBgAttribute(u8 bgId, u8 attributeId); // battle_anim_mons.c @@ -92,7 +92,7 @@ void AnimTranslateLinearAndFlicker_Flipped(struct Sprite *sprite); void AnimWeatherBallUp(struct Sprite *sprite); void AnimWeatherBallDown(struct Sprite *sprite); void AnimSpinningSparkle(struct Sprite *sprite); -void SetAverageBattlerPositions(u8 battlerId, bool8 respectMonPicOffsets, s16 *x, s16 *y); +void SetAverageBattlerPositions(u8 battler, bool8 respectMonPicOffsets, s16 *x, s16 *y); void DestroySpriteAndMatrix(struct Sprite *sprite); void TranslateSpriteLinearFixedPoint(struct Sprite *sprite); void InitSpritePosToAnimAttacker(struct Sprite *sprite, bool8 respectMonPicOffsets); @@ -102,7 +102,7 @@ void StartAnimLinearTranslation(struct Sprite *sprite); void InitAnimArcTranslation(struct Sprite *sprite); bool8 AnimTranslateLinear(struct Sprite *sprite); void TranslateAnimSpriteToTargetMonLocation(struct Sprite *sprite); -u8 GetBattlerSpriteCoord2(u8 battlerId, u8 attributeId); +u8 GetBattlerSpriteCoord2(u8 battler, u8 coordType); void InitAnimLinearTranslationWithSpeed(struct Sprite *sprite); u16 ArcTan2Neg(s16 x, s16 y); void TrySetSpriteRotScale(struct Sprite *sprite, bool8 recalcCenterVector, s16 xScale, s16 yScale, u16 rotation); @@ -111,19 +111,19 @@ void TranslateSpriteLinearAndFlicker(struct Sprite *sprite); void SetSpriteCoordsToAnimAttackerCoords(struct Sprite *sprite); void RunStoredCallbackWhenAnimEnds(struct Sprite *sprite); void SetAnimSpriteInitialXOffset(struct Sprite *sprite, s16 xOffset); -s16 GetBattlerSpriteCoordAttr(u8 battlerId, u8 attr); -u8 GetBattlerYCoordWithElevation(u8 battlerId); +s16 GetBattlerSpriteCoordAttr(u8 battler, u8 attr); +u8 GetBattlerYCoordWithElevation(u8 battler); void WaitAnimForDuration(struct Sprite *sprite); void AnimTravelDiagonally(struct Sprite *sprite); void InitAnimLinearTranslation(struct Sprite *sprite); void AnimTranslateLinear_WithFollowup(struct Sprite *sprite); -u8 GetBattlerSpriteBGPriority(u8 battlerId); -void *LoadPointerFromVars(s16 bottom, s16 top); -void StorePointerInVars(s16 *bottom, s16 *top, const void *ptr); +u8 GetBattlerSpriteBGPriority(u8 battler); +void *LoadPointerFromVars(s16 lo, s16 hi); +void StorePointerInVars(s16 *lo, s16 *hi, const void *ptr); void InitPrioritiesForVisibleBattlers(void); -void GetBattleAnimBg1Data(struct BattleAnimBgData *); -void GetBattleAnimBgData(struct BattleAnimBgData *, u32 bgId); -u8 GetBattlerSpriteSubpriority(u8 battlerId); +void GetBattleAnimBg1Data(struct BattleAnimBgData *out); +void GetBattleAnimBgData(struct BattleAnimBgData *out, u32 bgId); +u8 GetBattlerSpriteSubpriority(u8 battler); bool8 TranslateAnimHorizontalArc(struct Sprite *sprite); void TranslateSpriteLinearByIdFixedPoint(struct Sprite *sprite); void ResetSpriteRotScale(u8 spriteId); @@ -135,16 +135,16 @@ u32 GetBattlePalettesMask(bool8 battleBackground, bool8 attacker, bool8 target, u32 GetBattleMonSpritePalettesMask(u8 playerLeft, u8 playerRight, u8 opponentLeft, u8 opponentRight); u8 GetSpritePalIdxByBattler(u8 battler); s16 CloneBattlerSpriteWithBlend(u8 animBattler); -void DestroySpriteWithActiveSheet(struct Sprite *); -u8 CreateInvisibleSpriteCopy(int, u8, int); -void AnimLoadCompressedBgTilemapHandleContest(struct BattleAnimBgData *, const void *, bool32); -void AnimLoadCompressedBgGfx(u32, const u32 *, u32); -void UpdateAnimBg3ScreenSize(bool8); -void TranslateSpriteInGrowingCircle(struct Sprite *); +void DestroySpriteWithActiveSheet(struct Sprite *sprite); +u8 CreateInvisibleSpriteCopy(int battler, u8 spriteId, int species); +void AnimLoadCompressedBgTilemapHandleContest(struct BattleAnimBgData *data, const void *src, bool32 largeScreen); +void AnimLoadCompressedBgGfx(u32 bgId, const u32 *src, u32 tilesOffset); +void UpdateAnimBg3ScreenSize(bool8 largeScreenSize); +void TranslateSpriteInGrowingCircle(struct Sprite *sprite); void SetBattlerSpriteYOffsetFromYScale(u8 spriteId); void PrepareEruptAnimTaskData(struct Task *task, u8 spriteId, s16 xScaleStart, s16 yScaleStart, s16 xScaleEnd, s16 yScaleEnd, u16 duration); u8 UpdateEruptAnimTask(struct Task *task); -void DestroyAnimSpriteAndDisableBlend(struct Sprite *); +void DestroyAnimSpriteAndDisableBlend(struct Sprite *sprite); void AnimLoadCompressedBgTilemap(u32 bgId, const void *src); void InitAnimFastLinearTranslationWithSpeed(struct Sprite *sprite); bool8 AnimFastTranslateLinear(struct Sprite *sprite); @@ -154,12 +154,12 @@ void TranslateSpriteLinear(struct Sprite *sprite); void AnimSpriteOnMonPos(struct Sprite *sprite); void InitAnimLinearTranslationWithSpeedAndPos(struct Sprite *sprite); void TranslateSpriteInCircle(struct Sprite *sprite); -void SetGrayscaleOrOriginalPalette(u16 palNum, bool8 restoreOriginal); +void SetGrayscaleOrOriginalPalette(u16 paletteNum, bool8 restoreOriginalColor); void PrepareAffineAnimInTaskData(struct Task *task, u8 spriteId, const union AffineAnimCmd *affineAnimCmds); bool8 RunAffineAnimFromTaskData(struct Task *task); void AnimThrowProjectile(struct Sprite *sprite); -void GetBgDataForTransform(struct BattleAnimBgData *dest, u8 battlerId); -u8 CreateAdditionalMonSpriteForMoveAnim(u16 species, bool8 isBackpic, u8 id, s16 x, s16 y, u8 subpriority, u32 personality, bool8 isShiny, u32 battlerId); +void GetBgDataForTransform(struct BattleAnimBgData *out, u8 battler); +u8 CreateAdditionalMonSpriteForMoveAnim(u16 species, bool8 isBackpic, u8 id, s16 x, s16 y, u8 subpriority, u32 personality, bool8 isShiny, u32 battler); void ResetSpriteRotScale_PreserveAffine(struct Sprite *sprite); void Trade_MoveSelectedMonToTarget(struct Sprite *sprite); void DestroyAnimVisualTaskAndDisableBlend(u8 taskId); @@ -188,17 +188,17 @@ enum BATTLER_COORD_ATTR_RAW_BOTTOM, }; -u8 GetBattlerSpriteCoord(u8 battlerId, u8 attributeId); +u8 GetBattlerSpriteCoord(u8 battler, u8 coordType); -bool8 IsBattlerSpritePresent(u8 battlerId); +bool8 IsBattlerSpritePresent(u8 battler); void ClearBattleAnimBg(u32 bgId); u8 GetAnimBattlerSpriteId(u8 wantedBattler); u8 GetBattleBgPaletteNum(void); -u8 GetBattlerSpriteBGPriorityRank(u8 battlerId); -void StoreSpriteCallbackInData6(struct Sprite *sprite, void (*spriteCallback)(struct Sprite *)); +u8 GetBattlerSpriteBGPriorityRank(u8 battler); +void StoreSpriteCallbackInData6(struct Sprite *sprite, void (*callback)(struct Sprite *)); void SetSpritePrimaryCoordsFromSecondaryCoords(struct Sprite *sprite); -u8 GetBattlerSpriteDefault_Y(u8 battlerId); -u8 GetSubstituteSpriteDefault_Y(u8 battlerId); +u8 GetBattlerSpriteDefault_Y(u8 battler); +u8 GetSubstituteSpriteDefault_Y(u8 battler); // battle_anim_status_effects.c #define STAT_ANIM_PLUS1 (MOVE_EFFECT_ATK_PLUS_1 - 1) @@ -221,7 +221,7 @@ enum { STAT_ANIM_PAL_MULTIPLE = 0xFF }; -void LaunchStatusAnimation(u8 battlerId, u8 statusAnimId); +void LaunchStatusAnimation(u8 battler, u8 statusAnimId); extern const union AnimCmd *const gAnims_SpinningSparkle[]; // battle_anim_ground.c @@ -235,18 +235,17 @@ extern const union AffineAnimCmd *const gAffineAnims_SpinningBone[]; // battle_anim_throw.c void TryShinyAnimation(u8 battler, struct Pokemon *mon); u8 AnimateBallOpenParticles(u8 x, u8 y, u8 priority, u8 subpriority, u8 ballId); -u8 LaunchBallFadeMonTask(bool8 unFadeLater, u8 spritePalNum, u32 selectedPalettes, u8 ballId); +u8 LaunchBallFadeMonTask(bool8 unfadeLater, u8 spritePalNum, u32 selectedPalettes, u8 ballId); bool32 IsCriticalCapture(void); - // battle_anim_utility_funcs.c -void InitStatsChangeAnimation(u8); -void StartMonScrollingBgMask(u8 taskId, int unused, u16 scrollSpeed, u8 battler, bool8 includePartner, u8 numFadeSteps, u8 fadeStepDelay, u8 duration, const u32 *gfx, const u32 *tilemap, const u32 *palette); +void InitStatsChangeAnimation(u8 taskId); +void StartMonScrollingBgMask(u8 taskId, int UNUSED unused, u16 scrollSpeed, u8 battler, bool8 includePartner, u8 numFadeSteps, u8 fadeStepDelay, u8 duration, const u32 *gfx, const u32 *tilemap, const u32 *palette); // battle_anim_effects_1.c void AnimFalseSwipeSlice_Step3(struct Sprite *); void SetSpriteNextToMonHead(u8 battler, struct Sprite *sprite); void AnimMoveTwisterParticle(struct Sprite *sprite); -void AnimParticleBurst(struct Sprite *); +void AnimParticleBurst(struct Sprite *sprite); void AnimPowerAbsorptionOrb(struct Sprite *sprite); void AnimNeedleArmSpike(struct Sprite *); void AnimTask_CompressTargetHorizontally(u8 taskId); @@ -382,9 +381,9 @@ void AnimPsychoBoost(struct Sprite *sprite); // battle_anim_smokescreen.c u8 SmokescreenImpact(s16 x, s16 y, bool8 persist); -u32 UnpackSelectedBattlePalettes(s16); +u32 UnpackSelectedBattlePalettes(s16 selector); -u8 GetBattlerSpriteFinal_Y(u8, u16, u8); +u8 GetBattlerSpriteFinal_Y(u8 battler, u16 species, bool8 a3); extern const struct OamData gOamData_AffineOff_ObjNormal_8x16; extern const struct OamData gOamData_AffineNormal_ObjBlend_16x16; diff --git a/include/battle_controllers.h b/include/battle_controllers.h index 0b7ea171c9..0716ae2e54 100644 --- a/include/battle_controllers.h +++ b/include/battle_controllers.h @@ -64,11 +64,65 @@ enum { REQUEST_TOUGH_RIBBON_BATTLE, }; +// Accessors for gBattleControllerExecFlags. +// +// These are provided for documentation purposes, to make the battle +// controller internals and the link communication internals more +// legible. Several of these have functions that you should call +// (e.g. MarkBattlerForControllerExec) instead of using these macros +// directly. + +#define MARK_BATTLE_CONTROLLER_ACTIVE_ON_LOCAL(battler) \ + gBattleControllerExecFlags |= (1u << battler) + +#define MARK_BATTLE_CONTROLLER_IDLE_ON_LOCAL(battler) \ + gBattleControllerExecFlags &= ~(1u << battler) + +#define IS_BATTLE_CONTROLLER_ACTIVE_ON_LOCAL(battler) \ + (gBattleControllerExecFlags & (1u << battler)) + +#define MARK_BATTLE_CONTROLLER_MESSAGE_OUTBOUND_OVER_LINK(battler) \ + gBattleControllerExecFlags |= (1u << battler) << (32 - MAX_BATTLERS_COUNT) + +#define MARK_BATTLE_CONTROLLER_MESSAGE_SYNCHRONIZED_OVER_LINK(battler) \ + gBattleControllerExecFlags &= ~((1 << 28) << (battler)) + +#define MARK_BATTLE_CONTROLLER_ACTIVE_FOR_PLAYER(battler, playerId) \ + gBattleControllerExecFlags |= (1u << battler) << ((playerId) << 2) + +#define MARK_BATTLE_CONTROLLER_IDLE_FOR_PLAYER(battler, playerId) \ + gBattleControllerExecFlags &= ~(1u << battler) << ((playerId) * 4) + +#define IS_BATTLE_CONTROLLER_ACTIVE_FOR_PLAYER(battler, playerId) \ + (gBattleControllerExecFlags & (1u << battler) << ((playerId) * 4)) + +// This actually checks if a specific controller is active on any player or if +// *any* controller is pending sync over link communications, but the macro name +// can only be so specific before it just gets ridiculous. +#define IS_BATTLE_CONTROLLER_ACTIVE_OR_PENDING_SYNC_ANYWHERE(battler) \ + (gBattleControllerExecFlags & ( \ + (1u << battler) \ + | (0xF << 28) \ + | (1u << battler << 4) \ + | (1u << battler << 8) \ + | (1u << battler << 12) \ + )) + // Special arguments for Battle Controller functions. -enum { // Values given to the emit functions to choose gBattleBufferA or gBattleBufferB - BUFFER_A, - BUFFER_B +enum { + // For commands sent from the core battle engine to a controller. + B_COMM_TO_CONTROLLER, // gBattleBufferA + + // For replies sent from a controller to the core battle engine. + B_COMM_TO_ENGINE, // gBattleBufferB + + // During local play, a controller must directly mark itself as + // inactive when it's done processing, whether or not it sends + // a reply. During multiplayer, it must NOT directly mark itself + // as inactive, but instead send one of these, with the player's + // multiplayer ID as data. + B_COMM_CONTROLLER_IS_DONE }; enum { @@ -237,11 +291,11 @@ void BtlController_EmitPlayFanfareOrBGM(u32 battler, u32 bufferId, u16 songId, b void BtlController_EmitFaintingCry(u32 battler, u32 bufferId); void BtlController_EmitIntroSlide(u32 battler, u32 bufferId, u8 terrainId); void BtlController_EmitIntroTrainerBallThrow(u32 battler, u32 bufferId); -void BtlController_EmitDrawPartyStatusSummary(u32 battler, u32 bufferId, struct HpAndStatus* hpAndStatus, u8 flags); +void BtlController_EmitDrawPartyStatusSummary(u32 battler, u32 bufferId, struct HpAndStatus *hpAndStatus, u8 flags); void BtlController_EmitHidePartyStatusSummary(u32 battler, u32 bufferId); void BtlController_EmitEndBounceEffect(u32 battler, u32 bufferId); void BtlController_EmitSpriteInvisibility(u32 battler, u32 bufferId, bool8 isInvisible); -void BtlController_EmitBattleAnimation(u32 battler, u32 bufferId, u8 animationId, struct DisableStruct* disableStructPtr, u16 argument); +void BtlController_EmitBattleAnimation(u32 battler, u32 bufferId, u8 animationId, struct DisableStruct *disableStructPtr, u16 argument); void BtlController_EmitLinkStandbyMsg(u32 battler, u32 bufferId, u8 mode, bool32 record); void BtlController_EmitResetActionMoveSelection(u32 battler, u32 bufferId, u8 caseId); void BtlController_EmitEndLinkBattle(u32 battler, u32 bufferId, u8 battleOutcome); @@ -301,8 +355,8 @@ u32 LinkPlayerGetTrainerPicId(u32 multiplayerId); void CB2_SetUpReshowBattleScreenAfterMenu(void); void CB2_SetUpReshowBattleScreenAfterMenu2(void); void Task_PlayerController_RestoreBgmAfterCry(u8 taskId); -void ActionSelectionCreateCursorAt(u8 cursorPos, u8 unused); -void ActionSelectionDestroyCursorAt(u8 cursorPos); +void ActionSelectionCreateCursorAt(u8 cursorPosition, u8 baseTileNum); +void ActionSelectionDestroyCursorAt(u8 cursorPosition); void InitMoveSelectionsVarsAndStrings(u32 battler); void MoveSelectionCreateCursorAt(u8 cursorPos, u8 arg1); void MoveSelectionDestroyCursorAt(u8 cursorPosition); diff --git a/include/battle_gfx_sfx_util.h b/include/battle_gfx_sfx_util.h index d84af67f35..c2cc901171 100644 --- a/include/battle_gfx_sfx_util.h +++ b/include/battle_gfx_sfx_util.h @@ -22,7 +22,7 @@ bool8 BattleInitAllSprites(u8 *state1, u8 *battler); void ClearSpritesHealthboxAnimData(void); void CopyAllBattleSpritesInvisibilities(void); void CopyBattleSpriteInvisibility(u8 battler); -void HandleSpeciesGfxDataChange(u8 attacker, u8 target, bool32 megaEvo, bool8 trackEnemyPersonality); +void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool32 megaEvo, bool8 trackEnemyPersonality); void BattleLoadSubstituteOrMonSpriteGfx(u8 battler, bool8 loadMonSprite); void LoadBattleMonGfxAndAnimate(u8 battler, bool8 loadMonSprite, u8 spriteId); void TrySetBehindSubstituteSpriteBit(u8 battler, u16 move); diff --git a/include/battle_interface.h b/include/battle_interface.h index 600a9a956d..ca2e415f12 100644 --- a/include/battle_interface.h +++ b/include/battle_interface.h @@ -103,10 +103,10 @@ enum u32 WhichBattleCoords(u32 battlerId); u8 CreateBattlerHealthboxSprites(u8 battler); u8 CreateSafariPlayerHealthboxSprites(void); -void SetBattleBarStruct(u8 battler, u8 healthboxSpriteId, s32 maxVal, s32 currVal, s32 receivedValue); +void SetBattleBarStruct(u8 battler, u8 healthboxSpriteId, s32 maxVal, s32 oldVal, s32 receivedValue); void SetHealthboxSpriteInvisible(u8 healthboxSpriteId); void SetHealthboxSpriteVisible(u8 healthboxSpriteId); -void DummyBattleInterfaceFunc(u8 healthboxSpriteId, bool8 isDoubleBattleBankOnly); +void DummyBattleInterfaceFunc(u8 healthboxSpriteId, bool8 isDoubleBattleBattlerOnly); void UpdateOamPriorityInAllHealthboxes(u8 priority, bool32 hideHpBoxes); void InitBattlerHealthboxCoords(u8 battler); void GetBattlerHealthboxCoords(u8 battler, s16 *x, s16 *y); diff --git a/include/battle_main.h b/include/battle_main.h index e8368f82d6..d2c2ef7ece 100644 --- a/include/battle_main.h +++ b/include/battle_main.h @@ -45,7 +45,7 @@ void SpriteCB_VsLetterDummy(struct Sprite *sprite); void SpriteCB_VsLetterInit(struct Sprite *sprite); void CB2_InitEndLinkBattle(void); u32 GetBattleBgTemplateData(u8 arrayId, u8 caseId); -u32 GetBattleWindowTemplatePixelWidth(u32 setId, u32 tableId); +u32 GetBattleWindowTemplatePixelWidth(u32 windowsType, u32 tableId); void SpriteCB_WildMon(struct Sprite *sprite); void SpriteCallbackDummy_2(struct Sprite *sprite); void SpriteCB_FaintOpponentMon(struct Sprite *sprite); @@ -67,7 +67,7 @@ const u8* FaintClearSetData(u32 battler); void BattleTurnPassed(void); u8 IsRunningFromBattleImpossible(u32 battler); void SwitchTwoBattlersInParty(u32 battler, u32 battler2); -void SwitchPartyOrder(u32 battlerId); +void SwitchPartyOrder(u32 battler); void SwapTurnOrder(u8 id1, u8 id2); u32 GetBattlerTotalSpeedStatArgs(u32 battler, u32 ability, u32 holdEffect); u32 GetBattlerTotalSpeedStat(u32 battler); @@ -80,7 +80,7 @@ s32 GetWhichBattlerFaster(u32 battler1, u32 battler2, bool32 ignoreChosenMoves); void RunBattleScriptCommands_PopCallbacksStack(void); void RunBattleScriptCommands(void); void SpecialStatusesClear(void); -u32 GetDynamicMoveType(struct Pokemon *mon, u32 move, u32 battler, u8 *ateBoost); +u32 GetDynamicMoveType(struct Pokemon *mon, u32 move, u32 battler, enum MonState monInBattle); void SetTypeBeforeUsingMove(u32 move, u32 battlerAtk); bool32 IsWildMonSmart(void); u8 CreateNPCTrainerPartyFromTrainer(struct Pokemon *party, const struct Trainer *trainer, bool32 firstTrainer, u32 battleTypeFlags); diff --git a/include/battle_pyramid.h b/include/battle_pyramid.h index 62320358b6..ec80fdeed3 100644 --- a/include/battle_pyramid.h +++ b/include/battle_pyramid.h @@ -15,7 +15,7 @@ void CopyPyramidTrainerSpeechBefore(u16 trainerId); void CopyPyramidTrainerWinSpeech(u16 trainerId); void CopyPyramidTrainerLoseSpeech(u16 trainerId); u8 GetTrainerEncounterMusicIdInBattlePyramid(u16 trainerId); -void GenerateBattlePyramidFloorLayout(u16 *mapArg, bool8 setPlayerPosition); +void GenerateBattlePyramidFloorLayout(u16 *backupMapData, bool8 setPlayerPosition); void LoadBattlePyramidObjectEventTemplates(void); void LoadBattlePyramidFloorObjectEventScripts(void); u8 GetNumBattlePyramidObjectEvents(void); diff --git a/include/battle_records.h b/include/battle_records.h index 88ff6adc96..fe71570389 100644 --- a/include/battle_records.h +++ b/include/battle_records.h @@ -4,7 +4,7 @@ extern u8 gRecordsWindowId; void ClearPlayerLinkBattleRecords(void); -void UpdatePlayerLinkBattleRecords(s32 battlerId); +void UpdatePlayerLinkBattleRecords(s32 battler); void ShowLinkBattleRecords(void); void RemoveRecordsWindow(void); void ShowTrainerHillRecords(void); diff --git a/include/battle_script_commands.h b/include/battle_script_commands.h index cc6c09012c..b19630d82e 100644 --- a/include/battle_script_commands.h +++ b/include/battle_script_commands.h @@ -25,7 +25,7 @@ struct PickupItem s32 CalcCritChanceStage(u32 battlerAtk, u32 battlerDef, u32 move, bool32 recordAbility, u32 abilityAtk, u32 abilityDef, u32 holdEffectAtk); s32 GetCritHitOdds(s32 critChanceIndex); u32 GetTotalAccuracy(u32 battlerAtk, u32 battlerDef, u32 move, u32 atkAbility, u32 defAbility, u32 atkHoldEffect, u32 defHoldEffect); -u8 GetBattlerTurnOrderNum(u8 battlerId); +u8 GetBattlerTurnOrderNum(u8 battler); bool32 NoAliveMonsForPlayer(void); bool32 NoAliveMonsForEitherParty(void); void SetMoveEffect(bool32 primary, bool32 certain); @@ -34,7 +34,7 @@ void BattleDestroyYesNoCursorAt(u8 cursorPosition); void BattleCreateYesNoCursorAt(u8 cursorPosition); void BufferMoveToLearnIntoBattleTextBuff2(void); void HandleBattleWindow(u8 xStart, u8 yStart, u8 xEnd, u8 yEnd, u8 flags); -bool8 UproarWakeUpCheck(u8 battlerId); +bool8 UproarWakeUpCheck(u8 battler); bool32 DoesSubstituteBlockMove(u32 battlerAtk, u32 battlerDef, u32 move); bool32 DoesDisguiseBlockMove(u32 battler, u32 move); bool32 CanPoisonType(u8 battlerAttacker, u8 battlerTarget); @@ -58,7 +58,7 @@ bool32 IsMoveAffectedByParentalBond(u32 move, u32 battler); void SaveBattlerTarget(u32 battler); void SaveBattlerAttacker(u32 battler); -extern void (* const gBattleScriptingCommandsTable[])(void); +extern void (*const gBattleScriptingCommandsTable[])(void); extern const struct StatFractions gAccuracyStageRatios[]; #endif // GUARD_BATTLE_SCRIPT_COMMANDS_H diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 20ea1ccd49..ab25df0684 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -237,8 +237,8 @@ extern const u8 BattleScript_SelectingNotAllowedMoveChoiceItemInPalace[]; extern const u8 BattleScript_HangedOnMsg[]; extern const u8 BattleScript_BerryConfuseHealEnd2[]; extern const u8 BattleScript_BerryConfuseHealRet[]; -extern const u8 BattleScript_BerryStatRaiseEnd2[]; -extern const u8 BattleScript_BerryStatRaiseRet[]; +extern const u8 BattleScript_ConsumableStatRaiseEnd2[]; +extern const u8 BattleScript_ConsumableStatRaiseRet[]; extern const u8 BattleScript_BerryFocusEnergyRet[]; extern const u8 BattleScript_BerryFocusEnergyEnd2[]; extern const u8 BattleScript_ActionSelectionItemsCantBeUsed[]; @@ -286,6 +286,7 @@ extern const u8 BattleScript_BadDreamsActivates[]; extern const u8 BattleScript_SwitchInAbilityMsg[]; extern const u8 BattleScript_SwitchInAbilityMsgRet[]; extern const u8 BattleScript_ToxicSpikesPoisoned[]; +extern const u8 BattleScript_ToxicSpikesBadlyPoisoned[]; extern const u8 BattleScript_ToxicSpikesAbsorbed[]; extern const u8 BattleScript_StickyWebOnSwitchIn[]; extern const u8 BattleScript_SolarPowerActivates[]; @@ -488,9 +489,9 @@ extern const u8 BattleScript_ShellTrapSetUp[]; extern const u8 BattleScript_StealthRockActivates[]; extern const u8 BattleScript_CouldntFullyProtect[]; extern const u8 BattleScript_MoveEffectStockpileWoreOff[]; -extern const u8 BattleScript_StealthRockActivates[]; extern const u8 BattleScript_SpikesActivates[]; extern const u8 BattleScript_BerserkGeneRet[]; +extern const u8 BattleScript_BerserkGeneRetEnd2[]; extern const u8 BattleScript_TargetFormChangeWithStringNoPopup[]; extern const u8 BattleScript_DefDown[]; extern const u8 BattleScript_UltraBurst[]; @@ -815,7 +816,7 @@ extern const u8 BattleScript_MoveEffectEerieSpell[]; extern const u8 BattleScript_EffectJungleHealing[]; extern const u8 BattleScript_EffectCoaching[]; extern const u8 BattleScript_EffectDecorate[]; -extern const u8 BattleScript_EffectRecoilHP25[]; +extern const u8 BattleScript_EffectStruggle[]; extern const u8 BattleScript_EffectStuffCheeks[]; extern const u8 BattleScript_MoveEffectLightScreen[]; extern const u8 BattleScript_MoveEffectReflect[]; diff --git a/include/battle_tv.h b/include/battle_tv.h index 72466d73b8..5766907637 100644 --- a/include/battle_tv.h +++ b/include/battle_tv.h @@ -6,6 +6,6 @@ void BattleTv_SetDataBasedOnMove(u16 move, u16 weatherFlags, struct DisableStruc void BattleTv_SetDataBasedOnAnimation(u8 animationId); void TryPutLinkBattleTvShowOnAir(void); void BattleTv_ClearExplosionFaintCause(void); -u8 GetBattlerMoveSlotId(u8 battlerId, u16 moveId); +u8 GetBattlerMoveSlotId(u8 battler, u16 move); #endif // GUARD_BATTLE_TV_H diff --git a/include/battle_util.h b/include/battle_util.h index 492c188278..8ef60742ad 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -212,7 +212,7 @@ bool32 HandleFaintedMonActions(void); void TryClearRageAndFuryCutter(void); u32 AtkCanceller_MoveSuccessOrder(void); void SetAtkCancellerForCalledMove(void); -bool32 HasNoMonsToSwitch(u32 battler, u8 r1, u8 r2); +bool32 HasNoMonsToSwitch(u32 battler, u8 partyIdBattlerOn1, u8 partyIdBattlerOn2); bool32 TryChangeBattleWeather(u32 battler, u32 battleWeatherId, bool32 viaAbility); bool32 CanAbilityBlockMove(u32 battlerAtk, u32 battlerDef, u32 move, u32 abilityDef, enum AbilityEffectOptions option); bool32 CanAbilityAbsorbMove(u32 battlerAtk, u32 battlerDef, u32 abilityDef, u32 move, u32 moveType, enum AbilityEffectOptions option); diff --git a/include/berry.h b/include/berry.h index ba1bbb1d12..4aad7daa68 100644 --- a/include/berry.h +++ b/include/berry.h @@ -10,13 +10,12 @@ bool8 IsPlayerFacingEmptyBerryTreePatch(void); bool8 TryToWaterBerryTree(void); void ClearBerryTrees(void); void BerryTreeTimeUpdate(s32 minutes); -void PlantBerryTree(u8 id, u8 berry, u8 stage, bool8 sparkle); +void PlantBerryTree(u8 id, u8 berry, u8 stage, bool8 allowGrowth); void RemoveBerryTree(u8 id); u8 GetBerryTypeByBerryTreeId(u8 id); -u8 GetStageByBerryTreeId(u8); +u8 GetStageByBerryTreeId(u8 id); u8 ItemIdToBerryType(u16 item); void GetBerryNameByBerryType(u8 berry, u8 *string); -void ResetBerryTreeSparkleFlag(u8 id); void Bag_ChooseBerry(void); void Bag_ChooseMulch(void); void ObjectEventInteractionGetBerryTreeData(void); diff --git a/include/cable_club.h b/include/cable_club.h index c493691c1c..5a68df621c 100644 --- a/include/cable_club.h +++ b/include/cable_club.h @@ -4,7 +4,7 @@ #include "task.h" #include "constants/cable_club.h" -void CreateTask_EnterCableClubSeat(TaskFunc taskFunc); +void CreateTask_EnterCableClubSeat(TaskFunc followupFunc); u8 CreateTask_ReestablishCableClubLink(void); void CB2_ReturnFromCableClubBattle(void); bool32 AreBattleTowerLinkSpeciesSame(u16 *speciesList1, u16 *speciesList2); diff --git a/include/constants/battle.h b/include/constants/battle.h index 86226013d5..cfb5d05e7e 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -23,12 +23,23 @@ * +---------------------------+ */ -#define MAX_BATTLERS_COUNT 4 +enum BattlerPosition +{ + B_POSITION_PLAYER_LEFT, + B_POSITION_OPPONENT_LEFT, + B_POSITION_PLAYER_RIGHT, + B_POSITION_OPPONENT_RIGHT, + MAX_POSITION_COUNT, +}; -#define B_POSITION_PLAYER_LEFT 0 -#define B_POSITION_OPPONENT_LEFT 1 -#define B_POSITION_PLAYER_RIGHT 2 -#define B_POSITION_OPPONENT_RIGHT 3 +enum BattlerId +{ + B_BATTLER_0, + B_BATTLER_1, + B_BATTLER_2, + B_BATTLER_3, + MAX_BATTLERS_COUNT, +}; // These macros can be used with either battler ID or positions to get the partner or the opposite mon #define BATTLE_OPPOSITE(id) ((id) ^ BIT_SIDE) @@ -611,4 +622,10 @@ enum SlideMsgStates RESTORE_BATTLER_SLIDE_CONTROL, }; +enum MonState +{ + MON_IN_BATTLE, + MON_OUTSIDE_BATTLE, +}; + #endif // GUARD_CONSTANTS_BATTLE_H diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index 6525cf1544..073d4d2058 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -292,7 +292,7 @@ enum { EFFECT_DYNAMAX_DOUBLE_DMG, EFFECT_DECORATE, EFFECT_SNIPE_SHOT, - EFFECT_RECOIL_HP_25, + EFFECT_STRUGGLE, EFFECT_STUFF_CHEEKS, EFFECT_GRAV_APPLE, EFFECT_HYPERSPACE_FURY, diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index 3ba637c690..7c7e023fa3 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -729,8 +729,9 @@ #define STRINGID_ITDOESNTAFFECTTWOFOES 727 #define STRINGID_SENDCAUGHTMONPARTYORBOX 728 #define STRINGID_PKMNSENTTOPCAFTERCATCH 729 +#define STRINGID_TOXICSPIKESBADLYPOISONED 730 -#define BATTLESTRINGS_COUNT 730 +#define BATTLESTRINGS_COUNT 731 // This is the string id that gBattleStringsTable starts with. // String ids before this (e.g. STRINGID_INTROMSG) are not in the table, diff --git a/include/contest.h b/include/contest.h index a10ec5babd..80a1370541 100644 --- a/include/contest.h +++ b/include/contest.h @@ -295,11 +295,11 @@ struct ContestResources struct ContestGraphicsState *gfxState; struct ContestMoveAnimData *moveAnim; struct ContestTV *tv; - struct ContestUnused * unused; + struct ContestUnused *unused; u8 *contestBgTilemaps[CONTESTANT_COUNT]; - void * boxBlinkTiles1; - void * boxBlinkTiles2; - void * animBgTileBuffer; + void *boxBlinkTiles1; + void *boxBlinkTiles2; + void *animBgTileBuffer; }; #define eContest (*gContestResources->contest) diff --git a/include/contest_ai.h b/include/contest_ai.h index 20b9eec10d..4ba2c9ca2e 100644 --- a/include/contest_ai.h +++ b/include/contest_ai.h @@ -10,7 +10,7 @@ enum CONTESTAI_DO_NOT_PROCESS }; -void ContestAI_ResetAI(u8); +void ContestAI_ResetAI(u8 contestantAI); u8 ContestAI_GetActionToUse(void); #endif // GUARD_CONTESTAI_H diff --git a/include/contest_link.h b/include/contest_link.h index cd26825246..091d344609 100644 --- a/include/contest_link.h +++ b/include/contest_link.h @@ -1,23 +1,23 @@ #ifndef GUARD_CONTEST_LINK_H #define GUARD_CONTEST_LINK_H -void Task_LinkContest_CommunicateAppealsState(u8); -void Task_LinkContest_CommunicateFinalStandings(u8); -void Task_LinkContest_Init(u8); -void Task_LinkContest_CommunicateMonsRS(u8); -void Task_LinkContest_CommunicateRngRS(u8); -void Task_LinkContest_CommunicateLeaderIdsRS(u8); -void Task_LinkContest_CommunicateCategoryRS(u8); -void Task_LinkContest_CommunicateMonIdxs(u8); -void Task_LinkContest_StartCommunicationEm(u8); -void Task_LinkContest_CommunicateRound1Points(u8); -void Task_LinkContest_CommunicateTurnOrder(u8); -void Task_LinkContest_FinalizeConnection(u8); -void Task_LinkContest_CommunicateMoveSelections(u8); -bool32 LinkContest_TryLinkStandby(s16 *); -bool32 LinkContest_SendBlock(void *, u16); +void Task_LinkContest_CommunicateAppealsState(u8 taskId); +void Task_LinkContest_CommunicateFinalStandings(u8 taskId); +void Task_LinkContest_Init(u8 taskId); +void Task_LinkContest_CommunicateMonsRS(u8 taskId); +void Task_LinkContest_CommunicateRngRS(u8 taskId); +void Task_LinkContest_CommunicateLeaderIdsRS(u8 taskId); +void Task_LinkContest_CommunicateCategoryRS(u8 taskId); +void Task_LinkContest_CommunicateMonIdxs(u8 taskId); +void Task_LinkContest_StartCommunicationEm(u8 taskId); +void Task_LinkContest_CommunicateRound1Points(u8 taskId); +void Task_LinkContest_CommunicateTurnOrder(u8 taskId); +void Task_LinkContest_FinalizeConnection(u8 taskId); +void Task_LinkContest_CommunicateMoveSelections(u8 taskId); +bool32 LinkContest_TryLinkStandby(s16 *state); +bool32 LinkContest_SendBlock(void *src, u16 size); bool8 LinkContest_GetBlockReceivedFromAllPlayers(void); -bool8 LinkContest_GetBlockReceived(u8); -u8 LinkContest_GetLeaderIndex(u8 *); +bool8 LinkContest_GetBlockReceived(u8 flag); +u8 LinkContest_GetLeaderIndex(u8 *ids); #endif //GUARD_CONTEST_LINK_H diff --git a/include/contest_painting.h b/include/contest_painting.h index f16a0d2f32..06277dec1f 100644 --- a/include/contest_painting.h +++ b/include/contest_painting.h @@ -1,7 +1,7 @@ #ifndef GUARD_CONTESTPAINTING_H #define GUARD_CONTESTPAINTING_H -void SetContestWinnerForPainting(int); +void SetContestWinnerForPainting(int contestWinnerId); void CB2_ContestPainting(void); #endif diff --git a/include/contest_util.h b/include/contest_util.h index 1e97d91d35..fcf742012f 100644 --- a/include/contest_util.h +++ b/include/contest_util.h @@ -6,7 +6,7 @@ void BufferContestantMonNickname(void); void StartContest(void); void BufferContestantMonSpecies(void); void ShowContestResults(void); -void ContestLinkTransfer(u8); +void ContestLinkTransfer(u8 category); void ShowContestPainting(void); u16 GetContestRand(void); u8 CountPlayerMuseumPaintings(void); diff --git a/include/coord_event_weather.h b/include/coord_event_weather.h index 86fb487932..92cceae68f 100644 --- a/include/coord_event_weather.h +++ b/include/coord_event_weather.h @@ -1,6 +1,6 @@ #ifndef GUARD_COORD_EVENT_WEATHER_H #define GUARD_COORD_EVENT_WEATHER_H -void DoCoordEventWeather(u8); +void DoCoordEventWeather(u8 coordEventWeather); #endif // GUARD_COORD_EVENT_WEATHER_H diff --git a/include/decoration.h b/include/decoration.h index db0f337f4d..415ffb85ae 100644 --- a/include/decoration.h +++ b/include/decoration.h @@ -58,10 +58,10 @@ extern u8 gCurDecorationIndex; void InitDecorationContextItems(void); void DoSecretBaseDecorationMenu(u8 taskId); -void ShowDecorationOnMap(u16 mapX, u16 mapY, u16 decor); +void ShowDecorationOnMap(u16 mapX, u16 mapY, u16 decoration); void DoPlayerRoomDecorationMenu(u8 taskId); void ShowDecorationCategoriesWindow(u8 taskId); -void CopyDecorationCategoryName(u8 *dest, u8 decorCat); +void CopyDecorationCategoryName(u8 *dest, u8 category); bool8 IsSelectedDecorInThePC(void); u8 AddDecorationIconObject(u8 decor, s16 x, s16 y, u8 priority, u16 tilesTag, u16 paletteTag); diff --git a/include/decoration_inventory.h b/include/decoration_inventory.h index f43b91d7a1..6bb9910ba4 100644 --- a/include/decoration_inventory.h +++ b/include/decoration_inventory.h @@ -12,9 +12,9 @@ extern struct DecorationInventory gDecorationInventories[]; void SetDecorationInventoriesPointers(void); void ClearDecorationInventories(void); s8 GetFirstEmptyDecorSlot(u8 category); -u8 CheckHasDecoration(u8 decor); -u8 DecorationAdd(u8 decor); -u8 DecorationCheckSpace(u8 decor); +bool8 CheckHasDecoration(u8 decor); +bool8 DecorationAdd(u8 decor); +bool8 DecorationCheckSpace(u8 decor); s8 DecorationRemove(u8 decor); void CondenseDecorationsInCategory(u8 category); u8 GetNumOwnedDecorationsInCategory(u8 category); diff --git a/include/easy_chat.h b/include/easy_chat.h index 2cec441d55..0434bb0100 100644 --- a/include/easy_chat.h +++ b/include/easy_chat.h @@ -122,16 +122,16 @@ struct EasyChatWordsByLetter void InitEasyChatPhrases(void); void ShowEasyChatScreen(void); -u8 *CopyEasyChatWord(u8 *dest, u16 word); -bool32 IsEasyChatAnswerUnlocked(int word); +u8 *CopyEasyChatWord(u8 *dest, u16 easyChatWord); +bool32 IsEasyChatAnswerUnlocked(int easyChatWord); void InitializeEasyChatWordArray(u16 *words, u16 length); u8 *ConvertEasyChatWordsToString(u8 *dest, const u16 *src, u16 columns, u16 rows); -bool8 IsBardWordInvalid(u16 word); -u16 GetRandomEasyChatWordFromGroup(u16 group); +bool8 IsBardWordInvalid(u16 easyChatWord); +u16 GetRandomEasyChatWordFromGroup(u16 groupId); u16 UnlockRandomTrendySaying(void); -u16 EasyChat_GetNumWordsInGroup(u8); -u16 GetRandomEasyChatWordFromUnlockedGroup(u16); -void DoEasyChatScreen(u8 type, u16 *words, MainCallback callback, u8 displayedPersonType); +u16 EasyChat_GetNumWordsInGroup(u8 groupId); +u16 GetRandomEasyChatWordFromUnlockedGroup(u16 groupId); +void DoEasyChatScreen(u8 type, u16 *words, MainCallback exitCallback, u8 displayedPersonType); void InitQuestionnaireWords(void); void UnlockTrendySaying(u8 wordIndex); diff --git a/include/ereader_helpers.h b/include/ereader_helpers.h index 29386bcb22..0e3d122b58 100755 --- a/include/ereader_helpers.h +++ b/include/ereader_helpers.h @@ -49,10 +49,10 @@ struct EReaderTrainerHillSet u8 unk_ec0[40]; }; // size = 0xf00 -bool8 ValidateTrainerHillData(struct EReaderTrainerHillSet *); -bool32 TryWriteTrainerHill(struct EReaderTrainerHillSet *); +bool8 ValidateTrainerHillData(struct EReaderTrainerHillSet *hillSet); +bool32 TryWriteTrainerHill(struct EReaderTrainerHillSet *hillSet); bool32 ReadTrainerHillAndValidate(void); -int EReaderHandleTransfer(u8, size_t, const void *, void *); +int EReaderHandleTransfer(u8 mode, size_t size, const void *data, void *recvBuffer); void EReaderHelper_Timer3Callback(void); void EReaderHelper_SerialCallback(void); void EReaderHelper_SaveRegsState(void); diff --git a/include/event_object_movement.h b/include/event_object_movement.h index 679ad80ea4..6dfcab82f5 100644 --- a/include/event_object_movement.h +++ b/include/event_object_movement.h @@ -133,28 +133,28 @@ void LoadSpecialObjectReflectionPalette(u16 tag, u8 slot); void TryMoveObjectEventToMapCoords(u8 localId, u8 mapNum, u8 mapGroup, s16 x, s16 y); void PatchObjectPalette(u16 paletteTag, u8 paletteSlot); void SpawnObjectEventsOnReturnToField(s16 x, s16 y); -void OverrideSecretBaseDecorationSpriteScript(u8 localId, u8 mapNum, u8 mapGroup, u8 decorCat); +void OverrideSecretBaseDecorationSpriteScript(u8 localId, u8 mapNum, u8 mapGroup, u8 decorationCategory); void GetMapCoordsFromSpritePos(s16 x, s16 y, s16 *destX, s16 *destY); u8 GetFaceDirectionAnimNum(u8 direction); void SetSpritePosToOffsetMapCoords(s16 *x, s16 *y, s16 dx, s16 dy); void ClearObjectEventMovement(struct ObjectEvent *objectEvent, struct Sprite *sprite); -void ObjectEventClearHeldMovement(struct ObjectEvent *); -void ObjectEventClearHeldMovementIfActive(struct ObjectEvent *); +void ObjectEventClearHeldMovement(struct ObjectEvent *objectEvent); +void ObjectEventClearHeldMovementIfActive(struct ObjectEvent *objectEvent); struct Pokemon *GetFirstLiveMon(void); u16 GetOverworldWeatherSpecies(u16 species); void UpdateFollowingPokemon(void); void RemoveFollowingPokemon(void); struct ObjectEvent *GetFollowerObject(void); void TrySpawnObjectEvents(s16 cameraX, s16 cameraY); -u8 CreateObjectGraphicsSprite(u16, void (*)(struct Sprite *), s16 x, s16 y, u8 subpriority); +u8 CreateObjectGraphicsSprite(u16 graphicsId, void (*callback)(struct Sprite *), s16 x, s16 y, u8 subpriority); u8 TrySpawnObjectEvent(u8 localId, u8 mapNum, u8 mapGroup); u8 SpawnSpecialObjectEventParameterized(u16 graphicsId, u8 movementBehavior, u8 localId, s16 x, s16 y, u8 elevation); -u8 SpawnSpecialObjectEvent(struct ObjectEventTemplate *); +u8 SpawnSpecialObjectEvent(struct ObjectEventTemplate *objectEventTemplate); void SetSpritePosToMapCoords(s16 mapX, s16 mapY, s16 *destX, s16 *destY); void CameraObjectReset(void); -u8 UpdateSpritePaletteByTemplate(const struct SpriteTemplate *, struct Sprite *); -void ObjectEventSetGraphicsId(struct ObjectEvent *, u16 graphicsId); -void ObjectEventTurn(struct ObjectEvent *, u8 direction); +u8 UpdateSpritePaletteByTemplate(const struct SpriteTemplate *spriteTemplate, struct Sprite *sprite); +void ObjectEventSetGraphicsId(struct ObjectEvent *objectEvent, u16 graphicsId); +void ObjectEventTurn(struct ObjectEvent *objectEvent, u8 direction); void ObjectEventTurnByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup, u8 direction); const struct ObjectEventGraphicsInfo *GetObjectEventGraphicsInfo(u16 graphicsId); void SetObjectInvisibility(u8 localId, u8 mapNum, u8 mapGroup, bool8 invisible); @@ -166,12 +166,12 @@ void ResetObjectSubpriority(u8 localId, u8 mapNum, u8 mapGroup); void SetObjectSubpriority(u8 localId, u8 mapNum, u8 mapGroup, u8 subpriority); void AllowObjectAtPosTriggerGroundEffects(s16 x, s16 y); void ObjectEventGetLocalIdAndMap(struct ObjectEvent *objectEvent, void *localId, void *mapNum, void *mapGroup); -void ShiftObjectEventCoords(struct ObjectEvent *, s16 x, s16 y); -void MoveObjectEventToMapCoords(struct ObjectEvent *, s16 x, s16 y); +void ShiftObjectEventCoords(struct ObjectEvent *objectEvent, s16 x, s16 y); +void MoveObjectEventToMapCoords(struct ObjectEvent *objectEvent, s16 x, s16 y); void TryOverrideObjectEventTemplateCoords(u8 localId, u8 mapNum, u8 mapGroup); -void InitObjectEventPalettes(u8 palSlot); -void UpdateObjectEventCurrentMovement(struct ObjectEvent *, struct Sprite *, bool8(struct ObjectEvent *, struct Sprite *)); -u8 ObjectEventFaceOppositeDirection(struct ObjectEvent *, u8 direction); +void InitObjectEventPalettes(u8 reflectionType); +void UpdateObjectEventCurrentMovement(struct ObjectEvent *objectEvent, struct Sprite *sprite, bool8 (*callback)(struct ObjectEvent *, struct Sprite *)); +bool8 ObjectEventFaceOppositeDirection(struct ObjectEvent *objectEvent, u8 direction); u8 GetOppositeDirection(u8 direction); u8 GetWalkInPlaceFasterMovementAction(u32); u8 GetWalkInPlaceFastMovementAction(u32); @@ -180,8 +180,8 @@ u8 GetWalkInPlaceSlowMovementAction(u32); u8 GetCollisionAtCoords(struct ObjectEvent *, s16 x, s16 y, u32 dir); u32 GetObjectObjectCollidesWith(struct ObjectEvent *objectEvent, s16 x, s16 y, bool32 addCoords); void MoveCoords(u8 direction, s16 *x, s16 *y); -bool8 ObjectEventIsHeldMovementActive(struct ObjectEvent *); -u8 ObjectEventClearHeldMovementIfFinished(struct ObjectEvent *); +bool8 ObjectEventIsHeldMovementActive(struct ObjectEvent *objectEvent); +u8 ObjectEventClearHeldMovementIfFinished(struct ObjectEvent *objectEvent); u8 GetObjectEventIdByPosition(u16 x, u16 y, u8 elevation); void SetTrainerMovementType(struct ObjectEvent *objectEvent, u8 movementType); u8 GetTrainerFacingDirectionMovementType(u8 direction); @@ -225,12 +225,12 @@ u8 GetWalkSlowMovementAction(u32); u8 GetWalkSlowStairsMovementAction(u32); u8 GetJumpMovementAction(u32); u8 ElevationToPriority(u8 elevation); -void ObjectEventUpdateElevation(struct ObjectEvent *objEvent, struct Sprite *); -void SetObjectSubpriorityByElevation(u8 elevation, struct Sprite *, u8 subpriority); -void UnfreezeObjectEvent(struct ObjectEvent *); -u8 FindLockedObjectEventIndex(struct ObjectEvent *); -void SetAndStartSpriteAnim(struct Sprite *, u8 animNum, u8 animCmdIndex); -bool8 SpriteAnimEnded(struct Sprite *); +void ObjectEventUpdateElevation(struct ObjectEvent *objectEvent, struct Sprite *sprite); +void SetObjectSubpriorityByElevation(u8 elevation, struct Sprite *sprite, u8 subpriority); +void UnfreezeObjectEvent(struct ObjectEvent *objectEvent); +u8 FindLockedObjectEventIndex(struct ObjectEvent *objectEvent); +void SetAndStartSpriteAnim(struct Sprite *sprite, u8 animNum, u8 animCmdIndex); +bool8 SpriteAnimEnded(struct Sprite *sprite); void UnfreezeObjectEvents(void); void FreezeObjectEventsExceptOne(u8 objectEventId); void FreezeObjectEventsExceptTwo(u8 objectEventId1, u8 objectEventId2); @@ -250,62 +250,62 @@ u8 GetObjectEventBerryTreeId(u8 objectEventId); void SetBerryTreeJustPicked(u8 mapId, u8 mapNumber, u8 mapGroup); bool8 IsBerryTreeSparkling(u8 localId, u8 mapNum, u8 mapGroup); -void MovementType_None(struct Sprite *); -void MovementType_LookAround(struct Sprite *); -void MovementType_WanderAround(struct Sprite *); -void MovementType_WanderUpAndDown(struct Sprite *); -void MovementType_WanderLeftAndRight(struct Sprite *); -void MovementType_FaceDirection(struct Sprite *); -void MovementType_Player(struct Sprite *); -void MovementType_BerryTreeGrowth(struct Sprite *); -void MovementType_FaceDownAndUp(struct Sprite *); -void MovementType_FaceLeftAndRight(struct Sprite *); -void MovementType_FaceUpAndLeft(struct Sprite *); -void MovementType_FaceUpAndRight(struct Sprite *); -void MovementType_FaceDownAndLeft(struct Sprite *); -void MovementType_FaceDownAndRight(struct Sprite *); -void MovementType_FaceDownUpAndLeft(struct Sprite *); -void MovementType_FaceDownUpAndRight(struct Sprite *); -void MovementType_FaceUpRightAndLeft(struct Sprite *); -void MovementType_FaceDownRightAndLeft(struct Sprite *); -void MovementType_RotateCounterclockwise(struct Sprite *); -void MovementType_RotateClockwise(struct Sprite *); -void MovementType_WalkBackAndForth(struct Sprite *); -void MovementType_WalkSequenceUpRightLeftDown(struct Sprite *); -void MovementType_WalkSequenceRightLeftDownUp(struct Sprite *); -void MovementType_WalkSequenceDownUpRightLeft(struct Sprite *); -void MovementType_WalkSequenceLeftDownUpRight(struct Sprite *); -void MovementType_WalkSequenceUpLeftRightDown(struct Sprite *); -void MovementType_WalkSequenceLeftRightDownUp(struct Sprite *); -void MovementType_WalkSequenceDownUpLeftRight(struct Sprite *); -void MovementType_WalkSequenceRightDownUpLeft(struct Sprite *); -void MovementType_WalkSequenceLeftUpDownRight(struct Sprite *); -void MovementType_WalkSequenceUpDownRightLeft(struct Sprite *); -void MovementType_WalkSequenceRightLeftUpDown(struct Sprite *); -void MovementType_WalkSequenceDownRightLeftUp(struct Sprite *); -void MovementType_WalkSequenceRightUpDownLeft(struct Sprite *); -void MovementType_WalkSequenceUpDownLeftRight(struct Sprite *); -void MovementType_WalkSequenceLeftRightUpDown(struct Sprite *); -void MovementType_WalkSequenceDownLeftRightUp(struct Sprite *); -void MovementType_WalkSequenceUpLeftDownRight(struct Sprite *); -void MovementType_WalkSequenceDownRightUpLeft(struct Sprite *); -void MovementType_WalkSequenceLeftDownRightUp(struct Sprite *); -void MovementType_WalkSequenceRightUpLeftDown(struct Sprite *); -void MovementType_WalkSequenceUpRightDownLeft(struct Sprite *); -void MovementType_WalkSequenceDownLeftUpRight(struct Sprite *); -void MovementType_WalkSequenceLeftUpRightDown(struct Sprite *); -void MovementType_WalkSequenceRightDownLeftUp(struct Sprite *); -void MovementType_CopyPlayer(struct Sprite *); -void MovementType_TreeDisguise(struct Sprite *); -void MovementType_MountainDisguise(struct Sprite *); -void MovementType_CopyPlayerInGrass(struct Sprite *); -void MovementType_Buried(struct Sprite *); -void MovementType_WalkInPlace(struct Sprite *); -void MovementType_JogInPlace(struct Sprite *); -void MovementType_RunInPlace(struct Sprite *); -void MovementType_Invisible(struct Sprite *); -void MovementType_WalkSlowlyInPlace(struct Sprite *); -void MovementType_FollowPlayer(struct Sprite *); +void MovementType_None(struct Sprite *sprite); +void MovementType_LookAround(struct Sprite *sprite); +void MovementType_WanderAround(struct Sprite *sprite); +void MovementType_WanderUpAndDown(struct Sprite *sprite); +void MovementType_WanderLeftAndRight(struct Sprite *sprite); +void MovementType_FaceDirection(struct Sprite *sprite); +void MovementType_Player(struct Sprite *sprite); +void MovementType_BerryTreeGrowth(struct Sprite *sprite); +void MovementType_FaceDownAndUp(struct Sprite *sprite); +void MovementType_FaceLeftAndRight(struct Sprite *sprite); +void MovementType_FaceUpAndLeft(struct Sprite *sprite); +void MovementType_FaceUpAndRight(struct Sprite *sprite); +void MovementType_FaceDownAndLeft(struct Sprite *sprite); +void MovementType_FaceDownAndRight(struct Sprite *sprite); +void MovementType_FaceDownUpAndLeft(struct Sprite *sprite); +void MovementType_FaceDownUpAndRight(struct Sprite *sprite); +void MovementType_FaceUpRightAndLeft(struct Sprite *sprite); +void MovementType_FaceDownRightAndLeft(struct Sprite *sprite); +void MovementType_RotateCounterclockwise(struct Sprite *sprite); +void MovementType_RotateClockwise(struct Sprite *sprite); +void MovementType_WalkBackAndForth(struct Sprite *sprite); +void MovementType_WalkSequenceUpRightLeftDown(struct Sprite *sprite); +void MovementType_WalkSequenceRightLeftDownUp(struct Sprite *sprite); +void MovementType_WalkSequenceDownUpRightLeft(struct Sprite *sprite); +void MovementType_WalkSequenceLeftDownUpRight(struct Sprite *sprite); +void MovementType_WalkSequenceUpLeftRightDown(struct Sprite *sprite); +void MovementType_WalkSequenceLeftRightDownUp(struct Sprite *sprite); +void MovementType_WalkSequenceDownUpLeftRight(struct Sprite *sprite); +void MovementType_WalkSequenceRightDownUpLeft(struct Sprite *sprite); +void MovementType_WalkSequenceLeftUpDownRight(struct Sprite *sprite); +void MovementType_WalkSequenceUpDownRightLeft(struct Sprite *sprite); +void MovementType_WalkSequenceRightLeftUpDown(struct Sprite *sprite); +void MovementType_WalkSequenceDownRightLeftUp(struct Sprite *sprite); +void MovementType_WalkSequenceRightUpDownLeft(struct Sprite *sprite); +void MovementType_WalkSequenceUpDownLeftRight(struct Sprite *sprite); +void MovementType_WalkSequenceLeftRightUpDown(struct Sprite *sprite); +void MovementType_WalkSequenceDownLeftRightUp(struct Sprite *sprite); +void MovementType_WalkSequenceUpLeftDownRight(struct Sprite *sprite); +void MovementType_WalkSequenceDownRightUpLeft(struct Sprite *sprite); +void MovementType_WalkSequenceLeftDownRightUp(struct Sprite *sprite); +void MovementType_WalkSequenceRightUpLeftDown(struct Sprite *sprite); +void MovementType_WalkSequenceUpRightDownLeft(struct Sprite *sprite); +void MovementType_WalkSequenceDownLeftUpRight(struct Sprite *sprite); +void MovementType_WalkSequenceLeftUpRightDown(struct Sprite *sprite); +void MovementType_WalkSequenceRightDownLeftUp(struct Sprite *sprite); +void MovementType_CopyPlayer(struct Sprite *sprite); +void MovementType_TreeDisguise(struct Sprite *sprite); +void MovementType_MountainDisguise(struct Sprite *sprite); +void MovementType_CopyPlayerInGrass(struct Sprite *sprite); +void MovementType_Buried(struct Sprite *sprite); +void MovementType_WalkInPlace(struct Sprite *sprite); +void MovementType_JogInPlace(struct Sprite *sprite); +void MovementType_RunInPlace(struct Sprite *sprite); +void MovementType_Invisible(struct Sprite *sprite); +void MovementType_WalkSlowlyInPlace(struct Sprite *sprite); +void MovementType_FollowPlayer(struct Sprite *sprite); u8 GetSlideMovementAction(u32); u8 GetJumpMovementAction(u32); u8 GetJump2MovementAction(u32); @@ -313,13 +313,13 @@ u8 CopySprite(struct Sprite *sprite, s16 x, s16 y, u8 subpriority); u8 CreateCopySpriteAt(struct Sprite *sprite, s16 x, s16 y, u8 subpriority); bool8 IsElevationMismatchAt(u8, s16, s16); -u8 MovementType_WanderAround_Step0(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WanderAround_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WanderAround_Step2(struct ObjectEvent *, struct Sprite *); -u8 MovementType_Wander_Step3(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WanderAround_Step4(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WanderAround_Step5(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WanderAround_Step6(struct ObjectEvent *, struct Sprite *); +u8 MovementType_WanderAround_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WanderAround_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WanderAround_Step2(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_Wander_Step3(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WanderAround_Step4(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WanderAround_Step5(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WanderAround_Step6(struct ObjectEvent *objectEvent, struct Sprite *sprite); u8 GetVectorDirection(s16 dx, s16 dy, s16 absdx, s16 absdy); u8 GetLimitedVectorDirection_SouthNorth(s16 dx, s16 dy, s16 absdx, s16 absdy); u8 GetLimitedVectorDirection_WestEast(s16 dx, s16 dy, s16 absdx, s16 absdy); @@ -331,156 +331,156 @@ u8 GetLimitedVectorDirection_SouthNorthWest(s16 dx, s16 dy, s16 absdx, s16 absdy u8 GetLimitedVectorDirection_SouthNorthEast(s16 dx, s16 dy, s16 absdx, s16 absdy); u8 GetLimitedVectorDirection_NorthWestEast(s16 dx, s16 dy, s16 absdx, s16 absdy); u8 GetLimitedVectorDirection_SouthWestEast(s16 dx, s16 dy, s16 absdx, s16 absdy); -u8 MovementType_LookAround_Step0(struct ObjectEvent *, struct Sprite *); -u8 MovementType_LookAround_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_LookAround_Step2(struct ObjectEvent *, struct Sprite *); -u8 MovementType_LookAround_Step3(struct ObjectEvent *, struct Sprite *); -u8 MovementType_LookAround_Step4(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WanderUpAndDown_Step0(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WanderUpAndDown_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WanderUpAndDown_Step2(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WanderUpAndDown_Step4(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WanderUpAndDown_Step5(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WanderUpAndDown_Step6(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WanderLeftAndRight_Step0(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WanderLeftAndRight_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WanderLeftAndRight_Step2(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WanderLeftAndRight_Step4(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WanderLeftAndRight_Step5(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WanderLeftAndRight_Step6(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceDirection_Step0(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceDirection_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceDirection_Step2(struct ObjectEvent *, struct Sprite *); -u8 MovementType_BerryTreeGrowth_Normal(struct ObjectEvent *, struct Sprite *); -u8 MovementType_BerryTreeGrowth_Move(struct ObjectEvent *, struct Sprite *); -u8 MovementType_BerryTreeGrowth_SparkleStart(struct ObjectEvent *, struct Sprite *); -u8 MovementType_BerryTreeGrowth_Sparkle(struct ObjectEvent *, struct Sprite *); -u8 MovementType_BerryTreeGrowth_SparkleEnd(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceDownAndUp_Step0(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceDownAndUp_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceDownAndUp_Step2(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceDownAndUp_Step3(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceDownAndUp_Step4(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceLeftAndRight_Step0(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceLeftAndRight_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceLeftAndRight_Step2(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceLeftAndRight_Step3(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceLeftAndRight_Step4(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceUpAndLeft_Step0(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceUpAndLeft_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceUpAndLeft_Step2(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceUpAndLeft_Step3(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceUpAndLeft_Step4(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceUpAndRight_Step0(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceUpAndRight_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceUpAndRight_Step2(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceUpAndRight_Step3(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceUpAndRight_Step4(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceDownAndLeft_Step0(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceDownAndLeft_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceDownAndLeft_Step2(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceDownAndLeft_Step3(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceDownAndLeft_Step4(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceDownAndRight_Step0(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceDownAndRight_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceDownAndRight_Step2(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceDownAndRight_Step3(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceDownAndRight_Step4(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceDownUpAndLeft_Step0(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceDownUpAndLeft_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceDownUpAndLeft_Step2(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceDownUpAndLeft_Step3(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceDownUpAndLeft_Step4(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceDownUpAndRight_Step0(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceDownUpAndRight_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceDownUpAndRight_Step2(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceDownUpAndRight_Step3(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceDownUpAndRight_Step4(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceUpLeftAndRight_Step0(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceUpLeftAndRight_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceUpLeftAndRight_Step2(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceUpLeftAndRight_Step3(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceUpLeftAndRight_Step4(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceDownLeftAndRight_Step0(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceDownLeftAndRight_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceDownLeftAndRight_Step2(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceDownLeftAndRight_Step3(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FaceDownLeftAndRight_Step4(struct ObjectEvent *, struct Sprite *); -u8 MovementType_RotateCounterclockwise_Step0(struct ObjectEvent *, struct Sprite *); -u8 MovementType_RotateCounterclockwise_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_RotateCounterclockwise_Step2(struct ObjectEvent *, struct Sprite *); -u8 MovementType_RotateCounterclockwise_Step3(struct ObjectEvent *, struct Sprite *); -u8 MovementType_RotateClockwise_Step0(struct ObjectEvent *, struct Sprite *); -u8 MovementType_RotateClockwise_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_RotateClockwise_Step2(struct ObjectEvent *, struct Sprite *); -u8 MovementType_RotateClockwise_Step3(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WalkBackAndForth_Step0(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WalkBackAndForth_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WalkBackAndForth_Step2(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WalkBackAndForth_Step3(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WalkSequence_Step0(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WalkSequence_Step2(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WalkSequenceUpRightLeftDown_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WalkSequenceRightLeftDownUp_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WalkSequenceDownUpRightLeft_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WalkSequenceLeftDownUpRight_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WalkSequenceUpLeftRightDown_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WalkSequenceLeftRightDownUp_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WalkSequenceDownUpLeftRight_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WalkSequenceRightDownUpLeft_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WalkSequenceLeftUpDownRight_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WalkSequenceUpDownRightLeft_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WalkSequenceRightLeftUpDown_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WalkSequenceDownRightLeftUp_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WalkSequenceRightUpDownLeft_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WalkSequenceUpDownLeftRight_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WalkSequenceLeftRightUpDown_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WalkSequenceDownLeftRightUp_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WalkSequenceUpLeftDownRight_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WalkSequenceDownRightUpLeft_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WalkSequenceLeftDownRightUp_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WalkSequenceRightUpLeftDown_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WalkSequenceUpRightDownLeft_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WalkSequenceDownLeftUpRight_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WalkSequenceLeftUpRightDown_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WalkSequenceRightDownLeftUp_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_CopyPlayer_Step0(struct ObjectEvent *, struct Sprite *); -u8 MovementType_CopyPlayer_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_CopyPlayer_Step2(struct ObjectEvent *, struct Sprite *); -bool8 CopyablePlayerMovement_None(struct ObjectEvent *, struct Sprite *, u8, bool8(u8)); -bool8 CopyablePlayerMovement_FaceDirection(struct ObjectEvent *, struct Sprite *, u8, bool8(u8)); -bool8 CopyablePlayerMovement_WalkNormal(struct ObjectEvent *, struct Sprite *, u8, bool8(u8)); -bool8 CopyablePlayerMovement_WalkFast(struct ObjectEvent *, struct Sprite *, u8, bool8(u8)); -bool8 CopyablePlayerMovement_WalkFaster(struct ObjectEvent *, struct Sprite *, u8, bool8(u8)); -bool8 CopyablePlayerMovement_Slide(struct ObjectEvent *, struct Sprite *, u8, bool8(u8)); -bool8 CopyablePlayerMovement_JumpInPlace(struct ObjectEvent *, struct Sprite *, u8, bool8(u8)); -bool8 CopyablePlayerMovement_Jump(struct ObjectEvent *, struct Sprite *, u8, bool8(u8)); +u8 MovementType_LookAround_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_LookAround_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_LookAround_Step2(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_LookAround_Step3(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_LookAround_Step4(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WanderUpAndDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WanderUpAndDown_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WanderUpAndDown_Step2(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WanderUpAndDown_Step4(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WanderUpAndDown_Step5(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WanderUpAndDown_Step6(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WanderLeftAndRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WanderLeftAndRight_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WanderLeftAndRight_Step2(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WanderLeftAndRight_Step4(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WanderLeftAndRight_Step5(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WanderLeftAndRight_Step6(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceDirection_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceDirection_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceDirection_Step2(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_BerryTreeGrowth_Normal(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_BerryTreeGrowth_Move(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_BerryTreeGrowth_SparkleStart(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_BerryTreeGrowth_Sparkle(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_BerryTreeGrowth_SparkleEnd(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceDownAndUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceDownAndUp_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceDownAndUp_Step2(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceDownAndUp_Step3(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceDownAndUp_Step4(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceLeftAndRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceLeftAndRight_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceLeftAndRight_Step2(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceLeftAndRight_Step3(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceLeftAndRight_Step4(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceUpAndLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceUpAndLeft_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceUpAndLeft_Step2(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceUpAndLeft_Step3(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceUpAndLeft_Step4(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceUpAndRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceUpAndRight_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceUpAndRight_Step2(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceUpAndRight_Step3(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceUpAndRight_Step4(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceDownAndLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceDownAndLeft_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceDownAndLeft_Step2(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceDownAndLeft_Step3(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceDownAndLeft_Step4(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceDownAndRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceDownAndRight_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceDownAndRight_Step2(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceDownAndRight_Step3(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceDownAndRight_Step4(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceDownUpAndLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceDownUpAndLeft_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceDownUpAndLeft_Step2(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceDownUpAndLeft_Step3(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceDownUpAndLeft_Step4(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceDownUpAndRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceDownUpAndRight_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceDownUpAndRight_Step2(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceDownUpAndRight_Step3(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceDownUpAndRight_Step4(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceUpLeftAndRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceUpLeftAndRight_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceUpLeftAndRight_Step2(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceUpLeftAndRight_Step3(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceUpLeftAndRight_Step4(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceDownLeftAndRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceDownLeftAndRight_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceDownLeftAndRight_Step2(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceDownLeftAndRight_Step3(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FaceDownLeftAndRight_Step4(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_RotateCounterclockwise_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_RotateCounterclockwise_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_RotateCounterclockwise_Step2(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_RotateCounterclockwise_Step3(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_RotateClockwise_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_RotateClockwise_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_RotateClockwise_Step2(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_RotateClockwise_Step3(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WalkBackAndForth_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WalkBackAndForth_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WalkBackAndForth_Step2(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WalkBackAndForth_Step3(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WalkSequence_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WalkSequence_Step2(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WalkSequenceUpRightLeftDown_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WalkSequenceRightLeftDownUp_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WalkSequenceDownUpRightLeft_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WalkSequenceLeftDownUpRight_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WalkSequenceUpLeftRightDown_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WalkSequenceLeftRightDownUp_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WalkSequenceDownUpLeftRight_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WalkSequenceRightDownUpLeft_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WalkSequenceLeftUpDownRight_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WalkSequenceUpDownRightLeft_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WalkSequenceRightLeftUpDown_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WalkSequenceDownRightLeftUp_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WalkSequenceRightUpDownLeft_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WalkSequenceUpDownLeftRight_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WalkSequenceLeftRightUpDown_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WalkSequenceDownLeftRightUp_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WalkSequenceUpLeftDownRight_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WalkSequenceDownRightUpLeft_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WalkSequenceLeftDownRightUp_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WalkSequenceRightUpLeftDown_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WalkSequenceUpRightDownLeft_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WalkSequenceDownLeftUpRight_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WalkSequenceLeftUpRightDown_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WalkSequenceRightDownLeftUp_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_CopyPlayer_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_CopyPlayer_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_CopyPlayer_Step2(struct ObjectEvent *objectEvent, struct Sprite *sprite); +bool8 CopyablePlayerMovement_None(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 playerDirection, bool8 tileCallback(u8)); +bool8 CopyablePlayerMovement_FaceDirection(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 playerDirection, bool8 tileCallback(u8)); +bool8 CopyablePlayerMovement_WalkNormal(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 playerDirection, bool8 tileCallback(u8)); +bool8 CopyablePlayerMovement_WalkFast(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 playerDirection, bool8 tileCallback(u8)); +bool8 CopyablePlayerMovement_WalkFaster(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 playerDirection, bool8 tileCallback(u8)); +bool8 CopyablePlayerMovement_Slide(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 playerDirection, bool8 tileCallback(u8)); +bool8 CopyablePlayerMovement_JumpInPlace(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 playerDirection, bool8 tileCallback(u8)); +bool8 CopyablePlayerMovement_Jump(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 playerDirection, bool8 tileCallback(u8)); -u8 MovementType_FollowPlayer_Shadow(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FollowPlayer_Active(struct ObjectEvent *, struct Sprite *); -u8 MovementType_FollowPlayer_Moving(struct ObjectEvent *, struct Sprite *); +u8 MovementType_FollowPlayer_Shadow(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FollowPlayer_Active(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_FollowPlayer_Moving(struct ObjectEvent *objectEvent, struct Sprite *sprite); void StartSpriteAnimInDirection(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 direction, u8 animNum); -bool8 FollowablePlayerMovement_Idle(struct ObjectEvent *, struct Sprite *, u8, bool8(u8)); -bool8 FollowablePlayerMovement_FaceDirection(struct ObjectEvent *, struct Sprite *, u8, bool8(u8)); -bool8 FollowablePlayerMovement_Step(struct ObjectEvent *, struct Sprite *, u8, bool8(u8)); -bool8 FollowablePlayerMovement_GoSpeed1(struct ObjectEvent *, struct Sprite *, u8, bool8(u8)); -bool8 FollowablePlayerMovement_GoSpeed2(struct ObjectEvent *, struct Sprite *, u8, bool8(u8)); -bool8 FollowablePlayerMovement_Slide(struct ObjectEvent *, struct Sprite *, u8, bool8(u8)); -bool8 FollowablePlayerMovement_JumpInPlace(struct ObjectEvent *, struct Sprite *, u8, bool8(u8)); -bool8 FollowablePlayerMovement_GoSpeed4(struct ObjectEvent *, struct Sprite *, u8, bool8(u8)); -bool8 FollowablePlayerMovement_Jump(struct ObjectEvent *, struct Sprite *, u8, bool8(u8)); -bool8 CopyablePlayerMovement_Jump2(struct ObjectEvent *, struct Sprite *, u8, bool8(u8)); -u8 MovementType_CopyPlayerInGrass_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_Buried_Step0(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WalkInPlace_Step0(struct ObjectEvent *, struct Sprite *); -u8 MovementType_MoveInPlace_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_WalkSlowlyInPlace_Step0(struct ObjectEvent *, struct Sprite *); -u8 MovementType_JogInPlace_Step0(struct ObjectEvent *, struct Sprite *); -u8 MovementType_RunInPlace_Step0(struct ObjectEvent *, struct Sprite *); -u8 MovementType_Invisible_Step0(struct ObjectEvent *, struct Sprite *); -u8 MovementType_Invisible_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_Invisible_Step2(struct ObjectEvent *, struct Sprite *); +bool8 FollowablePlayerMovement_Idle(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8, bool8 tileCallback(u8)); +bool8 FollowablePlayerMovement_FaceDirection(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8, bool8 tileCallback(u8)); +bool8 FollowablePlayerMovement_Step(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8, bool8 tileCallback(u8)); +bool8 FollowablePlayerMovement_GoSpeed1(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8, bool8 tileCallback(u8)); +bool8 FollowablePlayerMovement_GoSpeed2(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8, bool8 tileCallback(u8)); +bool8 FollowablePlayerMovement_Slide(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8, bool8 tileCallback(u8)); +bool8 FollowablePlayerMovement_JumpInPlace(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8, bool8 tileCallback(u8)); +bool8 FollowablePlayerMovement_GoSpeed4(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8, bool8 tileCallback(u8)); +bool8 FollowablePlayerMovement_Jump(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8, bool8 tileCallback(u8)); +bool8 CopyablePlayerMovement_Jump2(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8, bool8 tileCallback(u8)); +u8 MovementType_CopyPlayerInGrass_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_Buried_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WalkInPlace_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_MoveInPlace_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_WalkSlowlyInPlace_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_JogInPlace_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_RunInPlace_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_Invisible_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_Invisible_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u8 MovementType_Invisible_Step2(struct ObjectEvent *objectEvent, struct Sprite *sprite); u8 CreateVirtualObject(u16 graphicsId, u8 virtualObjId, s16 x, s16 y, u8 elevation, u8 direction); void TurnVirtualObject(u8 virtualObjId, u8 direction); diff --git a/include/evolution_graphics.h b/include/evolution_graphics.h index eab5c6eb70..52586fc4f5 100644 --- a/include/evolution_graphics.h +++ b/include/evolution_graphics.h @@ -8,6 +8,6 @@ u8 EvolutionSparkles_ArcDown(void); u8 EvolutionSparkles_CircleInward(void); u8 EvolutionSparkles_SprayAndFlash(u16 species); u8 EvolutionSparkles_SprayAndFlash_Trade(u16 species); -u8 CycleEvolutionMonSprite(u8 preEvoSpriteID, u8 postEvoSpriteID); +u8 CycleEvolutionMonSprite(u8 preEvoSpriteId, u8 postEvoSpriteId); #endif // GUARD_EVOLUTION_GRAPHICS_H diff --git a/include/evolution_scene.h b/include/evolution_scene.h index 25d34eddfb..1b8999c775 100644 --- a/include/evolution_scene.h +++ b/include/evolution_scene.h @@ -1,9 +1,9 @@ #ifndef GUARD_EVOLUTION_SCENE_H #define GUARD_EVOLUTION_SCENE_H -void BeginEvolutionScene(struct Pokemon *mon, u16 speciesToEvolve, bool8 canStopEvo, u8 partyID); -void EvolutionScene(struct Pokemon *mon, u16 speciesToEvolve, bool8 canStopEvo, u8 partyID); -void TradeEvolutionScene(struct Pokemon *mon, u16 speciesToEvolve, u8 preEvoSpriteID, u8 partyID); +void BeginEvolutionScene(struct Pokemon *mon, u16 postEvoSpecies, bool8 canStopEvo, u8 partyId); +void EvolutionScene(struct Pokemon *mon, u16 postEvoSpecies, bool8 canStopEvo, u8 partyId); +void TradeEvolutionScene(struct Pokemon *mon, u16 postEvoSpecies, u8 preEvoSpriteId, u8 partyId); extern void (*gCB2_AfterEvolution)(void); diff --git a/include/faraway_island.h b/include/faraway_island.h index 9fd2a69fc4..f7cef9b8c3 100755 --- a/include/faraway_island.h +++ b/include/faraway_island.h @@ -2,9 +2,9 @@ #define GUARD_FARAWAY_ISLAND_H u32 GetMewMoveDirection(void); -bool8 ShouldMewShakeGrass(struct ObjectEvent *); +bool8 ShouldMewShakeGrass(struct ObjectEvent *objectEvent); void UpdateFarawayIslandStepCounter(void); -bool8 ObjectEventIsFarawayIslandMew(struct ObjectEvent *); +bool8 ObjectEventIsFarawayIslandMew(struct ObjectEvent *objectEvent); bool8 IsMewPlayingHideAndSeek(void); #endif // GUARD_FARAWAY_ISLAND_H diff --git a/include/field_camera.h b/include/field_camera.h index 6e8af1a539..edbd2c09fa 100644 --- a/include/field_camera.h +++ b/include/field_camera.h @@ -18,7 +18,7 @@ extern u16 gTotalCameraPixelOffsetY; void DrawWholeMapView(void); void CurrentMapDrawMetatileAt(int x, int y); void GetCameraOffsetWithPan(s16 *x, s16 *y); -void DrawDoorMetatileAt(int x, int y, u16 *arr); +void DrawDoorMetatileAt(int x, int y, u16 *tiles); void ResetFieldCamera(void); void ResetCameraUpdateInfo(void); u32 InitCameraUpdateCallback(u8 trackedSpriteId); diff --git a/include/field_control_avatar.h b/include/field_control_avatar.h index 9a55f9e7bf..15236936fd 100644 --- a/include/field_control_avatar.h +++ b/include/field_control_avatar.h @@ -22,13 +22,12 @@ struct FieldInput u8 dpadDirection; }; -void FieldClearPlayerInput(struct FieldInput *pStruct); -void FieldGetPlayerInput(struct FieldInput *pStruct, u16 keys, u16 heldKeys); -int ProcessPlayerFieldInput(struct FieldInput *pStruct); -void overworld_poison_timer_set(void); +void FieldClearPlayerInput(struct FieldInput *input); +void FieldGetPlayerInput(struct FieldInput *input, u16 newKeys, u16 heldKeys); +int ProcessPlayerFieldInput(struct FieldInput *input); void RestartWildEncounterImmunitySteps(void); const u8 *GetObjectEventScriptPointerPlayerFacing(void); -bool8 TryDoDiveWarp(struct MapPosition *position, u16 b); +bool8 TryDoDiveWarp(struct MapPosition *position, u16 metatileBehavior); int SetCableClubWarp(void); u8 TrySetDiveWarp(void); const u8 *GetInteractedLinkPlayerScript(struct MapPosition *position, u8 metatileBehavior, u8 direction); diff --git a/include/field_door.h b/include/field_door.h index 2e32005c6c..1d8a30ca14 100644 --- a/include/field_door.h +++ b/include/field_door.h @@ -1,10 +1,10 @@ #ifndef GUARD_FIELD_DOOR_H #define GUARD_FIELD_DOOR_H -void FieldSetDoorOpened(u32, u32); -void FieldSetDoorClosed(u32, u32); -s8 FieldAnimateDoorClose(u32, u32); -s8 FieldAnimateDoorOpen(u32, u32); +void FieldSetDoorOpened(u32 x, u32 y); +void FieldSetDoorClosed(u32 x, u32 y); +s8 FieldAnimateDoorClose(u32 x, u32 y); +s8 FieldAnimateDoorOpen(u32 x, u32 y); bool8 FieldIsDoorAnimationRunning(void); u32 GetDoorSoundEffect(u32 x, u32 y); diff --git a/include/field_effect.h b/include/field_effect.h index 3db86bc219..0e607b254f 100644 --- a/include/field_effect.h +++ b/include/field_effect.h @@ -9,12 +9,12 @@ extern s32 gFieldEffectArguments[8]; extern void (*gPostMenuFieldCallback)(void); extern bool8 (*gFieldCallback2)(void); -u32 FieldEffectStart(u8); +u32 FieldEffectStart(u8 id); bool8 FieldEffectActiveListContains(u8 id); void FieldEffectActiveListClear(void); void ReturnToFieldFromFlyMapSelect(void); void FieldCallback_UseFly(void); -u8 AddNewGameBirchObject(s16, s16, u8); +u8 AddNewGameBirchObject(s16 x, s16 y, u8 subpriority); void FieldEffectStop(struct Sprite *sprite, u8 id); u8 CreateTrainerSprite(u8 trainerSpriteID, s16 x, s16 y, u8 subpriority, u8 *buffer); void FldEff_TeleportWarpOut(void); @@ -41,8 +41,8 @@ void StartEscalatorWarp(u8 metatileBehavior, u8 priority); void StartLavaridgeGymB1FWarp(u8 priority); void StartLavaridgeGym1FWarp(u8 priority); -void SpriteCB_AshPuff(struct Sprite *); -void SpriteCB_AshLaunch(struct Sprite *); +void SpriteCB_AshPuff(struct Sprite *sprite); +void SpriteCB_AshLaunch(struct Sprite *sprite); void MultiplyPaletteRGBComponents(u16 i, u8 r, u8 g, u8 b); void FreeResourcesAndDestroySprite(struct Sprite *sprite, u8 spriteId); diff --git a/include/field_effect_helpers.h b/include/field_effect_helpers.h index 22dcb119a4..c5cf390feb 100644 --- a/include/field_effect_helpers.h +++ b/include/field_effect_helpers.h @@ -13,33 +13,33 @@ enum { }; u8 CreateWarpArrowSprite(void); -u8 StartUnderwaterSurfBlobBobbing(u8 oldSpriteId); +u8 StartUnderwaterSurfBlobBobbing(u8 blobSpriteId); void SetSurfBlob_BobState(u8 spriteId, u8 state); void SetSurfBlob_DontSyncAnim(u8 spriteId, bool8 dontSync); void SetSurfBlob_PlayerOffset(u8 spriteId, bool8 hasOffset, s16 offset); -bool8 UpdateRevealDisguise(struct ObjectEvent *); -void StartRevealDisguise(struct ObjectEvent *); -void StartAshFieldEffect(s16, s16, u16, s16); -void SetUpReflection(struct ObjectEvent *, struct Sprite *, u8); -void SetUpShadow(struct ObjectEvent *, struct Sprite *); -u32 StartFieldEffectForObjectEvent(u8, struct ObjectEvent *); +bool8 UpdateRevealDisguise(struct ObjectEvent *objectEvent); +void StartRevealDisguise(struct ObjectEvent *objectEvent); +void StartAshFieldEffect(s16 x, s16 y, u16 metatileId, s16 delay); +void SetUpReflection(struct ObjectEvent *objectEvent, struct Sprite *sprite, bool8 stillReflection); +void SetUpShadow(struct ObjectEvent *objectEvent, struct Sprite *sprite); +u32 StartFieldEffectForObjectEvent(u8, struct ObjectEvent *objectEvent); u8 FindTallGrassFieldEffectSpriteId(u8 localId, u8 mapNum, u8 mapGroup, s16 x, s16 y); -void UpdateRayquazaSpotlightEffect(struct Sprite *); -void UpdateShadowFieldEffect(struct Sprite *); -void UpdateTallGrassFieldEffect(struct Sprite *); -void WaitFieldEffectSpriteAnim(struct Sprite *); -void UpdateAshFieldEffect(struct Sprite *); -void UpdateSurfBlobFieldEffect(struct Sprite *); -void UpdateJumpImpactEffect(struct Sprite *); -void UpdateFootprintsTireTracksFieldEffect(struct Sprite *); -void UpdateSplashFieldEffect(struct Sprite *); -void UpdateLongGrassFieldEffect(struct Sprite *); -void UpdateSandPileFieldEffect(struct Sprite *); -void UpdateDisguiseFieldEffect(struct Sprite *); -void UpdateShortGrassFieldEffect(struct Sprite *); -void UpdateHotSpringsWaterFieldEffect(struct Sprite *); -void UpdateBubblesFieldEffect(struct Sprite *); -void UpdateSparkleFieldEffect(struct Sprite *); +void UpdateRayquazaSpotlightEffect(struct Sprite *sprite); +void UpdateShadowFieldEffect(struct Sprite *sprite); +void UpdateTallGrassFieldEffect(struct Sprite *sprite); +void WaitFieldEffectSpriteAnim(struct Sprite *sprite); +void UpdateAshFieldEffect(struct Sprite *sprite); +void UpdateSurfBlobFieldEffect(struct Sprite *sprite); +void UpdateJumpImpactEffect(struct Sprite *sprite); +void UpdateFootprintsTireTracksFieldEffect(struct Sprite *sprite); +void UpdateSplashFieldEffect(struct Sprite *sprite); +void UpdateLongGrassFieldEffect(struct Sprite *sprite); +void UpdateSandPileFieldEffect(struct Sprite *sprite); +void UpdateDisguiseFieldEffect(struct Sprite *sprite); +void UpdateShortGrassFieldEffect(struct Sprite *sprite); +void UpdateHotSpringsWaterFieldEffect(struct Sprite *sprite); +void UpdateBubblesFieldEffect(struct Sprite *sprite); +void UpdateSparkleFieldEffect(struct Sprite *sprite); void SetSpriteInvisible(u8 spriteId); void ShowWarpArrowSprite(u8 spriteId, u8 direction, s16 x, s16 y); diff --git a/include/field_message_box.h b/include/field_message_box.h index 810ac0fc20..6942d7452a 100644 --- a/include/field_message_box.h +++ b/include/field_message_box.h @@ -9,10 +9,10 @@ enum FIELD_MESSAGE_BOX_AUTO_SCROLL, }; -bool8 ShowFieldMessage(const u8 *message); -bool8 ShowPokenavFieldMessage(const u8 *message); +bool8 ShowFieldMessage(const u8 *str); +bool8 ShowPokenavFieldMessage(const u8 *str); bool8 ShowFieldMessageFromBuffer(void); -bool8 ShowFieldAutoScrollMessage(const u8 *message); +bool8 ShowFieldAutoScrollMessage(const u8 *str); void HideFieldMessageBox(void); bool8 IsFieldMessageBoxHidden(void); u8 GetFieldMessageBoxMode(void); diff --git a/include/field_player_avatar.h b/include/field_player_avatar.h index 12de71be8f..0048ed1355 100644 --- a/include/field_player_avatar.h +++ b/include/field_player_avatar.h @@ -3,11 +3,11 @@ void PlayerStep(u8 direction, u16 newKeys, u16 heldKeys); void ClearPlayerAvatarInfo(void); -void SetPlayerAvatarExtraStateTransition(u16, u8); -u8 GetPlayerAvatarGenderByGraphicsId(u16); -bool8 TestPlayerAvatarFlags(u8); +void SetPlayerAvatarExtraStateTransition(u16 graphicsId, u8 transitionFlag); +u8 GetPlayerAvatarGenderByGraphicsId(u16 gfxId); +u8 TestPlayerAvatarFlags(u8 flag); u8 GetPlayerAvatarSpriteId(void); -void PlayerGetDestCoords(s16 *, s16 *); +void PlayerGetDestCoords(s16 *x, s16 *y); u8 GetPlayerFacingDirection(void); u8 GetPlayerMovementDirection(void); u8 PlayerGetCopyableMovement(void); @@ -36,7 +36,7 @@ void CancelPlayerForcedMovement(void); void InitPlayerAvatar(s16 x, s16 y, u8 direction, u8 gender); void PlayerFreeze(void); void StopPlayerAvatar(void); -void SetSpinStartFacingDir(u8); +void SetSpinStartFacingDir(u8 direction); void GetXYCoordsOneStepInFrontOfPlayer(s16 *xPtr, s16 *yPtr); u16 GetRivalAvatarGraphicsIdByStateIdAndGender(u8 state, u8 gender); void SetPlayerAvatarFieldMove(void); @@ -50,8 +50,8 @@ bool8 IsPlayerSurfingNorth(void); void SetPlayerAvatarWatering(u8 direction); u8 GetPlayerAvatarFlags(void); void UpdatePlayerAvatarTransitionState(void); -u16 GetFRLGAvatarGraphicsIdByGender(u8); -u16 GetRSAvatarGraphicsIdByGender(u8); +u16 GetFRLGAvatarGraphicsIdByGender(u8 gender); +u16 GetRSAvatarGraphicsIdByGender(u8 gender); void PlayerWheelieInPlace(u8 direction); void PlayerWheelieMove(u8 direction); void PlayerPopWheelieWhileMoving(u8 direction); diff --git a/include/field_specials.h b/include/field_specials.h index 975a57970b..50afecf2fb 100644 --- a/include/field_specials.h +++ b/include/field_specials.h @@ -6,7 +6,7 @@ extern u8 gBikeCollisions; extern u16 gScrollableMultichoice_ScrollOffset; u8 GetLeadMonIndex(void); -u8 IsDestinationBoxFull(void); +bool8 IsDestinationBoxFull(void); u16 GetPCBoxToSendMon(void); bool8 InMultiPartnerRoom(void); void UpdateTrainerFansAfterLinkBattle(void); diff --git a/include/fieldmap.h b/include/fieldmap.h index ecb1e49c4d..2788a3f1a9 100644 --- a/include/fieldmap.h +++ b/include/fieldmap.h @@ -24,19 +24,19 @@ extern struct BackupMapLayout gBackupMapLayout; extern u16 ALIGNED(4) sBackupMapData[MAX_MAP_DATA_SIZE]; -u32 MapGridGetMetatileIdAt(int, int); -u32 MapGridGetMetatileBehaviorAt(int, int); -void MapGridSetMetatileIdAt(int, int, u16); -void MapGridSetMetatileEntryAt(int, int, u16); -void GetCameraCoords(u16 *, u16 *); -u8 MapGridGetCollisionAt(int, int); +u32 MapGridGetMetatileIdAt(int x, int y); +u32 MapGridGetMetatileBehaviorAt(int x, int y); +void MapGridSetMetatileIdAt(int x, int y, u16 metatile); +void MapGridSetMetatileEntryAt(int x, int y, u16 metatile); +void GetCameraCoords(u16 *x, u16 *y); +u8 MapGridGetCollisionAt(int x, int y); int GetMapBorderIdAt(int x, int y); bool32 CanCameraMoveInDirection(int direction); -u16 GetMetatileAttributesById(u16 metatileId); +u16 GetMetatileAttributesById(u16 metatile); void GetCameraFocusCoords(u16 *x, u16 *y); u8 MapGridGetMetatileLayerTypeAt(int x, int y); u8 MapGridGetElevationAt(int x, int y); -bool8 CameraMove(int deltaX, int deltaY); +bool8 CameraMove(int x, int y); void SaveMapView(void); void SetCameraFocusCoords(u16 x, u16 y); void InitMap(void); @@ -47,8 +47,8 @@ void CopyMapTilesetsToVram(struct MapLayout const *mapLayout); void LoadMapTilesetPalettes(struct MapLayout const *mapLayout); void LoadSecondaryTilesetPalette(struct MapLayout const *mapLayout); void CopySecondaryTilesetToVramUsingHeap(struct MapLayout const *mapLayout); -void CopyPrimaryTilesetToVram(const struct MapLayout *); -void CopySecondaryTilesetToVram(const struct MapLayout *); +void CopyPrimaryTilesetToVram(struct MapLayout const *mapLayout); +void CopySecondaryTilesetToVram(struct MapLayout const *mapLayout); const struct MapHeader *const GetMapHeaderFromConnection(const struct MapConnection *connection); const struct MapConnection *GetMapConnectionAtPos(s16 x, s16 y); void MapGridSetMetatileImpassabilityAt(int x, int y, bool32 impassable); diff --git a/include/fldeff.h b/include/fldeff.h index f676720ede..46de616999 100644 --- a/include/fldeff.h +++ b/include/fldeff.h @@ -13,7 +13,7 @@ extern const struct SpritePalette gSpritePalette_CutGrass; extern struct MapPosition gPlayerFacingPosition; // escalator -void StartEscalator(bool8 var); +void StartEscalator(bool8 goingUp); void StopEscalator(void); bool8 IsEscalatorMoving(void); diff --git a/include/gba/m4a_internal.h b/include/gba/m4a_internal.h index fc8205efd9..a90771048d 100644 --- a/include/gba/m4a_internal.h +++ b/include/gba/m4a_internal.h @@ -170,7 +170,11 @@ struct SoundChannel struct MusicPlayerInfo; +#if __STDC_VERSION__ < 202311L typedef void (*MPlayFunc)(); +#else +typedef void (*MPlayFunc)(...); +#endif typedef void (*PlyNoteFunc)(u32, struct MusicPlayerInfo *, struct MusicPlayerTrack *); typedef void (*CgbSoundFunc)(void); typedef void (*CgbOscOffFunc)(u8); diff --git a/include/global.h b/include/global.h index a6e494f03a..53b1c63169 100644 --- a/include/global.h +++ b/include/global.h @@ -27,6 +27,10 @@ #define asm_unified(x) asm(".syntax unified\n" x "\n.syntax divided") #define NAKED __attribute__((naked)) +#if MODERN +#define asm __asm__ +#endif + /// IDE support #if defined(__APPLE__) || defined(__CYGWIN__) || defined(__INTELLISENSE__) // We define these when using certain IDEs to fool preproc @@ -489,7 +493,7 @@ struct ApprenticeQuestion u8 moveSlot:2; u8 suggestedChange:2; // TRUE if told to use held item or second move, FALSE if told to use no item or first move //u8 padding; - u16 data; // used both as an itemId and a moveId + u16 data; // used both as an itemId and a move }; struct PlayersApprentice @@ -1122,7 +1126,7 @@ struct SaveBlock1 // sizeof: 0x3??? }; -extern struct SaveBlock1* gSaveBlock1Ptr; +extern struct SaveBlock1 *gSaveBlock1Ptr; struct MapPosition { diff --git a/include/image_processing_effects.h b/include/image_processing_effects.h index 7f726707cd..20ee822e46 100755 --- a/include/image_processing_effects.h +++ b/include/image_processing_effects.h @@ -46,8 +46,8 @@ struct ImageProcessingContext u8 personality; }; -void ApplyImageProcessingEffects(struct ImageProcessingContext *); -void ApplyImageProcessingQuantization(struct ImageProcessingContext *); -void ConvertImageProcessingToGBA(struct ImageProcessingContext *); +void ApplyImageProcessingEffects(struct ImageProcessingContext *context); +void ApplyImageProcessingQuantization(struct ImageProcessingContext *context); +void ConvertImageProcessingToGBA(struct ImageProcessingContext *context); #endif diff --git a/include/international_string_util.h b/include/international_string_util.h index 0628ab932a..04def5ac53 100644 --- a/include/international_string_util.h +++ b/include/international_string_util.h @@ -4,7 +4,7 @@ #include "menu.h" #include "list_menu.h" -void ConvertInternationalPlayerName(u8 *src); +void ConvertInternationalPlayerName(u8 *str); void TVShowConvertInternationalString(u8 *dest, const u8 *src, int language); int GetStringCenterAlignXOffset(int fontId, const u8 *str, int totalWidth); int GetStringRightAlignXOffset(int fontId, const u8 *str, int totalWidth); @@ -16,9 +16,9 @@ int Intl_GetListMenuWidth(const struct ListMenuTemplate *listMenu); void CopyMonCategoryText(u16 species, u8 *dest); u8 *GetStringClearToWidth(u8 *dest, int fontId, const u8 *str, int totalStringWidth); void PadNameString(u8 *dest, u8 padChar); -void ConvertInternationalPlayerNameStripChar(u8 *, u8); -void ConvertInternationalContestantName(u8 *); -int GetNicknameLanguage(u8 *); +void ConvertInternationalPlayerNameStripChar(u8 *str, u8 removeChar); +void ConvertInternationalContestantName(u8 *str); +int GetNicknameLanguage(u8 *str); void FillWindowTilesByRow(int windowId, int columnStart, int rowStart, int numFillTiles, int numRows); #endif // GUARD_INTERNATIONAL_STRING_UTIL_H diff --git a/include/intro.h b/include/intro.h index 1c89c65952..e77811299e 100644 --- a/include/intro.h +++ b/include/intro.h @@ -8,7 +8,7 @@ // Exported ROM declarations void CB2_InitCopyrightScreenAfterBootup(void); void CB2_InitCopyrightScreenAfterTitleScreen(void); -void PanFadeAndZoomScreen(u16, u16, u16, u16); +void PanFadeAndZoomScreen(u16 screenX, u16 screenY, u16 zoom, u16 alpha); void MainCB2_Intro(void); void Task_Scene1_Load(u8); diff --git a/include/intro_credits_graphics.h b/include/intro_credits_graphics.h index c6f4a73c55..b37846f345 100644 --- a/include/intro_credits_graphics.h +++ b/include/intro_credits_graphics.h @@ -35,10 +35,10 @@ extern const struct SpritePalette gSpritePalettes_Credits[]; void LoadIntroPart2Graphics(u8 scenery); void SetIntroPart2BgCnt(u8 scenery); -void LoadCreditsSceneGraphics(u8); -void SetCreditsSceneBgCnt(u8); +void LoadCreditsSceneGraphics(u8 scene); +void SetCreditsSceneBgCnt(u8 scene); u8 CreateBicycleBgAnimationTask(u8 mode, u16 bg1Speed, u16 bg2Speed, u16 bg3Speed); -void CycleSceneryPalette(u8); +void CycleSceneryPalette(u8 mode); u8 CreateIntroBrendanSprite(s16 x, s16 y); u8 CreateIntroMaySprite(s16 x, s16 y); u8 CreateIntroFlygonSprite(s16 x, s16 y); diff --git a/include/item.h b/include/item.h index b99a6f30c2..3c6962efe1 100644 --- a/include/item.h +++ b/include/item.h @@ -63,25 +63,25 @@ u16 BagGetItemIdByPocketPosition(u8 pocketId, u16 pocketPos); u16 BagGetQuantityByPocketPosition(u8 pocketId, u16 pocketPos); void CompactItemsInBagPocket(struct BagPocket *bagPocket); void SortBerriesOrTMHMs(struct BagPocket *bagPocket); -void MoveItemSlotInList(struct ItemSlot* itemSlots_, u32 from, u32 to_); +void MoveItemSlotInList(struct ItemSlot *itemSlots_, u32 from, u32 to_); void ClearBag(void); u16 CountTotalItemQuantityInBag(u16 itemId); bool8 AddPyramidBagItem(u16 itemId, u16 count); bool8 RemovePyramidBagItem(u16 itemId, u16 count); -const u8 *ItemId_GetName(u16 itemId); -u32 ItemId_GetPrice(u16 itemId); -const u8 *ItemId_GetEffect(u32 itemId); -u32 ItemId_GetHoldEffect(u32 itemId); -u32 ItemId_GetHoldEffectParam(u32 itemId); -const u8 *ItemId_GetDescription(u16 itemId); -u8 ItemId_GetImportance(u16 itemId); -u8 ItemId_GetConsumability(u16 itemId); -u8 ItemId_GetPocket(u16 itemId); -u8 ItemId_GetType(u16 itemId); -ItemUseFunc ItemId_GetFieldFunc(u16 itemId); -u8 ItemId_GetBattleUsage(u16 itemId); -u32 ItemId_GetSecondaryId(u32 itemId); -u32 ItemId_GetFlingPower(u32 itemId); +const u8 *GetItemName(u16 itemId); +u32 GetItemPrice(u16 itemId); +const u8 *GetItemEffect(u32 itemId); +u32 GetItemHoldEffect(u32 itemId); +u32 GetItemHoldEffectParam(u32 itemId); +const u8 *GetItemDescription(u16 itemId); +u8 GetItemImportance(u16 itemId); +u8 GetItemConsumability(u16 itemId); +u8 GetItemPocket(u16 itemId); +u8 GetItemType(u16 itemId); +ItemUseFunc GetItemFieldFunc(u16 itemId); +u8 GetItemBattleUsage(u16 itemId); +u32 GetItemSecondaryId(u32 itemId); +u32 GetItemFlingPower(u32 itemId); u32 GetItemStatus1Mask(u16 itemId); u32 GetItemStatus2Mask(u16 itemId); diff --git a/include/item_menu.h b/include/item_menu.h index 75912eca62..84137da1de 100644 --- a/include/item_menu.h +++ b/include/item_menu.h @@ -97,17 +97,17 @@ void CB2_BagMenuFromStartMenu(void); u8 GetItemListPosition(u8 pocketId); bool8 UseRegisteredKeyItemOnField(void); void CB2_GoToSellMenu(void); -void GoToBagMenu(u8 bagMenuType, u8 pocketId, void ( *exitCallback)()); +void GoToBagMenu(u8 location, u8 pocket, void ( *exitCallback)()); void DoWallyTutorialBagMenu(void); void ResetBagScrollPositions(void); void ChooseBerryForMachine(void (*exitCallback)(void)); void CB2_ChooseBerry(void); void CB2_ChooseMulch(void); void Task_FadeAndCloseBagMenu(u8 taskId); -void BagMenu_YesNo(u8 taskId, u8 windowType, const struct YesNoFuncTable* funcTable); +void BagMenu_YesNo(u8 taskId, u8 windowType, const struct YesNoFuncTable *funcTable); void UpdatePocketItemList(u8 pocketId); -void DisplayItemMessage(u8 taskId, u8 fontId, const u8 *str, void ( *callback)(u8 taskId)); -void DisplayItemMessageOnField(u8 taskId, const u8 *src, TaskFunc callback); +void DisplayItemMessage(u8 taskId, u8 fontId, const u8 *str, void (*callback)(u8 taskId)); +void DisplayItemMessageOnField(u8 taskId, const u8 *string, TaskFunc callback); void CloseItemMessage(u8 taskId); void ItemMenu_RotomCatalog(u8 taskId); diff --git a/include/item_use.h b/include/item_use.h index d7871fd6f2..ad8018d67d 100644 --- a/include/item_use.h +++ b/include/item_use.h @@ -1,48 +1,48 @@ #ifndef GUARD_ITEM_USE_H #define GUARD_ITEM_USE_H -void ItemUseOutOfBattle_Mail(u8); -void ItemUseOutOfBattle_Bike(u8); -void ItemUseOutOfBattle_Rod(u8); -void ItemUseOutOfBattle_Itemfinder(u8); -void ItemUseOutOfBattle_PokeblockCase(u8); -void ItemUseOutOfBattle_CoinCase(u8); -void ItemUseOutOfBattle_PokemonBoxLink(u8); -void ItemUseOutOfBattle_PowderJar(u8); -void ItemUseOutOfBattle_SSTicket(u8); -void ItemUseOutOfBattle_WailmerPail(u8); -void ItemUseOutOfBattle_Medicine(u8); -void ItemUseOutOfBattle_AbilityCapsule(u8); -void ItemUseOutOfBattle_AbilityPatch(u8); -void ItemUseOutOfBattle_Mint(u8); -void ItemUseOutOfBattle_ResetEVs(u8); -void ItemUseOutOfBattle_ReduceEV(u8); -void ItemUseOutOfBattle_SacredAsh(u8); -void ItemUseOutOfBattle_PPRecovery(u8); -void ItemUseOutOfBattle_PPUp(u8); -void ItemUseOutOfBattle_RareCandy(u8); -void ItemUseOutOfBattle_DynamaxCandy(u8); -void ItemUseOutOfBattle_TMHM(u8); -void ItemUseOutOfBattle_Repel(u8); -void ItemUseOutOfBattle_Lure(u8); -void ItemUseOutOfBattle_EscapeRope(u8); -void ItemUseOutOfBattle_BlackWhiteFlute(u8); -void ItemUseOutOfBattle_EvolutionStone(u8); -void ItemUseOutOfBattle_Berry(u8); -void ItemUseOutOfBattle_EnigmaBerry(u8); -void ItemUseOutOfBattle_FormChange(u8); -void ItemUseOutOfBattle_FormChange_ConsumedOnUse(u8); -void ItemUseOutOfBattle_RotomCatalog(u8); -void ItemUseOutOfBattle_ZygardeCube(u8); -void ItemUseOutOfBattle_Fusion(u8); -void ItemUseOutOfBattle_Honey(u8); -void ItemUseOutOfBattle_CannotUse(u8); -void ItemUseOutOfBattle_ExpShare(u8); +void ItemUseOutOfBattle_Mail(u8 taskId); +void ItemUseOutOfBattle_Bike(u8 taskId); +void ItemUseOutOfBattle_Rod(u8 taskId); +void ItemUseOutOfBattle_Itemfinder(u8 taskId); +void ItemUseOutOfBattle_PokeblockCase(u8 taskId); +void ItemUseOutOfBattle_CoinCase(u8 taskId); +void ItemUseOutOfBattle_PokemonBoxLink(u8 taskId); +void ItemUseOutOfBattle_PowderJar(u8 taskId); +void ItemUseOutOfBattle_SSTicket(u8 taskId); +void ItemUseOutOfBattle_WailmerPail(u8 taskId); +void ItemUseOutOfBattle_Medicine(u8 taskId); +void ItemUseOutOfBattle_AbilityCapsule(u8 taskId); +void ItemUseOutOfBattle_AbilityPatch(u8 taskId); +void ItemUseOutOfBattle_Mint(u8 taskId); +void ItemUseOutOfBattle_ResetEVs(u8 taskId); +void ItemUseOutOfBattle_ReduceEV(u8 taskId); +void ItemUseOutOfBattle_SacredAsh(u8 taskId); +void ItemUseOutOfBattle_PPRecovery(u8 taskId); +void ItemUseOutOfBattle_PPUp(u8 taskId); +void ItemUseOutOfBattle_RareCandy(u8 taskId); +void ItemUseOutOfBattle_DynamaxCandy(u8 taskId); +void ItemUseOutOfBattle_TMHM(u8 taskId); +void ItemUseOutOfBattle_Repel(u8 taskId); +void ItemUseOutOfBattle_Lure(u8 taskId); +void ItemUseOutOfBattle_EscapeRope(u8 taskId); +void ItemUseOutOfBattle_BlackWhiteFlute(u8 taskId); +void ItemUseOutOfBattle_EvolutionStone(u8 taskId); +void ItemUseOutOfBattle_Berry(u8 taskId); +void ItemUseOutOfBattle_EnigmaBerry(u8 taskId); +void ItemUseOutOfBattle_FormChange(u8 taskId); +void ItemUseOutOfBattle_FormChange_ConsumedOnUse(u8 taskId); +void ItemUseOutOfBattle_RotomCatalog(u8 taskId); +void ItemUseOutOfBattle_ZygardeCube(u8 taskId); +void ItemUseOutOfBattle_Fusion(u8 taskId); +void ItemUseOutOfBattle_Honey(u8 taskId); +void ItemUseOutOfBattle_CannotUse(u8 taskId); +void ItemUseOutOfBattle_ExpShare(u8 taskId); void ItemUseInBattle_BagMenu(u8 taskId); void ItemUseInBattle_PartyMenu(u8 taskId); void ItemUseInBattle_PartyMenuChooseMove(u8 taskId); void Task_UseDigEscapeRopeOnField(u8 taskId); -u8 CanUseDigOrEscapeRopeOnCurMap(void); +bool8 CanUseDigOrEscapeRopeOnCurMap(void); u8 CheckIfItemIsTMHMOrEvolutionStone(u16 itemId); void FieldUseFunc_VsSeeker(u8 taskId); void Task_ItemUse_CloseMessageBoxAndReturnToField_VsSeeker(u8 taskId); diff --git a/include/librfu.h b/include/librfu.h index 6b0bd97c71..8125d64043 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -316,7 +316,11 @@ struct STWIStatus u8 recoveryCount; u8 unk_16; u8 unk_17; +#if __STDC_VERSION__ < 202311L void (*callbackM)(); +#else + void (*callbackM)(...); +#endif void (*callbackS)(u16); void (*callbackID)(void); union RfuPacket *txPacket; @@ -515,7 +519,7 @@ void rfu_REQ_endSearchParent(void); void rfu_REQ_startConnectParent(u16 pid); void rfu_REQ_pollConnectParent(void); void rfu_REQ_endConnectParent(void); -u16 rfu_getConnectParentStatus(u8 *status,u8 *connectSlotNo); +u16 rfu_getConnectParentStatus(u8 *status, u8 *connectSlotNo); // Restore link from child device void rfu_REQ_CHILD_startConnectRecovery(u8 bmRecoverySlot); void rfu_REQ_CHILD_pollConnectRecovery(void); @@ -607,7 +611,7 @@ void STWI_send_DataRxREQ(void); void STWI_send_MS_ChangeREQ(void); void STWI_send_StopModeREQ(void); void STWI_send_SystemStatusREQ(void); -void STWI_send_GameConfigREQ(const u8 *serial_uname, const u8 *gname); +void STWI_send_GameConfigREQ(const u8 *serial_gname, const u8 *uname); void STWI_send_ResetREQ(void); void STWI_send_LinkStatusREQ(void); void STWI_send_VersionStatusREQ(void); diff --git a/include/lilycove_lady.h b/include/lilycove_lady.h index d3cce4ca83..0f2b4f19dd 100644 --- a/include/lilycove_lady.h +++ b/include/lilycove_lady.h @@ -8,7 +8,7 @@ void FieldCallback_FavorLadyEnableScriptContexts(void); void FieldCallback_QuizLadyEnableScriptContexts(void); void QuizLadyClearQuestionForRecordMix(const LilycoveLady *lilycoveLady); bool8 GivePokeblockToContestLady(struct Pokeblock *pokeblock); -void BufferContestLadyMonName(u8 *dest1, u8 *dest2); +void BufferContestLadyMonName(u8 *category, u8 *nickname); void BufferContestLadyPlayerName(u8 *dest); void BufferContestLadyLanguage(u8 *dest); void BufferContestName(u8 *dest, u8 category); diff --git a/include/link.h b/include/link.h index 6763065055..4b8179d2af 100644 --- a/include/link.h +++ b/include/link.h @@ -233,7 +233,7 @@ struct Link struct BlockRequest { - void * address; + void *address; u32 size; }; @@ -255,21 +255,21 @@ bool8 IsWirelessAdapterConnected(void); void Task_DestroySelf(u8 taskId); void OpenLink(void); void CloseLink(void); -u16 LinkMain2(const u16 *); +u16 LinkMain2(const u16 *heldKeys); void ClearLinkCallback(void); void ClearLinkCallback_2(void); u8 GetLinkPlayerCount(void); void OpenLinkTimed(void); -u8 GetLinkPlayerDataExchangeStatusTimed(int lower, int upper); +u8 GetLinkPlayerDataExchangeStatusTimed(int minPlayers, int maxPlayers); bool8 IsLinkPlayerDataExchangeComplete(void); -u32 GetLinkPlayerTrainerId(u8); +u32 GetLinkPlayerTrainerId(u8 who); void ResetLinkPlayers(void); u8 GetMultiplayerId(void); u8 BitmaskAllOtherLinkPlayers(void); -bool8 SendBlock(u8, const void *, u16); +bool8 SendBlock(u8 unused, const void *src, u16 size); u8 GetBlockReceivedStatus(void); void ResetBlockReceivedFlags(void); -void ResetBlockReceivedFlag(u8); +void ResetBlockReceivedFlag(u8 who); u8 GetLinkPlayerCount_2(void); bool8 IsLinkMaster(void); void CB2_LinkError(void); @@ -293,7 +293,7 @@ bool8 HandleLinkConnection(void); void SetLinkDebugValues(u32 seed, u32 flags); void SetBerryBlenderLinkCallback(void); void SetSuppressLinkErrorMessage(bool8 flag); -void ConvertLinkPlayerName(struct LinkPlayer *linkPlayer); +void ConvertLinkPlayerName(struct LinkPlayer *player); void ClearSavedLinkPlayers(void); void SetLinkErrorBuffer(u32 status, u8 lastSendQueueCount, u8 lastRecvQueueCount, bool8 disconnected); void LocalLinkPlayerToBlock(void); @@ -331,10 +331,10 @@ extern u16 gLinkSavedIme; extern struct LinkPlayer gLocalLinkPlayer; bool32 Link_AnyPartnersPlayingRubyOrSapphire(void); -bool32 LinkDummy_Return2(void); -void SetLocalLinkPlayerId(u8); +u32 LinkDummy_Return2(void); +void SetLocalLinkPlayerId(u8 playerId); u8 GetSavedPlayerCount(void); -bool8 SendBlockRequest(u8 type); +bool8 SendBlockRequest(u8 blockReqType); u8 GetLinkPlayerCountAsBitFlags(void); u8 GetSavedLinkPlayerCountAsBitFlags(void); void SetCloseLinkCallbackHandleJP(void); diff --git a/include/link_rfu.h b/include/link_rfu.h index f3ae61afba..aadaf70412 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -268,7 +268,7 @@ void RfuVSync(void); void RfuSetIgnoreError(bool32 enable); u8 RfuGetStatus(void); struct RfuGameData *GetHostRfuGameData(void); -void UpdateGameData_GroupLockedIn(u8 startedActivity); +void UpdateGameData_GroupLockedIn(bool8 startedActivity); void RfuSetErrorParams(u32 errorInfo); void RfuSetStatus(u8 status, u16 errorInfo); u8 Rfu_SetLinkRecovery(bool32 enable); @@ -320,8 +320,8 @@ void RfuRecvQueue_Reset(struct RfuRecvQueue *queue); void RfuSendQueue_Reset(struct RfuSendQueue *queue); void RfuRecvQueue_Enqueue(struct RfuRecvQueue *queue, u8 *data); void RfuSendQueue_Enqueue(struct RfuSendQueue *queue, u8 *data); -bool8 RfuRecvQueue_Dequeue(struct RfuRecvQueue *queue, u8 *dest); -bool8 RfuSendQueue_Dequeue(struct RfuSendQueue *queue, u8 *dest); +bool8 RfuRecvQueue_Dequeue(struct RfuRecvQueue *queue, u8 *src); +bool8 RfuSendQueue_Dequeue(struct RfuSendQueue *queue, u8 *src); void RfuBackupQueue_Enqueue(struct RfuBackupQueue *queue, const u8 *data); bool8 RfuBackupQueue_Dequeue(struct RfuBackupQueue *queue, u8 *src); void InitHostRfuGameData(struct RfuGameData *data, u8 activity, bool32 startedActivity, s32 partnerInfo); diff --git a/include/list_menu.h b/include/list_menu.h index 413b978227..17587afa1d 100644 --- a/include/list_menu.h +++ b/include/list_menu.h @@ -38,8 +38,8 @@ struct ListMenuItem struct ListMenuTemplate { const struct ListMenuItem *items; - void (* moveCursorFunc)(s32 itemIndex, bool8 onInit, struct ListMenu *list); - void (* itemPrintFunc)(u8 windowId, u32 itemId, u8 y); + void (*moveCursorFunc)(s32 itemIndex, bool8 onInit, struct ListMenu *list); + void (*itemPrintFunc)(u8 windowId, u32 itemId, u8 y); u32 totalItems:12; u32 maxShowed:12; u32 textNarrowWidth:8; @@ -107,7 +107,7 @@ struct CursorStruct extern struct ScrollArrowsTemplate gTempScrollArrowTemplate; extern struct ListMenuTemplate gMultiuseListMenuTemplate; -s32 DoMysteryGiftListMenu(const struct WindowTemplate *windowTemplate, const struct ListMenuTemplate *listMenuTemplate, u8 drawMode, u16 tileNum, u16 palNum); +s32 DoMysteryGiftListMenu(const struct WindowTemplate *windowTemplate, const struct ListMenuTemplate *listMenuTemplate, u8 drawMode, u16 tileNum, u16 palOffset); u8 ListMenuInit(struct ListMenuTemplate *listMenuTemplate, u16 scrollOffset, u16 selectedRow); u8 ListMenuInitInRect(struct ListMenuTemplate *listMenuTemplate, struct ListMenuWindowRect *rect, u16 scrollOffset, u16 selectedRow); s32 ListMenu_ProcessInput(u8 listTaskId); @@ -120,11 +120,11 @@ void ListMenuGetCurrentItemArrayId(u8 listTaskId, u16 *arrayId); void ListMenuGetScrollAndRow(u8 listTaskId, u16 *scrollOffset, u16 *selectedRow); u16 ListMenuGetYCoordForPrintingArrowCursor(u8 listTaskId); void ListMenuOverrideSetColors(u8 cursorPal, u8 fillValue, u8 cursorShadowPal); -void ListMenuDefaultCursorMoveFunc(s32 itemIndex, u8 onInit, struct ListMenu *list); +void ListMenuDefaultCursorMoveFunc(s32 itemIndex, bool8 onInit, struct ListMenu *list); s32 ListMenuGetUnkIndicatorsStructFields(u8 taskId, u8 field); void ListMenuSetUnkIndicatorsStructField(u8 taskId, u8 field, s32 value); u8 AddScrollIndicatorArrowPair(const struct ScrollArrowsTemplate *arrowInfo, u16 *scrollOffset); -u8 AddScrollIndicatorArrowPairParameterized(u32 arrowType, s32 commonPos, s32 firstPos, s32 secondPos, s32 fullyDownThreshold, s32 tileTag, s32 palTag, u16 *currItemPtr); +u8 AddScrollIndicatorArrowPairParameterized(u32 arrowType, s32 commonPos, s32 firstPos, s32 secondPos, s32 fullyDownThreshold, s32 tileTag, s32 palTag, u16 *scrollOffset); void RemoveScrollIndicatorArrowPair(u8 taskId); void Task_ScrollIndicatorArrowPairOnMainMenu(u8 taskId); bool8 ListMenuChangeSelection(struct ListMenu *list, bool8 updateCursorAndCallCallback, u8 count, bool8 movingDown); diff --git a/include/main.h b/include/main.h index b64c9349a8..962f269b5a 100644 --- a/include/main.h +++ b/include/main.h @@ -64,7 +64,7 @@ void SetHBlankCallback(IntrCallback callback); void SetVCountCallback(IntrCallback callback); void SetSerialCallback(IntrCallback callback); void InitFlashTimer(void); -void SetTrainerHillVBlankCounter(u32 *var); +void SetTrainerHillVBlankCounter(u32 *counter); void ClearTrainerHillVBlankCounter(void); void DoSoftReset(void); void ClearPokemonCrySongs(void); diff --git a/include/malloc.h b/include/malloc.h index 60421dac2f..ca4ff8af7e 100644 --- a/include/malloc.h +++ b/include/malloc.h @@ -59,7 +59,7 @@ extern u8 gHeap[HEAP_SIZE]; void *Alloc_(u32 size, const char *location); void *AllocZeroed_(u32 size, const char *location); void Free(void *pointer); -void InitHeap(void *pointer, u32 size); +void InitHeap(void *heapStart, u32 heapSize); const struct MemBlock *HeapHead(void); const char *MemBlockLocation(const struct MemBlock *block); diff --git a/include/match_call.h b/include/match_call.h index 8aebb3bc77..ed2cf506c5 100644 --- a/include/match_call.h +++ b/include/match_call.h @@ -16,7 +16,7 @@ bool32 TryStartMatchCall(void); bool32 IsMatchCallTaskActive(void); void StartMatchCallFromScript(const u8 *message); void BufferPokedexRatingForMatchCall(u8 *destStr); -bool32 SelectMatchCallMessage(int, u8 *); +bool32 SelectMatchCallMessage(int trainerId, u8 *str); void LoadMatchCallWindowGfx(u32 windowId, u32 destOffset, u32 paletteId); void DrawMatchCallTextBoxBorder(u32 windowId, u32 tileOffset, u32 paletteId); diff --git a/include/mauville_old_man.h b/include/mauville_old_man.h index 9e5986ee81..dc7d16b743 100644 --- a/include/mauville_old_man.h +++ b/include/mauville_old_man.h @@ -6,9 +6,9 @@ extern struct BardSong gBardSong; void SetMauvilleOldMan(void); u8 GetCurrentMauvilleOldMan(void); void SetMauvilleOldManObjEventGfx(void); -void SanitizeMauvilleOldManForRuby(OldMan *dest); -void SanitizeReceivedRubyOldMan(union OldMan * oldMan, u32 version, u32 language); -void SanitizeReceivedEmeraldOldMan(union OldMan * oldMan, u32 version, u32 language); +void SanitizeMauvilleOldManForRuby(union OldMan *oldMan); +void SanitizeReceivedRubyOldMan(union OldMan *oldMan, u32 version, u32 language); +void SanitizeReceivedEmeraldOldMan(union OldMan *oldMan, u32 version, u32 language); void ResetMauvilleOldManFlag(void); #endif // GUARD_MAUVILLE_OLD_MAN_H diff --git a/include/menu.h b/include/menu.h index d2190fb854..ca7f8d008c 100644 --- a/include/menu.h +++ b/include/menu.h @@ -57,7 +57,7 @@ void LoadMessageBoxAndBorderGfx(void); void DrawDialogueFrame(u8 windowId, bool8 copyToVram); void ClearStdWindowAndFrame(u8 windowId, bool8 copyToVram); u16 AddTextPrinterParameterized2(u8 windowId, u8 fontId, const u8 *str, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16), u8 fgColor, u8 bgColor, u8 shadowColor); -void PrintPlayerNameOnWindow(u8, const u8 *, u16, u16); +void PrintPlayerNameOnWindow(u8 windowId, const u8 *src, u16 x, u16 y); void ClearDialogWindowAndFrame(u8 windowId, bool8 copyToVram); void SetStandardWindowBorderStyle(u8 windowId, bool8 copyToVram); void DisplayYesNoMenuDefaultYes(void); @@ -68,11 +68,11 @@ void AddTextPrinterWithCallbackForMessage(bool8 canSpeedUp, void (*callback)(str void BgDmaFill(u32 bg, u8 value, int offset, int size); void AddTextPrinterParameterized3(u8 windowId, u8 fontId, u8 left, u8 top, const u8 *color, s8 speed, const u8 *str); void ClearStdWindowAndFrameToTransparent(u8 windowId, bool8 copyToVram); -void SetWindowTemplateFields(struct WindowTemplate *template, u8 priority, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 palNum, u16 baseBlock); -void DrawStdFrameWithCustomTileAndPalette(u8 windowId, bool8 copyToVram, u16 tileStart, u8 palette); -void ScheduleBgCopyTilemapToVram(u8 bgNum); -void PrintMenuTable(u8 windowId, u8 itemCount, const struct MenuAction *strs); -u8 InitMenuInUpperLeftCornerNormal(u8 windowId, u8 numItems, u8 initialCursorPos); +void SetWindowTemplateFields(struct WindowTemplate *template, u8 bg, u8 left, u8 top, u8 width, u8 height, u8 paletteNum, u16 baseBlock); +void DrawStdFrameWithCustomTileAndPalette(u8 windowId, bool8 copyToVram, u16 baseTileNum, u8 paletteNum); +void ScheduleBgCopyTilemapToVram(u8 bgId); +void PrintMenuTable(u8 windowId, u8 itemCount, const struct MenuAction *menuActions); +u8 InitMenuInUpperLeftCornerNormal(u8 windowId, u8 itemCount, u8 initialCursorPos); u8 Menu_GetCursorPos(void); s8 Menu_ProcessInput(void); s8 Menu_ProcessInputNoWrap(void); @@ -81,17 +81,17 @@ void ResetTempTileDataBuffers(void); void *DecompressAndCopyTileDataToVram(u8 bgId, const void *src, u32 size, u16 offset, u8 mode); bool8 FreeTempTileDataBuffersIfPossible(void); struct WindowTemplate CreateWindowTemplate(u8 bg, u8 left, u8 top, u8 width, u8 height, u8 paletteNum, u16 baseBlock); -void CreateYesNoMenu(const struct WindowTemplate *windowTemplate, u16 borderFirstTileNum, u8 borderPalette, u8 initialCursorPos); +void CreateYesNoMenu(const struct WindowTemplate *window, u16 baseTileNum, u8 paletteNum, u8 initialCursorPos); void DecompressAndLoadBgGfxUsingHeap(u8 bgId, const void *src, u32 size, u16 offset, u8 mode); s8 Menu_ProcessInputNoWrapClearOnChoose(void); s8 ProcessMenuInput_other(void); void DoScheduledBgTilemapCopiesToVram(void); void ClearScheduledBgCopiesToVram(void); -void AddTextPrinterParameterized4(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, const u8 *color, s8 speed, const u8 *str); +void AddTextPrinterParameterized4(u8 windowId, u8 fontId, u8 left, u8 top, u8 letterSpacing, u8 lineSpacing, const u8 *color, s8 speed, const u8 *str); void DrawDialogFrameWithCustomTileAndPalette(u8 windowId, bool8 copyToVram, u16 tileNum, u8 paletteNum); -void PrintMenuActionTextsInUpperLeftCorner(u8 windowId, u8 optionsNo, const struct MenuAction *actions, const u8 *actionIds); +void PrintMenuActionTextsInUpperLeftCorner(u8 windowId, u8 itemCount, const struct MenuAction *menuActions, const u8 *actionIds); void ClearDialogWindowAndFrameToTransparent(u8 windowId, bool8 copyToVram); -void *malloc_and_decompress(const void *src, u32 *sizeOut); +void *malloc_and_decompress(const void *src, u32 *size); u16 copy_decompressed_tile_data_to_vram(u8 bgId, const void *src, u16 size, u16 offset, u8 mode); void AddTextPrinterForMessage(bool8 allowSkippingDelayWithButtonPress); void PrintMenuActionTexts(u8 windowId, u8 fontId, u8 left, u8 top, u8 letterSpacing, u8 lineHeight, u8 itemCount, const struct MenuAction *menuActions, const u8 *actionIds); @@ -102,7 +102,7 @@ u8 GetStartMenuWindowId(void); void ListMenuLoadStdPalAt(u8 palOffset, u8 palId); u8 Menu_MoveCursor(s8 cursorDelta); u8 Menu_MoveCursorNoWrapAround(s8 cursorDelta); -void DrawStdWindowFrame(u8 windowId, bool8 CopyToVram); +void DrawStdWindowFrame(u8 windowId, bool8 copyToVram); u8 AddStartMenuWindow(u8 numActions); u8 InitMenuNormal(u8 windowId, u8 fontId, u8 left, u8 top, u8 cursorHeight, u8 numChoices, u8 initialCursorPos); void LoadMessageBoxAndFrameGfx(u8 windowId, bool8 copyToVram); @@ -115,9 +115,9 @@ u8 GetMapNamePopUpWindowId(void); u8 AddMapNamePopUpWindow(void); void AddTextPrinterParameterized5(u8 windowId, u8 fontId, const u8 *str, u8 left, u8 top, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16), u8 letterSpacing, u8 lineSpacing); void SetBgTilemapPalette(u8 bgId, u8 left, u8 top, u8 width, u8 height, u8 palette); -void AddValToTilemapBuffer(void *ptr, int delta, int width, int height, bool32 is8BPP); +void AddValToTilemapBuffer(void *ptr, int delta, int width, int height, bool32 isAffine); void EraseFieldMessageBox(bool8 copyToVram); -void PrintMenuGridTable(u8 windowId, u8 optionWidth, u8 columns, u8 rows, const struct MenuAction *strs); +void PrintMenuGridTable(u8 windowId, u8 optionWidth, u8 columns, u8 rows, const struct MenuAction *menuActions); s8 Menu_ProcessGridInput(void); u8 InitMenuInUpperLeftCorner(u8 windowId, u8 itemCount, u8 initialCursorPos, bool8 APressMuted); s8 Menu_ProcessInputNoWrapAround_other(void); @@ -129,7 +129,7 @@ void HofPCTopBar_PrintPair(const u8 *string, const u8 *string2, bool8 noBg, u8 l void ResetBgPositions(void); void AddTextPrinterWithCustomSpeedForMessage(bool8 allowSkippingDelayWithButtonPress, u8 speed); void EraseYesNoWindow(void); -void PrintMenuActionTextsAtPos(u8 windowId, u8 fontId, u8 left, u8 top, u8 lineHeight, u8 itemCount, const struct MenuAction *strs); +void PrintMenuActionTextsAtPos(u8 windowId, u8 fontId, u8 left, u8 top, u8 lineHeight, u8 itemCount, const struct MenuAction *menuActions); void Menu_LoadStdPal(void); u8 AddSecondaryPopUpWindow(void); u8 GetSecondaryPopUpWindowId(void); diff --git a/include/menu_specialized.h b/include/menu_specialized.h index 152afb59ac..fccd989ffb 100644 --- a/include/menu_specialized.h +++ b/include/menu_specialized.h @@ -112,16 +112,16 @@ bool8 ConditionMenu_UpdateMonExit(struct ConditionGraph *graph, s16 *x); bool8 MoveConditionMonOnscreen(s16 *x); bool8 MoveConditionMonOffscreen(s16 *x); void GetConditionMenuMonNameAndLocString(u8 *locationDst, u8 *nameDst, u16 boxId, u16 monId, u16 partyId, u16 numMons, bool8 excludesCancel); -void GetConditionMenuMonConditions(struct ConditionGraph *graph, u8 *sheen, u16 boxId, u16 monId, u16 partyId, u16 id, u16 numMons, bool8 excludesCancel); +void GetConditionMenuMonConditions(struct ConditionGraph *graph, u8 *numSparkles, u16 boxId, u16 monId, u16 partyId, u16 id, u16 numMons, bool8 excludesCancel); void GetConditionMenuMonGfx(void *tilesDst, void *palDst, u16 boxId, u16 monId, u16 partyId, u16 numMons, bool8 excludesCancel); void LoadConditionMonPicTemplate(struct SpriteSheet *sheet, struct SpriteTemplate *template, struct SpritePalette *pal); -void LoadConditionSelectionIcons(struct SpriteSheet *sheets, struct SpriteTemplate * template, struct SpritePalette *pals); +void LoadConditionSelectionIcons(struct SpriteSheet *sheets, struct SpriteTemplate *template, struct SpritePalette *pals); s32 GetBoxOrPartyMonData(u16 boxId, u16 monId, s32 request, u8 *dst); // Condition sparkles void LoadConditionSparkle(struct SpriteSheet *sheet, struct SpritePalette *pal); void ResetConditionSparkleSprites(struct Sprite **sprites); -void CreateConditionSparkleSprites(struct Sprite **sprites, u8 monSpriteId, u8 count); +void CreateConditionSparkleSprites(struct Sprite **sprites, u8 monSpriteId, u8 _count); void DestroyConditionSparkleSprites(struct Sprite **sprites); void FreeConditionSparkles(struct Sprite **sprites); diff --git a/include/metatile_behavior.h b/include/metatile_behavior.h index 58eb83ea7b..ecdc696d41 100644 --- a/include/metatile_behavior.h +++ b/include/metatile_behavior.h @@ -9,145 +9,144 @@ enum { BRIDGE_TYPE_POND_HIGH, }; -bool8 MetatileBehavior_IsATile(u8); -bool8 MetatileBehavior_IsEncounterTile(u8); -bool8 MetatileBehavior_IsJumpEast(u8); -bool8 MetatileBehavior_IsJumpWest(u8); -bool8 MetatileBehavior_IsJumpNorth(u8); -bool8 MetatileBehavior_IsJumpSouth(u8); -bool8 MetatileBehavior_IsPokeGrass(u8); -bool8 MetatileBehavior_IsSandOrDeepSand(u8); -bool8 MetatileBehavior_IsDeepSand(u8); -bool8 MetatileBehavior_IsReflective(u8); -bool8 MetatileBehavior_IsIce(u8); -bool8 MetatileBehavior_IsWarpDoor(u8); -bool8 MetatileBehavior_IsDoor(u8); -bool8 MetatileBehavior_IsEscalator(u8); -bool8 MetatileBehavior_IsLadder(u8); -bool8 MetatileBehavior_IsNonAnimDoor(u8); -bool8 MetatileBehavior_IsDeepSouthWarp(u8); -bool8 MetatileBehavior_IsSurfableWaterOrUnderwater(u8); -bool8 MetatileBehavior_IsEastArrowWarp(u8); -bool8 MetatileBehavior_IsWestArrowWarp(u8); -bool8 MetatileBehavior_IsNorthArrowWarp(u8); -bool8 MetatileBehavior_IsSouthArrowWarp(u8); -bool8 MetatileBehavior_IsArrowWarp(u8); -bool8 MetatileBehavior_IsForcedMovementTile(u8); -bool8 MetatileBehavior_IsIce_2(u8); -bool8 MetatileBehavior_IsTrickHouseSlipperyFloor(u8); -bool8 MetatileBehavior_IsWalkNorth(u8); -bool8 MetatileBehavior_IsWalkSouth(u8); -bool8 MetatileBehavior_IsWalkWest(u8); -bool8 MetatileBehavior_IsWalkEast(u8); -bool8 MetatileBehavior_IsNorthwardCurrent(u8); -bool8 MetatileBehavior_IsSouthwardCurrent(u8); -bool8 MetatileBehavior_IsWestwardCurrent(u8); -bool8 MetatileBehavior_IsEastwardCurrent(u8); -bool8 MetatileBehavior_IsSlideNorth(u8); -bool8 MetatileBehavior_IsSlideSouth(u8); -bool8 MetatileBehavior_IsSlideWest(u8); -bool8 MetatileBehavior_IsSlideEast(u8); -bool8 MetatileBehavior_IsCounter(u8); -bool8 MetatileBehavior_IsPlayerFacingTVScreen(u8 tile, u8 playerDir); -bool8 MetatileBehavior_IsPC(u8); -bool8 MetatileBehavior_IsCableBoxResults1(u8); -bool8 MetatileBehavior_IsOpenSecretBaseDoor(u8); -bool8 MetatileBehavior_IsSecretBaseCave(u8); -bool8 MetatileBehavior_IsSecretBaseTree(u8); -bool8 MetatileBehavior_IsSecretBaseShrub(u8); -bool8 MetatileBehavior_IsSecretBasePC(u8); -bool8 MetatileBehavior_IsRecordMixingSecretBasePC(u8); -bool8 MetatileBehavior_IsSecretBaseTrainerSpot(u8); -bool8 MetatileBehavior_IsSecretBaseImpassable(u8); -bool8 MetatileBehavior_IsSecretBaseDecorationBase(u8); -bool8 MetatileBehavior_IsSecretBasePoster(u8); -bool8 MetatileBehavior_IsNormal(u8); -bool8 MetatileBehavior_IsSecretBaseNorthWall(u8); -bool8 MetatileBehavior_HoldsSmallDecoration(u8); -bool8 MetatileBehavior_HoldsLargeDecoration(u8); -bool8 MetatileBehavior_IsSecretBaseHole(u8); -bool8 MetatileBehavior_IsSecretBaseBalloon(u8); -bool8 MetatileBehavior_IsSecretBaseBreakableDoor(u8); -bool8 MetatileBehavior_IsSecretBaseSoundMat(u8); -bool8 MetatileBehavior_IsSecretBaseGlitterMat(u8); -bool8 MetatileBehavior_IsSecretBaseSandOrnament(u8); -bool8 MetatileBehavior_IsSecretBaseShieldOrToyTV(u8); -bool8 MetatileBehavior_IsPlayerRoomPCOn(u8); -bool8 MetatileBehavior_HasRipples(u8); -bool8 MetatileBehavior_IsPuddle(u8); -bool8 MetatileBehavior_IsTallGrass(u8); -bool8 MetatileBehavior_IsLongGrass(u8); -bool8 MetatileBehavior_IsBerryTreeSoil(u8); -bool8 MetatileBehavior_IsAshGrass(u8); -bool8 MetatileBehavior_IsFootprints(u8); -bool8 MetatileBehavior_IsBridgeOverWater(u8); -u8 MetatileBehavior_GetBridgeType(u8); -bool8 MetatileBehavior_IsBridgeOverWaterNoEdge(u8); -bool8 MetatileBehavior_IsLandWildEncounter(u8); -bool8 MetatileBehavior_IsWaterWildEncounter(u8); -bool8 MetatileBehavior_IsIndoorEncounter(u8); -bool8 MetatileBehavior_IsMountain(u8); -bool8 MetatileBehavior_IsDiveable(u8); -bool8 MetatileBehavior_IsUnableToEmerge(u8); -bool8 MetatileBehavior_IsShallowFlowingWater(u8); -bool8 MetatileBehavior_IsThinIce(u8); -bool8 MetatileBehavior_IsCrackedIce(u8); -bool8 MetatileBehavior_IsDeepOrOceanWater(u8); -bool8 MetatileBehavior_IsSurfableAndNotWaterfall(u8); -bool8 MetatileBehavior_IsEastBlocked(u8); -bool8 MetatileBehavior_IsWestBlocked(u8); -bool8 MetatileBehavior_IsNorthBlocked(u8); -bool8 MetatileBehavior_IsSouthBlocked(u8); -bool8 MetatileBehavior_IsShortGrass(u8); -bool8 MetatileBehavior_IsHotSprings(u8); -bool8 MetatileBehavior_IsWaterfall(u8); -bool8 MetatileBehavior_IsFortreeBridge(u8); -bool8 MetatileBehavior_IsPacifidlogVerticalLogTop(u8); -bool8 MetatileBehavior_IsPacifidlogVerticalLogBottom(u8); -bool8 MetatileBehavior_IsPacifidlogHorizontalLogLeft(u8); -bool8 MetatileBehavior_IsPacifidlogHorizontalLogRight(u8); -bool8 MetatileBehavior_IsPacifidlogLog(u8); -bool8 MetatileBehavior_IsTrickHousePuzzleDoor(u8); -bool8 MetatileBehavior_IsRegionMap(u8); -bool8 MetatileBehavior_IsClosedSootopolisDoor(u8); -bool8 MetatileBehavior_IsSkyPillarClosedDoor(u8); -bool8 MetatileBehavior_IsRoulette(u8); -bool8 MetatileBehavior_IsPokeblockFeeder(u8); -bool8 MetatileBehavior_IsSecretBaseJumpMat(u8); -bool8 MetatileBehavior_IsSecretBaseSpinMat(u8); -bool8 MetatileBehavior_IsLavaridgeB1FWarp(u8); -bool8 MetatileBehavior_IsLavaridge1FWarp(u8); -bool8 MetatileBehavior_IsAquaHideoutWarp(u8); -bool8 MetatileBehavior_IsUnionRoomWarp(u8); -bool8 MetatileBehavior_IsMossdeepGymWarp(u8); -bool8 MetatileBehavior_IsSurfableFishableWater(u8); -bool8 MetatileBehavior_IsMtPyreHole(u8); -bool8 MetatileBehavior_IsCrackedFloorHole(u8); -bool8 MetatileBehavior_IsCrackedFloor(u8); -bool8 MetatileBehavior_IsMuddySlope(u8); -bool8 MetatileBehavior_IsBumpySlope(u8); -bool8 MetatileBehavior_IsIsolatedVerticalRail(u8); -bool8 MetatileBehavior_IsIsolatedHorizontalRail(u8); -bool8 MetatileBehavior_IsVerticalRail(u8); -bool8 MetatileBehavior_IsHorizontalRail(u8); -bool8 MetatileBehavior_IsSeaweed(u8); -bool8 MetatileBehavior_IsRunningDisallowed(u8); -bool8 MetatileBehavior_IsCuttableGrass(u8); -bool8 MetatileBehavior_IsRunningShoesManual(u8); -bool8 MetatileBehavior_IsPictureBookShelf(u8); -bool8 MetatileBehavior_IsBookShelf(u8); -bool8 MetatileBehavior_IsPokeCenterBookShelf(u8); -bool8 MetatileBehavior_IsVase(u8); -bool8 MetatileBehavior_IsTrashCan(u8); -bool8 MetatileBehavior_IsShopShelf(u8); -bool8 MetatileBehavior_IsBlueprint(u8); -bool8 MetatileBehavior_IsBattlePyramidWarp(u8); +bool8 MetatileBehavior_IsATile(u8 metatileBehavior); +bool8 MetatileBehavior_IsEncounterTile(u8 metatileBehavior); +bool8 MetatileBehavior_IsJumpEast(u8 metatileBehavior); +bool8 MetatileBehavior_IsJumpWest(u8 metatileBehavior); +bool8 MetatileBehavior_IsJumpNorth(u8 metatileBehavior); +bool8 MetatileBehavior_IsJumpSouth(u8 metatileBehavior); +bool8 MetatileBehavior_IsPokeGrass(u8 metatileBehavior); +bool8 MetatileBehavior_IsSandOrDeepSand(u8 metatileBehavior); +bool8 MetatileBehavior_IsDeepSand(u8 metatileBehavior); +bool8 MetatileBehavior_IsReflective(u8 metatileBehavior); +bool8 MetatileBehavior_IsIce(u8 metatileBehavior); +bool8 MetatileBehavior_IsWarpDoor(u8 metatileBehavior); +bool8 MetatileBehavior_IsDoor(u8 metatileBehavior); +bool8 MetatileBehavior_IsEscalator(u8 metatileBehavior); +bool8 MetatileBehavior_IsLadder(u8 metatileBehavior); +bool8 MetatileBehavior_IsNonAnimDoor(u8 metatileBehavior); +bool8 MetatileBehavior_IsDeepSouthWarp(u8 metatileBehavior); +bool8 MetatileBehavior_IsSurfableWaterOrUnderwater(u8 metatileBehavior); +bool8 MetatileBehavior_IsEastArrowWarp(u8 metatileBehavior); +bool8 MetatileBehavior_IsWestArrowWarp(u8 metatileBehavior); +bool8 MetatileBehavior_IsNorthArrowWarp(u8 metatileBehavior); +bool8 MetatileBehavior_IsSouthArrowWarp(u8 metatileBehavior); +bool8 MetatileBehavior_IsForcedMovementTile(u8 metatileBehavior); +bool8 MetatileBehavior_IsIce_2(u8 metatileBehavior); +bool8 MetatileBehavior_IsTrickHouseSlipperyFloor(u8 metatileBehavior); +bool8 MetatileBehavior_IsWalkNorth(u8 metatileBehavior); +bool8 MetatileBehavior_IsWalkSouth(u8 metatileBehavior); +bool8 MetatileBehavior_IsWalkWest(u8 metatileBehavior); +bool8 MetatileBehavior_IsWalkEast(u8 metatileBehavior); +bool8 MetatileBehavior_IsNorthwardCurrent(u8 metatileBehavior); +bool8 MetatileBehavior_IsSouthwardCurrent(u8 metatileBehavior); +bool8 MetatileBehavior_IsWestwardCurrent(u8 metatileBehavior); +bool8 MetatileBehavior_IsEastwardCurrent(u8 metatileBehavior); +bool8 MetatileBehavior_IsSlideNorth(u8 metatileBehavior); +bool8 MetatileBehavior_IsSlideSouth(u8 metatileBehavior); +bool8 MetatileBehavior_IsSlideWest(u8 metatileBehavior); +bool8 MetatileBehavior_IsSlideEast(u8 metatileBehavior); +bool8 MetatileBehavior_IsCounter(u8 metatileBehavior); +bool8 MetatileBehavior_IsPlayerFacingTVScreen(u8 metatileBehavior, u8 playerDir); +bool8 MetatileBehavior_IsPC(u8 metatileBehavior); +bool8 MetatileBehavior_IsCableBoxResults1(u8 metatileBehavior); +bool8 MetatileBehavior_IsOpenSecretBaseDoor(u8 metatileBehavior); +bool8 MetatileBehavior_IsSecretBaseCave(u8 metatileBehavior); +bool8 MetatileBehavior_IsSecretBaseTree(u8 metatileBehavior); +bool8 MetatileBehavior_IsSecretBaseShrub(u8 metatileBehavior); +bool8 MetatileBehavior_IsSecretBasePC(u8 metatileBehavior); +bool8 MetatileBehavior_IsRecordMixingSecretBasePC(u8 metatileBehavior); +bool8 MetatileBehavior_IsSecretBaseTrainerSpot(u8 metatileBehavior); +bool8 MetatileBehavior_IsSecretBaseImpassable(u8 metatileBehavior); +bool8 MetatileBehavior_IsSecretBaseDecorationBase(u8 metatileBehavior); +bool8 MetatileBehavior_IsSecretBasePoster(u8 metatileBehavior); +bool8 MetatileBehavior_IsNormal(u8 metatileBehavior); +bool8 MetatileBehavior_IsSecretBaseNorthWall(u8 metatileBehavior); +bool8 MetatileBehavior_HoldsSmallDecoration(u8 metatileBehavior); +bool8 MetatileBehavior_HoldsLargeDecoration(u8 metatileBehavior); +bool8 MetatileBehavior_IsSecretBaseHole(u8 metatileBehavior); +bool8 MetatileBehavior_IsSecretBaseBalloon(u8 metatileBehavior); +bool8 MetatileBehavior_IsSecretBaseBreakableDoor(u8 metatileBehavior); +bool8 MetatileBehavior_IsSecretBaseSoundMat(u8 metatileBehavior); +bool8 MetatileBehavior_IsSecretBaseGlitterMat(u8 metatileBehavior); +bool8 MetatileBehavior_IsSecretBaseSandOrnament(u8 metatileBehavior); +bool8 MetatileBehavior_IsSecretBaseShieldOrToyTV(u8 metatileBehavior); +bool8 MetatileBehavior_IsPlayerRoomPCOn(u8 metatileBehavior); +bool8 MetatileBehavior_HasRipples(u8 metatileBehavior); +bool8 MetatileBehavior_IsPuddle(u8 metatileBehavior); +bool8 MetatileBehavior_IsTallGrass(u8 metatileBehavior); +bool8 MetatileBehavior_IsLongGrass(u8 metatileBehavior); +bool8 MetatileBehavior_IsBerryTreeSoil(u8 metatileBehavior); +bool8 MetatileBehavior_IsAshGrass(u8 metatileBehavior); +bool8 MetatileBehavior_IsFootprints(u8 metatileBehavior); +bool8 MetatileBehavior_IsBridgeOverWater(u8 metatileBehavior); +u8 MetatileBehavior_GetBridgeType(u8 metatileBehavior); +bool8 MetatileBehavior_IsBridgeOverWaterNoEdge(u8 metatileBehavior); +bool8 MetatileBehavior_IsLandWildEncounter(u8 metatileBehavior); +bool8 MetatileBehavior_IsWaterWildEncounter(u8 metatileBehavior); +bool8 MetatileBehavior_IsIndoorEncounter(u8 metatileBehavior); +bool8 MetatileBehavior_IsMountain(u8 metatileBehavior); +bool8 MetatileBehavior_IsDiveable(u8 metatileBehavior); +bool8 MetatileBehavior_IsUnableToEmerge(u8 metatileBehavior); +bool8 MetatileBehavior_IsShallowFlowingWater(u8 metatileBehavior); +bool8 MetatileBehavior_IsThinIce(u8 metatileBehavior); +bool8 MetatileBehavior_IsCrackedIce(u8 metatileBehavior); +bool8 MetatileBehavior_IsDeepOrOceanWater(u8 metatileBehavior); +bool8 MetatileBehavior_IsSurfableAndNotWaterfall(u8 metatileBehavior); +bool8 MetatileBehavior_IsEastBlocked(u8 metatileBehavior); +bool8 MetatileBehavior_IsWestBlocked(u8 metatileBehavior); +bool8 MetatileBehavior_IsNorthBlocked(u8 metatileBehavior); +bool8 MetatileBehavior_IsSouthBlocked(u8 metatileBehavior); +bool8 MetatileBehavior_IsShortGrass(u8 metatileBehavior); +bool8 MetatileBehavior_IsHotSprings(u8 metatileBehavior); +bool8 MetatileBehavior_IsWaterfall(u8 metatileBehavior); +bool8 MetatileBehavior_IsFortreeBridge(u8 metatileBehavior); +bool8 MetatileBehavior_IsPacifidlogVerticalLogTop(u8 metatileBehavior); +bool8 MetatileBehavior_IsPacifidlogVerticalLogBottom(u8 metatileBehavior); +bool8 MetatileBehavior_IsPacifidlogHorizontalLogLeft(u8 metatileBehavior); +bool8 MetatileBehavior_IsPacifidlogHorizontalLogRight(u8 metatileBehavior); +bool8 MetatileBehavior_IsPacifidlogLog(u8 metatileBehavior); +bool8 MetatileBehavior_IsTrickHousePuzzleDoor(u8 metatileBehavior); +bool8 MetatileBehavior_IsRegionMap(u8 metatileBehavior); +bool8 MetatileBehavior_IsClosedSootopolisDoor(u8 metatileBehavior); +bool8 MetatileBehavior_IsSkyPillarClosedDoor(u8 metatileBehavior); +bool8 MetatileBehavior_IsRoulette(u8 metatileBehavior); +bool8 MetatileBehavior_IsPokeblockFeeder(u8 metatileBehavior); +bool8 MetatileBehavior_IsSecretBaseJumpMat(u8 metatileBehavior); +bool8 MetatileBehavior_IsSecretBaseSpinMat(u8 metatileBehavior); +bool8 MetatileBehavior_IsLavaridgeB1FWarp(u8 metatileBehavior); +bool8 MetatileBehavior_IsLavaridge1FWarp(u8 metatileBehavior); +bool8 MetatileBehavior_IsAquaHideoutWarp(u8 metatileBehavior); +bool8 MetatileBehavior_IsUnionRoomWarp(u8 metatileBehavior); +bool8 MetatileBehavior_IsMossdeepGymWarp(u8 metatileBehavior); +bool8 MetatileBehavior_IsSurfableFishableWater(u8 metatileBehavior); +bool8 MetatileBehavior_IsMtPyreHole(u8 metatileBehavior); +bool8 MetatileBehavior_IsCrackedFloorHole(u8 metatileBehavior); +bool8 MetatileBehavior_IsCrackedFloor(u8 metatileBehavior); +bool8 MetatileBehavior_IsMuddySlope(u8 metatileBehavior); +bool8 MetatileBehavior_IsBumpySlope(u8 metatileBehavior); +bool8 MetatileBehavior_IsIsolatedVerticalRail(u8 metatileBehavior); +bool8 MetatileBehavior_IsIsolatedHorizontalRail(u8 metatileBehavior); +bool8 MetatileBehavior_IsVerticalRail(u8 metatileBehavior); +bool8 MetatileBehavior_IsHorizontalRail(u8 metatileBehavior); +bool8 MetatileBehavior_IsSeaweed(u8 metatileBehavior); +bool8 MetatileBehavior_IsRunningDisallowed(u8 metatileBehavior); +bool8 MetatileBehavior_IsCuttableGrass(u8 metatileBehavior); +bool8 MetatileBehavior_IsRunningShoesManual(u8 metatileBehavior); +bool8 MetatileBehavior_IsPictureBookShelf(u8 metatileBehavior); +bool8 MetatileBehavior_IsBookShelf(u8 metatileBehavior); +bool8 MetatileBehavior_IsPokeCenterBookShelf(u8 metatileBehavior); +bool8 MetatileBehavior_IsVase(u8 metatileBehavior); +bool8 MetatileBehavior_IsTrashCan(u8 metatileBehavior); +bool8 MetatileBehavior_IsShopShelf(u8 metatileBehavior); +bool8 MetatileBehavior_IsBlueprint(u8 metatileBehavior); +bool8 MetatileBehavior_IsBattlePyramidWarp(u8 metatileBehavior); bool8 MetatileBehavior_IsPlayerFacingWirelessBoxResults(u8 tile, u8 playerDir); bool8 MetatileBehavior_IsCableBoxResults2(u8 tile, u8 playerDir); -bool8 MetatileBehavior_IsQuestionnaire(u8); -bool8 MetatileBehavior_IsLongGrass_Duplicate(u8); -bool8 MetatileBehavior_IsLongGrassSouthEdge(u8); -bool8 MetatileBehavior_IsTrainerHillTimer(u8); +bool8 MetatileBehavior_IsQuestionnaire(u8 metatileBehavior); +bool8 MetatileBehavior_IsLongGrass_Duplicate(u8 metatileBehavior); +bool8 MetatileBehavior_IsLongGrassSouthEdge(u8 metatileBehavior); +bool8 MetatileBehavior_IsTrainerHillTimer(u8 metatileBehavior); bool8 MetatileBehavior_IsDirectionalUpRightStairWarp(u8 metatileBehavior); bool8 MetatileBehavior_IsDirectionalUpLeftStairWarp(u8 metatileBehavior); bool8 MetatileBehavior_IsDirectionalDownRightStairWarp(u8 metatileBehavior); diff --git a/include/mini_printf.h b/include/mini_printf.h index a891327cc4..ae5c226628 100644 --- a/include/mini_printf.h +++ b/include/mini_printf.h @@ -45,8 +45,8 @@ #else -s32 mini_vsnprintf(char* buffer, u32 buffer_len, const char *fmt, va_list va); -s32 mini_vpprintf(void* buf, const char *fmt, va_list va); +s32 mini_vsnprintf(char *buffer, u32 buffer_len, const char *fmt, va_list va); +s32 mini_vpprintf(void *buf, const char *fmt, va_list va); #endif #endif diff --git a/include/move_relearner.h b/include/move_relearner.h index c97b3894b1..9aab3974df 100644 --- a/include/move_relearner.h +++ b/include/move_relearner.h @@ -2,7 +2,7 @@ #define GUARD_MOVE_RELEARNER_H void TeachMoveRelearnerMove(void); -void MoveRelearnerShowHideHearts(s32); +void MoveRelearnerShowHideHearts(s32 move); void MoveRelearnerShowHideCategoryIcon(s32); void CB2_InitLearnMove(void); diff --git a/include/mystery_event_script.h b/include/mystery_event_script.h index 198a07e857..09032b4395 100644 --- a/include/mystery_event_script.h +++ b/include/mystery_event_script.h @@ -12,7 +12,7 @@ enum { void InitMysteryEventScriptContext(u8 *script); bool32 RunMysteryEventScriptContextCommand(u32 *status); u32 RunMysteryEventScript(u8 *script); -void SetMysteryEventScriptStatus(u32 val); +void SetMysteryEventScriptStatus(u32 status); u16 GetRecordMixingGift(void); #endif // GUARD_MYSTERY_EVENT_SCRIPT_H diff --git a/include/mystery_gift_client.h b/include/mystery_gift_client.h index a17778f41a..63520b42d1 100644 --- a/include/mystery_gift_client.h +++ b/include/mystery_gift_client.h @@ -75,19 +75,19 @@ struct MysteryGiftClient u32 funcId; u32 funcState; u32 cmdidx; - void * sendBuffer; - void * recvBuffer; - struct MysteryGiftClientCmd * script; - void * msg; + void *sendBuffer; + void *recvBuffer; + struct MysteryGiftClientCmd *script; + void *msg; struct MysteryGiftLink link; bool32 isWonderNews; ALIGNED(4) u8 bufferScript[MG_LINK_BUFFER_SIZE]; }; void MysteryGiftClient_Create(bool32 isWonderNews); -u32 MysteryGiftClient_Run(u16 * endVal); +u32 MysteryGiftClient_Run(u16 *endVal); void MysteryGiftClient_AdvanceState(void); void * MysteryGiftClient_GetMsg(void); -void MysteryGiftClient_SetParam(u32 value); +void MysteryGiftClient_SetParam(u32 val); #endif //GUARD_MYSTERY_GIFT_CLIENT_H diff --git a/include/mystery_gift_link.h b/include/mystery_gift_link.h index 32100db5f1..5f6b655270 100644 --- a/include/mystery_gift_link.h +++ b/include/mystery_gift_link.h @@ -34,16 +34,16 @@ struct MysteryGiftLink u16 sendCounter; u16 sendCRC; u16 sendSize; - void * recvBuffer; - const void * sendBuffer; + void *recvBuffer; + const void *sendBuffer; u32 (*recvFunc)(struct MysteryGiftLink *); u32 (*sendFunc)(struct MysteryGiftLink *); }; -void MysteryGiftLink_Init(struct MysteryGiftLink * link, u32 sendPlayerId, u32 recvPlayerId); -void MysteryGiftLink_InitSend(struct MysteryGiftLink * link, u32 ident, const void * src, u32 size); -bool32 MysteryGiftLink_Recv(struct MysteryGiftLink * link); -bool32 MysteryGiftLink_Send(struct MysteryGiftLink * link); -void MysteryGiftLink_InitRecv(struct MysteryGiftLink * link, u32 ident, void * dest); +void MysteryGiftLink_Init(struct MysteryGiftLink *link, u32 sendPlayerId, u32 recvPlayerId); +void MysteryGiftLink_InitSend(struct MysteryGiftLink *link, u32 ident, const void *src, u32 size); +u32 MysteryGiftLink_Recv(struct MysteryGiftLink *link); +u32 MysteryGiftLink_Send(struct MysteryGiftLink *link); +void MysteryGiftLink_InitRecv(struct MysteryGiftLink *link, u32 ident, void *dest); #endif //GUARD_MYSTERY_GIFT_LINK_H diff --git a/include/mystery_gift_menu.h b/include/mystery_gift_menu.h index 665c4596e7..6d694bc3e1 100644 --- a/include/mystery_gift_menu.h +++ b/include/mystery_gift_menu.h @@ -5,11 +5,11 @@ extern bool8 gGiftIsFromEReader; u16 GetMysteryGiftBaseBlock(void); void CB2_MysteryGiftEReader(void); -void PrintMysteryGiftOrEReaderHeader(bool8 isJapanese, bool32 usePickOkCancel); +void PrintMysteryGiftOrEReaderHeader(bool8 isEReader, bool32 useCancel); void MG_DrawCheckerboardPattern(u32 bg); void MainCB_FreeAllBuffersAndReturnToInitTitleScreen(void); bool32 PrintMysteryGiftMenuMessage(u8 *textState, const u8 *str); -void MG_AddMessageTextPrinter(const u8 *src); +void MG_AddMessageTextPrinter(const u8 *str); void CB2_InitEReader(void); void CB2_InitMysteryGift(void); void MG_DrawTextBorder(u8 windowId); diff --git a/include/mystery_gift_server.h b/include/mystery_gift_server.h index 8e3842f73c..e16ebc76d0 100644 --- a/include/mystery_gift_server.h +++ b/include/mystery_gift_server.h @@ -71,7 +71,7 @@ struct MysteryGiftServerCmd { u32 instr; u32 parameter; - const void * ptr; + const void *ptr; }; struct MysteryGiftServer @@ -80,21 +80,21 @@ struct MysteryGiftServer u32 param; u32 funcId; u32 cmdidx; - const struct MysteryGiftServerCmd * script; - void * recvBuffer; - struct WonderCard * card; - struct WonderNews * news; - struct MysteryGiftLinkGameData * linkGameData; - const void * ramScript; + const struct MysteryGiftServerCmd *script; + void *recvBuffer; + struct WonderCard *card; + struct WonderNews *news; + struct MysteryGiftLinkGameData *linkGameData; + const void *ramScript; u32 ramScriptSize; - const void * clientScript; + const void *clientScript; u32 clientScriptSize; u32 stamp; struct MysteryGiftLink link; }; -void MysterGiftServer_CreateForCard(); -void MysterGiftServer_CreateForNews(); -u32 MysterGiftServer_Run(u16 * endVal); +void MysterGiftServer_CreateForCard(void); +void MysterGiftServer_CreateForNews(void); +u32 MysterGiftServer_Run(u16 *endVal); #endif //GUARD_MYSTERY_GIFT_SERVER_H diff --git a/include/mystery_gift_view.h b/include/mystery_gift_view.h index 038093c7a1..4abe7db920 100644 --- a/include/mystery_gift_view.h +++ b/include/mystery_gift_view.h @@ -9,12 +9,12 @@ enum { NEWS_INPUT_NONE = 0xFF }; -bool32 WonderCard_Init(struct WonderCard * card, struct WonderCardMetadata * metadata); -bool32 WonderNews_Init(const struct WonderNews * news); +bool32 WonderCard_Init(struct WonderCard *card, struct WonderCardMetadata *metadata); +bool32 WonderNews_Init(const struct WonderNews *news); s32 WonderCard_Enter(void); s32 WonderNews_Enter(void); -s32 WonderCard_Exit(bool32 flag); -s32 WonderNews_Exit(bool32 flag); +s32 WonderCard_Exit(bool32 useCancel); +s32 WonderNews_Exit(bool32 useCancel); void WonderCard_Destroy(void); void WonderNews_Destroy(void); u32 WonderNews_GetInput(u16 input); diff --git a/include/overworld.h b/include/overworld.h index ea23c15b30..6a712ec7e8 100644 --- a/include/overworld.h +++ b/include/overworld.h @@ -78,7 +78,7 @@ void SetWarpDestination(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y); void SetWarpDestinationToMapWarp(s8 mapGroup, s8 mapNum, s8 warpId); void SetDynamicWarp(s32 unused, s8 mapGroup, s8 mapNum, s8 warpId); void SetDynamicWarpWithCoords(s32 unused, s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y); -void SetWarpDestinationToDynamicWarp(u8 unused); +void SetWarpDestinationToDynamicWarp(u8 unusedWarpId); void SetWarpDestinationToHealLocation(u8 healLocationId); void SetWarpDestinationToLastHealLocation(void); void SetLastHealLocationWarp(u8 healLocationId); @@ -101,7 +101,7 @@ void SetDefaultFlashLevel(void); void SetFlashLevel(s32 flashLevel); u8 GetFlashLevel(void); void SetCurrentMapLayout(u16 mapLayoutId); -void SetObjectEventLoadFlag(u8 var); +void SetObjectEventLoadFlag(u8 flag); u16 GetLocationMusic(struct WarpData *warp); u16 GetCurrLocationDefaultMusic(void); u16 GetWarpDestinationMusic(void); diff --git a/include/palette_util.h b/include/palette_util.h index 12ffc145e4..a81078f498 100644 --- a/include/palette_util.h +++ b/include/palette_util.h @@ -66,18 +66,18 @@ struct RouletteFlashUtil struct RouletteFlashPalette palettes[16]; }; -int InitPulseBlendPaletteSettings(struct PulseBlend *, const struct PulseBlendSettings *); -void InitPulseBlend(struct PulseBlend *); -void MarkUsedPulseBlendPalettes(struct PulseBlend *, u16, u8); -void UnloadUsedPulseBlendPalettes(struct PulseBlend *, u16, u8); -void UnmarkUsedPulseBlendPalettes(struct PulseBlend *, u16, u8); -void UpdatePulseBlend(struct PulseBlend *); -void FillTilemapRect(u16 *dest, u16 src, u8 left, u8 top, u8 width, u8 height); +int InitPulseBlendPaletteSettings(struct PulseBlend *pulseBlend, const struct PulseBlendSettings *settings); +void InitPulseBlend(struct PulseBlend *pulseBlend); +void MarkUsedPulseBlendPalettes(struct PulseBlend *pulseBlend, u16 pulseBlendPaletteSelector, u8 multiSelection); +void UnloadUsedPulseBlendPalettes(struct PulseBlend *pulseBlend, u16 pulseBlendPaletteSelector, u8 multiSelection); +void UnmarkUsedPulseBlendPalettes(struct PulseBlend *pulseBlend, u16 pulseBlendPaletteSelector, u8 multiSelection); +void UpdatePulseBlend(struct PulseBlend *pulseBlend); +void FillTilemapRect(u16 *dest, u16 value, u8 left, u8 top, u8 width, u8 height); void SetTilemapRect(u16 *dest, u16 *src, u8 left, u8 top, u8 width, u8 height); -void RouletteFlash_Run(struct RouletteFlashUtil *r0); -void RouletteFlash_Reset(struct RouletteFlashUtil *r0); -u8 RouletteFlash_Add(struct RouletteFlashUtil *r0, u8 r1, const struct RouletteFlashSettings *r2); -void RouletteFlash_Stop(struct RouletteFlashUtil *r0, u16 r1); -void RouletteFlash_Enable(struct RouletteFlashUtil *r0, u16 r1); +void RouletteFlash_Run(struct RouletteFlashUtil *flash); +void RouletteFlash_Reset(struct RouletteFlashUtil *flash); +u8 RouletteFlash_Add(struct RouletteFlashUtil *flash, u8 id, const struct RouletteFlashSettings *settings); +void RouletteFlash_Stop(struct RouletteFlashUtil *flash, u16 flags); +void RouletteFlash_Enable(struct RouletteFlashUtil *flash, u16 flags); #endif // GUARD_PALETTE_UTIL_H diff --git a/include/party_menu.h b/include/party_menu.h index 5236dd27a7..7c4af8c3a4 100644 --- a/include/party_menu.h +++ b/include/party_menu.h @@ -16,7 +16,7 @@ struct PartyMenu s8 slotId2; u8 action; u16 bagItem; - s16 data1; // used variously as a moveId, counter, moveSlotId, or cursorPos + s16 data1; // used variously as a move, counter, moveSlotId, or cursorPos s16 learnMoveState; // data2, used only as a learn move state }; @@ -41,7 +41,7 @@ void Task_HandleChooseMonInput(u8 taskId); u8 *GetMonNickname(struct Pokemon *mon, u8 *dest); u8 DisplayPartyMenuMessage(const u8 *str, bool8 keepOpen); bool8 IsPartyMenuTextPrinterActive(void); -void PartyMenuModifyHP(u8 taskId, u8 slot, s8 hpIncrement, s16 HPDifference, TaskFunc task); +void PartyMenuModifyHP(u8 taskId, u8 slot, s8 hpIncrement, s16 hpDifference, TaskFunc task); u8 GetAilmentFromStatus(u32 status); u8 GetMonAilment(struct Pokemon *mon); void DisplayPartyMenuStdMessage(u32 stringId); @@ -87,10 +87,10 @@ void ChooseMonForWirelessMinigame(void); void OpenPartyMenuInBattle(u8 partyAction); void ChooseMonForInBattleItem(void); void BufferBattlePartyCurrentOrder(void); -void BufferBattlePartyCurrentOrderBySide(u8 battlerId, u8 flankId); -void SwitchPartyOrderLinkMulti(u8 battlerId, u8 slot, u8 arrayIndex); +void BufferBattlePartyCurrentOrderBySide(u8 battler, u8 flankId); +void SwitchPartyOrderLinkMulti(u8 battler, u8 slot, u8 slot2); void SwitchPartyMonSlots(u8 slot, u8 slot2); -u8 GetPartyIdFromBattlePartyId(u8 slot); +u8 GetPartyIdFromBattlePartyId(u8 battlePartyId); void ShowPartyMenuToShowcaseMultiBattleParty(void); void ChooseMonForDaycare(void); bool8 CB2_FadeFromPartyMenu(void); diff --git a/include/player_pc.h b/include/player_pc.h index 305c661766..5deb02bbab 100644 --- a/include/player_pc.h +++ b/include/player_pc.h @@ -16,7 +16,7 @@ extern struct PlayerPCItemPageStruct gPlayerPCItemPageInfo; extern const struct MenuAction gMailboxMailOptions[]; -void ReshowPlayerPC(u8 taskId); +void ReshowPlayerPC(u8 var); void CB2_PlayerPCExitBagMenu(void); void Mailbox_ReturnToMailListAfterDeposit(void); void NewGameInitPCItems(void); diff --git a/include/pokedex.h b/include/pokedex.h index 0bd91449c3..aa88834e67 100644 --- a/include/pokedex.h +++ b/include/pokedex.h @@ -5,12 +5,12 @@ extern u8 gUnusedPokedexU8; extern void (*gPokedexVBlankCB)(void); void ResetPokedex(void); -u16 GetNationalPokedexCount(u8); -u16 GetHoennPokedexCount(u8); +u16 GetNationalPokedexCount(u8 caseID); +u16 GetHoennPokedexCount(u8 caseID); u8 DisplayCaughtMonDexPage(u16 species, bool32 isShiny, u32 personality); -s8 GetSetPokedexFlag(u16 nationalNum, u8 caseId); +s8 GetSetPokedexFlag(u16 nationalDexNo, u8 caseID); void DrawFootprint(u8 windowId, u16 species); -u16 CreateMonSpriteFromNationalDexNumber(u16, s16, s16, u16); +u16 CreateMonSpriteFromNationalDexNumber(u16 nationalNum, s16 x, s16 y, u16 paletteSlot); bool16 HasAllHoennMons(void); void ResetPokedexScrollPositions(void); bool16 HasAllMons(void); diff --git a/include/pokedex_area_region_map.h b/include/pokedex_area_region_map.h index 6526d7b458..0a5fc72fc8 100755 --- a/include/pokedex_area_region_map.h +++ b/include/pokedex_area_region_map.h @@ -9,9 +9,9 @@ struct PokedexAreaMapTemplate u32 unk:20; // never read }; -void LoadPokedexAreaMapGfx(const struct PokedexAreaMapTemplate *); +void LoadPokedexAreaMapGfx(const struct PokedexAreaMapTemplate *template); bool32 TryShowPokedexAreaMap(void); -void PokedexAreaMapChangeBgY(u32); +void PokedexAreaMapChangeBgY(u32 move); void FreePokedexAreaMapBgNum(void); #endif // GUARD_POKEDEX_AREA_REGION_MAP_H diff --git a/include/pokedex_area_screen.h b/include/pokedex_area_screen.h index 86dfaa6c5b..1aa42b3a26 100755 --- a/include/pokedex_area_screen.h +++ b/include/pokedex_area_screen.h @@ -1,6 +1,6 @@ #ifndef GUARD_POKEDEX_AREA_SCREEN_H #define GUARD_POKEDEX_AREA_SCREEN_H -void ShowPokedexAreaScreen(u16, u8 *); +void ShowPokedexAreaScreen(u16 species, u8 *screenSwitchState); #endif // GUARD_POKEDEX_AREA_SCREEN_H diff --git a/include/pokedex_cry_screen.h b/include/pokedex_cry_screen.h index 3401db22da..c44035605f 100755 --- a/include/pokedex_cry_screen.h +++ b/include/pokedex_cry_screen.h @@ -12,10 +12,10 @@ struct CryScreenWindow extern u8 gDexCryScreenState; -bool8 LoadCryWaveformWindow(struct CryScreenWindow *, u8); -void UpdateCryWaveformWindow(u8); -void CryScreenPlayButton(u16); -bool8 LoadCryMeter(struct CryScreenWindow *, u8); +bool8 LoadCryWaveformWindow(struct CryScreenWindow *window, u8 windowId); +void UpdateCryWaveformWindow(u8 windowId); +void CryScreenPlayButton(u16 species); +bool8 LoadCryMeter(struct CryScreenWindow *window, u8 windowId); void FreeCryScreen(void); #endif diff --git a/include/pokemon.h b/include/pokemon.h index 574eafce0e..13d871b4b3 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -6,6 +6,7 @@ #include "constants/regions.h" #include "constants/region_map_sections.h" #include "constants/map_groups.h" +#include "constants/battle.h" #include "contest_effect.h" #define GET_BASE_SPECIES_ID(speciesId) (GetFormSpeciesId(speciesId, 0)) @@ -640,7 +641,7 @@ void CreateBattleTowerMon_HandleLevel(struct Pokemon *mon, struct BattleTowerPok void CreateApprenticeMon(struct Pokemon *mon, const struct Apprentice *src, u8 monId); void CreateMonWithEVSpreadNatureOTID(struct Pokemon *mon, u16 species, u8 level, u8 nature, u8 fixedIV, u8 evSpread, u32 otId); void ConvertPokemonToBattleTowerPokemon(struct Pokemon *mon, struct BattleTowerPokemon *dest); -bool8 ShouldIgnoreDeoxysForm(u8 caseId, u8 battlerId); +bool8 ShouldIgnoreDeoxysForm(u8 caseId, u8 battler); u16 GetUnionRoomTrainerPic(void); u16 GetUnionRoomTrainerClass(void); void CreateEnemyEventMon(void); @@ -659,14 +660,14 @@ u16 MonTryLearningNewMove(struct Pokemon *mon, bool8 firstMove); void DeleteFirstMoveAndGiveMoveToMon(struct Pokemon *mon, u16 move); void DeleteFirstMoveAndGiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move); u8 CountAliveMonsInBattle(u8 caseId, u32 battler); -u8 GetDefaultMoveTarget(u8 battlerId); +u8 GetDefaultMoveTarget(u8 battler); u8 GetMonGender(struct Pokemon *mon); u8 GetBoxMonGender(struct BoxPokemon *boxMon); u8 GetGenderFromSpeciesAndPersonality(u16 species, u32 personality); bool32 IsPersonalityFemale(u16 species, u32 personality); u32 GetUnownSpeciesId(u32 personality); void SetMultiuseSpriteTemplateToPokemon(u16 speciesTag, u8 battlerPosition); -void SetMultiuseSpriteTemplateToTrainerBack(u16 trainerSpriteId, u8 battlerPosition); +void SetMultiuseSpriteTemplateToTrainerBack(u16 trainerPicId, u8 battlerPosition); void SetMultiuseSpriteTemplateToTrainerFront(u16 trainerPicId, u8 battlerPosition); /* GameFreak called Get(Box)MonData with either 2 or 3 arguments, for @@ -713,10 +714,10 @@ u8 CalculatePPWithBonus(u16 move, u8 ppBonuses, u8 moveIndex); void RemoveMonPPBonus(struct Pokemon *mon, u8 moveIndex); void RemoveBattleMonPPBonus(struct BattlePokemon *mon, u8 moveIndex); void PokemonToBattleMon(struct Pokemon *src, struct BattlePokemon *dst); -void CopyPartyMonToBattleData(u32 battlerId, u32 partyIndex); +void CopyPartyMonToBattleData(u32 battler, u32 partyIndex); bool8 ExecuteTableBasedItemEffect(struct Pokemon *mon, u16 item, u8 partyIndex, u8 moveIndex); -bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 moveIndex, u8 e); -bool8 HealStatusConditions(struct Pokemon *mon, u32 healMask, u8 battlerId); +bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 moveIndex, u8 usedByAI); +bool8 HealStatusConditions(struct Pokemon *mon, u32 healMask, u8 battler); u8 GetItemEffectParamOffset(u32 battler, u16 itemId, u8 effectByte, u8 effectBit); u8 *UseStatIncreaseItem(u16 itemId); u8 GetNature(struct Pokemon *mon); @@ -732,10 +733,10 @@ u16 HoennToNationalOrder(u16 hoennNum); void DrawSpindaSpots(u32 personality, u8 *dest, bool32 isSecondFrame); void EvolutionRenameMon(struct Pokemon *mon, u16 oldSpecies, u16 newSpecies); u8 GetPlayerFlankId(void); -u16 GetLinkTrainerFlankId(u8 id); +u16 GetLinkTrainerFlankId(u8 linkPlayerId); s32 GetBattlerMultiplayerId(u16 id); u8 GetTrainerEncounterMusicId(u16 trainerOpponentId); -u16 ModifyStatByNature(u8 nature, u16 n, u8 statIndex); +u16 ModifyStatByNature(u8 nature, u16 stat, u8 statIndex); void AdjustFriendship(struct Pokemon *mon, u8 event); void MonGainEVs(struct Pokemon *mon, u16 defeatedSpecies); u16 GetMonEVCount(struct Pokemon *mon); @@ -805,7 +806,7 @@ void HealPokemon(struct Pokemon *mon); void HealBoxPokemon(struct BoxPokemon *boxMon); void UpdateDaysPassedSinceFormChange(u16 days); void TrySetDayLimitToFormChange(struct Pokemon *mon); -u32 CheckDynamicMoveType(struct Pokemon *mon, u32 move, u32 battler); +u32 CheckDynamicMoveType(struct Pokemon *mon, u32 move, u32 battler, enum MonState state); uq4_12_t GetDynamaxLevelHPMultiplier(u32 dynamaxLevel, bool32 inverseMultiplier); u32 GetRegionalFormByRegion(u32 species, u32 region); bool32 IsSpeciesForeignRegionalForm(u32 species, u32 currentRegion); diff --git a/include/pokemon_icon.h b/include/pokemon_icon.h index 3986f8948b..a16d2e2b1b 100644 --- a/include/pokemon_icon.h +++ b/include/pokemon_icon.h @@ -6,11 +6,11 @@ extern const struct SpritePalette gMonIconPaletteTable[]; const u8 *GetMonIconTiles(u16 species, u32 personality); void TryLoadAllMonIconPalettesAtOffset(u16 offset); u8 GetValidMonIconPalIndex(u16 species); -const u8 *GetMonIconPtr(u16 speciesId, u32 personality); -const u16 *GetValidMonIconPalettePtr(u16 speciesId); +const u8 *GetMonIconPtr(u16 species, u32 personality); +const u16 *GetValidMonIconPalettePtr(u16 species); u16 GetIconSpecies(u16 species, u32 personality); u16 GetUnownLetterByPersonality(u32 personality); -u16 GetIconSpeciesNoPersonality(u16 speciesId); +u16 GetIconSpeciesNoPersonality(u16 species); void LoadMonIconPalettes(void); void LoadMonIconPalette(u16 species); void FreeMonIconPalettes(void); diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h index c2825bf779..397ec24dea 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -59,7 +59,7 @@ bool8 CheckFreePokemonStorageSpace(void); bool32 CheckBoxMonSanityAt(u32 boxId, u32 boxPosition); u32 CountStorageNonEggMons(void); u32 CountAllStorageMons(void); -bool32 AnyStorageMonWithMove(u16 moveId); +bool32 AnyStorageMonWithMove(u16 move); void ResetWaldaWallpaper(void); void SetWaldaWallpaperLockedOrUnlocked(bool32 unlocked); diff --git a/include/pokenav.h b/include/pokenav.h index 5c238a6c54..2992a76d12 100644 --- a/include/pokenav.h +++ b/include/pokenav.h @@ -33,7 +33,7 @@ typedef void (*PokenavListBufferItemFunc)(struct PokenavListItem *, u8 *); struct PokenavListTemplate { - struct PokenavListItem * list; + struct PokenavListItem *list; u16 count; u16 startIndex; u8 itemSize; @@ -309,7 +309,7 @@ enum { }; // pokenav.c -void SetSelectedConditionSearch(u32); +void SetSelectedConditionSearch(u32 cursorPos); u32 GetSelectedConditionSearch(void); void CB2_InitPokeNav(void); @@ -336,7 +336,7 @@ int PokenavList_MoveCursorDown(void); int PokenavList_PageDown(void); int PokenavList_PageUp(void); bool32 PokenavList_IsMoveWindowTaskActive(void); -void PokenavList_ToggleVerticalArrows(bool32 shouldHide); +void PokenavList_ToggleVerticalArrows(bool32 invisible); void PokenavList_DrawCurrentItemIcon(void); void PokenavList_EraseListForCheckPage(void); bool32 PokenavList_IsTaskActive(void); @@ -362,7 +362,7 @@ void CopyPaletteIntoBufferUnfaded(const u16 *palette, u32 bufferOffset, u32 size void RunMainMenuLoopedTask(u32 state); u32 IsActiveMenuLoopTaskActive(void); void LoadLeftHeaderGfxForIndex(u32 menuGfxId); -void ShowLeftHeaderGfx(u32 menugfxId, bool32 isMain, bool32 isOnRightSide); +void ShowLeftHeaderGfx(u32 menuGfxId, bool32 isMain, bool32 isOnRightSide); void PokenavFadeScreen(s32 fadeType); bool32 AreLeftHeaderSpritesMoving(void); void InitBgTemplates(const struct BgTemplate *templates, int count); @@ -372,7 +372,7 @@ bool32 WaitForHelpBar(void); void SlideMenuHeaderDown(void); bool32 MainMenuLoopedTaskIsBusy(void); void SetLeftHeaderSpritesInvisibility(void); -void PokenavCopyPalette(const u16 *a0, const u16 *a1, int a2, int a3, int a4, u16 *palette); +void PokenavCopyPalette(const u16 *src, const u16 *dest, int size, int a3, int a4, u16 *palette); void FadeToBlackExceptPrimary(void); struct Sprite *GetSpinningPokenavSprite(void); void HideSpinningPokenavSprite(void); @@ -382,7 +382,7 @@ void SlideMenuHeaderUp(void); void PokenavFillPalette(u32 palIndex, u16 fillValue); u32 PokenavMainMenuLoopedTaskIsActive(void); bool32 WaitForPokenavShutdownFade(void); -void SetActiveMenuLoopTasks(void *func1, void *func2); +void SetActiveMenuLoopTasks(void *createLoopTask, void *isLoopTaskActive); // Fix types later. void ShutdownPokenav(void); // pokenav_menu_handler.c @@ -413,11 +413,11 @@ void FreeMatchCallSubstruct1(void); int IsMatchCallListInitFinished(void); int GetNumberRegistered(void); struct PokenavMatchCallEntry *GetMatchCallList(void); -u16 GetMatchCallMapSec(int); +u16 GetMatchCallMapSec(int index); bool32 ShouldDrawRematchPokeballIcon(int index); void ClearRematchPokeballIcon(u16 windowId, u32 tileOffset); int GetMatchCallTrainerPic(int index); -const u8 *GetMatchCallFlavorText(int index, int textType); +const u8 *GetMatchCallFlavorText(int index, int checkPageEntry); const u8 *GetMatchCallMessageText(int index, bool8 *newRematchRequest); u16 GetMatchCallOptionCursorPos(void); u16 GetMatchCallOptionId(int optionId); @@ -425,7 +425,7 @@ void BufferMatchCallNameAndDesc(struct PokenavMatchCallEntry *matchCallEntry, u8 u8 GetMatchTableMapSectionId(int rematchIndex); int GetIndexDeltaOfNextCheckPageDown(int index); int GetIndexDeltaOfNextCheckPageUp(int index); -bool32 IsRematchEntryRegistered(int index); +bool32 IsRematchEntryRegistered(int rematchIndex); // pokenav_match_call_gfx.c bool32 OpenMatchCall(void); @@ -437,15 +437,15 @@ void FreeMatchCallSubstruct2(void); u32 PokenavCallback_Init_RegionMap(void); u32 GetRegionMapCallback(void); bool32 OpenPokenavRegionMap(void); -void CreateRegionMapLoopedTask(s32); +void CreateRegionMapLoopedTask(s32 index); bool32 IsRegionMapLoopedTaskActive(void); void FreeRegionMapSubstruct1(void); void FreeRegionMapSubstruct2(void); void UpdateRegionMapHelpBarText(void); // pokenav_conditions.c -u32 PokenavCallback_Init_ConditionGraph_Party(void); -u32 PokenavCallback_Init_ConditionGraph_Search(void); +bool32 PokenavCallback_Init_ConditionGraph_Party(void); +bool32 PokenavCallback_Init_ConditionGraph_Search(void); u32 GetConditionGraphMenuCallback(void); void FreeConditionGraphMenuSubstruct1(void); bool32 LoadConditionGraphMenuGfx(void); @@ -456,47 +456,47 @@ u16 GetMonListCount(void); u8 GetNumConditionMonSparkles(void); bool32 LoadNextConditionMenuMonData(u8 mode); u8 TryGetMonMarkId(void); -u8 *GetConditionMonNameText(u8 id); -u8 *GetConditionMonLocationText(u8 id); +u8 *GetConditionMonNameText(u8 loadId); +u8 *GetConditionMonLocationText(u8 loadId); u16 GetConditionMonDataBuffer(void); -void *GetConditionMonPicGfx(u8 id); -void *GetConditionMonPal(u8 id); +void *GetConditionMonPicGfx(u8 loadId); +void *GetConditionMonPal(u8 loadId); // pokenav_conditions_gfx.c bool32 OpenConditionGraphMenu(void); -void CreateConditionGraphMenuLoopedTask(s32); +void CreateConditionGraphMenuLoopedTask(s32 id); u32 IsConditionGraphMenuLoopedTaskActive(void); void FreeConditionGraphMenuSubstruct2(void); u8 GetMonMarkingsData(void); // pokenav_conditions_search_results.c -u32 PokenavCallback_Init_ConditionSearch(void); -u32 PokenavCallback_Init_ReturnToMonSearchList(void); +bool32 PokenavCallback_Init_ConditionSearch(void); +bool32 PokenavCallback_Init_ReturnToMonSearchList(void); u32 GetConditionSearchResultsCallback(void); void FreeSearchResultSubstruct1(void); bool32 OpenConditionSearchResults(void); bool32 OpenConditionSearchListFromGraph(void); -void CreateSearchResultsLoopedTask(s32); -u32 IsSearchResultLoopedTaskActive(void); +void CreateSearchResultsLoopedTask(s32 idx); +bool32 IsSearchResultLoopedTaskActive(void); void FreeSearchResultSubstruct2(void); // pokenav_ribbons_list.c -u32 PokenavCallback_Init_MonRibbonList(void); -u32 PokenavCallback_Init_RibbonsMonListFromSummary(void); +bool32 PokenavCallback_Init_MonRibbonList(void); +bool32 PokenavCallback_Init_RibbonsMonListFromSummary(void); u32 GetRibbonsMonListCallback(void); void FreeRibbonsMonList(void); bool32 OpenRibbonsMonList(void); bool32 OpenRibbonsMonListFromRibbonsSummary(void); -void CreateRibbonsMonListLoopedTask(s32); -u32 IsRibbonsMonListLoopedTaskActive(void); +void CreateRibbonsMonListLoopedTask(s32 idx); +bool32 IsRibbonsMonListLoopedTaskActive(void); void FreeRibbonsMonMenu(void); // pokenav_ribbons_summary.c -u32 PokenavCallback_Init_RibbonsSummaryMenu(void); +bool32 PokenavCallback_Init_RibbonsSummaryMenu(void); u32 GetRibbonsSummaryMenuCallback(void); void FreeRibbonsSummaryScreen1(void); bool32 OpenRibbonsSummaryMenu(void); -void CreateRibbonsSummaryLoopedTask(s32); +void CreateRibbonsSummaryLoopedTask(s32 id); u32 IsRibbonsSummaryLoopedTaskActive(void); void FreeRibbonsSummaryScreen2(void); diff --git a/include/rayquaza_scene.h b/include/rayquaza_scene.h index 5aa21981eb..422b591273 100644 --- a/include/rayquaza_scene.h +++ b/include/rayquaza_scene.h @@ -1,6 +1,6 @@ #ifndef GUARD_RAYQUAZA_SCENE_H #define GUARD_RAYQUAZA_SCENE_H -void DoRayquazaScene(u8 animId, bool8 endEarly, void (*callback)(void)); +void DoRayquazaScene(u8 animId, bool8 endEarly, void (*exitCallback)(void)); #endif // GUARD_RAYQUAZA_SCENE_H diff --git a/include/recorded_battle.h b/include/recorded_battle.h index 0945eefe92..88a0ee439b 100644 --- a/include/recorded_battle.h +++ b/include/recorded_battle.h @@ -60,11 +60,11 @@ extern u8 gRecordedBattleMultiplayerId; void RecordedBattle_Init(u8 mode); void RecordedBattle_SetTrainerInfo(void); -void RecordedBattle_SetBattlerAction(u8 battlerId, u8 action); -void RecordedBattle_ClearBattlerAction(u8 battlerId, u8 bytesToClear); -u8 RecordedBattle_GetBattlerAction(u32 actionType, u8 battlerId); +void RecordedBattle_SetBattlerAction(u8 battler, u8 action); +void RecordedBattle_ClearBattlerAction(u8 battler, u8 bytesToClear); +u8 RecordedBattle_GetBattlerAction(u32 actionType, u8 battler); u8 RecordedBattle_BufferNewBattlerData(u8 *dst); -void RecordedBattle_RecordAllBattlerData(u8 *data); +void RecordedBattle_RecordAllBattlerData(u8 *src); bool32 CanCopyRecordedBattleSaveData(void); bool32 MoveRecordedBattleToSaveData(void); void SetPartiesFromRecordedSave(struct RecordedBattleSave *src); diff --git a/include/region_map.h b/include/region_map.h index 08277651de..2ca153e92f 100644 --- a/include/region_map.h +++ b/include/region_map.h @@ -96,7 +96,7 @@ struct RegionMapLocation void InitRegionMapData(struct RegionMap *regionMap, const struct BgTemplate *template, bool8 zoomed); bool8 LoadRegionMapGfx(void); void UpdateRegionMapVideoRegs(void); -void InitRegionMap(struct RegionMap *regionMap, u8 argument); +void InitRegionMap(struct RegionMap *regionMap, bool8 zoomed); u8 DoRegionMapInputCallback(void); bool8 UpdateRegionMapZoom(void); void FreeRegionMapIconResources(void); @@ -104,7 +104,7 @@ u16 GetRegionMapSecIdAt(u16 x, u16 y); void CreateRegionMapPlayerIcon(u16 tileTag, u16 paletteTag); void CreateRegionMapCursor(u16 tileTag, u16 paletteTag); bool32 IsEventIslandMapSecId(u8 mapSecId); -u8 *GetMapName(u8 *, u16, u16); +u8 *GetMapName(u8 *dest, u16 regionMapId, u16 padLength); u8 *GetMapNameGeneric(u8 *dest, u16 mapSecId); u8 *GetMapNameHandleAquaHideout(u8 *dest, u16 mapSecId); u16 CorrectSpecialMapSecId(u16 mapSecId); diff --git a/include/roamer.h b/include/roamer.h index 36e9f14000..eac732a74c 100644 --- a/include/roamer.h +++ b/include/roamer.h @@ -8,7 +8,7 @@ void RoamerMoveToOtherLocationSet(u32 roamerIndex); void RoamerMove(u32 roamerIndex); bool8 IsRoamerAt(u32 roamerIndex, u8 mapGroup, u8 mapNum); void CreateRoamerMonInstance(u32 roamerIndex); -u8 TryStartRoamerEncounter(void); +bool8 TryStartRoamerEncounter(void); void UpdateRoamerHPStatus(struct Pokemon *mon); void SetRoamerInactive(u32 roamerIndex); void GetRoamerLocation(u32 roamerIndex, u8 *mapGroup, u8 *mapNum); diff --git a/include/safari_zone.h b/include/safari_zone.h index 39ee3ccb3e..5336c81057 100644 --- a/include/safari_zone.h +++ b/include/safari_zone.h @@ -16,6 +16,6 @@ void SafariZoneRetirePrompt(void); void CB2_EndSafariBattle(void); struct Pokeblock *SafariZoneGetActivePokeblock(void); -void SafariZoneActivatePokeblockFeeder(u8 pokeblock_index); +void SafariZoneActivatePokeblockFeeder(u8 pkblId); #endif // GUARD_SAFARI_ZONE_H diff --git a/include/scanline_effect.h b/include/scanline_effect.h index 0b395d4f60..18f5307f87 100644 --- a/include/scanline_effect.h +++ b/include/scanline_effect.h @@ -39,7 +39,7 @@ extern u16 ALIGNED(4) gScanlineEffectRegBuffers[2][0x3C0]; void ScanlineEffect_Stop(void); void ScanlineEffect_Clear(void); -void ScanlineEffect_SetParams(struct ScanlineEffectParams); +void ScanlineEffect_SetParams(struct ScanlineEffectParams params); void ScanlineEffect_InitHBlankDmaTransfer(void); u8 ScanlineEffect_InitWave(u8 startLine, u8 endLine, u8 frequency, u8 amplitude, u8 delayInterval, u8 regOffset, bool8 applyBattleBgOffsets); diff --git a/include/script_menu.h b/include/script_menu.h index d690939fae..7b92de04ea 100644 --- a/include/script_menu.h +++ b/include/script_menu.h @@ -42,7 +42,7 @@ bool8 (*ScriptMenu_HidePokemonPic(void))(void); int ConvertPixelWidthToTileWidth(int width); u8 CreateWindowFromRect(u8 x, u8 y, u8 width, u8 height); void ClearToTransparentAndRemoveWindow(u8 windowId); -int DisplayTextAndGetWidth(const u8 *str, int width); +int DisplayTextAndGetWidth(const u8 *str, int prevWidth); int ScriptMenu_AdjustLeftCoordFromWidth(int left, int width); bool16 ScriptMenu_CreatePCMultichoice(void); void ScriptMenu_DisplayPCStartupPrompt(void); diff --git a/include/script_pokemon_util.h b/include/script_pokemon_util.h index 6508295a2d..050bc0ed32 100644 --- a/include/script_pokemon_util.h +++ b/include/script_pokemon_util.h @@ -1,11 +1,11 @@ #ifndef GUARD_SCRIPT_POKEMON_UTIL_H #define GUARD_SCRIPT_POKEMON_UTIL_H -u32 ScriptGiveMon(u16, u8, u16); -u8 ScriptGiveEgg(u16); -void CreateScriptedWildMon(u16, u8, u16); -void CreateScriptedDoubleWildMon(u16, u8, u16, u16, u8, u16); -void ScriptSetMonMoveSlot(u8, u16, u8); +u32 ScriptGiveMon(u16 species, u8 level, u16 item); +u8 ScriptGiveEgg(u16 species); +void CreateScriptedWildMon(u16 species, u8 level, u16 item); +void CreateScriptedDoubleWildMon(u16 species, u8 level, u16 item, u16 species2, u8 level2, u16 item2); +void ScriptSetMonMoveSlot(u8 monIndex, u16 move, u8 slot); void ReducePlayerPartyToSelectedMons(void); void HealPlayerParty(void); void Script_GetChosenMonOffensiveEVs(void); diff --git a/include/secret_base.h b/include/secret_base.h index 567316cf9c..5502194ff2 100644 --- a/include/secret_base.h +++ b/include/secret_base.h @@ -3,7 +3,7 @@ void HideSecretBaseDecorationSprites(void); void CopyCurSecretBaseOwnerName_StrVar1(void); -void ClearJapaneseSecretBases(struct SecretBase *dest); +void ClearJapaneseSecretBases(struct SecretBase *bases); void SetPlayerSecretBaseParty(void); u8 *GetSecretBaseMapName(u8 *dest); const u8 *GetSecretBaseTrainerLoseText(void); @@ -24,6 +24,6 @@ void SetCurSecretBaseIdFromPosition(const struct MapPosition *position, const st void TrySetCurSecretBaseIndex(void); void CheckPlayerHasSecretBase(void); void ToggleSecretBaseEntranceMetatile(void); -void ReceiveSecretBasesData(void *records, size_t recordSize, u8 linkIdx); +void ReceiveSecretBasesData(void *secretBases, size_t recordSize, u8 linkIdx); #endif //GUARD_SECRET_BASE_H diff --git a/include/shop.h b/include/shop.h index 6644ba0aa0..367c06ed6c 100644 --- a/include/shop.h +++ b/include/shop.h @@ -3,9 +3,9 @@ extern struct ItemSlot gMartPurchaseHistory[3]; -void CreatePokemartMenu(const u16 *); -void CreateDecorationShop1Menu(const u16 *); -void CreateDecorationShop2Menu(const u16 *); +void CreatePokemartMenu(const u16 *itemsForSale); +void CreateDecorationShop1Menu(const u16 *itemsForSale); +void CreateDecorationShop2Menu(const u16 *itemsForSale); void CB2_ExitSellMenu(void); #endif // GUARD_SHOP_H diff --git a/include/slot_machine.h b/include/slot_machine.h index 88bbbd91bd..56617b23d7 100644 --- a/include/slot_machine.h +++ b/include/slot_machine.h @@ -1,6 +1,6 @@ #ifndef GUARD_SLOT_MACHINE_H #define GUARD_SLOT_MACHINE_H -void PlaySlotMachine(u8, void (callback)(void)); +void PlaySlotMachine(u8 machineId, MainCallback exitCallback); #endif // GUARD_SLOT_MACHINE_H diff --git a/include/sprite.h b/include/sprite.h index 138c2ea506..60f76b9d88 100644 --- a/include/sprite.h +++ b/include/sprite.h @@ -314,8 +314,6 @@ void FreeSpriteTilesByTag(u16 tag); void FreeSpriteTileRanges(void); u16 GetSpriteTileStartByTag(u16 tag); u16 GetSpriteTileTagByTileStart(u16 start); -void RequestSpriteSheetCopy(const struct SpriteSheet *sheet); -u16 LoadSpriteSheetDeferred(const struct SpriteSheet *sheet); void FreeAllSpritePalettes(void); u32 LoadSpritePalette(const struct SpritePalette *palette); void LoadSpritePalettes(const struct SpritePalette *palettes); @@ -324,7 +322,7 @@ u32 IndexOfSpritePaletteTag(u16 tag); u16 GetSpritePaletteTagByPaletteNum(u8 paletteNum); void FreeSpritePaletteByTag(u16 tag); void SetSubspriteTables(struct Sprite *sprite, const struct SubspriteTable *subspriteTables); -bool8 AddSpriteToOamBuffer(struct Sprite *object, u8 *oamIndex); +bool8 AddSpriteToOamBuffer(struct Sprite *sprite, u8 *oamIndex); bool8 AddSubspritesToOamBuffer(struct Sprite *sprite, struct OamData *destOam, u8 *oamIndex); void CopyToSprites(u8 *src); void CopyFromSprites(u8 *dest); diff --git a/include/text.h b/include/text.h index a148410c2f..040fe49f13 100644 --- a/include/text.h +++ b/include/text.h @@ -141,14 +141,14 @@ extern struct TextGlyph gCurGlyph; void DeactivateAllTextPrinters(void); u16 AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 *str, u8 x, u8 y, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16)); -bool32 AddTextPrinter(struct TextPrinterTemplate *template, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16)); +bool32 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16)); void RunTextPrinters(void); bool32 IsTextPrinterActive(u8 id); void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor); void SaveTextColors(u8 *fgColor, u8 *bgColor, u8 *shadowColor); void RestoreTextColors(u8 *fgColor, u8 *bgColor, u8 *shadowColor); void DecompressGlyphTile(const void *src_, void *dest_); -void CopyGlyphToWindow(struct TextPrinter *x); +void CopyGlyphToWindow(struct TextPrinter *textPrinter); void ClearTextSpan(struct TextPrinter *textPrinter, u32 width); void TextPrinterInitDownArrowCounters(struct TextPrinter *textPrinter); diff --git a/include/tilesets.h b/include/tilesets.h index b495b6c52c..976c8342e7 100644 --- a/include/tilesets.h +++ b/include/tilesets.h @@ -4,8 +4,8 @@ extern const u32 gTilesetTiles_General[]; extern const u16 gTilesetPalettes_General[][16]; -extern const struct Tileset * const gTilesetPointer_SecretBase; -extern const struct Tileset * const gTilesetPointer_SecretBaseRedCave; +extern const struct Tileset *const gTilesetPointer_SecretBase; +extern const struct Tileset *const gTilesetPointer_SecretBaseRedCave; extern const struct Tileset gTileset_Building; extern const struct Tileset gTileset_BrendansMaysHouse; diff --git a/include/time_events.h b/include/time_events.h index fd6d29f390..f40b9b45ef 100644 --- a/include/time_events.h +++ b/include/time_events.h @@ -1,8 +1,8 @@ #ifndef GUARD_TIME_EVENTS_H #define GUARD_TIME_EVENTS_H -void UpdateMirageRnd(u16); -u8 IsMirageIslandPresent(void); -void UpdateBirchState(u16); +void UpdateMirageRnd(u16 days); +bool8 IsMirageIslandPresent(void); +void UpdateBirchState(u16 days); #endif // GUARD_TIME_EVENTS_H diff --git a/include/trade.h b/include/trade.h index 6b621038fc..33191f0ac6 100644 --- a/include/trade.h +++ b/include/trade.h @@ -14,10 +14,10 @@ void CB2_StartCreateTradeMenu(void); void CB2_LinkTrade(void); int CanRegisterMonForTradingBoard(struct RfuGameCompatibilityData player, u16 species2, u16 species, bool8 isModernFatefulEncounter); int GetUnionRoomTradeMessageId(struct RfuGameCompatibilityData player, struct RfuGameCompatibilityData partner, u16 playerSpecies2, u16 partnerSpecies, u8 requestedType, u16 playerSpecies, bool8 isModernFatefulEncounter); -int CanSpinTradeMon(struct Pokemon *, u16); +int CanSpinTradeMon(struct Pokemon *mon, u16 monIdx); void InitTradeSequenceBgGpuRegs(void); void LinkTradeDrawWindow(void); void LoadTradeAnimGfx(void); -void DrawTextOnTradeWindow(u8, const u8 *, u8); +void DrawTextOnTradeWindow(u8 windowId, const u8 *str, u8 speed); #endif //GUARD_TRADE_H diff --git a/include/trainer_card.h b/include/trainer_card.h index 9e5e53df66..ecba9fd1f2 100644 --- a/include/trainer_card.h +++ b/include/trainer_card.h @@ -69,6 +69,6 @@ u8 GetTrainerCardStars(u8 cardId); void CopyTrainerCardData(struct TrainerCard *dst, struct TrainerCard *src, u8 gameVersion); void ShowPlayerTrainerCard(void (*callback)(void)); void ShowTrainerCardInLink(u8 cardId, void (*callback)(void)); -void TrainerCard_GenerateCardForLinkPlayer(struct TrainerCard *); +void TrainerCard_GenerateCardForLinkPlayer(struct TrainerCard *trainerCard); #endif // GUARD_TRAINER_CARD_H diff --git a/include/trainer_see.h b/include/trainer_see.h index 5518a91761..438bf43ce2 100644 --- a/include/trainer_see.h +++ b/include/trainer_see.h @@ -17,7 +17,7 @@ extern bool8 gTrainerApproachedPlayer; extern u8 gApproachingTrainerId; bool8 CheckForTrainersWantingBattle(void); -void SetBuriedTrainerMovement(struct ObjectEvent *var); +void SetBuriedTrainerMovement(struct ObjectEvent *objEvent); void DoTrainerApproach(void); void TryPrepareSecondApproachingTrainer(void); u8 FldEff_ExclamationMarkIcon(void); diff --git a/include/tv.h b/include/tv.h index 31c8fcc50f..a9a387e95b 100644 --- a/include/tv.h +++ b/include/tv.h @@ -5,8 +5,8 @@ extern u8 *const gTVStringVarPtrs[3]; void ClearTVShowData(void); void TryPutBreakingNewsOnAir(void); -void TryPutBattleSeminarOnAir(u16 foeSpecies, u16 species, u8 moveIdx, const u16 *movePtr, u16 betterMove); -void TryPutFrontierTVShowOnAir(u16 winStreak, u8 facility); +void TryPutBattleSeminarOnAir(u16 foeSpecies, u16 species, u8 moveIndex, const u16 *movePtr, u16 betterMove); +void TryPutFrontierTVShowOnAir(u16 winStreak, u8 facilityAndMode); void DoTVShow(void); void DoTVShowInSearchOfTrainers(void); void TryPutTreasureInvestigatorsOnAir(void); @@ -16,7 +16,7 @@ void IncrementDailyPlantedBerries(void); void IncrementDailyPickedBerries(void); void IncrementDailyBattlePoints(u16 delta); void HideBattleTowerReporter(void); -void ReceiveTvShowsData(void *src, u32 size, u8 masterIdx); +void ReceiveTvShowsData(void *src, u32 size, u8 playersLinkId); void TryPutSpotTheCutiesOnAir(struct Pokemon *pokemon, u8 ribbonMonDataIdx); u32 GetPlayerIDAsU32(void); bool8 IsPokeNewsActive(u8 newsKind); @@ -29,7 +29,7 @@ void TryPutFindThatGamerOnAir(u16 nCoinsPaidOut); void TryPutSecretBaseSecretsOnAir(void); void TryPutTodaysRivalTrainerOnAir(void); void TryPutTrendWatcherOnAir(const u16 *words); -void ReceivePokeNewsData(void *src, u32 size, u8 masterIdx); +void ReceivePokeNewsData(void *src, u32 size, u8 playersLinkId); void DeactivateAllNormalTVShows(void); void RecordFishingAttemptForTV(bool8 caughtFish); void IncrementDailySlotsUses(void); @@ -37,8 +37,8 @@ void IncrementDailyRouletteUses(void); void IncrementDailyWildBattles(void); void IncrementDailyBerryBlender(void); void SanitizeTVShowsForRuby(TVShow *shows); -void TryPutSafariFanClubOnAir(u8 nMonsCaught, u8 nPkblkUsed); -bool8 Put3CheersForPokeblocksOnTheAir(const u8 *partnersName, u8 flavor, u8 unused, u8 sheen, u8 language); +void TryPutSafariFanClubOnAir(u8 monsCaught, u8 pokeblocksUsed); +bool8 Put3CheersForPokeblocksOnTheAir(const u8 *partnersName, u8 flavor, u8 color, u8 sheen, u8 language); void SetPokemonAnglerSpecies(u16 species); void UpdateTVShowsPerDay(u16 days); void TryPutPokemonTodayOnAir(void); @@ -47,7 +47,7 @@ void PutBattleUpdateOnTheAir(u8 opponentLinkPlayerId, u16 move, u16 speciesPlaye void BravoTrainerPokemonProfile_BeforeInterview1(u16 move); void InterviewBefore(void); void InterviewAfter(void); -void UpdateTVScreensOnMap(int, int); +void UpdateTVScreensOnMap(int width, int height); void ConvertIntToDecimalString(u8 varIdx, int value); void TryPutSmartShopperOnAir(void); bool8 ShouldAirFrontierTVShow(void); diff --git a/include/util.h b/include/util.h index fcc4e37bb1..f5a7785f4b 100644 --- a/include/util.h +++ b/include/util.h @@ -5,9 +5,9 @@ extern const u8 gMiscBlank_Gfx[]; // unused in Emerald -u8 CreateInvisibleSpriteWithCallback(void (*)(struct Sprite *)); -void StoreWordInTwoHalfwords(u16 *, u32); -void LoadWordFromTwoHalfwords(u16 *, u32 *); +u8 CreateInvisibleSpriteWithCallback(void (*callback)(struct Sprite *)); +void StoreWordInTwoHalfwords(u16 *h, u32 w); +void LoadWordFromTwoHalfwords(u16 *h, u32 *w); int CountTrailingZeroBits(u32 value); u16 CalcCRC16(const u8 *data, s32 length); u16 CalcCRC16WithTable(const u8 *data, u32 length); diff --git a/include/wild_encounter.h b/include/wild_encounter.h index c7abb72aa1..92b074629e 100644 --- a/include/wild_encounter.h +++ b/include/wild_encounter.h @@ -34,7 +34,7 @@ extern u8 gChainFishingDexNavStreak; void DisableWildEncounters(bool8 disabled); u8 PickWildMonNature(void); -bool8 StandardWildEncounter(u16 currMetaTileBehavior, u16 previousMetaTileBehavior); +bool8 StandardWildEncounter(u16 curMetatileBehavior, u16 prevMetatileBehavior); bool8 SweetScentWildEncounter(void); bool8 DoesCurrentMapHaveFishingMons(void); void FishingWildEncounter(u8 rod); diff --git a/map_data_rules.mk b/map_data_rules.mk index 6712698272..f3e8d5dc89 100755 --- a/map_data_rules.mk +++ b/map_data_rules.mk @@ -11,6 +11,7 @@ INCLUDECONSTS_OUTDIR := include/constants AUTO_GEN_TARGETS += $(INCLUDECONSTS_OUTDIR)/map_groups.h AUTO_GEN_TARGETS += $(INCLUDECONSTS_OUTDIR)/layouts.h +AUTO_GEN_TARGETS += $(DATA_SRC_SUBDIR)/map_group_count.h MAP_DIRS := $(dir $(wildcard $(MAPS_DIR)/*/map.json)) MAP_CONNECTIONS := $(patsubst $(MAPS_DIR)/%/,$(MAPS_DIR)/%/connections.inc,$(MAP_DIRS)) diff --git a/src/agb_flash_1m.c b/src/agb_flash_1m.c index 037f7a964d..49696a7bbf 100644 --- a/src/agb_flash_1m.c +++ b/src/agb_flash_1m.c @@ -3,7 +3,7 @@ USED static const char AgbLibFlashVersion[] = "FLASH1M_V103"; -static const struct FlashSetupInfo * const sSetupInfos[] = +static const struct FlashSetupInfo *const sSetupInfos[] = { &MX29L010, &LE26FV10N1TS, @@ -14,7 +14,7 @@ u16 IdentifyFlash(void) { u16 result; u16 flashId; - const struct FlashSetupInfo * const *setupInfo; + const struct FlashSetupInfo *const *setupInfo; REG_WAITCNT = (REG_WAITCNT & ~WAITCNT_SRAM_MASK) | WAITCNT_SRAM_8; diff --git a/src/apprentice.c b/src/apprentice.c index 7dcca7b28b..4b0403b281 100644 --- a/src/apprentice.c +++ b/src/apprentice.c @@ -70,8 +70,8 @@ struct ApprenticeQuestionData { u16 speciesId; u16 altSpeciesId; - u16 moveId1; - u16 moveId2; + u16 move1; + u16 move2; }; // IWRAM common @@ -81,7 +81,7 @@ COMMON_DATA void (*gApprenticeFunc)(void) = NULL; // This file's functions. static u16 GetRandomAlternateMove(u8 monId); -static bool8 TrySetMove(u8 monId, u16 moveId); +static bool8 TrySetMove(u8 monId, u16 move); static void CreateChooseAnswerTask(bool8 noBButton, u8 itemsCount, u8 windowId); static u8 CreateAndShowWindow(u8 left, u8 top, u8 width, u8 height); static void RemoveAndHideWindow(u8 windowId); @@ -316,7 +316,7 @@ static u16 GetRandomAlternateMove(u8 monId) u16 species; const struct LevelUpMove *learnset; bool32 needTMs = FALSE; - u16 moveId = MOVE_NONE; + u16 move = MOVE_NONE; bool32 shouldUseMove; u8 level; @@ -358,7 +358,7 @@ static u16 GetRandomAlternateMove(u8 monId) } while (!shouldUseMove); - moveId = ItemIdToBattleMoveId(ITEM_TM01 + id); + move = ItemIdToBattleMoveId(ITEM_TM01 + id); shouldUseMove = TRUE; if (numLearnsetMoves <= MAX_MON_MOVES) @@ -369,7 +369,7 @@ static u16 GetRandomAlternateMove(u8 monId) for (; j < numLearnsetMoves; j++) { // Keep looking for TMs until one not in the level up learnset is found - if ((learnset[j].move) == moveId) + if ((learnset[j].move) == move) { shouldUseMove = FALSE; break; @@ -393,13 +393,13 @@ static u16 GetRandomAlternateMove(u8 monId) { // Get a random move excluding the 4 it would know at max level u8 learnsetId = Random() % (numLearnsetMoves - MAX_MON_MOVES); - moveId = learnset[learnsetId].move; + move = learnset[learnsetId].move; shouldUseMove = TRUE; for (j = numLearnsetMoves - MAX_MON_MOVES; j < numLearnsetMoves; j++) { // Keep looking for moves until one not in the last 4 is found - if ((learnset[j].move) == moveId) + if ((learnset[j].move) == move) { shouldUseMove = FALSE; break; @@ -409,29 +409,29 @@ static u16 GetRandomAlternateMove(u8 monId) } } - if (TrySetMove(monId, moveId)) + if (TrySetMove(monId, move)) { - if (IsValidApprenticeMove(moveId)) + if (IsValidApprenticeMove(move)) break; i++; } } gApprenticePartyMovesData->moveCounter++; - return moveId; + return move; } -static bool8 TrySetMove(u8 monId, u16 moveId) +static bool8 TrySetMove(u8 monId, u16 move) { u8 i; for (i = 0; i < NUM_WHICH_MOVE_QUESTIONS; i++) { - if (gApprenticePartyMovesData->moves[monId][i] == moveId) + if (gApprenticePartyMovesData->moves[monId][i] == move) return FALSE; } - gApprenticePartyMovesData->moves[monId][gApprenticePartyMovesData->moveCounter] = moveId; + gApprenticePartyMovesData->moves[monId][gApprenticePartyMovesData->moveCounter] = move; return TRUE; } @@ -584,8 +584,8 @@ static void CreateApprenticeMenu(u8 menu) case APPRENTICE_ASK_MOVES: left = 17; top = 8; - strings[0] = GetMoveName(gApprenticeQuestionData->moveId1); - strings[1] = GetMoveName(gApprenticeQuestionData->moveId2); + strings[0] = GetMoveName(gApprenticeQuestionData->move1); + strings[1] = GetMoveName(gApprenticeQuestionData->move2); break; case APPRENTICE_ASK_GIVE: left = 18; @@ -985,8 +985,8 @@ static void InitQuestionData(void) count = PLAYER_APPRENTICE.questions[CURRENT_QUESTION_NUM].monId; APPRENTICE_SPECIES_ID_NO_COND(id1, count); gApprenticeQuestionData->speciesId = gApprentices[PLAYER_APPRENTICE.id].species[id1]; - gApprenticeQuestionData->moveId1 = GetDefaultMove(count, id1, PLAYER_APPRENTICE.questions[CURRENT_QUESTION_NUM].moveSlot); - gApprenticeQuestionData->moveId2 = PLAYER_APPRENTICE.questions[CURRENT_QUESTION_NUM].data; + gApprenticeQuestionData->move1 = GetDefaultMove(count, id1, PLAYER_APPRENTICE.questions[CURRENT_QUESTION_NUM].moveSlot); + gApprenticeQuestionData->move2 = PLAYER_APPRENTICE.questions[CURRENT_QUESTION_NUM].data; } } else if (gSpecialVar_0x8005 == APPRENTICE_QUESTION_WHAT_ITEM) @@ -1041,13 +1041,13 @@ static void ApprenticeBufferString(void) StringCopy(stringDst, GetSpeciesName(gApprenticeQuestionData->speciesId)); break; case APPRENTICE_BUFF_MOVE1: - StringCopy(stringDst, GetMoveName(gApprenticeQuestionData->moveId1)); + StringCopy(stringDst, GetMoveName(gApprenticeQuestionData->move1)); break; case APPRENTICE_BUFF_MOVE2: - StringCopy(stringDst, GetMoveName(gApprenticeQuestionData->moveId2)); + StringCopy(stringDst, GetMoveName(gApprenticeQuestionData->move2)); break; case APPRENTICE_BUFF_ITEM: - StringCopy(stringDst, ItemId_GetName(PLAYER_APPRENTICE.questions[CURRENT_QUESTION_NUM].data)); + StringCopy(stringDst, GetItemName(PLAYER_APPRENTICE.questions[CURRENT_QUESTION_NUM].data)); break; case APPRENTICE_BUFF_NAME: TVShowConvertInternationalString(text, GetApprenticeNameInLanguage(PLAYER_APPRENTICE.id, GAME_LANGUAGE), GAME_LANGUAGE); diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index b823e6e23e..87bd6f0540 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -310,8 +310,8 @@ void Ai_InitPartyStruct(void) bool32 isOmniscient = (AI_THINKING_STRUCT->aiFlags[B_POSITION_OPPONENT_LEFT] & AI_FLAG_OMNISCIENT) || (AI_THINKING_STRUCT->aiFlags[B_POSITION_OPPONENT_RIGHT] & AI_FLAG_OMNISCIENT); struct Pokemon *mon; - AI_PARTY->count[B_SIDE_PLAYER] = gPlayerPartyCount; - AI_PARTY->count[B_SIDE_OPPONENT] = gEnemyPartyCount; + AI_PARTY->count[B_SIDE_PLAYER] = CalculatePlayerPartyCount(); + AI_PARTY->count[B_SIDE_OPPONENT] = CalculateEnemyPartyCount(); // Save first 2 or 4(in doubles) mons CopyBattlerDataToAIParty(B_POSITION_PLAYER_LEFT, B_SIDE_PLAYER); @@ -336,7 +336,7 @@ void Ai_InitPartyStruct(void) u32 j; mon = &gPlayerParty[i]; AI_PARTY->mons[B_SIDE_PLAYER][i].item = GetMonData(mon, MON_DATA_HELD_ITEM); - AI_PARTY->mons[B_SIDE_PLAYER][i].heldEffect = ItemId_GetHoldEffect(AI_PARTY->mons[B_SIDE_PLAYER][i].item); + AI_PARTY->mons[B_SIDE_PLAYER][i].heldEffect = GetItemHoldEffect(AI_PARTY->mons[B_SIDE_PLAYER][i].item); AI_PARTY->mons[B_SIDE_PLAYER][i].ability = GetMonAbility(mon); for (j = 0; j < MAX_MON_MOVES; j++) AI_PARTY->mons[B_SIDE_PLAYER][i].moves[j] = GetMonData(mon, MON_DATA_MOVE1 + j); @@ -1138,7 +1138,7 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score) ADJUST_SCORE(-10); break; case EFFECT_STUFF_CHEEKS: - if (ItemId_GetPocket(gBattleMons[battlerAtk].item) != POCKET_BERRIES) + if (GetItemPocket(gBattleMons[battlerAtk].item) != POCKET_BERRIES) return 0; // cannot even select //fallthrough case EFFECT_DEFENSE_UP: @@ -4191,7 +4191,7 @@ static u32 AI_CalcMoveEffectScore(u32 battlerAtk, u32 battlerDef, u32 move) if (aiData->abilities[battlerAtk] == ABILITY_RIPEN) { u32 item = GetUsedHeldItem(battlerAtk); - u32 toHeal = (ItemId_GetHoldEffectParam(item) == 10) ? 10 : gBattleMons[battlerAtk].maxHP / ItemId_GetHoldEffectParam(item); + u32 toHeal = (GetItemHoldEffectParam(item) == 10) ? 10 : gBattleMons[battlerAtk].maxHP / GetItemHoldEffectParam(item); if (IsStatBoostingBerry(item) && aiData->hpPercents[battlerAtk] > 60) ADJUST_SCORE(WEAK_EFFECT); @@ -4723,13 +4723,13 @@ static u32 AI_CalcMoveEffectScore(u32 battlerAtk, u32 battlerDef, u32 move) case MOVE_EFFECT_BUG_BITE: // And pluck if (gBattleMons[battlerDef].status2 & STATUS2_SUBSTITUTE || aiData->abilities[battlerDef] == ABILITY_STICKY_HOLD) break; - else if (ItemId_GetPocket(aiData->items[battlerDef]) == POCKET_BERRIES) + else if (GetItemPocket(aiData->items[battlerDef]) == POCKET_BERRIES) ADJUST_SCORE(DECENT_EFFECT); break; case MOVE_EFFECT_INCINERATE: if (gBattleMons[battlerDef].status2 & STATUS2_SUBSTITUTE || aiData->abilities[battlerDef] == ABILITY_STICKY_HOLD) break; - else if (ItemId_GetPocket(aiData->items[battlerDef]) == POCKET_BERRIES || aiData->holdEffects[battlerDef] == HOLD_EFFECT_GEMS) + else if (GetItemPocket(aiData->items[battlerDef]) == POCKET_BERRIES || aiData->holdEffects[battlerDef] == HOLD_EFFECT_GEMS) ADJUST_SCORE(DECENT_EFFECT); break; case MOVE_EFFECT_SMACK_DOWN: @@ -5407,19 +5407,19 @@ static s32 AI_PowerfulStatus(u32 battlerAtk, u32 battlerDef, u32 move, s32 score ADJUST_SCORE(POWERFUL_STATUS_MOVE); break; case EFFECT_SUNNY_DAY: - if (!(AI_GetWeather() & (B_WEATHER_SUN | B_WEATHER_PRIMAL_ANY))) + if (IsWeatherActive(B_WEATHER_SUN | B_WEATHER_PRIMAL_ANY) == WEATHER_INACTIVE) ADJUST_SCORE(POWERFUL_STATUS_MOVE); break; case EFFECT_RAIN_DANCE: - if (!(AI_GetWeather() & (B_WEATHER_RAIN | B_WEATHER_PRIMAL_ANY))) + if (IsWeatherActive(B_WEATHER_RAIN | B_WEATHER_PRIMAL_ANY) == WEATHER_INACTIVE) ADJUST_SCORE(POWERFUL_STATUS_MOVE); break; case EFFECT_HAIL: - if (!(AI_GetWeather() & (B_WEATHER_HAIL | B_WEATHER_PRIMAL_ANY))) + if (IsWeatherActive(B_WEATHER_HAIL | B_WEATHER_PRIMAL_ANY) == WEATHER_INACTIVE) ADJUST_SCORE(POWERFUL_STATUS_MOVE); break; case EFFECT_SNOWSCAPE: - if (!(AI_GetWeather() & (B_WEATHER_SNOW | B_WEATHER_PRIMAL_ANY))) + if (IsWeatherActive(B_WEATHER_SNOW | B_WEATHER_PRIMAL_ANY) == WEATHER_INACTIVE) ADJUST_SCORE(POWERFUL_STATUS_MOVE); } diff --git a/src/battle_ai_script_commands.c b/src/battle_ai_script_commands.c new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index 73a9b4505c..06ce16cb74 100644 --- a/src/battle_ai_switch_items.c +++ b/src/battle_ai_switch_items.c @@ -1244,7 +1244,7 @@ void AI_TrySwitchOrUseItem(u32 battler) } } - BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_USE_MOVE, BATTLE_OPPOSITE(battler) << 8); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, B_ACTION_USE_MOVE, BATTLE_OPPOSITE(battler) << 8); } // If there are two(or more) mons to choose from, always choose one that has baton pass @@ -1396,7 +1396,7 @@ bool32 IsMonGrounded(u16 heldItemEffect, u32 ability, u8 type1, u8 type2) static u32 GetSwitchinHazardsDamage(u32 battler, struct BattlePokemon *battleMon) { u8 defType1 = battleMon->types[0], defType2 = battleMon->types[1], tSpikesLayers; - u16 heldItemEffect = ItemId_GetHoldEffect(battleMon->item); + u16 heldItemEffect = GetItemHoldEffect(battleMon->item); u32 maxHP = battleMon->maxHP, ability = battleMon->ability, status = battleMon->status1; u32 spikesDamage = 0, tSpikesDamage = 0, hazardDamage = 0; u32 hazardFlags = gSideStatuses[GetBattlerSide(battler)] & (SIDE_STATUS_SPIKES | SIDE_STATUS_STEALTH_ROCK | SIDE_STATUS_STICKY_WEB | SIDE_STATUS_TOXIC_SPIKES | SIDE_STATUS_SAFEGUARD); @@ -1454,7 +1454,7 @@ static u32 GetSwitchinHazardsDamage(u32 battler, struct BattlePokemon *battleMon static s32 GetSwitchinWeatherImpact(void) { s32 weatherImpact = 0, maxHP = AI_DATA->switchinCandidate.battleMon.maxHP, ability = AI_DATA->switchinCandidate.battleMon.ability; - u32 holdEffect = ItemId_GetHoldEffect(AI_DATA->switchinCandidate.battleMon.item); + u32 holdEffect = GetItemHoldEffect(AI_DATA->switchinCandidate.battleMon.item); if (HasWeatherEffect()) { @@ -1518,7 +1518,7 @@ static s32 GetSwitchinWeatherImpact(void) static u32 GetSwitchinRecurringHealing(void) { u32 recurringHealing = 0, maxHP = AI_DATA->switchinCandidate.battleMon.maxHP, ability = AI_DATA->switchinCandidate.battleMon.ability; - u32 holdEffect = ItemId_GetHoldEffect(AI_DATA->switchinCandidate.battleMon.item); + u32 holdEffect = GetItemHoldEffect(AI_DATA->switchinCandidate.battleMon.item); // Items if (ability != ABILITY_KLUTZ) @@ -1552,7 +1552,7 @@ static u32 GetSwitchinRecurringHealing(void) static u32 GetSwitchinRecurringDamage(void) { u32 passiveDamage = 0, maxHP = AI_DATA->switchinCandidate.battleMon.maxHP, ability = AI_DATA->switchinCandidate.battleMon.ability; - u32 holdEffect = ItemId_GetHoldEffect(AI_DATA->switchinCandidate.battleMon.item); + u32 holdEffect = GetItemHoldEffect(AI_DATA->switchinCandidate.battleMon.item); // Items if (ability != ABILITY_MAGIC_GUARD && ability != ABILITY_KLUTZ) @@ -1584,7 +1584,7 @@ static u32 GetSwitchinStatusDamage(u32 battler) { u8 defType1 = AI_DATA->switchinCandidate.battleMon.types[0], defType2 = AI_DATA->switchinCandidate.battleMon.types[1]; u8 tSpikesLayers = gSideTimers[GetBattlerSide(battler)].toxicSpikesAmount; - u16 heldItemEffect = ItemId_GetHoldEffect(AI_DATA->switchinCandidate.battleMon.item); + u16 heldItemEffect = GetItemHoldEffect(AI_DATA->switchinCandidate.battleMon.item); u32 status = AI_DATA->switchinCandidate.battleMon.status1, ability = AI_DATA->switchinCandidate.battleMon.ability, maxHP = AI_DATA->switchinCandidate.battleMon.maxHP; u32 statusDamage = 0; @@ -1662,8 +1662,8 @@ static u32 GetSwitchinHitsToKO(s32 damageTaken, u32 battler) u32 recurringHealing = GetSwitchinRecurringHealing(); u32 statusDamage = GetSwitchinStatusDamage(battler); u32 hitsToKO = 0, singleUseItemHeal = 0; - u16 maxHP = AI_DATA->switchinCandidate.battleMon.maxHP, item = AI_DATA->switchinCandidate.battleMon.item, heldItemEffect = ItemId_GetHoldEffect(item); - u8 weatherDuration = gWishFutureKnock.weatherDuration, holdEffectParam = ItemId_GetHoldEffectParam(item); + u16 maxHP = AI_DATA->switchinCandidate.battleMon.maxHP, item = AI_DATA->switchinCandidate.battleMon.item, heldItemEffect = GetItemHoldEffect(item); + u8 weatherDuration = gWishFutureKnock.weatherDuration, holdEffectParam = GetItemHoldEffectParam(item); u32 opposingBattler = GetOppositeBattler(battler); u32 opposingAbility = gBattleMons[opposingBattler].ability, ability = AI_DATA->switchinCandidate.battleMon.ability; bool32 usedSingleUseHealingItem = FALSE, opponentCanBreakMold = IsMoldBreakerTypeAbility(opposingBattler, opposingAbility); @@ -2248,11 +2248,11 @@ static bool32 ShouldUseItem(u32 battler) item = gBattleResources->battleHistory->trainerItems[i]; if (item == ITEM_NONE) continue; - itemEffects = ItemId_GetEffect(item); + itemEffects = GetItemEffect(item); if (itemEffects == NULL) continue; - switch (ItemId_GetBattleUsage(item)) + switch (GetItemBattleUsage(item)) { case EFFECT_ITEM_HEAL_AND_CURE_STATUS: shouldUse = AI_ShouldHeal(battler, 0); @@ -2311,7 +2311,7 @@ static bool32 ShouldUseItem(u32 battler) // Set selected party ID to current battler if none chosen. if (gBattleStruct->itemPartyIndex[battler] == PARTY_SIZE) gBattleStruct->itemPartyIndex[battler] = gBattlerPartyIndexes[battler]; - BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_USE_ITEM, 0); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, B_ACTION_USE_ITEM, 0); gBattleStruct->chosenItem[battler] = item; gBattleResources->battleHistory->trainerItems[i] = 0; return shouldUse; diff --git a/src/battle_ai_util.c b/src/battle_ai_util.c index 6478950a85..13e438a5d4 100644 --- a/src/battle_ai_util.c +++ b/src/battle_ai_util.c @@ -128,19 +128,20 @@ void RecordLastUsedMoveBy(u32 battlerId, u32 move) BATTLE_HISTORY->moveHistory[battlerId][*index] = move; } -void RecordKnownMove(u32 battlerId, u32 move) +void RecordKnownMove(u32 battler, u32 move) { - s32 i; - for (i = 0; i < MAX_MON_MOVES; i++) + s32 moveIndex; + + for (moveIndex = 0; moveIndex < MAX_MON_MOVES; moveIndex++) { - if (BATTLE_HISTORY->usedMoves[battlerId][i] == move) + if (gBattleMons[battler].moves[moveIndex] == move) break; - if (BATTLE_HISTORY->usedMoves[battlerId][i] == MOVE_NONE) - { - BATTLE_HISTORY->usedMoves[battlerId][i] = move; - AI_PARTY->mons[GetBattlerSide(battlerId)][gBattlerPartyIndexes[battlerId]].moves[i] = move; - break; - } + } + + if (moveIndex < MAX_MON_MOVES && BATTLE_HISTORY->usedMoves[battler][moveIndex] == MOVE_NONE) + { + BATTLE_HISTORY->usedMoves[battler][moveIndex] = move; + AI_PARTY->mons[GetBattlerSide(battler)][gBattlerPartyIndexes[battler]].moves[moveIndex] = move; } } @@ -420,19 +421,50 @@ static inline s32 DmgRoll(s32 dmg) return dmg; } -bool32 IsDamageMoveUnusable(u32 battlerAtk, u32 battlerDef, u32 move, u32 moveType) +bool32 IsDamageMoveUnusable(u32 battlerAtk, u32 battlerDef, u32 move, u32 moveType, uq4_12_t effectiveness, u32 weather) { + u32 battlerDefAbility; + u32 partnerDefAbility; struct AiLogicData *aiData = AI_DATA; + if (effectiveness == UQ_4_12(0.0)) + return TRUE; if (gBattleStruct->battlerState[battlerDef].commandingDondozo) return TRUE; - if (CanAbilityBlockMove(battlerAtk, battlerDef, move, aiData->abilities[battlerDef], ABILITY_CHECK_TRIGGER)) + // aiData->abilities does not check for Mold Breaker since it happens during combat so it needs to be done manually + if (IsMoldBreakerTypeAbility(battlerAtk, aiData->abilities[battlerAtk]) || MoveIgnoresTargetAbility(move)) + { + battlerDefAbility = ABILITY_NONE; + partnerDefAbility = ABILITY_NONE; + } + else + { + battlerDefAbility = aiData->abilities[battlerDef]; + partnerDefAbility = aiData->abilities[BATTLE_PARTNER(battlerDef)]; + } + + if (CanAbilityBlockMove(battlerAtk, battlerDef, move, battlerDefAbility, ABILITY_CHECK_TRIGGER)) return TRUE; - if (CanAbilityAbsorbMove(battlerAtk, battlerDef, aiData->abilities[battlerDef], move, moveType, ABILITY_CHECK_TRIGGER)) + if (CanAbilityAbsorbMove(battlerAtk, battlerDef, battlerDefAbility, move, moveType, ABILITY_CHECK_TRIGGER)) return TRUE; + // Limited to Lighning Rod and Storm Drain because otherwise the AI would consider Water Absorb, etc... + if (partnerDefAbility == ABILITY_LIGHTNING_ROD || partnerDefAbility == ABILITY_STORM_DRAIN) + { + if (CanAbilityAbsorbMove(battlerAtk, BATTLE_PARTNER(battlerDef), partnerDefAbility, move, moveType, ABILITY_CHECK_TRIGGER)) + return TRUE; + } + + if (HasWeatherEffect()) + { + if (weather & B_WEATHER_SUN_PRIMAL && moveType == TYPE_WATER) + return TRUE; + if (weather & B_WEATHER_RAIN_PRIMAL && moveType == TYPE_FIRE) + return TRUE; + } + switch (GetMoveEffect(move)) { case EFFECT_DREAM_EATER: @@ -468,6 +500,11 @@ bool32 IsDamageMoveUnusable(u32 battlerAtk, u32 battlerDef, u32 move, u32 moveTy if (!gDisableStructs[battlerAtk].isFirstTurn) return TRUE; break; + case EFFECT_EXPLOSION: + case EFFECT_MIND_BLOWN: + if (battlerDefAbility == ABILITY_DAMP || partnerDefAbility == ABILITY_DAMP) + return TRUE; + break; } return FALSE; @@ -657,7 +694,7 @@ struct SimulatedDamage AI_CalcDamage(u32 move, u32 battlerAtk, u32 battlerDef, u u32 movePower = GetMovePower(move); if (movePower) - isDamageMoveUnusable = IsDamageMoveUnusable(battlerAtk, battlerDef, move, moveType); + isDamageMoveUnusable = IsDamageMoveUnusable(battlerAtk, battlerDef, move, moveType, effectivenessMultiplier, weather); if (movePower && !isDamageMoveUnusable) { @@ -1417,6 +1454,26 @@ u32 AI_GetWeather(void) return gBattleWeather; } +enum WeatherState IsWeatherActive(u32 flags) +{ + enum WeatherState state = WEATHER_INACTIVE; + + if (gBattleWeather & flags) + state = WEATHER_ACTIVE; + else + state = WEATHER_INACTIVE; + + if (!AI_WeatherHasEffect()) + { + if (state == WEATHER_ACTIVE) + state = WEATHER_ACTIVE_BUT_BLOCKED; + else + state = WEATHER_INACTIVE_AND_BLOCKED; + } + + return state; +} + bool32 IsAromaVeilProtectedEffect(u32 moveEffect) { switch (moveEffect) @@ -1618,19 +1675,18 @@ bool32 ShouldTryOHKO(u32 battlerAtk, u32 battlerDef, u32 atkAbility, u32 defAbil bool32 ShouldSetSandstorm(u32 battler, u32 ability, u32 holdEffect) { - u32 weather = AI_GetWeather(); - if (weather & B_WEATHER_SANDSTORM) + if (IsWeatherActive(B_WEATHER_SANDSTORM | B_WEATHER_PRIMAL_ANY) != WEATHER_INACTIVE) return FALSE; if (ability == ABILITY_SAND_VEIL - || ability == ABILITY_SAND_RUSH - || ability == ABILITY_SAND_FORCE - || ability == ABILITY_OVERCOAT - || ability == ABILITY_MAGIC_GUARD - || holdEffect == HOLD_EFFECT_SAFETY_GOGGLES - || IS_BATTLER_ANY_TYPE(battler, TYPE_ROCK, TYPE_GROUND, TYPE_STEEL) - || HasMoveEffect(battler, EFFECT_SHORE_UP) - || HasMoveEffect(battler, EFFECT_WEATHER_BALL)) + || ability == ABILITY_SAND_RUSH + || ability == ABILITY_SAND_FORCE + || ability == ABILITY_OVERCOAT + || ability == ABILITY_MAGIC_GUARD + || holdEffect == HOLD_EFFECT_SAFETY_GOGGLES + || IS_BATTLER_ANY_TYPE(battler, TYPE_ROCK, TYPE_GROUND, TYPE_STEEL) + || HasMoveEffect(battler, EFFECT_SHORE_UP) + || HasMoveEffect(battler, EFFECT_WEATHER_BALL)) { return TRUE; } @@ -1639,21 +1695,20 @@ bool32 ShouldSetSandstorm(u32 battler, u32 ability, u32 holdEffect) bool32 ShouldSetHail(u32 battler, u32 ability, u32 holdEffect) { - u32 weather = AI_GetWeather(); - if (weather & (B_WEATHER_HAIL | B_WEATHER_SNOW)) + if (IsWeatherActive(B_WEATHER_HAIL | B_WEATHER_SNOW | B_WEATHER_PRIMAL_ANY) != WEATHER_INACTIVE) return FALSE; if (ability == ABILITY_SNOW_CLOAK - || ability == ABILITY_ICE_BODY - || ability == ABILITY_FORECAST - || ability == ABILITY_SLUSH_RUSH - || ability == ABILITY_MAGIC_GUARD - || ability == ABILITY_OVERCOAT - || holdEffect == HOLD_EFFECT_SAFETY_GOGGLES - || IS_BATTLER_OF_TYPE(battler, TYPE_ICE) - || HasMoveEffect(battler, EFFECT_BLIZZARD) - || HasMoveEffect(battler, EFFECT_AURORA_VEIL) - || HasMoveEffect(battler, EFFECT_WEATHER_BALL)) + || ability == ABILITY_ICE_BODY + || ability == ABILITY_FORECAST + || ability == ABILITY_SLUSH_RUSH + || ability == ABILITY_MAGIC_GUARD + || ability == ABILITY_OVERCOAT + || holdEffect == HOLD_EFFECT_SAFETY_GOGGLES + || IS_BATTLER_OF_TYPE(battler, TYPE_ICE) + || HasMoveEffect(battler, EFFECT_BLIZZARD) + || HasMoveEffect(battler, EFFECT_AURORA_VEIL) + || HasMoveEffect(battler, EFFECT_WEATHER_BALL)) { return TRUE; } @@ -1662,8 +1717,7 @@ bool32 ShouldSetHail(u32 battler, u32 ability, u32 holdEffect) bool32 ShouldSetRain(u32 battlerAtk, u32 atkAbility, u32 holdEffect) { - u32 weather = AI_GetWeather(); - if (weather & B_WEATHER_RAIN) + if (IsWeatherActive(B_WEATHER_RAIN | B_WEATHER_PRIMAL_ANY) != WEATHER_INACTIVE) return FALSE; if (holdEffect != HOLD_EFFECT_UTILITY_UMBRELLA @@ -1683,8 +1737,7 @@ bool32 ShouldSetRain(u32 battlerAtk, u32 atkAbility, u32 holdEffect) bool32 ShouldSetSun(u32 battlerAtk, u32 atkAbility, u32 holdEffect) { - u32 weather = AI_GetWeather(); - if (weather & B_WEATHER_SUN) + if (IsWeatherActive(B_WEATHER_SUN | B_WEATHER_PRIMAL_ANY) != WEATHER_INACTIVE) return FALSE; if (holdEffect != HOLD_EFFECT_UTILITY_UMBRELLA @@ -1709,18 +1762,17 @@ bool32 ShouldSetSun(u32 battlerAtk, u32 atkAbility, u32 holdEffect) bool32 ShouldSetSnow(u32 battler, u32 ability, u32 holdEffect) { - u32 weather = AI_GetWeather(); - if (weather & (B_WEATHER_SNOW | B_WEATHER_HAIL)) + if (IsWeatherActive(B_WEATHER_SNOW | B_WEATHER_HAIL | B_WEATHER_PRIMAL_ANY) != WEATHER_INACTIVE) return FALSE; if (ability == ABILITY_SNOW_CLOAK - || ability == ABILITY_ICE_BODY - || ability == ABILITY_FORECAST - || ability == ABILITY_SLUSH_RUSH - || IS_BATTLER_OF_TYPE(battler, TYPE_ICE) - || HasMoveEffect(battler, EFFECT_BLIZZARD) - || HasMoveEffect(battler, EFFECT_AURORA_VEIL) - || HasMoveEffect(battler, EFFECT_WEATHER_BALL)) + || ability == ABILITY_ICE_BODY + || ability == ABILITY_FORECAST + || ability == ABILITY_SLUSH_RUSH + || IS_BATTLER_OF_TYPE(battler, TYPE_ICE) + || HasMoveEffect(battler, EFFECT_BLIZZARD) + || HasMoveEffect(battler, EFFECT_AURORA_VEIL) + || HasMoveEffect(battler, EFFECT_WEATHER_BALL)) { return TRUE; } diff --git a/src/battle_anim.c b/src/battle_anim.c index eb0e2af560..258144bb19 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -122,7 +122,7 @@ EWRAM_DATA static bool8 sAnimHideHpBoxes = FALSE; #include "data/battle_anim.h" -static void (* const sScriptCmdTable[])(void) = +static void (*const sScriptCmdTable[])(void) = { Cmd_loadspritegfx, // 0x00 Cmd_unloadspritegfx, // 0x01 @@ -954,30 +954,30 @@ static void Cmd_monbg(void) { bool8 toBG_2; u8 taskId; - u8 battlerId; + u8 battler; u8 animBattler; sBattleAnimScriptPtr++; animBattler = sBattleAnimScriptPtr[0]; if (animBattler & ANIM_TARGET) - battlerId = gBattleAnimTarget; + battler = gBattleAnimTarget; else - battlerId = gBattleAnimAttacker; + battler = gBattleAnimAttacker; // Move designated battler to background - if (IsBattlerSpriteVisible(battlerId)) + if (IsBattlerSpriteVisible(battler)) { - u8 position = GetBattlerPosition(battlerId); + u8 position = GetBattlerPosition(battler); if (position == B_POSITION_OPPONENT_LEFT || position == B_POSITION_PLAYER_RIGHT || IsContest()) toBG_2 = FALSE; else toBG_2 = TRUE; - MoveBattlerSpriteToBG(battlerId, toBG_2, FALSE); + MoveBattlerSpriteToBG(battler, toBG_2, FALSE); taskId = CreateTask(Task_InitUpdateMonBg, 10); gAnimVisualTaskCount++; - gTasks[taskId].tBattlerId = battlerId; + gTasks[taskId].tBattlerId = battler; gTasks[taskId].tInBg2 = toBG_2; gTasks[taskId].tActive = TRUE; gTasks[taskId].tIsPartner = FALSE; @@ -985,19 +985,19 @@ static void Cmd_monbg(void) } // Move battler's partner to background - battlerId ^= BIT_FLANK; - if (IsBattlerSpriteVisible(battlerId)) + battler ^= BIT_FLANK; + if (IsBattlerSpriteVisible(battler)) { - u8 position = GetBattlerPosition(battlerId); + u8 position = GetBattlerPosition(battler); if (position == B_POSITION_OPPONENT_LEFT || position == B_POSITION_PLAYER_RIGHT || IsContest()) toBG_2 = FALSE; else toBG_2 = TRUE; - MoveBattlerSpriteToBG(battlerId, toBG_2, FALSE); + MoveBattlerSpriteToBG(battler, toBG_2, FALSE); taskId = CreateTask(Task_InitUpdateMonBg, 10); gAnimVisualTaskCount++; - gTasks[taskId].tBattlerId = battlerId; + gTasks[taskId].tBattlerId = battler; gTasks[taskId].tInBg2 = toBG_2; gTasks[taskId].tActive = TRUE; gTasks[taskId].tIsPartner = TRUE; @@ -1026,26 +1026,26 @@ u8 GetAnimBattlerId(u8 wantedBattler) } } -bool8 IsBattlerSpriteVisible(u8 battlerId) +bool8 IsBattlerSpriteVisible(u8 battler) { if (IsContest()) { - if (battlerId == gBattleAnimAttacker) + if (battler == gBattleAnimAttacker) return TRUE; else return FALSE; } - if (!IsBattlerSpritePresent(battlerId)) + if (!IsBattlerSpritePresent(battler)) return FALSE; if (IsContest()) return TRUE; // This line won't ever be reached. - if (!gBattleSpritesDataPtr->battlerData[battlerId].invisible || !gSprites[gBattlerSpriteIds[battlerId]].invisible) + if (!gBattleSpritesDataPtr->battlerData[battler].invisible || !gSprites[gBattlerSpriteIds[battler]].invisible) return TRUE; return FALSE; } -void MoveBattlerSpriteToBG(u8 battlerId, bool8 toBG_2, bool8 setSpriteInvisible) +void MoveBattlerSpriteToBG(u8 battler, bool8 toBG_2, bool8 setSpriteInvisible) { struct BattleAnimBgData animBg; u8 battlerSpriteId; @@ -1073,7 +1073,7 @@ void MoveBattlerSpriteToBG(u8 battlerId, bool8 toBG_2, bool8 setSpriteInvisible) SetAnimBgAttribute(1, BG_ANIM_SCREEN_SIZE, 1); SetAnimBgAttribute(1, BG_ANIM_AREA_OVERFLOW_MODE, 0); - battlerSpriteId = gBattlerSpriteIds[battlerId]; + battlerSpriteId = gBattlerSpriteIds[battler]; gBattle_BG1_X = -(gSprites[battlerSpriteId].x + gSprites[battlerSpriteId].x2) + 0x20; if (IsContest() && IsSpeciesNotUnown(gContestResources->moveAnim->species)) @@ -1081,18 +1081,18 @@ void MoveBattlerSpriteToBG(u8 battlerId, bool8 toBG_2, bool8 setSpriteInvisible) gBattle_BG1_Y = -(gSprites[battlerSpriteId].y + gSprites[battlerSpriteId].y2) + 0x20; if (setSpriteInvisible) - gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE; + gSprites[gBattlerSpriteIds[battler]].invisible = TRUE; SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X); SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y); - LoadPalette(&gPlttBufferUnfaded[OBJ_PLTT_ID(battlerId)], BG_PLTT_ID(animBg.paletteId), PLTT_SIZE_4BPP); - CpuCopy32(&gPlttBufferUnfaded[OBJ_PLTT_ID(battlerId)], (void *)(BG_PLTT + PLTT_OFFSET_4BPP(animBg.paletteId)), PLTT_SIZE_4BPP); + LoadPalette(&gPlttBufferUnfaded[OBJ_PLTT_ID(battler)], BG_PLTT_ID(animBg.paletteId), PLTT_SIZE_4BPP); + CpuCopy32(&gPlttBufferUnfaded[OBJ_PLTT_ID(battler)], (void *)(BG_PLTT + PLTT_OFFSET_4BPP(animBg.paletteId)), PLTT_SIZE_4BPP); if (IsContest()) battlerPosition = 0; else - battlerPosition = GetBattlerPosition(battlerId); + battlerPosition = GetBattlerPosition(battler); DrawBattlerOnBg(1, 0, 0, battlerPosition, animBg.paletteId, animBg.bgTiles, animBg.bgTilemap, animBg.tilesOffset); @@ -1110,21 +1110,21 @@ void MoveBattlerSpriteToBG(u8 battlerId, bool8 toBG_2, bool8 setSpriteInvisible) SetAnimBgAttribute(2, BG_ANIM_SCREEN_SIZE, 1); SetAnimBgAttribute(2, BG_ANIM_AREA_OVERFLOW_MODE, 0); - battlerSpriteId = gBattlerSpriteIds[battlerId]; + battlerSpriteId = gBattlerSpriteIds[battler]; gBattle_BG2_X = -(gSprites[battlerSpriteId].x + gSprites[battlerSpriteId].x2) + 0x20; gBattle_BG2_Y = -(gSprites[battlerSpriteId].y + gSprites[battlerSpriteId].y2) + 0x20; if (setSpriteInvisible) - gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE; + gSprites[gBattlerSpriteIds[battler]].invisible = TRUE; SetGpuReg(REG_OFFSET_BG2HOFS, gBattle_BG2_X); SetGpuReg(REG_OFFSET_BG2VOFS, gBattle_BG2_Y); - LoadPalette(&gPlttBufferUnfaded[OBJ_PLTT_ID(battlerId)], BG_PLTT_ID(9), PLTT_SIZE_4BPP); - CpuCopy32(&gPlttBufferUnfaded[OBJ_PLTT_ID(battlerId)], (void *)(BG_PLTT + PLTT_OFFSET_4BPP(9)), PLTT_SIZE_4BPP); + LoadPalette(&gPlttBufferUnfaded[OBJ_PLTT_ID(battler)], BG_PLTT_ID(9), PLTT_SIZE_4BPP); + CpuCopy32(&gPlttBufferUnfaded[OBJ_PLTT_ID(battler)], (void *)(BG_PLTT + PLTT_OFFSET_4BPP(9)), PLTT_SIZE_4BPP); - DrawBattlerOnBg(2, 0, 0, GetBattlerPosition(battlerId), animBg.paletteId, animBg.bgTiles + 0x1000, animBg.bgTilemap + 0x400, animBg.tilesOffset); + DrawBattlerOnBg(2, 0, 0, GetBattlerPosition(battler), animBg.paletteId, animBg.bgTiles + 0x1000, animBg.bgTilemap + 0x400, animBg.tilesOffset); } } @@ -1192,12 +1192,12 @@ void ResetBattleAnimBg(bool8 toBG2) static void Task_UpdateMonBg(u8 taskId) { - u8 spriteId, battlerId; + u8 spriteId, battler; s16 x, y; struct BattleAnimBgData animBg; spriteId = gTasks[taskId].t2_SpriteId; - battlerId = gTasks[taskId].t2_BattlerId; + battler = gTasks[taskId].t2_BattlerId; GetBattleAnimBg1Data(&animBg); x = gTasks[taskId].t2_SpriteX - (gSprites[spriteId].x + gSprites[spriteId].x2); y = gTasks[taskId].t2_SpriteY - (gSprites[spriteId].y + gSprites[spriteId].y2); @@ -1206,13 +1206,13 @@ static void Task_UpdateMonBg(u8 taskId) { gBattle_BG1_X = x + gTasks[taskId].t2_BgX; gBattle_BG1_Y = y + gTasks[taskId].t2_BgY; - CpuCopy32(&gPlttBufferFaded[OBJ_PLTT_ID(battlerId)], &gPlttBufferFaded[BG_PLTT_ID(animBg.paletteId)], PLTT_SIZE_4BPP); + CpuCopy32(&gPlttBufferFaded[OBJ_PLTT_ID(battler)], &gPlttBufferFaded[BG_PLTT_ID(animBg.paletteId)], PLTT_SIZE_4BPP); } else { gBattle_BG2_X = x + gTasks[taskId].t2_BgX; gBattle_BG2_Y = y + gTasks[taskId].t2_BgY; - CpuCopy32(&gPlttBufferFaded[OBJ_PLTT_ID(battlerId)], &gPlttBufferFaded[BG_PLTT_ID(9)], PLTT_SIZE_4BPP); + CpuCopy32(&gPlttBufferFaded[OBJ_PLTT_ID(battler)], &gPlttBufferFaded[BG_PLTT_ID(9)], PLTT_SIZE_4BPP); } } @@ -1232,7 +1232,7 @@ static void Task_UpdateMonBg(u8 taskId) static void Cmd_clearmonbg(void) { u8 animBattlerId; - u8 battlerId; + u8 battler; u8 taskId; sBattleAnimScriptPtr++; @@ -1244,20 +1244,20 @@ static void Cmd_clearmonbg(void) animBattlerId = ANIM_DEF_PARTNER; if (animBattlerId == ANIM_ATTACKER || animBattlerId == ANIM_ATK_PARTNER) - battlerId = gBattleAnimAttacker; + battler = gBattleAnimAttacker; else - battlerId = gBattleAnimTarget; + battler = gBattleAnimTarget; if (sMonAnimTaskIdArray[0] != TASK_NONE) - gSprites[gBattlerSpriteIds[battlerId]].invisible = FALSE; + gSprites[gBattlerSpriteIds[battler]].invisible = FALSE; if (animBattlerId > 1 && sMonAnimTaskIdArray[1] != TASK_NONE) - gSprites[gBattlerSpriteIds[BATTLE_PARTNER(battlerId)]].invisible = FALSE; + gSprites[gBattlerSpriteIds[BATTLE_PARTNER(battler)]].invisible = FALSE; else animBattlerId = 0; taskId = CreateTask(Task_ClearMonBg, 5); gTasks[taskId].data[0] = animBattlerId; - gTasks[taskId].data[2] = battlerId; + gTasks[taskId].data[2] = battler; sBattleAnimScriptPtr++; } @@ -1294,7 +1294,7 @@ static void Task_ClearMonBg(u8 taskId) static void Cmd_monbg_static(void) { bool8 toBG_2; - u8 battlerId; + u8 battler; u8 animBattlerId; sBattleAnimScriptPtr++; @@ -1307,31 +1307,31 @@ static void Cmd_monbg_static(void) animBattlerId = ANIM_DEF_PARTNER; if (animBattlerId == ANIM_ATTACKER || animBattlerId == ANIM_ATK_PARTNER) - battlerId = gBattleAnimAttacker; + battler = gBattleAnimAttacker; else - battlerId = gBattleAnimTarget; + battler = gBattleAnimTarget; - if (IsBattlerSpriteVisible(battlerId)) + if (IsBattlerSpriteVisible(battler)) { - u8 position = GetBattlerPosition(battlerId); + u8 position = GetBattlerPosition(battler); if (position == B_POSITION_OPPONENT_LEFT || position == B_POSITION_PLAYER_RIGHT || IsContest()) toBG_2 = FALSE; else toBG_2 = TRUE; - MoveBattlerSpriteToBG(battlerId, toBG_2, FALSE); + MoveBattlerSpriteToBG(battler, toBG_2, FALSE); } - battlerId ^= BIT_FLANK; - if (animBattlerId > 1 && IsBattlerSpriteVisible(battlerId)) + battler ^= BIT_FLANK; + if (animBattlerId > 1 && IsBattlerSpriteVisible(battler)) { - u8 position = GetBattlerPosition(battlerId); + u8 position = GetBattlerPosition(battler); if (position == B_POSITION_OPPONENT_LEFT || position == B_POSITION_PLAYER_RIGHT || IsContest()) toBG_2 = FALSE; else toBG_2 = TRUE; - MoveBattlerSpriteToBG(battlerId, toBG_2, FALSE); + MoveBattlerSpriteToBG(battler, toBG_2, FALSE); } sBattleAnimScriptPtr++; @@ -1340,7 +1340,7 @@ static void Cmd_monbg_static(void) static void Cmd_clearmonbg_static(void) { u8 animBattlerId; - u8 battlerId; + u8 battler; u8 taskId; sBattleAnimScriptPtr++; @@ -1352,20 +1352,20 @@ static void Cmd_clearmonbg_static(void) animBattlerId = ANIM_DEF_PARTNER; if (animBattlerId == ANIM_ATTACKER || animBattlerId == ANIM_ATK_PARTNER) - battlerId = gBattleAnimAttacker; + battler = gBattleAnimAttacker; else - battlerId = gBattleAnimTarget; + battler = gBattleAnimTarget; - if (IsBattlerSpriteVisible(battlerId)) - gSprites[gBattlerSpriteIds[battlerId]].invisible = FALSE; - if (animBattlerId > 1 && IsBattlerSpriteVisible(BATTLE_PARTNER(battlerId))) - gSprites[gBattlerSpriteIds[BATTLE_PARTNER(battlerId)]].invisible = FALSE; + if (IsBattlerSpriteVisible(battler)) + gSprites[gBattlerSpriteIds[battler]].invisible = FALSE; + if (animBattlerId > 1 && IsBattlerSpriteVisible(BATTLE_PARTNER(battler))) + gSprites[gBattlerSpriteIds[BATTLE_PARTNER(battler)]].invisible = FALSE; else animBattlerId = 0; taskId = CreateTask(Task_ClearMonBgStatic, 5); gTasks[taskId].data[0] = animBattlerId; - gTasks[taskId].data[2] = battlerId; + gTasks[taskId].data[2] = battler; sBattleAnimScriptPtr++; } @@ -1376,16 +1376,16 @@ static void Task_ClearMonBgStatic(u8 taskId) if (gTasks[taskId].data[1] != 1) { bool8 toBG_2; - u8 battlerId = gTasks[taskId].data[2]; - u8 position = GetBattlerPosition(battlerId); + u8 battler = gTasks[taskId].data[2]; + u8 position = GetBattlerPosition(battler); if (position == B_POSITION_OPPONENT_LEFT || position == B_POSITION_PLAYER_RIGHT || IsContest()) toBG_2 = FALSE; else toBG_2 = TRUE; - if (IsBattlerSpriteVisible(battlerId)) + if (IsBattlerSpriteVisible(battler)) ResetBattleAnimBg(toBG_2); - if (gTasks[taskId].data[0] > 1 && IsBattlerSpriteVisible(BATTLE_PARTNER(battlerId))) + if (gTasks[taskId].data[0] > 1 && IsBattlerSpriteVisible(BATTLE_PARTNER(battler))) ResetBattleAnimBg(toBG_2 ^ 1); DestroyTask(taskId); @@ -2067,19 +2067,19 @@ static void Cmd_jumpifcontest(void) static void Cmd_splitbgprio(void) { u8 wantedBattler; - u8 battlerId; + u8 battler; u8 battlerPosition; wantedBattler = sBattleAnimScriptPtr[1]; sBattleAnimScriptPtr += 2; if (wantedBattler != ANIM_ATTACKER) - battlerId = gBattleAnimTarget; + battler = gBattleAnimTarget; else - battlerId = gBattleAnimAttacker; + battler = gBattleAnimAttacker; // Apply only if the given battler is the lead (on left from team's perspective) - battlerPosition = GetBattlerPosition(battlerId); + battlerPosition = GetBattlerPosition(battler); if (!IsContest() && (battlerPosition == B_POSITION_PLAYER_LEFT || battlerPosition == B_POSITION_OPPONENT_RIGHT)) { SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1); @@ -2101,7 +2101,7 @@ static void Cmd_splitbgprio_foes(void) { u8 wantedBattler; u8 battlerPosition; - u8 battlerId; + u8 battler; wantedBattler = sBattleAnimScriptPtr[1]; sBattleAnimScriptPtr += 2; @@ -2110,12 +2110,12 @@ static void Cmd_splitbgprio_foes(void) if (GetBattlerSide(gBattleAnimAttacker) != GetBattlerSide(gBattleAnimTarget)) { if (wantedBattler != ANIM_ATTACKER) - battlerId = gBattleAnimTarget; + battler = gBattleAnimTarget; else - battlerId = gBattleAnimAttacker; + battler = gBattleAnimAttacker; // Apply only if the given battler is the lead (on left from team's perspective) - battlerPosition = GetBattlerPosition(battlerId); + battlerPosition = GetBattlerPosition(battler); if (!IsContest() && (battlerPosition == B_POSITION_PLAYER_LEFT || battlerPosition == B_POSITION_OPPONENT_RIGHT)) { SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1); diff --git a/src/battle_anim_flying.c b/src/battle_anim_flying.c index a4b37389ed..ca7b370654 100644 --- a/src/battle_anim_flying.c +++ b/src/battle_anim_flying.c @@ -920,7 +920,7 @@ static void AnimUnusedBubbleThrow(struct Sprite *sprite) sprite->callback = TranslateAnimSpriteToTargetMonLocation; } -static void AnimWhirlwindLine(struct Sprite * sprite) +static void AnimWhirlwindLine(struct Sprite *sprite) { u16 offset; u8 mult; diff --git a/src/battle_anim_ice.c b/src/battle_anim_ice.c index 7cc2395bf0..8b818790e8 100644 --- a/src/battle_anim_ice.c +++ b/src/battle_anim_ice.c @@ -13,11 +13,16 @@ #include "constants/battle_anim.h" #include "constants/rgb.h" +enum { + HAILSTRUCTTYPE_NEGATIVE_POS_MOD = 0, + HAILSTRUCTTYPE_POSITIVE_POS_MOD = 1, + HAILSTRUCTTYPE_FIXED_POSITION = 2, +}; struct HailStruct { s32 x:10; s32 y:10; s32 bPosition:8; - s32 unk3:4; + s32 type:4; }; static void AnimUnusedIceCrystalThrow(struct Sprite *); @@ -382,16 +387,16 @@ const struct SpriteTemplate gPoisonGasCloudSpriteTemplate = static const struct HailStruct sHailCoordData[] = { - {.x = 100, .y = 120, .bPosition = B_POSITION_PLAYER_LEFT, .unk3 = 2}, - {.x = 85, .y = 120, .bPosition = B_POSITION_PLAYER_LEFT, .unk3 = 0}, - {.x = 242, .y = 120, .bPosition = B_POSITION_OPPONENT_LEFT, .unk3 = 1}, - {.x = 66, .y = 120, .bPosition = B_POSITION_PLAYER_RIGHT, .unk3 = 1}, - {.x = 182, .y = 120, .bPosition = B_POSITION_OPPONENT_RIGHT, .unk3 = 0}, - {.x = 60, .y = 120, .bPosition = B_POSITION_PLAYER_LEFT, .unk3 = 2}, - {.x = 214, .y = 120, .bPosition = B_POSITION_OPPONENT_LEFT, .unk3 = 0}, - {.x = 113, .y = 120, .bPosition = B_POSITION_PLAYER_LEFT, .unk3 = 1}, - {.x = 210, .y = 120, .bPosition = B_POSITION_OPPONENT_RIGHT, .unk3 = 1}, - {.x = 38, .y = 120, .bPosition = B_POSITION_PLAYER_RIGHT, .unk3 = 0}, + {.x = 100, .y = 120, .bPosition = B_POSITION_PLAYER_LEFT, .type = HAILSTRUCTTYPE_FIXED_POSITION}, + {.x = 85, .y = 120, .bPosition = B_POSITION_PLAYER_LEFT, .type = HAILSTRUCTTYPE_NEGATIVE_POS_MOD}, + {.x = 242, .y = 120, .bPosition = B_POSITION_OPPONENT_LEFT, .type = HAILSTRUCTTYPE_POSITIVE_POS_MOD}, + {.x = 66, .y = 120, .bPosition = B_POSITION_PLAYER_RIGHT, .type = HAILSTRUCTTYPE_POSITIVE_POS_MOD}, + {.x = 182, .y = 120, .bPosition = B_POSITION_OPPONENT_RIGHT, .type = HAILSTRUCTTYPE_NEGATIVE_POS_MOD}, + {.x = 60, .y = 120, .bPosition = B_POSITION_PLAYER_LEFT, .type = HAILSTRUCTTYPE_FIXED_POSITION}, + {.x = 214, .y = 120, .bPosition = B_POSITION_OPPONENT_LEFT, .type = HAILSTRUCTTYPE_NEGATIVE_POS_MOD}, + {.x = 113, .y = 120, .bPosition = B_POSITION_PLAYER_LEFT, .type = HAILSTRUCTTYPE_POSITIVE_POS_MOD}, + {.x = 210, .y = 120, .bPosition = B_POSITION_OPPONENT_RIGHT, .type = HAILSTRUCTTYPE_POSITIVE_POS_MOD}, + {.x = 38, .y = 120, .bPosition = B_POSITION_PLAYER_RIGHT, .type = HAILSTRUCTTYPE_NEGATIVE_POS_MOD}, }; static const union AffineAnimCmd sAffineAnim_HailParticle_0[] = @@ -1445,6 +1450,13 @@ static void MovePoisonGasCloud(struct Sprite *sprite) } } +#define tState data[0] +#define tSpriteCount data[1] +#define tHailAffineAnimNum data[2] +#define tHailStructId data[3] +#define tInitialDelayTimer data[4] +#define tHailSpawnTimer data[5] + void AnimTask_Hail(u8 taskId) { struct Task *task = &gTasks[taskId]; @@ -1455,71 +1467,86 @@ void AnimTask_Hail(u8 taskId) static void AnimTask_Hail2(u8 taskId) { struct Task *task = &gTasks[taskId]; - switch (task->data[0]) + switch (task->tState) { case 0: - if (++task->data[4] > 2) + if (++task->tInitialDelayTimer > 2) { - task->data[4] = 0; - task->data[5] = 0; - task->data[2] = 0; - task->data[0]++; + task->tInitialDelayTimer = 0; + task->tHailSpawnTimer = 0; + task->tHailAffineAnimNum = 0; + task->tState++; } break; case 1: - if (task->data[5] == 0) + if (task->tHailSpawnTimer == 0) { - if (GenerateHailParticle(task->data[3], task->data[2], taskId, 1)) - task->data[1]++; + if (GenerateHailParticle(task->tHailStructId, task->tHailAffineAnimNum, taskId, 1)) + task->tSpriteCount++; - if (++task->data[2] == 3) + if (++task->tHailAffineAnimNum == (int)ARRAY_COUNT(sAffineAnims_HailParticle)) { - if (++task->data[3] == 10) - task->data[0]++; + if (++task->tHailStructId == (int)ARRAY_COUNT(sHailCoordData)) + task->tState++; else - task->data[0]--; + task->tState--; } else { - task->data[5] = 1; + task->tHailSpawnTimer = 1; } } else { - task->data[5]--; + task->tHailSpawnTimer--; } break; case 2: - if (task->data[1] == 0) + if (task->tSpriteCount == 0) DestroyAnimVisualTask(taskId); break; } } +#undef tState +#undef tSpriteCount +#undef tHailAffineAnimNum +#undef tHailStructId +#undef tInitialDelayTimer +#undef tHailSpawnTimer + +// Hail falling particle sprite vars +#define sSpawnImpactEffect data[0] +#define sTargetX data[3] +#define sTargetY data[4] +#define sAffineAnimNum data[5] +#define sOwnerTaskId data[6] +#define sOwnerTaskSpriteCountField data[7] + static bool8 GenerateHailParticle(u8 hailStructId, u8 affineAnimNum, u8 taskId, u8 c) { u8 id; s16 battlerX, battlerY; s16 spriteX; - bool8 possibleBool = FALSE; - s8 unk = sHailCoordData[hailStructId].unk3; + bool8 shouldSpawnImpactEffect = FALSE; + s8 type = sHailCoordData[hailStructId].type; - if (unk != 2) + if (type != HAILSTRUCTTYPE_FIXED_POSITION) { id = GetBattlerAtPosition(sHailCoordData[hailStructId].bPosition); if (IsBattlerSpriteVisible(id)) { - possibleBool = TRUE; + shouldSpawnImpactEffect = TRUE; battlerX = GetBattlerSpriteCoord(id, BATTLER_COORD_X_2); battlerY = GetBattlerSpriteCoord(id, BATTLER_COORD_Y_PIC_OFFSET); - switch (unk) + switch (type) { - case 0: + case HAILSTRUCTTYPE_NEGATIVE_POS_MOD: battlerX -= GetBattlerSpriteCoordAttr(id, BATTLER_COORD_ATTR_WIDTH) / 6; battlerY -= GetBattlerSpriteCoordAttr(id, BATTLER_COORD_ATTR_HEIGHT) / 6; break; - case 1: + case HAILSTRUCTTYPE_POSITIVE_POS_MOD: battlerX += GetBattlerSpriteCoordAttr(id, BATTLER_COORD_ATTR_WIDTH) / 6; battlerY += GetBattlerSpriteCoordAttr(id, BATTLER_COORD_ATTR_HEIGHT) / 6; break; @@ -1545,12 +1572,12 @@ static bool8 GenerateHailParticle(u8 hailStructId, u8 affineAnimNum, u8 taskId, else { StartSpriteAffineAnim(&gSprites[id], affineAnimNum); - gSprites[id].data[0] = possibleBool; - gSprites[id].data[3] = battlerX; - gSprites[id].data[4] = battlerY; - gSprites[id].data[5] = affineAnimNum; - gSprites[id].data[6] = taskId; - gSprites[id].data[7] = c; + gSprites[id].sSpawnImpactEffect = shouldSpawnImpactEffect; + gSprites[id].sTargetX = battlerX; + gSprites[id].sTargetY = battlerY; + gSprites[id].sAffineAnimNum = affineAnimNum; + gSprites[id].sOwnerTaskId = taskId; + gSprites[id].sOwnerTaskSpriteCountField = c; return TRUE; } } @@ -1562,20 +1589,23 @@ static void AnimHailBegin(struct Sprite *sprite) sprite->x += 4; sprite->y += 8; - if (sprite->x < sprite->data[3] && sprite->y < sprite->data[4]) + if (sprite->x < sprite->sTargetX && sprite->y < sprite->sTargetY) return; - if (sprite->data[0] == 1 && sprite->data[5] == 0) + if (sprite->sSpawnImpactEffect == 1 && sprite->sAffineAnimNum == 0) { spriteId = CreateSprite(&gIceCrystalHitLargeSpriteTemplate, - sprite->data[3], sprite->data[4], sprite->subpriority); + sprite->sTargetX, sprite->sTargetY, sprite->subpriority); sprite->data[0] = spriteId; if (spriteId != MAX_SPRITES) { + // The sprite template we're using is shared amongst a few other + // places, which make the sprite flicker. That's not what we want + // here, though. Override the callback. gSprites[sprite->data[0]].callback = AnimHailContinue; - gSprites[sprite->data[0]].data[6] = sprite->data[6]; - gSprites[sprite->data[0]].data[7] = sprite->data[7]; + gSprites[sprite->data[0]].sOwnerTaskId = sprite->sOwnerTaskId; + gSprites[sprite->data[0]].sOwnerTaskSpriteCountField = sprite->sOwnerTaskSpriteCountField; } FreeOamMatrix(sprite->oam.matrixNum); @@ -1583,22 +1613,34 @@ static void AnimHailBegin(struct Sprite *sprite) } else { - gTasks[sprite->data[6]].data[sprite->data[7]]--; + gTasks[sprite->sOwnerTaskId].data[sprite->sOwnerTaskSpriteCountField]--; FreeOamMatrix(sprite->oam.matrixNum); DestroySprite(sprite); } } +#undef sSpawnImpactEffect +#undef sTargetX +#undef sTargetY +#undef sAffineAnimNum + +// Hail impact VFX sprite vars +#define sTimer data[0] + static void AnimHailContinue(struct Sprite *sprite) { - if (++sprite->data[0] == 20) + if (++sprite->sTimer == 20) { - gTasks[sprite->data[6]].data[sprite->data[7]]--; + gTasks[sprite->sOwnerTaskId].data[sprite->sOwnerTaskSpriteCountField]--; FreeOamMatrix(sprite->oam.matrixNum); DestroySprite(sprite); } } +#undef sTimer +#undef sOwnerTaskId +#undef sOwnerTaskSpriteCountField + // Initializes the animation for Ice Ball. // arg 0: initial x pixel offset // arg 1: initial y pixel offset diff --git a/src/battle_anim_mon_movement.c b/src/battle_anim_mon_movement.c index e8ce92677c..db39c6aadb 100644 --- a/src/battle_anim_mon_movement.c +++ b/src/battle_anim_mon_movement.c @@ -183,7 +183,7 @@ void AnimTask_ShakeMon2(u8 taskId) { u8 spriteId; bool8 abort = FALSE; - u8 battlerId; + u8 battler; if (gBattleAnimArgs[0] < MAX_BATTLERS_COUNT) { @@ -196,24 +196,24 @@ void AnimTask_ShakeMon2(u8 taskId) switch (gBattleAnimArgs[0]) { case ANIM_PLAYER_LEFT: - battlerId = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); + battler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); break; case ANIM_PLAYER_RIGHT: - battlerId = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT); + battler = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT); break; case ANIM_OPPONENT_LEFT: - battlerId = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); + battler = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); break; case ANIM_OPPONENT_RIGHT: default: - battlerId = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); + battler = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); break; } - if (IsBattlerSpriteVisible(battlerId) == FALSE) + if (IsBattlerSpriteVisible(battler) == FALSE) abort = TRUE; - spriteId = gBattlerSpriteIds[battlerId]; + spriteId = gBattlerSpriteIds[battler]; } else { @@ -675,16 +675,16 @@ static void SlideMonToOffsetPartner(struct Sprite *sprite) static void SlideMonToOffsetAndBack(struct Sprite *sprite) { u8 spriteId; - u8 battlerId; + u8 battler; sprite->invisible = TRUE; if (gBattleAnimArgs[0] == ANIM_ATTACKER) - battlerId = gBattleAnimAttacker; + battler = gBattleAnimAttacker; else - battlerId = gBattleAnimTarget; + battler = gBattleAnimTarget; - spriteId = gBattlerSpriteIds[battlerId]; - if (GetBattlerSide(battlerId)) + spriteId = gBattlerSpriteIds[battler]; + if (GetBattlerSide(battler)) { gBattleAnimArgs[1] = -gBattleAnimArgs[1]; if (gBattleAnimArgs[3] == 1) diff --git a/src/battle_anim_mons.c b/src/battle_anim_mons.c index af38afc814..9cb8bfe6e3 100644 --- a/src/battle_anim_mons.c +++ b/src/battle_anim_mons.c @@ -82,7 +82,7 @@ static const struct SpriteSheet sSpriteSheets_MoveEffectMons[] = { gMiscBlank_Gfx, MON_PIC_SIZE, TAG_MOVE_EFFECT_MON_2, }, }; -u8 GetBattlerSpriteCoord(u8 battlerId, u8 coordType) +u8 GetBattlerSpriteCoord(u8 battler, u8 coordType) { u8 retVal; u16 species; @@ -91,7 +91,7 @@ u8 GetBattlerSpriteCoord(u8 battlerId, u8 coordType) if (IsContest()) { - if (coordType == BATTLER_COORD_Y_PIC_OFFSET && battlerId == 3) + if (coordType == BATTLER_COORD_Y_PIC_OFFSET && battler == 3) coordType = BATTLER_COORD_Y; } @@ -99,10 +99,10 @@ u8 GetBattlerSpriteCoord(u8 battlerId, u8 coordType) { case BATTLER_COORD_X: case BATTLER_COORD_X_2: - retVal = sBattlerCoords[WhichBattleCoords(battlerId)][GetBattlerPosition(battlerId)].x; + retVal = sBattlerCoords[WhichBattleCoords(battler)][GetBattlerPosition(battler)].x; break; case BATTLER_COORD_Y: - retVal = sBattlerCoords[WhichBattleCoords(battlerId)][GetBattlerPosition(battlerId)].y; + retVal = sBattlerCoords[WhichBattleCoords(battler)][GetBattlerPosition(battler)].y; break; case BATTLER_COORD_Y_PIC_OFFSET: case BATTLER_COORD_Y_PIC_OFFSET_DEFAULT: @@ -116,27 +116,27 @@ u8 GetBattlerSpriteCoord(u8 battlerId, u8 coordType) } else { - mon = GetPartyBattlerData(battlerId); - illusionMon = GetIllusionMonPtr(battlerId); + mon = GetPartyBattlerData(battler); + illusionMon = GetIllusionMonPtr(battler); if (illusionMon != NULL) mon = illusionMon; spriteInfo = gBattleSpritesDataPtr->battlerData; - if (!spriteInfo[battlerId].transformSpecies) + if (!spriteInfo[battler].transformSpecies) species = GetMonData(mon, MON_DATA_SPECIES); else - species = spriteInfo[battlerId].transformSpecies; + species = spriteInfo[battler].transformSpecies; } if (coordType == BATTLER_COORD_Y_PIC_OFFSET) - retVal = GetBattlerSpriteFinal_Y(battlerId, species, TRUE); + retVal = GetBattlerSpriteFinal_Y(battler, species, TRUE); else - retVal = GetBattlerSpriteFinal_Y(battlerId, species, FALSE); + retVal = GetBattlerSpriteFinal_Y(battler, species, FALSE); break; } return retVal; } -u8 GetBattlerYDelta(u8 battlerId, u16 species) +u8 GetBattlerYDelta(u8 battler, u16 species) { u32 personality; struct BattleSpriteInfo *spriteInfo; @@ -159,25 +159,25 @@ u8 GetBattlerYDelta(u8 battlerId, u16 species) if (species == SPECIES_UNOWN) { spriteInfo = gBattleSpritesDataPtr->battlerData; - if (!spriteInfo[battlerId].transformSpecies) - personality = GetMonData(GetPartyBattlerData(battlerId), MON_DATA_PERSONALITY); + if (!spriteInfo[battler].transformSpecies) + personality = GetMonData(GetPartyBattlerData(battler), MON_DATA_PERSONALITY); else - personality = gTransformedPersonalities[battlerId]; + personality = gTransformedPersonalities[battler]; species = GetUnownSpeciesId(personality); } } - if (GetBattlerSide(battlerId) == B_SIDE_PLAYER || IsContest()) + if (GetBattlerSide(battler) == B_SIDE_PLAYER || IsContest()) ret = gSpeciesInfo[species].backPicYOffset; else ret = gSpeciesInfo[species].frontPicYOffset; return ret; } -u8 GetBattlerElevation(u8 battlerId, u16 species) +u8 GetBattlerElevation(u8 battler, u16 species) { u8 ret = 0; - if (GetBattlerSide(battlerId) == B_SIDE_OPPONENT) + if (GetBattlerSide(battler) == B_SIDE_OPPONENT) { if (!IsContest()) { @@ -188,24 +188,24 @@ u8 GetBattlerElevation(u8 battlerId, u16 species) return ret; } -u8 GetBattlerSpriteFinal_Y(u8 battlerId, u16 species, bool8 a3) +u8 GetBattlerSpriteFinal_Y(u8 battler, u16 species, bool8 a3) { u16 offset; u8 y; - if (GetBattlerSide(battlerId) == B_SIDE_PLAYER || IsContest()) + if (GetBattlerSide(battler) == B_SIDE_PLAYER || IsContest()) { - offset = GetBattlerYDelta(battlerId, species); + offset = GetBattlerYDelta(battler, species); } else { - offset = GetBattlerYDelta(battlerId, species); - offset -= GetBattlerElevation(battlerId, species); + offset = GetBattlerYDelta(battler, species); + offset -= GetBattlerElevation(battler, species); } - y = offset + sBattlerCoords[WhichBattleCoords(battlerId)][GetBattlerPosition(battlerId)].y; + y = offset + sBattlerCoords[WhichBattleCoords(battler)][GetBattlerPosition(battler)].y; if (a3) { - if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) + if (GetBattlerSide(battler) == B_SIDE_PLAYER) y += 8; if (y > DISPLAY_HEIGHT - MON_PIC_HEIGHT + 8) y = DISPLAY_HEIGHT - MON_PIC_HEIGHT + 8; @@ -213,7 +213,7 @@ u8 GetBattlerSpriteFinal_Y(u8 battlerId, u16 species, bool8 a3) return y; } -u8 GetBattlerSpriteCoord2(u8 battlerId, u8 coordType) +u8 GetBattlerSpriteCoord2(u8 battler, u8 coordType) { u16 species; struct BattleSpriteInfo *spriteInfo; @@ -230,55 +230,55 @@ u8 GetBattlerSpriteCoord2(u8 battlerId, u8 coordType) else { spriteInfo = gBattleSpritesDataPtr->battlerData; - if (!spriteInfo[battlerId].transformSpecies) - species = gAnimBattlerSpecies[battlerId]; + if (!spriteInfo[battler].transformSpecies) + species = gAnimBattlerSpecies[battler]; else - species = spriteInfo[battlerId].transformSpecies; + species = spriteInfo[battler].transformSpecies; } if (coordType == BATTLER_COORD_Y_PIC_OFFSET) - return GetBattlerSpriteFinal_Y(battlerId, species, TRUE); + return GetBattlerSpriteFinal_Y(battler, species, TRUE); else - return GetBattlerSpriteFinal_Y(battlerId, species, FALSE); + return GetBattlerSpriteFinal_Y(battler, species, FALSE); } else { - return GetBattlerSpriteCoord(battlerId, coordType); + return GetBattlerSpriteCoord(battler, coordType); } } -u8 GetBattlerSpriteDefault_Y(u8 battlerId) +u8 GetBattlerSpriteDefault_Y(u8 battler) { - return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y_PIC_OFFSET_DEFAULT); + return GetBattlerSpriteCoord(battler, BATTLER_COORD_Y_PIC_OFFSET_DEFAULT); } -u8 GetSubstituteSpriteDefault_Y(u8 battlerId) +u8 GetSubstituteSpriteDefault_Y(u8 battler) { u16 y; - if (GetBattlerSide(battlerId) != B_SIDE_PLAYER) - y = GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y) + 16; + if (GetBattlerSide(battler) != B_SIDE_PLAYER) + y = GetBattlerSpriteCoord(battler, BATTLER_COORD_Y) + 16; else - y = GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y) + 17; + y = GetBattlerSpriteCoord(battler, BATTLER_COORD_Y) + 17; return y; } -u8 GetBattlerYCoordWithElevation(u8 battlerId) +u8 GetBattlerYCoordWithElevation(u8 battler) { u16 species; u8 y; struct BattleSpriteInfo *spriteInfo; - y = GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y); + y = GetBattlerSpriteCoord(battler, BATTLER_COORD_Y); if (!IsContest()) { spriteInfo = gBattleSpritesDataPtr->battlerData; - if (!spriteInfo[battlerId].transformSpecies) - species = GetMonData(GetPartyBattlerData(battlerId), MON_DATA_SPECIES); + if (!spriteInfo[battler].transformSpecies) + species = GetMonData(GetPartyBattlerData(battler), MON_DATA_SPECIES); else - species = spriteInfo[battlerId].transformSpecies; + species = spriteInfo[battler].transformSpecies; - if (GetBattlerSide(battlerId) != B_SIDE_PLAYER) - y -= GetBattlerElevation(battlerId, species); + if (GetBattlerSide(battler) != B_SIDE_PLAYER) + y -= GetBattlerElevation(battler, species); } return y; } @@ -799,23 +799,23 @@ bool32 InitSpritePosToAnimBattler(u32 animBattlerId, struct Sprite *sprite, bool return TRUE; } -bool8 IsBattlerSpritePresent(u8 battlerId) +bool8 IsBattlerSpritePresent(u8 battler) { if (IsContest()) { - if (gBattleAnimAttacker == battlerId) + if (gBattleAnimAttacker == battler) return TRUE; - else if (gBattleAnimTarget == battlerId) + else if (gBattleAnimTarget == battler) return TRUE; else return FALSE; } else { - if (GetBattlerPosition(battlerId) == 0xff) + if (GetBattlerPosition(battler) == 0xff) return FALSE; - if (!gBattleStruct->spriteIgnore0Hp && GetMonData(GetPartyBattlerData(battlerId), MON_DATA_HP) == 0) + if (!gBattleStruct->spriteIgnore0Hp && GetMonData(GetPartyBattlerData(battler), MON_DATA_HP) == 0) return FALSE; return TRUE; } @@ -873,7 +873,7 @@ void GetBattleAnimBgData(struct BattleAnimBgData *out, u32 bgId) } } -void GetBgDataForTransform(struct BattleAnimBgData *out, u8 battlerId) +void GetBgDataForTransform(struct BattleAnimBgData *out, u8 battler) { out->bgTiles = gBattleAnimBgTileBuffer; out->bgTilemap = (u16 *)gBattleAnimBgTilemapBuffer; @@ -1211,14 +1211,14 @@ static bool8 ShouldRotScaleSpeciesBeFlipped(void) void PrepareBattlerSpriteForRotScale(u8 spriteId, u8 objMode) { - u8 battlerId = gSprites[spriteId].data[0]; + u8 battler = gSprites[spriteId].data[0]; - if (IsContest() || IsBattlerSpriteVisible(battlerId)) + if (IsContest() || IsBattlerSpriteVisible(battler)) gSprites[spriteId].invisible = FALSE; gSprites[spriteId].oam.objMode = objMode; gSprites[spriteId].affineAnimPaused = TRUE; if (!IsContest() && !gSprites[spriteId].oam.affineMode) - gSprites[spriteId].oam.matrixNum = gBattleSpritesDataPtr->healthBoxesData[battlerId].matrixNum; + gSprites[spriteId].oam.matrixNum = gBattleSpritesDataPtr->healthBoxesData[battler].matrixNum; gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_DOUBLE; CalcCenterToCornerVec(&gSprites[spriteId], gSprites[spriteId].oam.shape, gSprites[spriteId].oam.size, gSprites[spriteId].oam.affineMode); } @@ -1434,21 +1434,21 @@ static u8 UNUSED GetSpritePalIdxByPosition(u8 position) // 2, 3 as some control variables void AnimSpriteOnMonPos(struct Sprite *sprite) { - bool8 var; + bool8 respectMonPicOffsets; if (!sprite->data[0]) { if (!gBattleAnimArgs[3]) - var = TRUE; + respectMonPicOffsets = TRUE; else - var = FALSE; + respectMonPicOffsets = FALSE; if (gBattleAnimArgs[2] == 0) - InitSpritePosToAnimAttacker(sprite, var); + InitSpritePosToAnimAttacker(sprite, respectMonPicOffsets); else if (gBattleAnimArgs[2] == 1) - InitSpritePosToAnimTarget(sprite, var); + InitSpritePosToAnimTarget(sprite, respectMonPicOffsets); else if (gBattleAnimArgs[2] == 2) - InitSpritePosToAnimAttackerPartner(sprite, var); + InitSpritePosToAnimAttackerPartner(sprite, respectMonPicOffsets); sprite->data[0]++; @@ -1520,35 +1520,35 @@ static void AnimThrowProjectile_Step(struct Sprite *sprite) void AnimTravelDiagonally(struct Sprite *sprite) { - bool8 r4; - u8 battlerId, coordType; + bool8 respectMonPicOffsets; + u8 battler, coordType; if (!gBattleAnimArgs[6]) { - r4 = TRUE; + respectMonPicOffsets = TRUE; coordType = BATTLER_COORD_Y_PIC_OFFSET; } else { - r4 = FALSE; + respectMonPicOffsets = FALSE; coordType = BATTLER_COORD_Y; } if (gBattleAnimArgs[5] == ANIM_ATTACKER) { - InitSpritePosToAnimAttacker(sprite, r4); - battlerId = gBattleAnimAttacker; + InitSpritePosToAnimAttacker(sprite, respectMonPicOffsets); + battler = gBattleAnimAttacker; } else { - InitSpritePosToAnimTarget(sprite, r4); - battlerId = gBattleAnimTarget; + InitSpritePosToAnimTarget(sprite, respectMonPicOffsets); + battler = gBattleAnimTarget; } if (GetBattlerSide(gBattleAnimAttacker)) gBattleAnimArgs[2] = -gBattleAnimArgs[2]; - InitSpritePosToAnimTarget(sprite, r4); + InitSpritePosToAnimTarget(sprite, respectMonPicOffsets); sprite->data[0] = gBattleAnimArgs[4]; - sprite->data[2] = GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2) + gBattleAnimArgs[2]; - sprite->data[4] = GetBattlerSpriteCoord(battlerId, coordType) + gBattleAnimArgs[3]; + sprite->data[2] = GetBattlerSpriteCoord(battler, BATTLER_COORD_X_2) + gBattleAnimArgs[2]; + sprite->data[4] = GetBattlerSpriteCoord(battler, coordType) + gBattleAnimArgs[3]; sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); } @@ -1832,7 +1832,7 @@ void SetBattlerSpriteYOffsetFromOtherYScale(u8 spriteId, u8 otherSpriteId) static u16 GetBattlerYDeltaFromSpriteId(u8 spriteId) { struct BattleSpriteInfo *spriteInfo; - u8 battlerId = gSprites[spriteId].data[0]; + u8 battler = gSprites[spriteId].data[0]; u16 species; u16 i; @@ -1848,10 +1848,10 @@ static u16 GetBattlerYDeltaFromSpriteId(u8 spriteId) else { spriteInfo = gBattleSpritesDataPtr->battlerData; - if (!spriteInfo[battlerId].transformSpecies) + if (!spriteInfo[battler].transformSpecies) species = GetMonData(GetPartyBattlerData(i), MON_DATA_SPECIES); else - species = spriteInfo[battlerId].transformSpecies; + species = spriteInfo[battler].transformSpecies; if (GetBattlerSide(i) == B_SIDE_PLAYER) return gSpeciesInfo[species].backPicYOffset; @@ -1951,21 +1951,21 @@ void InitPrioritiesForVisibleBattlers(void) } } -u8 GetBattlerSpriteSubpriority(u8 battlerId) +u8 GetBattlerSpriteSubpriority(u8 battler) { u8 position; u8 subpriority; if (IsContest()) { - if (battlerId == 2) + if (battler == 2) return 30; else return 40; } else { - position = GetBattlerPosition(battlerId); + position = GetBattlerPosition(battler); if (position == B_POSITION_PLAYER_LEFT) subpriority = 30; else if (position == B_POSITION_PLAYER_RIGHT) @@ -1979,9 +1979,9 @@ u8 GetBattlerSpriteSubpriority(u8 battlerId) return subpriority; } -u8 GetBattlerSpriteBGPriority(u8 battlerId) +u8 GetBattlerSpriteBGPriority(u8 battler) { - u8 position = GetBattlerPosition(battlerId); + u8 position = GetBattlerPosition(battler); if (IsContest()) return 2; @@ -1991,11 +1991,11 @@ u8 GetBattlerSpriteBGPriority(u8 battlerId) return GetAnimBgAttribute(1, BG_ANIM_PRIORITY); } -u8 GetBattlerSpriteBGPriorityRank(u8 battlerId) +u8 GetBattlerSpriteBGPriorityRank(u8 battler) { if (!IsContest()) { - u8 position = GetBattlerPosition(battlerId); + u8 position = GetBattlerPosition(battler); if (position == B_POSITION_PLAYER_LEFT || position == B_POSITION_OPPONENT_RIGHT) return 2; else @@ -2005,7 +2005,7 @@ u8 GetBattlerSpriteBGPriorityRank(u8 battlerId) } // Create Pokémon sprite to be used for a move animation effect (e.g. Role Play / Snatch) -u8 CreateAdditionalMonSpriteForMoveAnim(u16 species, bool8 isBackpic, u8 id, s16 x, s16 y, u8 subpriority, u32 personality, bool8 isShiny, u32 battlerId) +u8 CreateAdditionalMonSpriteForMoveAnim(u16 species, bool8 isBackpic, u8 id, s16 x, s16 y, u8 subpriority, u32 personality, bool8 isShiny, u32 battler) { u8 spriteId; u16 sheet = LoadSpriteSheet(&sSpriteSheets_MoveEffectMons[id]); @@ -2051,7 +2051,7 @@ void DestroySpriteAndFreeResources_(struct Sprite *sprite) DestroySpriteAndFreeResources(sprite); } -s16 GetBattlerSpriteCoordAttr(u8 battlerId, u8 attr) +s16 GetBattlerSpriteCoordAttr(u8 battler, u8 attr) { u16 species; u32 personality; @@ -2080,25 +2080,25 @@ s16 GetBattlerSpriteCoordAttr(u8 battlerId, u8 attr) } else { - struct Pokemon *mon = GetPartyBattlerData(battlerId); + struct Pokemon *mon = GetPartyBattlerData(battler); spriteInfo = gBattleSpritesDataPtr->battlerData; - if (!spriteInfo[battlerId].transformSpecies) + if (!spriteInfo[battler].transformSpecies) { species = GetMonData(mon, MON_DATA_SPECIES); personality = GetMonData(mon, MON_DATA_PERSONALITY); } else { - species = spriteInfo[battlerId].transformSpecies; - personality = gTransformedPersonalities[battlerId]; + species = spriteInfo[battler].transformSpecies; + personality = gTransformedPersonalities[battler]; } species = SanitizeSpeciesId(species); if (species == SPECIES_UNOWN) species = GetUnownSpeciesId(personality); - if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) + if (GetBattlerSide(battler) == B_SIDE_PLAYER) { #if P_GENDER_DIFFERENCES if (gSpeciesInfo[species].backPicFemale != NULL && IsPersonalityFemale(species, personality)) @@ -2129,22 +2129,22 @@ s16 GetBattlerSpriteCoordAttr(u8 battlerId, u8 attr) case BATTLER_COORD_ATTR_WIDTH: return GET_MON_COORDS_WIDTH(size); case BATTLER_COORD_ATTR_LEFT: - return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2) - (GET_MON_COORDS_WIDTH(size) / 2); + return GetBattlerSpriteCoord(battler, BATTLER_COORD_X_2) - (GET_MON_COORDS_WIDTH(size) / 2); case BATTLER_COORD_ATTR_RIGHT: - return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2) + (GET_MON_COORDS_WIDTH(size) / 2); + return GetBattlerSpriteCoord(battler, BATTLER_COORD_X_2) + (GET_MON_COORDS_WIDTH(size) / 2); case BATTLER_COORD_ATTR_TOP: - return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y_PIC_OFFSET) - (GET_MON_COORDS_HEIGHT(size) / 2); + return GetBattlerSpriteCoord(battler, BATTLER_COORD_Y_PIC_OFFSET) - (GET_MON_COORDS_HEIGHT(size) / 2); case BATTLER_COORD_ATTR_BOTTOM: - return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y_PIC_OFFSET) + (GET_MON_COORDS_HEIGHT(size) / 2); + return GetBattlerSpriteCoord(battler, BATTLER_COORD_Y_PIC_OFFSET) + (GET_MON_COORDS_HEIGHT(size) / 2); case BATTLER_COORD_ATTR_RAW_BOTTOM: - ret = GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y) + 31; + ret = GetBattlerSpriteCoord(battler, BATTLER_COORD_Y) + 31; return ret - y_offset; default: return 0; } } -void SetAverageBattlerPositions(u8 battlerId, bool8 respectMonPicOffsets, s16 *x, s16 *y) +void SetAverageBattlerPositions(u8 battler, bool8 respectMonPicOffsets, s16 *x, s16 *y) { u8 xCoordType, yCoordType; s16 battlerX, battlerY; @@ -2161,12 +2161,12 @@ void SetAverageBattlerPositions(u8 battlerId, bool8 respectMonPicOffsets, s16 *x yCoordType = BATTLER_COORD_Y_PIC_OFFSET; } - battlerX = GetBattlerSpriteCoord(battlerId, xCoordType); - battlerY = GetBattlerSpriteCoord(battlerId, yCoordType); + battlerX = GetBattlerSpriteCoord(battler, xCoordType); + battlerY = GetBattlerSpriteCoord(battler, yCoordType); if (IsDoubleBattle() && !IsContest()) { - partnerX = GetBattlerSpriteCoord(BATTLE_PARTNER(battlerId), xCoordType); - partnerY = GetBattlerSpriteCoord(BATTLE_PARTNER(battlerId), yCoordType); + partnerX = GetBattlerSpriteCoord(BATTLE_PARTNER(battler), xCoordType); + partnerY = GetBattlerSpriteCoord(BATTLE_PARTNER(battler), yCoordType); } else { @@ -2178,7 +2178,7 @@ void SetAverageBattlerPositions(u8 battlerId, bool8 respectMonPicOffsets, s16 *x *y = (battlerY + partnerY) / 2; } -u8 CreateInvisibleSpriteCopy(int battlerId, u8 spriteId, int species) +u8 CreateInvisibleSpriteCopy(int battler, u8 spriteId, int species) { u8 newSpriteId = CreateInvisibleSpriteWithCallback(SpriteCallbackDummy); gSprites[newSpriteId] = gSprites[spriteId]; diff --git a/src/battle_anim_new.c b/src/battle_anim_new.c index 3386570885..edb555c4bc 100644 --- a/src/battle_anim_new.c +++ b/src/battle_anim_new.c @@ -8698,8 +8698,8 @@ void AnimTask_PurpleFlamesOnTarget(u8 taskId) void AnimTask_TechnoBlast(u8 taskId) { - if (ItemId_GetHoldEffect(gBattleMons[gBattleAnimAttacker].item) == HOLD_EFFECT_DRIVE) - gBattleAnimArgs[0] = ItemId_GetSecondaryId(gBattleMons[gBattleAnimAttacker].item); + if (GetItemHoldEffect(gBattleMons[gBattleAnimAttacker].item) == HOLD_EFFECT_DRIVE) + gBattleAnimArgs[0] = GetItemSecondaryId(gBattleMons[gBattleAnimAttacker].item); else gBattleAnimArgs[0] = 0; DestroyAnimVisualTask(taskId); diff --git a/src/battle_anim_rock.c b/src/battle_anim_rock.c index dcdb2a8965..13f05567f0 100644 --- a/src/battle_anim_rock.c +++ b/src/battle_anim_rock.c @@ -515,6 +515,11 @@ static void AnimParticleInVortex_Step(struct Sprite *sprite) } } +#define tBlendTimer data[10] +#define tBlend data[11] +#define tFullAlphaTimer data[11] // not a typo; this data field is used for multiple purposes +#define tState data[12] + void AnimTask_LoadSandstormBackground(u8 taskId) { int var0; @@ -557,45 +562,45 @@ static void AnimTask_LoadSandstormBackground_Step(u8 taskId) gBattle_BG1_Y += -1; - switch (gTasks[taskId].data[12]) + switch (gTasks[taskId].tState) { case 0: - if (++gTasks[taskId].data[10] == 4) + if (++gTasks[taskId].tBlendTimer == 4) { - gTasks[taskId].data[10] = 0; - gTasks[taskId].data[11]++; - SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[11], 16 - gTasks[taskId].data[11])); - if (gTasks[taskId].data[11] == 7) + gTasks[taskId].tBlendTimer = 0; + gTasks[taskId].tBlend++; + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].tBlend, 16 - gTasks[taskId].tBlend)); + if (gTasks[taskId].tBlend == 7) { - gTasks[taskId].data[12]++; - gTasks[taskId].data[11] = 0; + gTasks[taskId].tState++; + gTasks[taskId].tFullAlphaTimer = 0; } } break; case 1: - if (++gTasks[taskId].data[11] == 101) + if (++gTasks[taskId].tFullAlphaTimer == 101) { - gTasks[taskId].data[11] = 7; - gTasks[taskId].data[12]++; + gTasks[taskId].tBlend = 7; + gTasks[taskId].tState++; } break; case 2: - if (++gTasks[taskId].data[10] == 4) + if (++gTasks[taskId].tBlendTimer == 4) { - gTasks[taskId].data[10] = 0; - gTasks[taskId].data[11]--; - SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[11], 16 - gTasks[taskId].data[11])); - if (gTasks[taskId].data[11] == 0) + gTasks[taskId].tBlendTimer = 0; + gTasks[taskId].tBlend--; + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].tBlend, 16 - gTasks[taskId].tBlend)); + if (gTasks[taskId].tBlend == 0) { - gTasks[taskId].data[12]++; - gTasks[taskId].data[11] = 0; + gTasks[taskId].tState++; + gTasks[taskId].tFullAlphaTimer = 0; } } break; case 3: GetBattleAnimBg1Data(&animBg); ClearBattleAnimBg(animBg.bgId); - gTasks[taskId].data[12]++; + gTasks[taskId].tState++; break; case 4: if (!IsContest()) @@ -611,21 +616,36 @@ static void AnimTask_LoadSandstormBackground_Step(u8 taskId) } } +#undef tBlendTimer +#undef tBlend +#undef tFullAlphaTimer +#undef tState + // Animates the sprites that fly diagonally across the screen // in Sandstorm and Heat Wave. -// arg 0: initial y pixel offset -// arg 1: projectile speed -// arg 2: y pixel drop -// arg 3: ??? unknown (possibly a color bit) + +#define sState data[0] +#define sVelocityX data[1] // 256ths of a pixel // init'd from gBattleAnimArgs[1] +#define sVelocityY data[2] // 256ths of a pixel // init'd from gBattleAnimArgs[2] +#define sFractionalX data[3] // 256ths of a pixel +#define sFractionalY data[4] // 256ths of a pixel +#define sMirroredX data[5] // init'd from gBattleAnimArgs[3] + +// The fields named "velocity" are arguably more like "acceleration," +// and the fields named "fractional" are arguably more like "velocity." +// +// ...is what I WOULD say if the "fractional" fields weren't AND'd with +// 0xFF after every frame. + void AnimFlyingSandCrescent(struct Sprite *sprite) { - if (sprite->data[0] == 0) + if (sprite->sState == 0) { if (gBattleAnimArgs[3] != 0 && GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) { sprite->x = DISPLAY_WIDTH + 64; gBattleAnimArgs[1] = -gBattleAnimArgs[1]; - sprite->data[5] = 1; + sprite->sMirroredX = 1; sprite->oam.matrixNum = ST_OAM_HFLIP; } else @@ -635,18 +655,18 @@ void AnimFlyingSandCrescent(struct Sprite *sprite) sprite->y = gBattleAnimArgs[0]; SetSubspriteTables(sprite, sFlyingSandSubspriteTable); - sprite->data[1] = gBattleAnimArgs[1]; - sprite->data[2] = gBattleAnimArgs[2]; - sprite->data[0]++; + sprite->sVelocityX = gBattleAnimArgs[1]; + sprite->sVelocityY = gBattleAnimArgs[2]; + sprite->sState++; } else { - sprite->data[3] += sprite->data[1]; - sprite->data[4] += sprite->data[2]; - sprite->x2 += (sprite->data[3] >> 8); - sprite->y2 += (sprite->data[4] >> 8); - sprite->data[3] &= 0xFF; - sprite->data[4] &= 0xFF; + sprite->sFractionalX += sprite->sVelocityX; + sprite->sFractionalY += sprite->sVelocityY; + sprite->x2 += (sprite->sFractionalX >> 8); + sprite->y2 += (sprite->sFractionalY >> 8); + sprite->sFractionalX &= 0xFF; + sprite->sFractionalY &= 0xFF; if (sprite->data[5] == 0) { @@ -662,6 +682,13 @@ void AnimFlyingSandCrescent(struct Sprite *sprite) } } +#undef sState +#undef sVelocityX +#undef sVelocityY +#undef sFractionalX +#undef sFractionalY +#undef sMirroredX + // Animates the rising rocks in Ancient Power. // arg 0: initial x pixel offset // arg 1: initial y pixel offset diff --git a/src/battle_anim_sound_tasks.c b/src/battle_anim_sound_tasks.c index c4ad988a0b..1bd7008aa4 100644 --- a/src/battle_anim_sound_tasks.c +++ b/src/battle_anim_sound_tasks.c @@ -148,26 +148,26 @@ void SoundTask_PlayCryHighPitch(u8 taskId) } else { - u8 battlerId; + u8 battler; // Get wanted battler. if (gBattleAnimArgs[0] == ANIM_ATTACKER) - battlerId = gBattleAnimAttacker; + battler = gBattleAnimAttacker; else if (gBattleAnimArgs[0] == ANIM_TARGET) - battlerId = gBattleAnimTarget; + battler = gBattleAnimTarget; else if (gBattleAnimArgs[0] == ANIM_ATK_PARTNER) - battlerId = BATTLE_PARTNER(gBattleAnimAttacker); + battler = BATTLE_PARTNER(gBattleAnimAttacker); else - battlerId = BATTLE_PARTNER(gBattleAnimTarget); + battler = BATTLE_PARTNER(gBattleAnimTarget); // Check if battler is visible. - if ((gBattleAnimArgs[0] == ANIM_TARGET || gBattleAnimArgs[0] == ANIM_DEF_PARTNER) && !IsBattlerSpriteVisible(battlerId)) + if ((gBattleAnimArgs[0] == ANIM_TARGET || gBattleAnimArgs[0] == ANIM_DEF_PARTNER) && !IsBattlerSpriteVisible(battler)) { DestroyAnimVisualTask(taskId); return; } - species = (GetIllusionMonSpecies(battlerId) != SPECIES_NONE) ? GetIllusionMonSpecies(battlerId) : gAnimBattlerSpecies[battlerId]; + species = (GetIllusionMonSpecies(battler) != SPECIES_NONE) ? GetIllusionMonSpecies(battler) : gAnimBattlerSpecies[battler]; } if (species != SPECIES_NONE) @@ -193,26 +193,26 @@ void SoundTask_PlayDoubleCry(u8 taskId) } else { - u8 battlerId; + u8 battler; // Get wanted battler. if (gBattleAnimArgs[0] == ANIM_ATTACKER) - battlerId = gBattleAnimAttacker; + battler = gBattleAnimAttacker; else if (gBattleAnimArgs[0] == ANIM_TARGET) - battlerId = gBattleAnimTarget; + battler = gBattleAnimTarget; else if (gBattleAnimArgs[0] == ANIM_ATK_PARTNER) - battlerId = BATTLE_PARTNER(gBattleAnimAttacker); + battler = BATTLE_PARTNER(gBattleAnimAttacker); else - battlerId = BATTLE_PARTNER(gBattleAnimTarget); + battler = BATTLE_PARTNER(gBattleAnimTarget); // Check if battler is visible. - if ((gBattleAnimArgs[0] == ANIM_TARGET || gBattleAnimArgs[0] == ANIM_DEF_PARTNER) && !IsBattlerSpriteVisible(battlerId)) + if ((gBattleAnimArgs[0] == ANIM_TARGET || gBattleAnimArgs[0] == ANIM_DEF_PARTNER) && !IsBattlerSpriteVisible(battler)) { DestroyAnimVisualTask(taskId); return; } - species = (GetIllusionMonSpecies(battlerId) != SPECIES_NONE) ? GetIllusionMonSpecies(battlerId) : gAnimBattlerSpecies[battlerId]; + species = (GetIllusionMonSpecies(battler) != SPECIES_NONE) ? GetIllusionMonSpecies(battler) : gAnimBattlerSpecies[battler]; } gTasks[taskId].data[0] = gBattleAnimArgs[1]; diff --git a/src/battle_anim_status_effects.c b/src/battle_anim_status_effects.c index 9090893fda..5df7b24980 100644 --- a/src/battle_anim_status_effects.c +++ b/src/battle_anim_status_effects.c @@ -269,16 +269,16 @@ static const struct SpriteTemplate sFlashingCircleImpactSpriteTemplate = .callback = AnimFlashingCircleImpact, }; -static u8 UNUSED Task_FlashingCircleImpacts(u8 battlerId, bool8 red) +static u8 UNUSED Task_FlashingCircleImpacts(u8 battler, bool8 red) { - u8 battlerSpriteId = gBattlerSpriteIds[battlerId]; + u8 battlerSpriteId = gBattlerSpriteIds[battler]; u8 taskId = CreateTask(Task_UpdateFlashingCircleImpacts, 10); u8 spriteId; u8 i; LoadCompressedSpriteSheetUsingHeap(&gBattleAnimPicTable[GET_TRUE_SPRITE_INDEX(ANIM_TAG_CIRCLE_IMPACT)]); LoadCompressedSpritePaletteUsingHeap(&gBattleAnimPaletteTable[GET_TRUE_SPRITE_INDEX(ANIM_TAG_CIRCLE_IMPACT)]); - gTasks[taskId].data[0] = battlerId; + gTasks[taskId].data[0] = battler; if (red) { gTasks[taskId].data[1] = RGB_RED; @@ -588,15 +588,15 @@ void AnimTask_StatsChange(u8 taskId) #undef CASE -void LaunchStatusAnimation(u8 battlerId, u8 statusAnimId) +void LaunchStatusAnimation(u8 battler, u8 statusAnimId) { u8 taskId; - gBattleAnimAttacker = battlerId; - gBattleAnimTarget = battlerId; + gBattleAnimAttacker = battler; + gBattleAnimTarget = battler; LaunchBattleAnimation(ANIM_TYPE_STATUS, statusAnimId); taskId = CreateTask(Task_DoStatusAnimation, 10); - gTasks[taskId].data[0] = battlerId; + gTasks[taskId].data[0] = battler; } static void Task_DoStatusAnimation(u8 taskId) diff --git a/src/battle_anim_water.c b/src/battle_anim_water.c index 39be71c6b5..eac5b4e3f2 100644 --- a/src/battle_anim_water.c +++ b/src/battle_anim_water.c @@ -657,27 +657,37 @@ static void AnimKnockOffAquaTailStep(struct Sprite *sprite) sprite->data[2]++; } +#define tRaindropSpawnTimer data[0] +#define tRaindropUnused data[1] +#define tRaindropSpawnInterval data[2] +#define tRaindropSpawnDuration data[3] // number of frames over which we spawn raindrops + void AnimTask_CreateRaindrops(u8 taskId) { u8 x, y; - if (gTasks[taskId].data[0] == 0) + if (gTasks[taskId].tRaindropSpawnTimer == 0) { - gTasks[taskId].data[1] = gBattleAnimArgs[0]; - gTasks[taskId].data[2] = gBattleAnimArgs[1]; - gTasks[taskId].data[3] = gBattleAnimArgs[2]; + gTasks[taskId].tRaindropUnused = gBattleAnimArgs[0]; + gTasks[taskId].tRaindropSpawnInterval = gBattleAnimArgs[1]; + gTasks[taskId].tRaindropSpawnDuration = gBattleAnimArgs[2]; } - gTasks[taskId].data[0]++; - if (gTasks[taskId].data[0] % gTasks[taskId].data[2] == 1) + gTasks[taskId].tRaindropSpawnTimer++; + if (gTasks[taskId].tRaindropSpawnTimer % gTasks[taskId].tRaindropSpawnInterval == 1) { x = Random2() % DISPLAY_WIDTH; y = Random2() % (DISPLAY_HEIGHT / 2); CreateSprite(&gRainDropSpriteTemplate, x, y, 4); } - if (gTasks[taskId].data[0] == gTasks[taskId].data[3]) + if (gTasks[taskId].tRaindropSpawnTimer == gTasks[taskId].tRaindropSpawnDuration) DestroyAnimVisualTask(taskId); } +#undef tRaindropSpawnTimer +#undef tRaindropUnused +#undef tRaindropSpawnInterval +#undef tRaindropSpawnDuration + static void AnimRainDrop(struct Sprite *sprite) { sprite->callback = AnimRainDrop_Step; @@ -687,6 +697,10 @@ static void AnimRainDrop_Step(struct Sprite *sprite) { if (++sprite->data[0] <= 13) { + // + // Make the raindrop fall, but only until it reaches the + // impact/splash frames of its animation. + // sprite->x2++; sprite->y2 += 4; } @@ -945,7 +959,7 @@ static void AnimHydroCannonCharge_Step(struct Sprite *sprite) // Flashing blue orbs move from the attacker to the target. Second stage of Hydro Cannon static void AnimHydroCannonBeam(struct Sprite *sprite) { - bool8 animType; + bool8 respectMonPicOffsets; u8 coordType; if (IsBattlerAlly(gBattleAnimAttacker, gBattleAnimTarget)) { @@ -954,14 +968,14 @@ static void AnimHydroCannonBeam(struct Sprite *sprite) gBattleAnimArgs[0] *= -1; } if ((gBattleAnimArgs[5] & 0xFF00) == 0) - animType = TRUE; + respectMonPicOffsets = TRUE; else - animType = FALSE; + respectMonPicOffsets = FALSE; if ((u8)gBattleAnimArgs[5] == 0) coordType = BATTLER_COORD_Y_PIC_OFFSET; else coordType = BATTLER_COORD_Y; - InitSpritePosToAnimAttacker(sprite, animType); + InitSpritePosToAnimAttacker(sprite, respectMonPicOffsets); if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) gBattleAnimArgs[2] = -gBattleAnimArgs[2]; sprite->data[0] = gBattleAnimArgs[4]; diff --git a/src/battle_arena.c b/src/battle_arena.c index d79602156f..b54ba2838d 100644 --- a/src/battle_arena.c +++ b/src/battle_arena.c @@ -116,7 +116,7 @@ static const struct CompressedSpriteSheet sBattleArenaJudgmentSymbolsSpriteSheet {0} }; -static void (* const sArenaFunctions[])(void) = +static void (*const sArenaFunctions[])(void) = { [BATTLE_ARENA_FUNC_INIT] = InitArenaChallenge, [BATTLE_ARENA_FUNC_GET_DATA] = GetArenaData, diff --git a/src/battle_bg.c b/src/battle_bg.c index d013ccfb1b..4caf180fb3 100644 --- a/src/battle_bg.c +++ b/src/battle_bg.c @@ -604,7 +604,7 @@ static const struct WindowTemplate sBattleArenaWindowTemplates[] = DUMMY_WIN_TEMPLATE }; -const struct WindowTemplate * const gBattleWindowTemplates[] = +const struct WindowTemplate *const gBattleWindowTemplates[] = { [B_WIN_TYPE_NORMAL] = sStandardBattleWindowTemplates, [B_WIN_TYPE_ARENA] = sBattleArenaWindowTemplates, diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c index 1e4bf628db..4fc44d97f2 100644 --- a/src/battle_controller_link_opponent.c +++ b/src/battle_controller_link_opponent.c @@ -367,7 +367,7 @@ static void LinkOpponentBufferExecCompleted(u32 battler) { u8 playerId = GetMultiplayerId(); - PrepareBufferDataTransferLink(battler, 2, 4, &playerId); + PrepareBufferDataTransferLink(battler, B_COMM_CONTROLLER_IS_DONE, 4, &playerId); gBattleResources->bufferA[battler][0] = CONTROLLER_TERMINATOR_NOP; } else diff --git a/src/battle_controller_link_partner.c b/src/battle_controller_link_partner.c index 795b885f95..a50f64d41f 100644 --- a/src/battle_controller_link_partner.c +++ b/src/battle_controller_link_partner.c @@ -193,7 +193,7 @@ static void LinkPartnerBufferExecCompleted(u32 battler) { u8 playerId = GetMultiplayerId(); - PrepareBufferDataTransferLink(battler, 2, 4, &playerId); + PrepareBufferDataTransferLink(battler, B_COMM_CONTROLLER_IS_DONE, 4, &playerId); gBattleResources->bufferA[battler][0] = CONTROLLER_TERMINATOR_NOP; } else diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c index 38fb304ac1..a01f23a56f 100644 --- a/src/battle_controller_opponent.c +++ b/src/battle_controller_opponent.c @@ -404,7 +404,7 @@ static void OpponentBufferExecCompleted(u32 battler) { u8 playerId = GetMultiplayerId(); - PrepareBufferDataTransferLink(battler, 2, 4, &playerId); + PrepareBufferDataTransferLink(battler, B_COMM_CONTROLLER_IS_DONE, 4, &playerId); gBattleResources->bufferA[battler][0] = CONTROLLER_TERMINATOR_NOP; } else @@ -540,7 +540,7 @@ static void OpponentHandleChooseMove(u32 battler) { if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, ChooseMoveAndTargetInBattlePalace(battler)); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, 10, ChooseMoveAndTargetInBattlePalace(battler)); } else { @@ -549,13 +549,13 @@ static void OpponentHandleChooseMove(u32 battler) switch (chosenMoveId) { case AI_CHOICE_WATCH: - BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_SAFARI_WATCH_CAREFULLY, 0); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, B_ACTION_SAFARI_WATCH_CAREFULLY, 0); break; case AI_CHOICE_FLEE: - BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_RUN, 0); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, B_ACTION_RUN, 0); break; case 6: - BtlController_EmitTwoReturnValues(battler, BUFFER_B, 15, gBattlerTarget); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, 15, gBattlerTarget); break; default: { @@ -573,11 +573,11 @@ static void OpponentHandleChooseMove(u32 battler) && !(gBattleStruct->gimmick.usableGimmick[battler] == GIMMICK_Z_MOVE && !ShouldUseZMove(battler, gBattlerTarget, moveInfo->moves[chosenMoveId]))) { - BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, (chosenMoveId) | (RET_GIMMICK) | (gBattlerTarget << 8)); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, 10, (chosenMoveId) | (RET_GIMMICK) | (gBattlerTarget << 8)); } else { - BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, (chosenMoveId) | (gBattlerTarget << 8)); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, 10, (chosenMoveId) | (gBattlerTarget << 8)); } } break; @@ -596,7 +596,7 @@ static void OpponentHandleChooseMove(u32 battler) } while (move == MOVE_NONE); if (GetBattlerMoveTargetType(battler, move) & MOVE_TARGET_USER) - BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, (chosenMoveId) | (battler << 8)); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, 10, (chosenMoveId) | (battler << 8)); else if (IsDoubleBattle()) { do { @@ -629,17 +629,17 @@ static void OpponentHandleChooseMove(u32 battler) } } if (isPartnerEnemy && CanTargetBattler(battler, target, move)) - BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, (chosenMoveId) | (GetBattlerAtPosition(BATTLE_PARTNER(battler)) << 8)); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, 10, (chosenMoveId) | (GetBattlerAtPosition(BATTLE_PARTNER(battler)) << 8)); else - BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, (chosenMoveId) | (target << 8)); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, 10, (chosenMoveId) | (target << 8)); } else { - BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, (chosenMoveId) | (target << 8)); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, 10, (chosenMoveId) | (target << 8)); } } else - BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, (chosenMoveId) | (GetBattlerAtPosition(B_POSITION_PLAYER_LEFT) << 8)); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, 10, (chosenMoveId) | (GetBattlerAtPosition(B_POSITION_PLAYER_LEFT) << 8)); OpponentBufferExecCompleted(battler); } @@ -647,7 +647,7 @@ static void OpponentHandleChooseMove(u32 battler) static void OpponentHandleChooseItem(u32 battler) { - BtlController_EmitOneReturnValue(battler, BUFFER_B, gBattleStruct->chosenItem[battler]); + BtlController_EmitOneReturnValue(battler, B_COMM_TO_ENGINE, gBattleStruct->chosenItem[battler]); OpponentBufferExecCompleted(battler); } @@ -720,7 +720,7 @@ static void OpponentHandleChoosePokemon(u32 battler) #if TESTING TestRunner_Battle_CheckSwitch(battler, chosenMonId); #endif // TESTING - BtlController_EmitChosenMonReturnValue(battler, BUFFER_B, chosenMonId, NULL); + BtlController_EmitChosenMonReturnValue(battler, B_COMM_TO_ENGINE, chosenMonId, NULL); OpponentBufferExecCompleted(battler); } diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index fed7abac0f..ab01c8c579 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -173,7 +173,7 @@ static void PlayerBufferExecCompleted(u32 battler) { u8 playerId = GetMultiplayerId(); - PrepareBufferDataTransferLink(battler, 2, 4, &playerId); + PrepareBufferDataTransferLink(battler, B_COMM_CONTROLLER_IS_DONE, 4, &playerId); gBattleResources->bufferA[battler][0] = CONTROLLER_TERMINATOR_NOP; } else @@ -306,7 +306,7 @@ static void HandleInputChooseAction(u32 battler) PlaySE(SE_SELECT); ArrowsChangeColorLastBallCycle(FALSE); TryHideLastUsedBall(); - BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_THROW_BALL, 0); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, B_ACTION_THROW_BALL, 0); PlayerBufferExecCompleted(battler); } return; @@ -321,16 +321,16 @@ static void HandleInputChooseAction(u32 battler) switch (gActionSelectionCursor[battler]) { case 0: // Top left - BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_USE_MOVE, 0); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, B_ACTION_USE_MOVE, 0); break; case 1: // Top right - BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_USE_ITEM, 0); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, B_ACTION_USE_ITEM, 0); break; case 2: // Bottom left - BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_SWITCH, 0); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, B_ACTION_SWITCH, 0); break; case 3: // Bottom right - BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_RUN, 0); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, B_ACTION_RUN, 0); break; } PlayerBufferExecCompleted(battler); @@ -383,12 +383,12 @@ static void HandleInputChooseAction(u32 battler) && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { // Return item to bag if partner had selected one (if consumable). - if (gBattleResources->bufferA[battler][1] == B_ACTION_USE_ITEM && ItemId_GetConsumability(itemId)) + if (gBattleResources->bufferA[battler][1] == B_ACTION_USE_ITEM && GetItemConsumability(itemId)) { AddBagItem(itemId, 1); } PlaySE(SE_SELECT); - BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_CANCEL_PARTNER, 0); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, B_ACTION_CANCEL_PARTNER, 0); PlayerBufferExecCompleted(battler); } else if (B_QUICK_MOVE_CURSOR_TO_RUN) @@ -408,7 +408,7 @@ static void HandleInputChooseAction(u32 battler) } else if (DEBUG_BATTLE_MENU == TRUE && JOY_NEW(SELECT_BUTTON)) { - BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_DEBUG, 0); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, B_ACTION_DEBUG, 0); PlayerBufferExecCompleted(battler); } else if (B_LAST_USED_BALL == TRUE && B_LAST_USED_BALL_CYCLE == FALSE @@ -416,7 +416,7 @@ static void HandleInputChooseAction(u32 battler) { PlaySE(SE_SELECT); TryHideLastUsedBall(); - BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_THROW_BALL, 0); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, B_ACTION_THROW_BALL, 0); PlayerBufferExecCompleted(battler); } } @@ -445,9 +445,9 @@ void HandleInputChooseTarget(u32 battler) PlaySE(SE_SELECT); gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCB_HideAsMoveTarget; if (gBattleStruct->gimmick.playerSelect) - BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, gMoveSelectionCursor[battler] | RET_GIMMICK | (gMultiUsePlayerCursor << 8)); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, 10, gMoveSelectionCursor[battler] | RET_GIMMICK | (gMultiUsePlayerCursor << 8)); else - BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, gMoveSelectionCursor[battler] | (gMultiUsePlayerCursor << 8)); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, 10, gMoveSelectionCursor[battler] | (gMultiUsePlayerCursor << 8)); EndBounceEffect(gMultiUsePlayerCursor, BOUNCE_HEALTHBOX); TryHideLastUsedBall(); HideGimmickTriggerSprite(); @@ -601,9 +601,9 @@ void HandleInputShowEntireFieldTargets(u32 battler) PlaySE(SE_SELECT); HideAllTargets(); if (gBattleStruct->gimmick.playerSelect) - BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, gMoveSelectionCursor[battler] | RET_GIMMICK | (gMultiUsePlayerCursor << 8)); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, 10, gMoveSelectionCursor[battler] | RET_GIMMICK | (gMultiUsePlayerCursor << 8)); else - BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, gMoveSelectionCursor[battler] | (gMultiUsePlayerCursor << 8)); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, 10, gMoveSelectionCursor[battler] | (gMultiUsePlayerCursor << 8)); HideGimmickTriggerSprite(); PlayerBufferExecCompleted(battler); } @@ -629,9 +629,9 @@ void HandleInputShowTargets(u32 battler) PlaySE(SE_SELECT); HideShownTargets(battler); if (gBattleStruct->gimmick.playerSelect) - BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, gMoveSelectionCursor[battler] | RET_GIMMICK | (gMultiUsePlayerCursor << 8)); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, 10, gMoveSelectionCursor[battler] | RET_GIMMICK | (gMultiUsePlayerCursor << 8)); else - BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, gMoveSelectionCursor[battler] | (gMultiUsePlayerCursor << 8)); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, 10, gMoveSelectionCursor[battler] | (gMultiUsePlayerCursor << 8)); HideGimmickTriggerSprite(); TryHideLastUsedBall(); PlayerBufferExecCompleted(battler); @@ -733,9 +733,9 @@ void HandleInputChooseMove(u32 battler) case 0: default: if (gBattleStruct->gimmick.playerSelect) - BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, gMoveSelectionCursor[battler] | RET_GIMMICK | (gMultiUsePlayerCursor << 8)); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, 10, gMoveSelectionCursor[battler] | RET_GIMMICK | (gMultiUsePlayerCursor << 8)); else - BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, gMoveSelectionCursor[battler] | (gMultiUsePlayerCursor << 8)); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, 10, gMoveSelectionCursor[battler] | (gMultiUsePlayerCursor << 8)); HideGimmickTriggerSprite(); TryHideLastUsedBall(); PlayerBufferExecCompleted(battler); @@ -771,7 +771,7 @@ void HandleInputChooseMove(u32 battler) } else { - BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, 0xFFFF); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, 10, 0xFFFF); HideGimmickTriggerSprite(); PlayerBufferExecCompleted(battler); TryToHideMoveInfoWindow(); @@ -1437,7 +1437,7 @@ static void Task_GiveExpToMon(u8 taskId) DynamaxModifyHPLevelUp(mon, battler, oldMaxHP); gainedExp -= nextLvlExp - currExp; - BtlController_EmitTwoReturnValues(battler, BUFFER_B, RET_VALUE_LEVELED_UP, gainedExp); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, RET_VALUE_LEVELED_UP, gainedExp); if (IsDoubleBattle() == TRUE && (monId == gBattlerPartyIndexes[battler] || monId == gBattlerPartyIndexes[BATTLE_PARTNER(battler)])) @@ -1518,7 +1518,7 @@ static void Task_GiveExpWithExpBar(u8 taskId) DynamaxModifyHPLevelUp(mon, battler, oldMaxHP); gainedExp -= expOnNextLvl - currExp; - BtlController_EmitTwoReturnValues(battler, BUFFER_B, RET_VALUE_LEVELED_UP, gainedExp); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, RET_VALUE_LEVELED_UP, gainedExp); gTasks[taskId].func = Task_LaunchLvlUpAnim; } else @@ -1587,9 +1587,9 @@ static void WaitForMonSelection(u32 battler) if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active) { if (gPartyMenuUseExitCallback == TRUE) - BtlController_EmitChosenMonReturnValue(battler, BUFFER_B, gSelectedMonPartyId, gBattlePartyCurrentOrder); + BtlController_EmitChosenMonReturnValue(battler, B_COMM_TO_ENGINE, gSelectedMonPartyId, gBattlePartyCurrentOrder); else - BtlController_EmitChosenMonReturnValue(battler, BUFFER_B, PARTY_SIZE, NULL); + BtlController_EmitChosenMonReturnValue(battler, B_COMM_TO_ENGINE, PARTY_SIZE, NULL); if ((gBattleResources->bufferA[battler][1] & 0xF) == 1) PrintLinkStandbyMsg(); @@ -1613,7 +1613,7 @@ static void CompleteWhenChoseItem(u32 battler) { if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active) { - BtlController_EmitOneReturnValue(battler, BUFFER_B, gSpecialVar_ItemId); + BtlController_EmitOneReturnValue(battler, B_COMM_TO_ENGINE, gSpecialVar_ItemId); PlayerBufferExecCompleted(battler); } } @@ -1640,9 +1640,9 @@ static void PlayerHandleYesNoInput(u32 battler) PlaySE(SE_SELECT); if (gMultiUsePlayerCursor != 0) - BtlController_EmitTwoReturnValues(battler, BUFFER_B, 0xE, 0); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, 0xE, 0); else - BtlController_EmitTwoReturnValues(battler, BUFFER_B, 0xD, 0); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, 0xD, 0); PlayerBufferExecCompleted(battler); } @@ -1714,7 +1714,6 @@ static void MoveSelectionDisplayMoveType(u32 battler) } else if (effect == EFFECT_IVY_CUDGEL) { - if (speciesId == SPECIES_OGERPON_WELLSPRING || speciesId == SPECIES_OGERPON_WELLSPRING_TERA || speciesId == SPECIES_OGERPON_HEARTHFLAME || speciesId == SPECIES_OGERPON_HEARTHFLAME_TERA || speciesId == SPECIES_OGERPON_CORNERSTONE || speciesId == SPECIES_OGERPON_CORNERSTONE_TERA) @@ -1734,7 +1733,7 @@ static void MoveSelectionDisplayMoveType(u32 battler) else if (P_SHOW_DYNAMIC_TYPES) // Non-vanilla changes to battle UI showing dynamic types { struct Pokemon *mon = &gPlayerParty[gBattlerPartyIndexes[battler]]; - type = CheckDynamicMoveType(mon, move, battler); + type = CheckDynamicMoveType(mon, move, battler, MON_IN_BATTLE); } end = StringCopy(txtPtr, gTypesInfo[type].name); @@ -2116,7 +2115,7 @@ static void PlayerChooseMoveInBattlePalace(u32 battler) if (--gBattleStruct->arenaMindPoints[battler] == 0) { gBattlePalaceMoveSelectionRngValue = gRngValue; - BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, ChooseMoveAndTargetInBattlePalace(battler)); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, 10, ChooseMoveAndTargetInBattlePalace(battler)); PlayerBufferExecCompleted(battler); } } @@ -2182,7 +2181,7 @@ static void PlayerHandleChoosePokemon(u32 battler) && (gBattleResources->bufferA[battler][1] & 0xF) != PARTY_ACTION_CHOOSE_FAINTED_MON && (gBattleResources->bufferA[battler][1] & 0xF) != PARTY_ACTION_SEND_MON_TO_BOX) { - BtlController_EmitChosenMonReturnValue(battler, BUFFER_B, gBattlerPartyIndexes[battler] + 1, gBattlePartyCurrentOrder); + BtlController_EmitChosenMonReturnValue(battler, B_COMM_TO_ENGINE, gBattlerPartyIndexes[battler] + 1, gBattlePartyCurrentOrder); PlayerBufferExecCompleted(battler); } else @@ -2281,25 +2280,25 @@ static void PlayerHandlePlayBGM(u32 battler) static void PlayerHandleTwoReturnValues(u32 battler) { - BtlController_EmitTwoReturnValues(battler, BUFFER_B, 0, 0); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, 0, 0); PlayerBufferExecCompleted(battler); } static void PlayerHandleChosenMonReturnValue(u32 battler) { - BtlController_EmitChosenMonReturnValue(battler, BUFFER_B, 0, NULL); + BtlController_EmitChosenMonReturnValue(battler, B_COMM_TO_ENGINE, 0, NULL); PlayerBufferExecCompleted(battler); } static void PlayerHandleOneReturnValue(u32 battler) { - BtlController_EmitOneReturnValue(battler, BUFFER_B, 0); + BtlController_EmitOneReturnValue(battler, B_COMM_TO_ENGINE, 0); PlayerBufferExecCompleted(battler); } static void PlayerHandleOneReturnValue_Duplicate(u32 battler) { - BtlController_EmitOneReturnValue_Duplicate(battler, BUFFER_B, 0); + BtlController_EmitOneReturnValue_Duplicate(battler, B_COMM_TO_ENGINE, 0); PlayerBufferExecCompleted(battler); } diff --git a/src/battle_controller_player_partner.c b/src/battle_controller_player_partner.c index 39c1d25526..e4254023ca 100644 --- a/src/battle_controller_player_partner.c +++ b/src/battle_controller_player_partner.c @@ -265,7 +265,7 @@ static void PlayerPartnerBufferExecCompleted(u32 battler) { u8 playerId = GetMultiplayerId(); - PrepareBufferDataTransferLink(battler, 2, 4, &playerId); + PrepareBufferDataTransferLink(battler, B_COMM_CONTROLLER_IS_DONE, 4, &playerId); gBattleResources->bufferA[battler][0] = CONTROLLER_TERMINATOR_NOP; } else @@ -366,11 +366,11 @@ static void PlayerPartnerHandleChooseMove(u32 battler) && !(gBattleStruct->gimmick.usableGimmick[battler] == GIMMICK_Z_MOVE && !ShouldUseZMove(battler, gBattlerTarget, moveInfo->moves[chosenMoveId]))) { - BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, (chosenMoveId) | (RET_GIMMICK) | (gBattlerTarget << 8)); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, 10, (chosenMoveId) | (RET_GIMMICK) | (gBattlerTarget << 8)); } else { - BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, (chosenMoveId) | (gBattlerTarget << 8)); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, 10, (chosenMoveId) | (gBattlerTarget << 8)); } PlayerPartnerBufferExecCompleted(battler); @@ -413,7 +413,7 @@ static void PlayerPartnerHandleChoosePokemon(u32 battler) gBattleStruct->AI_monToSwitchIntoId[battler] = PARTY_SIZE; gBattleStruct->monToSwitchIntoId[battler] = chosenMonId; } - BtlController_EmitChosenMonReturnValue(battler, BUFFER_B, chosenMonId, NULL); + BtlController_EmitChosenMonReturnValue(battler, B_COMM_TO_ENGINE, chosenMonId, NULL); PlayerPartnerBufferExecCompleted(battler); } diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c index 38d2e0ea02..0c970a8aac 100644 --- a/src/battle_controller_recorded_opponent.c +++ b/src/battle_controller_recorded_opponent.c @@ -451,7 +451,7 @@ static void RecordedOpponentHandlePrintString(u32 battler) static void RecordedOpponentHandleChooseAction(u32 battler) { - BtlController_EmitTwoReturnValues(battler, BUFFER_B, RecordedBattle_GetBattlerAction(RECORDED_ACTION_TYPE, battler), 0); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, RecordedBattle_GetBattlerAction(RECORDED_ACTION_TYPE, battler), 0); RecordedOpponentBufferExecCompleted(battler); } @@ -459,13 +459,13 @@ static void RecordedOpponentHandleChooseMove(u32 battler) { if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, ChooseMoveAndTargetInBattlePalace(battler)); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, 10, ChooseMoveAndTargetInBattlePalace(battler)); } else { u8 moveId = RecordedBattle_GetBattlerAction(RECORDED_MOVE_SLOT, battler); u8 target = RecordedBattle_GetBattlerAction(RECORDED_MOVE_TARGET, battler); - BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, moveId | (target << 8)); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, 10, moveId | (target << 8)); } RecordedOpponentBufferExecCompleted(battler); @@ -478,7 +478,7 @@ static void RecordedOpponentHandleChooseItem(u32 battler) gBattleStruct->chosenItem[battler] = (byte1 << 8) | byte2; gBattleStruct->itemPartyIndex[battler] = RecordedBattle_GetBattlerAction(RECORDED_ITEM_TARGET, battler); gBattleStruct->itemMoveIndex[battler] = RecordedBattle_GetBattlerAction(RECORDED_ITEM_MOVE, battler); - BtlController_EmitOneReturnValue(battler, BUFFER_B, gBattleStruct->chosenItem[battler]); + BtlController_EmitOneReturnValue(battler, B_COMM_TO_ENGINE, gBattleStruct->chosenItem[battler]); RecordedOpponentBufferExecCompleted(battler); } @@ -486,7 +486,7 @@ static void RecordedOpponentHandleChoosePokemon(u32 battler) { gBattleStruct->monToSwitchIntoId[battler] = RecordedBattle_GetBattlerAction(RECORDED_PARTY_INDEX, battler); gSelectedMonPartyId = gBattleStruct->monToSwitchIntoId[battler]; // Revival Blessing - BtlController_EmitChosenMonReturnValue(battler, BUFFER_B, gBattleStruct->monToSwitchIntoId[battler], NULL); + BtlController_EmitChosenMonReturnValue(battler, B_COMM_TO_ENGINE, gBattleStruct->monToSwitchIntoId[battler], NULL); RecordedOpponentBufferExecCompleted(battler); } diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c index 2ca57d7af8..f65eb1dc73 100644 --- a/src/battle_controller_recorded_player.c +++ b/src/battle_controller_recorded_player.c @@ -342,7 +342,7 @@ static void RecordedPlayerBufferExecCompleted(u32 battler) { u8 playerId = GetMultiplayerId(); - PrepareBufferDataTransferLink(battler, 2, 4, &playerId); + PrepareBufferDataTransferLink(battler, B_COMM_CONTROLLER_IS_DONE, 4, &playerId); gBattleResources->bufferA[battler][0] = CONTROLLER_TERMINATOR_NOP; } else @@ -430,7 +430,7 @@ static void ChooseActionInBattlePalace(u32 battler) { if (gBattleCommunication[4] >= gBattlersCount / 2) { - BtlController_EmitTwoReturnValues(battler, BUFFER_B, RecordedBattle_GetBattlerAction(RECORDED_BATTLE_PALACE_ACTION, battler), 0); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, RecordedBattle_GetBattlerAction(RECORDED_BATTLE_PALACE_ACTION, battler), 0); RecordedPlayerBufferExecCompleted(battler); } } @@ -443,7 +443,7 @@ static void RecordedPlayerHandleChooseAction(u32 battler) } else { - BtlController_EmitTwoReturnValues(battler, BUFFER_B, RecordedBattle_GetBattlerAction(RECORDED_ACTION_TYPE, battler), 0); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, RecordedBattle_GetBattlerAction(RECORDED_ACTION_TYPE, battler), 0); RecordedPlayerBufferExecCompleted(battler); } } @@ -452,13 +452,13 @@ static void RecordedPlayerHandleChooseMove(u32 battler) { if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, ChooseMoveAndTargetInBattlePalace(battler)); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, 10, ChooseMoveAndTargetInBattlePalace(battler)); } else { - u8 moveId = RecordedBattle_GetBattlerAction(RECORDED_MOVE_SLOT, battler); + u8 moveIndex = RecordedBattle_GetBattlerAction(RECORDED_MOVE_SLOT, battler); u8 target = RecordedBattle_GetBattlerAction(RECORDED_MOVE_TARGET, battler); - BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, moveId | (target << 8)); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, 10, moveIndex | (target << 8)); } RecordedPlayerBufferExecCompleted(battler); @@ -471,7 +471,7 @@ static void RecordedPlayerHandleChooseItem(u32 battler) gBattleStruct->chosenItem[battler] = (byte1 << 8) | byte2; gBattleStruct->itemPartyIndex[battler] = RecordedBattle_GetBattlerAction(RECORDED_ITEM_TARGET, battler); gBattleStruct->itemMoveIndex[battler] = RecordedBattle_GetBattlerAction(RECORDED_ITEM_MOVE, battler); - BtlController_EmitOneReturnValue(battler, BUFFER_B, gBattleStruct->chosenItem[battler]); + BtlController_EmitOneReturnValue(battler, B_COMM_TO_ENGINE, gBattleStruct->chosenItem[battler]); RecordedPlayerBufferExecCompleted(battler); } @@ -479,7 +479,7 @@ static void RecordedPlayerHandleChoosePokemon(u32 battler) { gBattleStruct->monToSwitchIntoId[battler] = RecordedBattle_GetBattlerAction(RECORDED_PARTY_INDEX, battler); gSelectedMonPartyId = gBattleStruct->monToSwitchIntoId[battler]; // Revival Blessing - BtlController_EmitChosenMonReturnValue(battler, BUFFER_B, gBattleStruct->monToSwitchIntoId[battler], NULL); + BtlController_EmitChosenMonReturnValue(battler, B_COMM_TO_ENGINE, gBattleStruct->monToSwitchIntoId[battler], NULL); RecordedPlayerBufferExecCompleted(battler); } diff --git a/src/battle_controller_safari.c b/src/battle_controller_safari.c index 2d85ddaaec..7c2542b603 100644 --- a/src/battle_controller_safari.c +++ b/src/battle_controller_safari.c @@ -127,16 +127,16 @@ static void HandleInputChooseAction(u32 battler) switch (gActionSelectionCursor[battler]) { case 0: - BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_SAFARI_BALL, 0); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, B_ACTION_SAFARI_BALL, 0); break; case 1: - BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_SAFARI_POKEBLOCK, 0); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, B_ACTION_SAFARI_POKEBLOCK, 0); break; case 2: - BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_SAFARI_GO_NEAR, 0); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, B_ACTION_SAFARI_GO_NEAR, 0); break; case 3: - BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_SAFARI_RUN, 0); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, B_ACTION_SAFARI_RUN, 0); break; } SafariBufferExecCompleted(battler); @@ -220,7 +220,7 @@ static void CompleteWhenChosePokeblock(u32 battler) { if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active) { - BtlController_EmitOneReturnValue(battler, BUFFER_B, gSpecialVar_ItemId); + BtlController_EmitOneReturnValue(battler, B_COMM_TO_ENGINE, gSpecialVar_ItemId); SafariBufferExecCompleted(battler); } } @@ -232,7 +232,7 @@ static void SafariBufferExecCompleted(u32 battler) { u8 playerId = GetMultiplayerId(); - PrepareBufferDataTransferLink(battler, 2, 4, &playerId); + PrepareBufferDataTransferLink(battler, B_COMM_CONTROLLER_IS_DONE, 4, &playerId); gBattleResources->bufferA[battler][0] = CONTROLLER_TERMINATOR_NOP; } else diff --git a/src/battle_controller_wally.c b/src/battle_controller_wally.c index bba1ffd1da..f4de1f9c27 100644 --- a/src/battle_controller_wally.c +++ b/src/battle_controller_wally.c @@ -145,7 +145,7 @@ static void WallyHandleActions(u32 battler) if (--gBattleStruct->wallyWaitFrames == 0) { PlaySE(SE_SELECT); - BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_USE_MOVE, 0); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, B_ACTION_USE_MOVE, 0); WallyBufferExecCompleted(battler); gBattleStruct->wallyBattleState++; gBattleStruct->wallyMovesState = 0; @@ -156,7 +156,7 @@ static void WallyHandleActions(u32 battler) if (--gBattleStruct->wallyWaitFrames == 0) { PlaySE(SE_SELECT); - BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_USE_MOVE, 0); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, B_ACTION_USE_MOVE, 0); WallyBufferExecCompleted(battler); gBattleStruct->wallyBattleState++; gBattleStruct->wallyMovesState = 0; @@ -166,7 +166,7 @@ static void WallyHandleActions(u32 battler) case 3: if (--gBattleStruct->wallyWaitFrames == 0) { - BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_WALLY_THROW, 0); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, B_ACTION_WALLY_THROW, 0); WallyBufferExecCompleted(battler); gBattleStruct->wallyBattleState++; gBattleStruct->wallyMovesState = 0; @@ -187,7 +187,7 @@ static void WallyHandleActions(u32 battler) if (--gBattleStruct->wallyWaitFrames == 0) { PlaySE(SE_SELECT); - BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_USE_ITEM, 0); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, B_ACTION_USE_ITEM, 0); WallyBufferExecCompleted(battler); } break; @@ -209,7 +209,7 @@ static void CompleteOnChosenItem(u32 battler) { if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active) { - BtlController_EmitOneReturnValue(battler, BUFFER_B, gSpecialVar_ItemId); + BtlController_EmitOneReturnValue(battler, B_COMM_TO_ENGINE, gSpecialVar_ItemId); WallyBufferExecCompleted(battler); } } @@ -279,7 +279,7 @@ static void WallyBufferExecCompleted(u32 battler) { u8 playerId = GetMultiplayerId(); - PrepareBufferDataTransferLink(battler, 2, 4, &playerId); + PrepareBufferDataTransferLink(battler, B_COMM_CONTROLLER_IS_DONE, 4, &playerId); gBattleResources->bufferA[battler][0] = CONTROLLER_TERMINATOR_NOP; } else @@ -378,7 +378,7 @@ static void WallyHandleChooseMove(u32 battler) if (--gBattleStruct->wallyMoveFrames == 0) { PlaySE(SE_SELECT); - BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, 0x100); + BtlController_EmitTwoReturnValues(battler, B_COMM_TO_ENGINE, 10, 0x100); WallyBufferExecCompleted(battler); } break; diff --git a/src/battle_controllers.c b/src/battle_controllers.c index c43f7f8309..88f8b1f7c3 100644 --- a/src/battle_controllers.c +++ b/src/battle_controllers.c @@ -127,31 +127,31 @@ static void InitSinglePlayerBtlControllers(void) if (gBattleTypeFlags & BATTLE_TYPE_RECORDED) { - gBattlerControllerFuncs[0] = SetControllerToRecordedPlayer; - gBattlerPositions[0] = B_POSITION_PLAYER_LEFT; + gBattlerControllerFuncs[B_BATTLER_0] = SetControllerToRecordedPlayer; + gBattlerPositions[B_BATTLER_0] = B_POSITION_PLAYER_LEFT; - gBattlerControllerFuncs[1] = SetControllerToOpponent; - gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT; + gBattlerControllerFuncs[B_BATTLER_1] = SetControllerToOpponent; + gBattlerPositions[B_BATTLER_1] = B_POSITION_OPPONENT_LEFT; - gBattlerControllerFuncs[2] = SetControllerToPlayerPartner; - gBattlerPositions[2] = B_POSITION_PLAYER_RIGHT; + gBattlerControllerFuncs[B_BATTLER_2] = SetControllerToPlayerPartner; + gBattlerPositions[B_BATTLER_2] = B_POSITION_PLAYER_RIGHT; - gBattlerControllerFuncs[3] = SetControllerToOpponent; - gBattlerPositions[3] = B_POSITION_OPPONENT_RIGHT; + gBattlerControllerFuncs[B_BATTLER_3] = SetControllerToOpponent; + gBattlerPositions[B_BATTLER_3] = B_POSITION_OPPONENT_RIGHT; } else { - gBattlerControllerFuncs[0] = SetControllerToPlayer; - gBattlerPositions[0] = B_POSITION_PLAYER_LEFT; + gBattlerControllerFuncs[B_BATTLER_0] = SetControllerToPlayer; + gBattlerPositions[B_BATTLER_0] = B_POSITION_PLAYER_LEFT; - gBattlerControllerFuncs[1] = SetControllerToOpponent; - gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT; + gBattlerControllerFuncs[B_BATTLER_1] = SetControllerToOpponent; + gBattlerPositions[B_BATTLER_1] = B_POSITION_OPPONENT_LEFT; - gBattlerControllerFuncs[2] = SetControllerToPlayerPartner; - gBattlerPositions[2] = B_POSITION_PLAYER_RIGHT; + gBattlerControllerFuncs[B_BATTLER_2] = SetControllerToPlayerPartner; + gBattlerPositions[B_BATTLER_2] = B_POSITION_PLAYER_RIGHT; - gBattlerControllerFuncs[3] = SetControllerToOpponent; - gBattlerPositions[3] = B_POSITION_OPPONENT_RIGHT; + gBattlerControllerFuncs[B_BATTLER_3] = SetControllerToOpponent; + gBattlerPositions[B_BATTLER_3] = B_POSITION_OPPONENT_RIGHT; } gBattlersCount = MAX_BATTLERS_COUNT; @@ -179,18 +179,18 @@ static void InitSinglePlayerBtlControllers(void) gBattleMainFunc = BeginBattleIntro; if (gBattleTypeFlags & BATTLE_TYPE_SAFARI) - gBattlerControllerFuncs[0] = SetControllerToSafari; + gBattlerControllerFuncs[B_BATTLER_0] = SetControllerToSafari; else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL) - gBattlerControllerFuncs[0] = SetControllerToWally; + gBattlerControllerFuncs[B_BATTLER_0] = SetControllerToWally; else if (IsAiVsAiBattle()) - gBattlerControllerFuncs[0] = SetControllerToPlayerPartner; + gBattlerControllerFuncs[B_BATTLER_0] = SetControllerToPlayerPartner; else - gBattlerControllerFuncs[0] = SetControllerToPlayer; + gBattlerControllerFuncs[B_BATTLER_0] = SetControllerToPlayer; - gBattlerPositions[0] = B_POSITION_PLAYER_LEFT; + gBattlerPositions[B_BATTLER_0] = B_POSITION_PLAYER_LEFT; - gBattlerControllerFuncs[1] = SetControllerToOpponent; - gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT; + gBattlerControllerFuncs[B_BATTLER_1] = SetControllerToOpponent; + gBattlerPositions[B_BATTLER_1] = B_POSITION_OPPONENT_LEFT; gBattlersCount = 2; @@ -202,32 +202,32 @@ static void InitSinglePlayerBtlControllers(void) { gBattleMainFunc = BeginBattleIntro; - gBattlerControllerFuncs[0] = SetControllerToRecordedPlayer; - gBattlerPositions[0] = B_POSITION_PLAYER_LEFT; + gBattlerControllerFuncs[B_BATTLER_0] = SetControllerToRecordedPlayer; + gBattlerPositions[B_BATTLER_0] = B_POSITION_PLAYER_LEFT; - gBattlerControllerFuncs[1] = SetControllerToRecordedOpponent; - gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT; + gBattlerControllerFuncs[B_BATTLER_1] = SetControllerToRecordedOpponent; + gBattlerPositions[B_BATTLER_1] = B_POSITION_OPPONENT_LEFT; gBattlersCount = 2; } else // see how the banks are switched { - gBattlerControllerFuncs[1] = SetControllerToRecordedPlayer; - gBattlerPositions[1] = B_POSITION_PLAYER_LEFT; + gBattlerControllerFuncs[B_BATTLER_1] = SetControllerToRecordedPlayer; + gBattlerPositions[B_BATTLER_1] = B_POSITION_PLAYER_LEFT; - gBattlerControllerFuncs[0] = SetControllerToRecordedOpponent; - gBattlerPositions[0] = B_POSITION_OPPONENT_LEFT; + gBattlerControllerFuncs[B_BATTLER_0] = SetControllerToRecordedOpponent; + gBattlerPositions[B_BATTLER_0] = B_POSITION_OPPONENT_LEFT; gBattlersCount = 2; } } else { - gBattlerControllerFuncs[0] = SetControllerToRecordedPlayer; - gBattlerPositions[0] = B_POSITION_PLAYER_LEFT; + gBattlerControllerFuncs[B_BATTLER_0] = SetControllerToRecordedPlayer; + gBattlerPositions[B_BATTLER_0] = B_POSITION_PLAYER_LEFT; - gBattlerControllerFuncs[1] = SetControllerToOpponent; - gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT; + gBattlerControllerFuncs[B_BATTLER_1] = SetControllerToOpponent; + gBattlerPositions[B_BATTLER_1] = B_POSITION_OPPONENT_LEFT; } } } @@ -236,22 +236,22 @@ static void InitSinglePlayerBtlControllers(void) gBattleMainFunc = BeginBattleIntro; if (IsAiVsAiBattle()) - gBattlerControllerFuncs[0] = SetControllerToPlayerPartner; + gBattlerControllerFuncs[B_BATTLER_0] = SetControllerToPlayerPartner; else - gBattlerControllerFuncs[0] = SetControllerToPlayer; - gBattlerPositions[0] = B_POSITION_PLAYER_LEFT; + gBattlerControllerFuncs[B_BATTLER_0] = SetControllerToPlayer; + gBattlerPositions[B_BATTLER_0] = B_POSITION_PLAYER_LEFT; - gBattlerControllerFuncs[1] = SetControllerToOpponent; - gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT; + gBattlerControllerFuncs[B_BATTLER_1] = SetControllerToOpponent; + gBattlerPositions[B_BATTLER_1] = B_POSITION_OPPONENT_LEFT; if (IsAiVsAiBattle()) - gBattlerControllerFuncs[2] = SetControllerToPlayerPartner; + gBattlerControllerFuncs[B_BATTLER_2] = SetControllerToPlayerPartner; else - gBattlerControllerFuncs[2] = SetControllerToPlayer; - gBattlerPositions[2] = B_POSITION_PLAYER_RIGHT; + gBattlerControllerFuncs[B_BATTLER_2] = SetControllerToPlayer; + gBattlerPositions[B_BATTLER_2] = B_POSITION_PLAYER_RIGHT; - gBattlerControllerFuncs[3] = SetControllerToOpponent; - gBattlerPositions[3] = B_POSITION_OPPONENT_RIGHT; + gBattlerControllerFuncs[B_BATTLER_3] = SetControllerToOpponent; + gBattlerPositions[B_BATTLER_3] = B_POSITION_OPPONENT_RIGHT; gBattlersCount = MAX_BATTLERS_COUNT; @@ -261,17 +261,17 @@ static void InitSinglePlayerBtlControllers(void) { gBattleMainFunc = BeginBattleIntro; - gBattlerControllerFuncs[0] = SetControllerToRecordedPlayer; - gBattlerPositions[0] = B_POSITION_PLAYER_LEFT; + gBattlerControllerFuncs[B_BATTLER_0] = SetControllerToRecordedPlayer; + gBattlerPositions[B_BATTLER_0] = B_POSITION_PLAYER_LEFT; - gBattlerControllerFuncs[1] = SetControllerToOpponent; - gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT; + gBattlerControllerFuncs[B_BATTLER_1] = SetControllerToOpponent; + gBattlerPositions[B_BATTLER_1] = B_POSITION_OPPONENT_LEFT; - gBattlerControllerFuncs[2] = SetControllerToRecordedPlayer; - gBattlerPositions[2] = B_POSITION_PLAYER_RIGHT; + gBattlerControllerFuncs[B_BATTLER_2] = SetControllerToRecordedPlayer; + gBattlerPositions[B_BATTLER_2] = B_POSITION_PLAYER_RIGHT; - gBattlerControllerFuncs[3] = SetControllerToOpponent; - gBattlerPositions[3] = B_POSITION_OPPONENT_RIGHT; + gBattlerControllerFuncs[B_BATTLER_3] = SetControllerToOpponent; + gBattlerPositions[B_BATTLER_3] = B_POSITION_OPPONENT_RIGHT; gBattlersCount = MAX_BATTLERS_COUNT; @@ -359,52 +359,52 @@ static void InitSinglePlayerBtlControllers(void) } else if (gBattleTypeFlags & BATTLE_TYPE_IS_MASTER) { - gBattlerControllerFuncs[0] = SetControllerToRecordedPlayer; - gBattlerPositions[0] = B_POSITION_PLAYER_LEFT; + gBattlerControllerFuncs[B_BATTLER_0] = SetControllerToRecordedPlayer; + gBattlerPositions[B_BATTLER_0] = B_POSITION_PLAYER_LEFT; - gBattlerControllerFuncs[2] = SetControllerToRecordedPlayer; - gBattlerPositions[2] = B_POSITION_PLAYER_RIGHT; + gBattlerControllerFuncs[B_BATTLER_2] = SetControllerToRecordedPlayer; + gBattlerPositions[B_BATTLER_2] = B_POSITION_PLAYER_RIGHT; if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK) { - gBattlerControllerFuncs[1] = SetControllerToRecordedOpponent; - gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT; + gBattlerControllerFuncs[B_BATTLER_1] = SetControllerToRecordedOpponent; + gBattlerPositions[B_BATTLER_1] = B_POSITION_OPPONENT_LEFT; - gBattlerControllerFuncs[3] = SetControllerToRecordedOpponent; - gBattlerPositions[3] = B_POSITION_OPPONENT_RIGHT; + gBattlerControllerFuncs[B_BATTLER_3] = SetControllerToRecordedOpponent; + gBattlerPositions[B_BATTLER_3] = B_POSITION_OPPONENT_RIGHT; } else { - gBattlerControllerFuncs[1] = SetControllerToOpponent; - gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT; + gBattlerControllerFuncs[B_BATTLER_1] = SetControllerToOpponent; + gBattlerPositions[B_BATTLER_1] = B_POSITION_OPPONENT_LEFT; - gBattlerControllerFuncs[3] = SetControllerToOpponent; - gBattlerPositions[3] = B_POSITION_OPPONENT_RIGHT; + gBattlerControllerFuncs[B_BATTLER_3] = SetControllerToOpponent; + gBattlerPositions[B_BATTLER_3] = B_POSITION_OPPONENT_RIGHT; } } else { - gBattlerControllerFuncs[1] = SetControllerToRecordedPlayer; - gBattlerPositions[1] = B_POSITION_PLAYER_LEFT; + gBattlerControllerFuncs[B_BATTLER_1] = SetControllerToRecordedPlayer; + gBattlerPositions[B_BATTLER_1] = B_POSITION_PLAYER_LEFT; - gBattlerControllerFuncs[3] = SetControllerToRecordedPlayer; - gBattlerPositions[3] = B_POSITION_PLAYER_RIGHT; + gBattlerControllerFuncs[B_BATTLER_3] = SetControllerToRecordedPlayer; + gBattlerPositions[B_BATTLER_3] = B_POSITION_PLAYER_RIGHT; if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK) { - gBattlerControllerFuncs[0] = SetControllerToRecordedOpponent; - gBattlerPositions[0] = B_POSITION_OPPONENT_LEFT; + gBattlerControllerFuncs[B_BATTLER_0] = SetControllerToRecordedOpponent; + gBattlerPositions[B_BATTLER_0] = B_POSITION_OPPONENT_LEFT; - gBattlerControllerFuncs[2] = SetControllerToRecordedOpponent; - gBattlerPositions[2] = B_POSITION_OPPONENT_RIGHT; + gBattlerControllerFuncs[B_BATTLER_2] = SetControllerToRecordedOpponent; + gBattlerPositions[B_BATTLER_2] = B_POSITION_OPPONENT_RIGHT; } else { - gBattlerControllerFuncs[0] = SetControllerToOpponent; - gBattlerPositions[0] = B_POSITION_OPPONENT_LEFT; + gBattlerControllerFuncs[B_BATTLER_0] = SetControllerToOpponent; + gBattlerPositions[B_BATTLER_0] = B_POSITION_OPPONENT_LEFT; - gBattlerControllerFuncs[2] = SetControllerToOpponent; - gBattlerPositions[2] = B_POSITION_OPPONENT_RIGHT; + gBattlerControllerFuncs[B_BATTLER_2] = SetControllerToOpponent; + gBattlerPositions[B_BATTLER_2] = B_POSITION_OPPONENT_RIGHT; } } } @@ -422,21 +422,21 @@ static void InitLinkBtlControllers(void) { gBattleMainFunc = BeginBattleIntro; - gBattlerControllerFuncs[0] = SetControllerToPlayer; - gBattlerPositions[0] = B_POSITION_PLAYER_LEFT; + gBattlerControllerFuncs[B_BATTLER_0] = SetControllerToPlayer; + gBattlerPositions[B_BATTLER_0] = B_POSITION_PLAYER_LEFT; - gBattlerControllerFuncs[1] = SetControllerToLinkOpponent; - gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT; + gBattlerControllerFuncs[B_BATTLER_1] = SetControllerToLinkOpponent; + gBattlerPositions[B_BATTLER_1] = B_POSITION_OPPONENT_LEFT; gBattlersCount = 2; } else { - gBattlerControllerFuncs[1] = SetControllerToPlayer; - gBattlerPositions[1] = B_POSITION_PLAYER_LEFT; + gBattlerControllerFuncs[B_BATTLER_1] = SetControllerToPlayer; + gBattlerPositions[B_BATTLER_1] = B_POSITION_PLAYER_LEFT; - gBattlerControllerFuncs[0] = SetControllerToLinkOpponent; - gBattlerPositions[0] = B_POSITION_OPPONENT_LEFT; + gBattlerControllerFuncs[B_BATTLER_0] = SetControllerToLinkOpponent; + gBattlerPositions[B_BATTLER_0] = B_POSITION_OPPONENT_LEFT; gBattlersCount = 2; } @@ -447,33 +447,33 @@ static void InitLinkBtlControllers(void) { gBattleMainFunc = BeginBattleIntro; - gBattlerControllerFuncs[0] = SetControllerToPlayer; - gBattlerPositions[0] = B_POSITION_PLAYER_LEFT; + gBattlerControllerFuncs[B_BATTLER_0] = SetControllerToPlayer; + gBattlerPositions[B_BATTLER_0] = B_POSITION_PLAYER_LEFT; - gBattlerControllerFuncs[1] = SetControllerToLinkOpponent; - gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT; + gBattlerControllerFuncs[B_BATTLER_1] = SetControllerToLinkOpponent; + gBattlerPositions[B_BATTLER_1] = B_POSITION_OPPONENT_LEFT; - gBattlerControllerFuncs[2] = SetControllerToPlayer; - gBattlerPositions[2] = B_POSITION_PLAYER_RIGHT; + gBattlerControllerFuncs[B_BATTLER_2] = SetControllerToPlayer; + gBattlerPositions[B_BATTLER_2] = B_POSITION_PLAYER_RIGHT; - gBattlerControllerFuncs[3] = SetControllerToLinkOpponent; - gBattlerPositions[3] = B_POSITION_OPPONENT_RIGHT; + gBattlerControllerFuncs[B_BATTLER_3] = SetControllerToLinkOpponent; + gBattlerPositions[B_BATTLER_3] = B_POSITION_OPPONENT_RIGHT; gBattlersCount = MAX_BATTLERS_COUNT; } else { - gBattlerControllerFuncs[1] = SetControllerToPlayer; - gBattlerPositions[1] = B_POSITION_PLAYER_LEFT; + gBattlerControllerFuncs[B_BATTLER_1] = SetControllerToPlayer; + gBattlerPositions[B_BATTLER_1] = B_POSITION_PLAYER_LEFT; - gBattlerControllerFuncs[0] = SetControllerToLinkOpponent; - gBattlerPositions[0] = B_POSITION_OPPONENT_LEFT; + gBattlerControllerFuncs[B_BATTLER_0] = SetControllerToLinkOpponent; + gBattlerPositions[B_BATTLER_0] = B_POSITION_OPPONENT_LEFT; - gBattlerControllerFuncs[3] = SetControllerToPlayer; - gBattlerPositions[3] = B_POSITION_PLAYER_RIGHT; + gBattlerControllerFuncs[B_BATTLER_3] = SetControllerToPlayer; + gBattlerPositions[B_BATTLER_3] = B_POSITION_PLAYER_RIGHT; - gBattlerControllerFuncs[2] = SetControllerToLinkOpponent; - gBattlerPositions[2] = B_POSITION_OPPONENT_RIGHT; + gBattlerControllerFuncs[B_BATTLER_2] = SetControllerToLinkOpponent; + gBattlerPositions[B_BATTLER_2] = B_POSITION_OPPONENT_RIGHT; gBattlersCount = MAX_BATTLERS_COUNT; } @@ -484,33 +484,33 @@ static void InitLinkBtlControllers(void) { gBattleMainFunc = BeginBattleIntro; - gBattlerControllerFuncs[0] = SetControllerToPlayer; - gBattlerPositions[0] = B_POSITION_PLAYER_LEFT; + gBattlerControllerFuncs[B_BATTLER_0] = SetControllerToPlayer; + gBattlerPositions[B_BATTLER_0] = B_POSITION_PLAYER_LEFT; - gBattlerControllerFuncs[1] = SetControllerToOpponent; - gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT; + gBattlerControllerFuncs[B_BATTLER_1] = SetControllerToOpponent; + gBattlerPositions[B_BATTLER_1] = B_POSITION_OPPONENT_LEFT; - gBattlerControllerFuncs[2] = SetControllerToLinkPartner; - gBattlerPositions[2] = B_POSITION_PLAYER_RIGHT; + gBattlerControllerFuncs[B_BATTLER_2] = SetControllerToLinkPartner; + gBattlerPositions[B_BATTLER_2] = B_POSITION_PLAYER_RIGHT; - gBattlerControllerFuncs[3] = SetControllerToOpponent; - gBattlerPositions[3] = B_POSITION_OPPONENT_RIGHT; + gBattlerControllerFuncs[B_BATTLER_3] = SetControllerToOpponent; + gBattlerPositions[B_BATTLER_3] = B_POSITION_OPPONENT_RIGHT; gBattlersCount = MAX_BATTLERS_COUNT; } else { - gBattlerControllerFuncs[0] = SetControllerToLinkPartner; - gBattlerPositions[0] = B_POSITION_PLAYER_LEFT; + gBattlerControllerFuncs[B_BATTLER_0] = SetControllerToLinkPartner; + gBattlerPositions[B_BATTLER_0] = B_POSITION_PLAYER_LEFT; - gBattlerControllerFuncs[1] = SetControllerToLinkOpponent; - gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT; + gBattlerControllerFuncs[B_BATTLER_1] = SetControllerToLinkOpponent; + gBattlerPositions[B_BATTLER_1] = B_POSITION_OPPONENT_LEFT; - gBattlerControllerFuncs[2] = SetControllerToPlayer; - gBattlerPositions[2] = B_POSITION_PLAYER_RIGHT; + gBattlerControllerFuncs[B_BATTLER_2] = SetControllerToPlayer; + gBattlerPositions[B_BATTLER_2] = B_POSITION_PLAYER_RIGHT; - gBattlerControllerFuncs[3] = SetControllerToLinkOpponent; - gBattlerPositions[3] = B_POSITION_OPPONENT_RIGHT; + gBattlerControllerFuncs[B_BATTLER_3] = SetControllerToLinkOpponent; + gBattlerPositions[B_BATTLER_3] = B_POSITION_OPPONENT_RIGHT; gBattlersCount = MAX_BATTLERS_COUNT; } @@ -689,11 +689,11 @@ static void PrepareBufferDataTransfer(u32 battler, u32 bufferId, u8 *data, u16 s { switch (bufferId) { - case BUFFER_A: + case B_COMM_TO_CONTROLLER: for (i = 0; i < size; data++, i++) gBattleResources->bufferA[battler][i] = *data; break; - case BUFFER_B: + case B_COMM_TO_ENGINE: for (i = 0; i < size; data++, i++) gBattleResources->bufferB[battler][i] = *data; break; @@ -701,20 +701,41 @@ static void PrepareBufferDataTransfer(u32 battler, u32 bufferId, u8 *data, u16 s } } +#define tInitialDelayTimer data[10] +#define tState data[11] +#define tCurrentBlock_WrapFrom data[12] +#define tBlockSendDelayTimer data[13] +#define tCurrentBlock_End data[14] +#define tCurrentBlock_Start data[15] +// +// Inbound communications are stored in one buffer; outbound communications +// in another. Both buffers work pretty similarly: the next message will be +// written into the buffer after the previous message (with 4-byte alignment), +// unless we're too close to the end of the buffer, in which case we jump back +// to the start. +// +// Regarding the task variable names above: these variables are altered in- +// place, so the precise operational definition of "current" depends on when +// the variables are being accessed. When data is present in the send and +// receive buffers, "current" refers to the most recently received message; +// but when a message is actually being placed in the buffers, "current" +// refers to the previous message, until such time that we finish updating it +// to refer to the new message. + static void CreateTasksForSendRecvLinkBuffers(void) { sLinkSendTaskId = CreateTask(Task_HandleSendLinkBuffersData, 0); - gTasks[sLinkSendTaskId].data[11] = 0; - gTasks[sLinkSendTaskId].data[12] = 0; - gTasks[sLinkSendTaskId].data[13] = 0; - gTasks[sLinkSendTaskId].data[14] = 0; - gTasks[sLinkSendTaskId].data[15] = 0; + gTasks[sLinkSendTaskId].tState = 0; + gTasks[sLinkSendTaskId].tCurrentBlock_WrapFrom = 0; + gTasks[sLinkSendTaskId].tBlockSendDelayTimer = 0; + gTasks[sLinkSendTaskId].tCurrentBlock_End = 0; + gTasks[sLinkSendTaskId].tCurrentBlock_Start = 0; sLinkReceiveTaskId = CreateTask(Task_HandleCopyReceivedLinkBuffersData, 0); - gTasks[sLinkReceiveTaskId].data[12] = 0; - gTasks[sLinkReceiveTaskId].data[13] = 0; - gTasks[sLinkReceiveTaskId].data[14] = 0; - gTasks[sLinkReceiveTaskId].data[15] = 0; + gTasks[sLinkReceiveTaskId].tCurrentBlock_WrapFrom = 0; + gTasks[sLinkReceiveTaskId].tBlockSendDelayTimer = 0; // not used by "receive" task + gTasks[sLinkReceiveTaskId].tCurrentBlock_End = 0; + gTasks[sLinkReceiveTaskId].tCurrentBlock_Start = 0; } enum @@ -730,52 +751,72 @@ enum LINK_BUFF_DATA, }; +// We want to send a message. Place it into the "send" buffer. +// First argument is a BATTLELINKCOMMTYPE_ void PrepareBufferDataTransferLink(u32 battler, u32 bufferId, u16 size, u8 *data) { s32 alignedSize; s32 i; alignedSize = size - size % 4 + 4; - if (gTasks[sLinkSendTaskId].data[14] + alignedSize + LINK_BUFF_DATA + 1 > BATTLE_BUFFER_LINK_SIZE) + if (gTasks[sLinkSendTaskId].tCurrentBlock_End + alignedSize + LINK_BUFF_DATA + 1 > BATTLE_BUFFER_LINK_SIZE) { - gTasks[sLinkSendTaskId].data[12] = gTasks[sLinkSendTaskId].data[14]; - gTasks[sLinkSendTaskId].data[14] = 0; + gTasks[sLinkSendTaskId].tCurrentBlock_WrapFrom = gTasks[sLinkSendTaskId].tCurrentBlock_End; + gTasks[sLinkSendTaskId].tCurrentBlock_End = 0; } - gLinkBattleSendBuffer[gTasks[sLinkSendTaskId].data[14] + LINK_BUFF_BUFFER_ID] = bufferId; - gLinkBattleSendBuffer[gTasks[sLinkSendTaskId].data[14] + LINK_BUFF_ACTIVE_BATTLER] = battler; - gLinkBattleSendBuffer[gTasks[sLinkSendTaskId].data[14] + LINK_BUFF_ATTACKER] = gBattlerAttacker; - gLinkBattleSendBuffer[gTasks[sLinkSendTaskId].data[14] + LINK_BUFF_TARGET] = gBattlerTarget; - gLinkBattleSendBuffer[gTasks[sLinkSendTaskId].data[14] + LINK_BUFF_SIZE_LO] = alignedSize; - gLinkBattleSendBuffer[gTasks[sLinkSendTaskId].data[14] + LINK_BUFF_SIZE_HI] = (alignedSize & 0x0000FF00) >> 8; - gLinkBattleSendBuffer[gTasks[sLinkSendTaskId].data[14] + LINK_BUFF_ABSENT_BATTLER_FLAGS] = gAbsentBattlerFlags; - gLinkBattleSendBuffer[gTasks[sLinkSendTaskId].data[14] + LINK_BUFF_EFFECT_BATTLER] = gEffectBattler; + + #define BYTE_TO_SEND(offset) \ + gLinkBattleSendBuffer[gTasks[sLinkSendTaskId].tCurrentBlock_End + offset] + + BYTE_TO_SEND(LINK_BUFF_BUFFER_ID) = bufferId; + BYTE_TO_SEND(LINK_BUFF_ACTIVE_BATTLER) = battler; + BYTE_TO_SEND(LINK_BUFF_ATTACKER) = gBattlerAttacker; + BYTE_TO_SEND(LINK_BUFF_TARGET) = gBattlerTarget; + BYTE_TO_SEND(LINK_BUFF_SIZE_LO) = alignedSize; + BYTE_TO_SEND(LINK_BUFF_SIZE_HI) = (alignedSize & 0x0000FF00) >> 8; + BYTE_TO_SEND(LINK_BUFF_ABSENT_BATTLER_FLAGS) = gAbsentBattlerFlags; + BYTE_TO_SEND(LINK_BUFF_EFFECT_BATTLER) = gEffectBattler; for (i = 0; i < size; i++) - gLinkBattleSendBuffer[gTasks[sLinkSendTaskId].data[14] + LINK_BUFF_DATA + i] = data[i]; + BYTE_TO_SEND(LINK_BUFF_DATA + i) = data[i]; - gTasks[sLinkSendTaskId].data[14] = gTasks[sLinkSendTaskId].data[14] + alignedSize + LINK_BUFF_DATA; + #undef BYTE_TO_SEND + + gTasks[sLinkSendTaskId].tCurrentBlock_End = gTasks[sLinkSendTaskId].tCurrentBlock_End + alignedSize + LINK_BUFF_DATA; } +enum { + SENDTASK_STATE_INITIALIZE = 0, + SENDTASK_STATE_INITIAL_DELAY = 1, + SENDTASK_STATE_COUNT_PLAYERS = 2, + SENDTASK_STATE_BEGIN_SEND_BLOCK = 3, + SENDTASK_STATE_FINISH_SEND_BLOCK = 4, + SENDTASK_STATE_UNUSED_STATE = 5, +}; + static void Task_HandleSendLinkBuffersData(u8 taskId) { u16 numPlayers; u16 blockSize; - switch (gTasks[taskId].data[11]) + #define BYTE_TO_SEND(offset) \ + gLinkBattleSendBuffer[gTasks[taskId].tCurrentBlock_Start + offset] + + switch (gTasks[taskId].tState) { - case 0: - gTasks[taskId].data[10] = 100; - gTasks[taskId].data[11]++; + case SENDTASK_STATE_INITIALIZE: + gTasks[taskId].tInitialDelayTimer = 100; + gTasks[taskId].tState++; break; - case 1: - gTasks[taskId].data[10]--; - if (gTasks[taskId].data[10] == 0) - gTasks[taskId].data[11]++; + case SENDTASK_STATE_INITIAL_DELAY: + gTasks[taskId].tInitialDelayTimer--; + if (gTasks[taskId].tInitialDelayTimer == 0) + gTasks[taskId].tState++; break; - case 2: + case SENDTASK_STATE_COUNT_PLAYERS: if (gWirelessCommType) { - gTasks[taskId].data[11]++; + gTasks[taskId].tState++; } else { @@ -789,56 +830,66 @@ static void Task_HandleSendLinkBuffersData(u8 taskId) if (IsLinkMaster()) { CheckShouldAdvanceLinkState(); - gTasks[taskId].data[11]++; + gTasks[taskId].tState++; } else { - gTasks[taskId].data[11]++; + gTasks[taskId].tState++; } } } break; - case 3: - if (gTasks[taskId].data[15] != gTasks[taskId].data[14]) + case SENDTASK_STATE_BEGIN_SEND_BLOCK: + if (gTasks[taskId].tCurrentBlock_Start != gTasks[taskId].tCurrentBlock_End) { - if (gTasks[taskId].data[13] == 0) + if (gTasks[taskId].tBlockSendDelayTimer == 0) { - if (gTasks[taskId].data[15] > gTasks[taskId].data[14] - && gTasks[taskId].data[15] == gTasks[taskId].data[12]) + if (gTasks[taskId].tCurrentBlock_Start > gTasks[taskId].tCurrentBlock_End + && gTasks[taskId].tCurrentBlock_Start == gTasks[taskId].tCurrentBlock_WrapFrom) { - gTasks[taskId].data[12] = 0; - gTasks[taskId].data[15] = 0; + gTasks[taskId].tCurrentBlock_WrapFrom = 0; + gTasks[taskId].tCurrentBlock_Start = 0; } - blockSize = (gLinkBattleSendBuffer[gTasks[taskId].data[15] + LINK_BUFF_SIZE_LO] | (gLinkBattleSendBuffer[gTasks[taskId].data[15] + LINK_BUFF_SIZE_HI] << 8)) + LINK_BUFF_DATA; - SendBlock(BitmaskAllOtherLinkPlayers(), &gLinkBattleSendBuffer[gTasks[taskId].data[15]], blockSize); - gTasks[taskId].data[11]++; + blockSize = (BYTE_TO_SEND(LINK_BUFF_SIZE_LO) | (BYTE_TO_SEND(LINK_BUFF_SIZE_HI) << 8)) + LINK_BUFF_DATA; + SendBlock(BitmaskAllOtherLinkPlayers(), &BYTE_TO_SEND(0), blockSize); + gTasks[taskId].tState++; } else { - gTasks[taskId].data[13]--; + gTasks[taskId].tBlockSendDelayTimer--; break; } } break; - case 4: + case SENDTASK_STATE_FINISH_SEND_BLOCK: if (IsLinkTaskFinished()) { - blockSize = gLinkBattleSendBuffer[gTasks[taskId].data[15] + LINK_BUFF_SIZE_LO] | (gLinkBattleSendBuffer[gTasks[taskId].data[15] + LINK_BUFF_SIZE_HI] << 8); - gTasks[taskId].data[13] = 1; - gTasks[taskId].data[15] = gTasks[taskId].data[15] + blockSize + LINK_BUFF_DATA; - gTasks[taskId].data[11] = 3; + blockSize = BYTE_TO_SEND(LINK_BUFF_SIZE_LO) | (BYTE_TO_SEND(LINK_BUFF_SIZE_HI) << 8); + gTasks[taskId].tBlockSendDelayTimer = 1; + gTasks[taskId].tCurrentBlock_Start = gTasks[taskId].tCurrentBlock_Start + blockSize + LINK_BUFF_DATA; + gTasks[taskId].tState = SENDTASK_STATE_BEGIN_SEND_BLOCK; } break; - case 5: - if (--gTasks[taskId].data[13] == 0) + case SENDTASK_STATE_UNUSED_STATE: + if (--gTasks[taskId].tBlockSendDelayTimer == 0) { - gTasks[taskId].data[13] = 1; - gTasks[taskId].data[11] = 3; + gTasks[taskId].tBlockSendDelayTimer = 1; + gTasks[taskId].tState = SENDTASK_STATE_BEGIN_SEND_BLOCK; } break; } + + #undef BYTE_TO_SEND } +// We have received a message. Place it into the "receive" buffer. +// +// Counterintuitively, we also "receive" the outbound messages that +// we send to other players. The GBA basically stores communicated +// data for all four players, so inbound and outbound data can be +// handled uniformly unless a game specifically decides to do +// otherwise. Pokemon, evidently, did not specifically decide to do +// otherwise. void TryReceiveLinkBattleData(void) { u8 i; @@ -858,19 +909,19 @@ void TryReceiveLinkBattleData(void) u8 *dest, *src; u16 dataSize = gBlockRecvBuffer[i][2]; - if (gTasks[sLinkReceiveTaskId].data[14] + 9 + dataSize > 0x1000) + if (gTasks[sLinkReceiveTaskId].tCurrentBlock_End + 9 + dataSize > 0x1000) { - gTasks[sLinkReceiveTaskId].data[12] = gTasks[sLinkReceiveTaskId].data[14]; - gTasks[sLinkReceiveTaskId].data[14] = 0; + gTasks[sLinkReceiveTaskId].tCurrentBlock_WrapFrom = gTasks[sLinkReceiveTaskId].tCurrentBlock_End; + gTasks[sLinkReceiveTaskId].tCurrentBlock_End = 0; } - dest = &gLinkBattleRecvBuffer[gTasks[sLinkReceiveTaskId].data[14]]; + dest = &gLinkBattleRecvBuffer[gTasks[sLinkReceiveTaskId].tCurrentBlock_End]; src = recvBuffer; for (j = 0; j < dataSize + 8; j++) dest[j] = src[j]; - gTasks[sLinkReceiveTaskId].data[14] = gTasks[sLinkReceiveTaskId].data[14] + dataSize + 8; + gTasks[sLinkReceiveTaskId].tCurrentBlock_End = gTasks[sLinkReceiveTaskId].tCurrentBlock_End + dataSize + 8; } } } @@ -881,49 +932,61 @@ static void Task_HandleCopyReceivedLinkBuffersData(u8 taskId) { u16 blockSize; u8 battler; - u8 var; + u8 playerId; - if (gTasks[taskId].data[15] != gTasks[taskId].data[14]) + #define BYTE_TO_RECEIVE(offset) \ + gLinkBattleRecvBuffer[gTasks[taskId].tCurrentBlock_Start + offset] + + if (gTasks[taskId].tCurrentBlock_Start != gTasks[taskId].tCurrentBlock_End) { - if (gTasks[taskId].data[15] > gTasks[taskId].data[14] - && gTasks[taskId].data[15] == gTasks[taskId].data[12]) + if (gTasks[taskId].tCurrentBlock_Start > gTasks[taskId].tCurrentBlock_End + && gTasks[taskId].tCurrentBlock_Start == gTasks[taskId].tCurrentBlock_WrapFrom) { - gTasks[taskId].data[12] = 0; - gTasks[taskId].data[15] = 0; + gTasks[taskId].tCurrentBlock_WrapFrom = 0; + gTasks[taskId].tCurrentBlock_Start = 0; } - battler = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + LINK_BUFF_ACTIVE_BATTLER]; - blockSize = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + LINK_BUFF_SIZE_LO] | (gLinkBattleRecvBuffer[gTasks[taskId].data[15] + LINK_BUFF_SIZE_HI] << 8); + battler = BYTE_TO_RECEIVE(LINK_BUFF_ACTIVE_BATTLER); + blockSize = BYTE_TO_RECEIVE(LINK_BUFF_SIZE_LO) | (BYTE_TO_RECEIVE(LINK_BUFF_SIZE_HI) << 8); - switch (gLinkBattleRecvBuffer[gTasks[taskId].data[15] + 0]) + switch (BYTE_TO_RECEIVE(0)) { - case 0: - if (gBattleControllerExecFlags & (1u << battler)) + case B_COMM_TO_CONTROLLER: + if (IS_BATTLE_CONTROLLER_ACTIVE_ON_LOCAL(battler)) return; - memcpy(gBattleResources->bufferA[battler], &gLinkBattleRecvBuffer[gTasks[taskId].data[15] + LINK_BUFF_DATA], blockSize); + memcpy(gBattleResources->bufferA[battler], &BYTE_TO_RECEIVE(LINK_BUFF_DATA), blockSize); MarkBattlerReceivedLinkData(battler); if (!(gBattleTypeFlags & BATTLE_TYPE_IS_MASTER)) { - gBattlerAttacker = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + LINK_BUFF_ATTACKER]; - gBattlerTarget = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + LINK_BUFF_TARGET]; - gAbsentBattlerFlags = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + LINK_BUFF_ABSENT_BATTLER_FLAGS]; - gEffectBattler = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + LINK_BUFF_EFFECT_BATTLER]; + gBattlerAttacker = BYTE_TO_RECEIVE(LINK_BUFF_ATTACKER); + gBattlerTarget = BYTE_TO_RECEIVE(LINK_BUFF_TARGET); + gAbsentBattlerFlags = BYTE_TO_RECEIVE(LINK_BUFF_ABSENT_BATTLER_FLAGS); + gEffectBattler = BYTE_TO_RECEIVE(LINK_BUFF_EFFECT_BATTLER); } break; - case 1: - memcpy(gBattleResources->bufferB[battler], &gLinkBattleRecvBuffer[gTasks[taskId].data[15] + LINK_BUFF_DATA], blockSize); + case B_COMM_TO_ENGINE: + memcpy(gBattleResources->bufferB[battler], &gLinkBattleRecvBuffer[gTasks[taskId].tCurrentBlock_Start + LINK_BUFF_DATA], blockSize); break; - case 2: - var = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + LINK_BUFF_DATA]; - gBattleControllerExecFlags &= ~(1u << (battler + var * 4)); + case B_COMM_CONTROLLER_IS_DONE: + playerId = BYTE_TO_RECEIVE(LINK_BUFF_DATA); + MARK_BATTLE_CONTROLLER_IDLE_FOR_PLAYER(battler, playerId); break; } - gTasks[taskId].data[15] = gTasks[taskId].data[15] + blockSize + LINK_BUFF_DATA; + gTasks[taskId].tCurrentBlock_Start = gTasks[taskId].tCurrentBlock_Start + blockSize + LINK_BUFF_DATA; } + + #undef BYTE_TO_RECEIVE } +#undef tInitialDelayTimer +#undef tState +#undef tCurrentBlock_WrapFrom +#undef tBlockSendDelayTimer +#undef tCurrentBlock_End +#undef tCurrentBlock_Start + void BtlController_EmitGetMonData(u32 battler, u32 bufferId, u8 requestId, u8 monToCheck) { gBattleResources->transferBuffer[0] = CONTROLLER_GETMONDATA; @@ -1093,15 +1156,15 @@ void BtlController_EmitMoveAnimation(u32 battler, u32 bufferId, u16 move, u8 tur PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 16 + sizeof(struct DisableStruct)); } -void BtlController_EmitPrintString(u32 battler, u32 bufferId, u16 stringID) +void BtlController_EmitPrintString(u32 battler, u32 bufferId, u16 stringId) { s32 i; struct BattleMsgData *stringInfo; gBattleResources->transferBuffer[0] = CONTROLLER_PRINTSTRING; gBattleResources->transferBuffer[1] = gBattleOutcome; - gBattleResources->transferBuffer[2] = stringID; - gBattleResources->transferBuffer[3] = (stringID & 0xFF00) >> 8; + gBattleResources->transferBuffer[2] = stringId; + gBattleResources->transferBuffer[3] = (stringId & 0xFF00) >> 8; stringInfo = (struct BattleMsgData *)(&gBattleResources->transferBuffer[4]); stringInfo->currentMove = gCurrentMove; @@ -1125,15 +1188,15 @@ void BtlController_EmitPrintString(u32 battler, u32 bufferId, u16 stringID) PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, sizeof(struct BattleMsgData) + 4); } -void BtlController_EmitPrintSelectionString(u32 battler, u32 bufferId, u16 stringID) +void BtlController_EmitPrintSelectionString(u32 battler, u32 bufferId, u16 stringId) { s32 i; struct BattleMsgData *stringInfo; gBattleResources->transferBuffer[0] = CONTROLLER_PRINTSTRINGPLAYERONLY; gBattleResources->transferBuffer[1] = CONTROLLER_PRINTSTRINGPLAYERONLY; - gBattleResources->transferBuffer[2] = stringID; - gBattleResources->transferBuffer[3] = (stringID & 0xFF00) >> 8; + gBattleResources->transferBuffer[2] = stringId; + gBattleResources->transferBuffer[3] = (stringId & 0xFF00) >> 8; stringInfo = (struct BattleMsgData *)(&gBattleResources->transferBuffer[4]); stringInfo->currentMove = gCurrentMove; @@ -1431,7 +1494,7 @@ void BtlController_EmitIntroTrainerBallThrow(u32 battler, u32 bufferId) PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 4); } -void BtlController_EmitDrawPartyStatusSummary(u32 battler, u32 bufferId, struct HpAndStatus* hpAndStatus, u8 flags) +void BtlController_EmitDrawPartyStatusSummary(u32 battler, u32 bufferId, struct HpAndStatus *hpAndStatus, u8 flags) { s32 i; @@ -1471,7 +1534,7 @@ void BtlController_EmitSpriteInvisibility(u32 battler, u32 bufferId, bool8 isInv PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 4); } -void BtlController_EmitBattleAnimation(u32 battler, u32 bufferId, u8 animationId, struct DisableStruct* disableStructPtr, u16 argument) +void BtlController_EmitBattleAnimation(u32 battler, u32 bufferId, u8 animationId, struct DisableStruct *disableStructPtr, u16 argument) { gBattleResources->transferBuffer[0] = CONTROLLER_BATTLEANIMATION; gBattleResources->transferBuffer[1] = animationId; @@ -2346,7 +2409,7 @@ void BtlController_HandleGetMonData(u32 battler) monToCheck >>= 1; } } - BtlController_EmitDataTransfer(battler, BUFFER_B, size, monData); + BtlController_EmitDataTransfer(battler, B_COMM_TO_ENGINE, size, monData); BattleControllerComplete(battler); } @@ -2362,7 +2425,7 @@ void BtlController_HandleGetRawMonData(u32 battler) for (i = 0; i < gBattleResources->bufferA[battler][2]; i++) dst[i] = src[i]; - BtlController_EmitDataTransfer(battler, BUFFER_B, gBattleResources->bufferA[battler][2], dst); + BtlController_EmitDataTransfer(battler, B_COMM_TO_ENGINE, gBattleResources->bufferA[battler][2], dst); BattleControllerComplete(battler); } diff --git a/src/battle_debug.c b/src/battle_debug.c index 897a782a6d..b14c485540 100644 --- a/src/battle_debug.c +++ b/src/battle_debug.c @@ -1134,7 +1134,7 @@ static void PutAiInfoText(struct BattleDebugMenu *data) u16 item = AI_DATA->items[i]; u8 x = (i == B_POSITION_PLAYER_LEFT) ? 83 + (i) * 75 : 83 + (i-1) * 75; AddTextPrinterParameterized(data->aiMovesWindowId, FONT_SMALL, gAbilitiesInfo[ability].name, x, 0, 0, NULL); - AddTextPrinterParameterized(data->aiMovesWindowId, FONT_SMALL, ItemId_GetName(item), x, 15, 0, NULL); + AddTextPrinterParameterized(data->aiMovesWindowId, FONT_SMALL, GetItemName(item), x, 15, 0, NULL); AddTextPrinterParameterized(data->aiMovesWindowId, FONT_SMALL, GetHoldEffectName(holdEffect), x, 30, 0, NULL); } } @@ -1697,7 +1697,7 @@ static void PrintSecondaryEntries(struct BattleDebugMenu *data) AddTextPrinter(&printer, 0, NULL); break; case LIST_ITEM_HELD_ITEM: - PadString(ItemId_GetName(gBattleMons[data->battlerId].item), text); + PadString(GetItemName(gBattleMons[data->battlerId].item), text); printer.currentY = printer.y = sSecondaryListTemplate.upText_Y; AddTextPrinter(&printer, 0, NULL); break; diff --git a/src/battle_dome.c b/src/battle_dome.c index d374843573..b503a81184 100644 --- a/src/battle_dome.c +++ b/src/battle_dome.c @@ -622,7 +622,7 @@ static const union AnimCmd sSpriteAnim_TourneyTreePokeballSelected[] = ANIMCMD_END, }; -static const union AnimCmd * const sSpriteAnimTable_TourneyTreePokeball[] = +static const union AnimCmd *const sSpriteAnimTable_TourneyTreePokeball[] = { sSpriteAnim_TourneyTreePokeballNormal, sSpriteAnim_TourneyTreePokeballSelected, @@ -652,7 +652,7 @@ static const union AnimCmd sSpriteAnim_TourneyTreeCancelButtonSelected[] = ANIMCMD_END, }; -static const union AnimCmd * const sSpriteAnimTable_TourneyTreeCancelButton[] = +static const union AnimCmd *const sSpriteAnimTable_TourneyTreeCancelButton[] = { sSpriteAnim_TourneyTreeCancelButtonNormal, sSpriteAnim_TourneyTreeCancelButtonSelected, @@ -681,7 +681,7 @@ static const union AnimCmd sSpriteAnim_TourneyTreeExitButtonSelected[] = ANIMCMD_END, }; -static const union AnimCmd * const sSpriteAnimTable_TourneyTreeExitButton[] = +static const union AnimCmd *const sSpriteAnimTable_TourneyTreeExitButton[] = { sSpriteAnim_TourneyTreeExitButtonNormal, sSpriteAnim_TourneyTreeExitButtonSelected, @@ -722,13 +722,13 @@ static const union AnimCmd sSpriteAnim_RightArrow[] = ANIMCMD_END, }; -static const union AnimCmd * const sSpriteAnimTable_VerticalScrollArrow[] = +static const union AnimCmd *const sSpriteAnimTable_VerticalScrollArrow[] = { sSpriteAnim_UpArrow, sSpriteAnim_DownArrow, }; -static const union AnimCmd * const sSpriteAnimTable_HorizontalScrollArrow[] = +static const union AnimCmd *const sSpriteAnimTable_HorizontalScrollArrow[] = { sSpriteAnim_LeftArrow, sSpriteAnim_RightArrow, @@ -759,7 +759,7 @@ static const struct SpriteTemplate sVerticalScrollArrowSpriteTemplate = // Organized by seed starting position, i.e. seed 0 battles seed 8 first static const u8 sTourneyTreeTrainerIds[DOME_TOURNAMENT_TRAINERS_COUNT] = {0, 8, 12, 4, 7, 15, 11, 3, 2, 10, 14, 6, 5, 13, 9, 1}; -static void (* const sBattleDomeFunctions[])(void) = +static void (*const sBattleDomeFunctions[])(void) = { [BATTLE_DOME_FUNC_INIT] = InitDomeChallenge, [BATTLE_DOME_FUNC_GET_DATA] = GetDomeData, @@ -2270,24 +2270,24 @@ int GetDomeTrainerSelectedMons(u16 tournamentTrainerId) static int SelectOpponentMons_Good(u16 tournamentTrainerId, bool8 allowRandom) { - int i, moveId, playerMonId; + int i, moveIndex, playerMonId; int partyMovePoints[FRONTIER_PARTY_SIZE]; for (i = 0; i < FRONTIER_PARTY_SIZE; i++) { partyMovePoints[i] = 0; - for (moveId = 0; moveId < MAX_MON_MOVES; moveId++) + for (moveIndex = 0; moveIndex < MAX_MON_MOVES; moveIndex++) { for (playerMonId = 0; playerMonId < FRONTIER_PARTY_SIZE; playerMonId++) { if (DOME_TRAINERS[tournamentTrainerId].trainerId == TRAINER_FRONTIER_BRAIN) { - partyMovePoints[i] += GetTypeEffectivenessPoints(GetFrontierBrainMonMove(i, moveId), + partyMovePoints[i] += GetTypeEffectivenessPoints(GetFrontierBrainMonMove(i, moveIndex), GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES, NULL), EFFECTIVENESS_MODE_GOOD); } else { - partyMovePoints[i] += GetTypeEffectivenessPoints(gFacilityTrainerMons[DOME_MONS[tournamentTrainerId][i]].moves[moveId], + partyMovePoints[i] += GetTypeEffectivenessPoints(gFacilityTrainerMons[DOME_MONS[tournamentTrainerId][i]].moves[moveIndex], GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES, NULL), EFFECTIVENESS_MODE_GOOD); } } @@ -2299,24 +2299,24 @@ static int SelectOpponentMons_Good(u16 tournamentTrainerId, bool8 allowRandom) // Identical to function above, but uses EFFECTIVENESS_MODE_BAD static int SelectOpponentMons_Bad(u16 tournamentTrainerId, bool8 allowRandom) { - int i, moveId, playerMonId; + int i, moveIndex, playerMonId; int partyMovePoints[FRONTIER_PARTY_SIZE]; for (i = 0; i < FRONTIER_PARTY_SIZE; i++) { partyMovePoints[i] = 0; - for (moveId = 0; moveId < MAX_MON_MOVES; moveId++) + for (moveIndex = 0; moveIndex < MAX_MON_MOVES; moveIndex++) { for (playerMonId = 0; playerMonId < FRONTIER_PARTY_SIZE; playerMonId++) { if (DOME_TRAINERS[tournamentTrainerId].trainerId == TRAINER_FRONTIER_BRAIN) { - partyMovePoints[i] += GetTypeEffectivenessPoints(GetFrontierBrainMonMove(i, moveId), + partyMovePoints[i] += GetTypeEffectivenessPoints(GetFrontierBrainMonMove(i, moveIndex), GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES, NULL), EFFECTIVENESS_MODE_BAD); } else { - partyMovePoints[i] += GetTypeEffectivenessPoints(gFacilityTrainerMons[DOME_MONS[tournamentTrainerId][i]].moves[moveId], + partyMovePoints[i] += GetTypeEffectivenessPoints(gFacilityTrainerMons[DOME_MONS[tournamentTrainerId][i]].moves[moveIndex], GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES, NULL), EFFECTIVENESS_MODE_BAD); } } @@ -5091,7 +5091,7 @@ static u16 GetWinningMove(int winnerTournamentId, int loserTournamentId, u8 roun { int i, j, k; int moveScores[MAX_MON_MOVES * FRONTIER_PARTY_SIZE]; - u16 moveIds[MAX_MON_MOVES * FRONTIER_PARTY_SIZE]; + u16 moves[MAX_MON_MOVES * FRONTIER_PARTY_SIZE]; u16 bestScore = 0; u16 bestId = 0; int movePower = 0; @@ -5105,16 +5105,16 @@ static u16 GetWinningMove(int winnerTournamentId, int loserTournamentId, u8 roun // TODO: Clean this up, looks like a different data structure (2D array) moveScores[i * MAX_MON_MOVES + j] = 0; if (DOME_TRAINERS[winnerTournamentId].trainerId == TRAINER_FRONTIER_BRAIN) - moveIds[i * MAX_MON_MOVES + j] = GetFrontierBrainMonMove(i, j); + moves[i * MAX_MON_MOVES + j] = GetFrontierBrainMonMove(i, j); else - moveIds[i * MAX_MON_MOVES + j] = gFacilityTrainerMons[DOME_MONS[winnerTournamentId][i]].moves[j]; + moves[i * MAX_MON_MOVES + j] = gFacilityTrainerMons[DOME_MONS[winnerTournamentId][i]].moves[j]; - movePower = GetMovePower(moveIds[i * MAX_MON_MOVES + j]); - if (IsBattleMoveStatus(moveIds[i * MAX_MON_MOVES + j])) + movePower = GetMovePower(moves[i * MAX_MON_MOVES + j]); + if (IsBattleMoveStatus(moves[i * MAX_MON_MOVES + j])) movePower = 40; else if (movePower == 1) movePower = 60; - else if (GetMoveEffect(moveIds[i * MAX_MON_MOVES + j]) == EFFECT_EXPLOSION) + else if (GetMoveEffect(moves[i * MAX_MON_MOVES + j]) == EFFECT_EXPLOSION) movePower /= 2; for (k = 0; k < FRONTIER_PARTY_SIZE; k++) @@ -5135,7 +5135,7 @@ static u16 GetWinningMove(int winnerTournamentId, int loserTournamentId, u8 roun else targetAbility = gSpeciesInfo[targetSpecies].abilities[0]; - typeMultiplier = CalcPartyMonTypeEffectivenessMultiplier(moveIds[i * 4 + j], targetSpecies, targetAbility); + typeMultiplier = CalcPartyMonTypeEffectivenessMultiplier(moves[i * 4 + j], targetSpecies, targetAbility); if (typeMultiplier == UQ_4_12(0)) moveScores[i * MAX_MON_MOVES + j] += 0; else if (typeMultiplier >= UQ_4_12(2)) @@ -5153,7 +5153,7 @@ static u16 GetWinningMove(int winnerTournamentId, int loserTournamentId, u8 roun } else if (bestScore == moveScores[i * MAX_MON_MOVES + j]) { - if (moveIds[bestId] < moveIds[i * MAX_MON_MOVES + j]) // Why not use (Random() & 1) instead of promoting moves with a higher id? + if (moves[bestId] < moves[i * MAX_MON_MOVES + j]) // Why not use (Random() & 1) instead of promoting moves with a higher id? bestId = i * MAX_MON_MOVES + j; } } @@ -5164,7 +5164,7 @@ static u16 GetWinningMove(int winnerTournamentId, int loserTournamentId, u8 roun { for (i = 0; i < roundId - 1; i++) { - if (gSaveBlock2Ptr->frontier.domeWinningMoves[GetOpposingNPCTournamentIdByRound(winnerTournamentId, i)] == moveIds[j]) + if (gSaveBlock2Ptr->frontier.domeWinningMoves[GetOpposingNPCTournamentIdByRound(winnerTournamentId, i)] == moves[j]) break; } if (i != roundId - 1) @@ -5184,7 +5184,7 @@ static u16 GetWinningMove(int winnerTournamentId, int loserTournamentId, u8 roun j = k; bestScore = moveScores[k]; } - else if (bestScore == moveScores[k] && moveIds[j] < moveIds[k]) // Yes, these conditions are redundant + else if (bestScore == moveScores[k] && moves[j] < moves[k]) // Yes, these conditions are redundant { j = k; bestScore = moveScores[k]; @@ -5196,7 +5196,7 @@ static u16 GetWinningMove(int winnerTournamentId, int loserTournamentId, u8 roun if (moveScores[j] == 0) j = bestId; - return moveIds[j]; + return moves[j]; } static void Task_ShowTourneyTree(u8 taskId) diff --git a/src/battle_factory.c b/src/battle_factory.c index 4ae2310c17..d1f24f7227 100644 --- a/src/battle_factory.c +++ b/src/battle_factory.c @@ -121,7 +121,7 @@ static const u16 *const sMoveStyles[FACTORY_NUM_STYLES - 1] = [FACTORY_STYLE_WEATHER - 1] = sMoves_DependsOnTheBattlesFlow, }; -static void (* const sBattleFactoryFunctions[])(void) = +static void (*const sBattleFactoryFunctions[])(void) = { [BATTLE_FACTORY_FUNC_INIT] = InitFactoryChallenge, [BATTLE_FACTORY_FUNC_GET_DATA] = GetBattleFactoryData, diff --git a/src/battle_factory_screen.c b/src/battle_factory_screen.c index 4119db47bd..d6233c88fb 100644 --- a/src/battle_factory_screen.c +++ b/src/battle_factory_screen.c @@ -299,7 +299,7 @@ static const struct SpritePalette sSelect_SpritePalettes[] = {}, }; -u8 static (* const sSelect_MenuOptionFuncs[])(void) = +u8 static (*const sSelect_MenuOptionFuncs[])(void) = { Select_OptionSummary, Select_OptionRentDeselect, @@ -517,17 +517,17 @@ static const union AnimCmd sAnim_Select_Pokeball_Moving[] = ANIMCMD_END, }; -static const union AnimCmd * const sAnims_Select_Interface[] = +static const union AnimCmd *const sAnims_Select_Interface[] = { sAnim_Select_Interface, }; -static const union AnimCmd * const sAnims_Select_MonPicBgAnim[] = +static const union AnimCmd *const sAnims_Select_MonPicBgAnim[] = { sAnim_Select_MonPicBgAnim, }; -static const union AnimCmd * const sAnims_Select_Pokeball[] = +static const union AnimCmd *const sAnims_Select_Pokeball[] = { sAnim_Select_Pokeball_Still, sAnim_Select_Pokeball_Moving, @@ -569,7 +569,7 @@ static const union AffineAnimCmd sAffineAnim_Select_MonPicBg_Open[] = AFFINEANIMCMD_END, }; -static const union AffineAnimCmd * const sAffineAnims_Select_MonPicBgAnim[] = +static const union AffineAnimCmd *const sAffineAnims_Select_MonPicBgAnim[] = { sAffineAnim_Select_MonPicBg_Opening, sAffineAnim_Select_MonPicBg_Closing, @@ -772,17 +772,17 @@ static const union AnimCmd sAnim_Swap_Pokeball_Moving[] = ANIMCMD_END, }; -static const union AnimCmd * const sAnims_Swap_Interface[] = +static const union AnimCmd *const sAnims_Swap_Interface[] = { sAnim_Swap_Interface, }; -static const union AnimCmd * const sAnims_Swap_MonPicBgAnim[] = +static const union AnimCmd *const sAnims_Swap_MonPicBgAnim[] = { sAnim_Swap_MonPicBgAnim, }; -static const union AnimCmd * const sAnims_Swap_Pokeball[] = +static const union AnimCmd *const sAnims_Swap_Pokeball[] = { sAnim_Swap_Pokeball_Still, sAnim_Swap_Pokeball_Moving, @@ -824,7 +824,7 @@ static const union AffineAnimCmd sAffineAnim_Swap_MonPicBg_Open[] = AFFINEANIMCMD_END, }; -static const union AffineAnimCmd * const sAffineAnims_Swap_MonPicBgAnim[] = +static const union AffineAnimCmd *const sAffineAnims_Swap_MonPicBgAnim[] = { sAffineAnim_Swap_MonPicBg_Opening, sAffineAnim_Swap_MonPicBg_Closing, @@ -886,7 +886,7 @@ static const struct SpriteTemplate sSpriteTemplate_Swap_MonPicBgAnim = .callback = SpriteCallbackDummy }; -void static (* const sSwap_MenuOptionFuncs[])(u8 taskId) = +void static (*const sSwap_MenuOptionFuncs[])(u8 taskId) = { Swap_OptionSummary, Swap_OptionSwap, diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index d70390e926..1f4fedd0d5 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -767,11 +767,11 @@ bool8 BattleLoadAllHealthBoxesGfx(u8 state) } else if (state == 4) { - LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[GetBattlerPosition(0)]); + LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[GetBattlerPosition(B_BATTLER_0)]); } else if (state == 5) { - LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[GetBattlerPosition(1)]); + LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[GetBattlerPosition(B_BATTLER_1)]); } else { @@ -794,13 +794,13 @@ bool8 BattleLoadAllHealthBoxesGfx(u8 state) else if (state == 5) LoadCompressedSpriteSheet(&sSpriteSheets_DoublesOpponentHealthbox[1]); else if (state == 6) - LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[GetBattlerPosition(0)]); + LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[GetBattlerPosition(B_BATTLER_0)]); else if (state == 7) - LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[GetBattlerPosition(1)]); + LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[GetBattlerPosition(B_BATTLER_1)]); else if (state == 8) - LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[GetBattlerPosition(2)]); + LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[GetBattlerPosition(B_BATTLER_2)]); else if (state == 9) - LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[GetBattlerPosition(3)]); + LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[GetBattlerPosition(B_BATTLER_3)]); else retVal = TRUE; } diff --git a/src/battle_interface.c b/src/battle_interface.c index e4f33ae2a6..6ff1f49653 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -634,13 +634,13 @@ static const struct WindowTemplate sHealthboxWindowTemplate = { // This function is here to cover a specific case - one player's mon in a 2 vs 1 double battle. In this scenario - display singles layout. // The same goes for a 2 vs 1 where opponent has only one pokemon. -u32 WhichBattleCoords(u32 battlerId) // 0 - singles, 1 - doubles +u32 WhichBattleCoords(u32 battler) // 0 - singles, 1 - doubles { - if (GetBattlerPosition(battlerId) == B_POSITION_PLAYER_LEFT + if (GetBattlerPosition(battler) == B_POSITION_PLAYER_LEFT && gPlayerPartyCount == 1 && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) return 0; - else if (GetBattlerPosition(battlerId) == B_POSITION_OPPONENT_LEFT + else if (GetBattlerPosition(battler) == B_POSITION_OPPONENT_LEFT && gEnemyPartyCount == 1 && !(gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS)) return 0; @@ -648,16 +648,16 @@ u32 WhichBattleCoords(u32 battlerId) // 0 - singles, 1 - doubles return IsDoubleBattle(); } -u8 CreateBattlerHealthboxSprites(u8 battlerId) +u8 CreateBattlerHealthboxSprites(u8 battler) { s16 data6 = 0; u8 healthboxLeftSpriteId, healthboxRightSpriteId; u8 healthbarSpriteId; struct Sprite *healthBarSpritePtr; - if (WhichBattleCoords(battlerId) == 0) // Singles + if (WhichBattleCoords(battler) == 0) // Singles { - if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) + if (GetBattlerSide(battler) == B_SIDE_PLAYER) { healthboxLeftSpriteId = CreateSprite(&sHealthboxPlayerSpriteTemplates[0], DISPLAY_WIDTH, DISPLAY_HEIGHT, 1); healthboxRightSpriteId = CreateSpriteAtEnd(&sHealthboxPlayerSpriteTemplates[0], DISPLAY_WIDTH, DISPLAY_HEIGHT, 1); @@ -683,10 +683,10 @@ u8 CreateBattlerHealthboxSprites(u8 battlerId) } else { - if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) + if (GetBattlerSide(battler) == B_SIDE_PLAYER) { - healthboxLeftSpriteId = CreateSprite(&sHealthboxPlayerSpriteTemplates[GetBattlerPosition(battlerId) / 2], DISPLAY_WIDTH, DISPLAY_HEIGHT, 1); - healthboxRightSpriteId = CreateSpriteAtEnd(&sHealthboxPlayerSpriteTemplates[GetBattlerPosition(battlerId) / 2], DISPLAY_WIDTH, DISPLAY_HEIGHT, 1); + healthboxLeftSpriteId = CreateSprite(&sHealthboxPlayerSpriteTemplates[GetBattlerPosition(battler) / 2], DISPLAY_WIDTH, DISPLAY_HEIGHT, 1); + healthboxRightSpriteId = CreateSpriteAtEnd(&sHealthboxPlayerSpriteTemplates[GetBattlerPosition(battler) / 2], DISPLAY_WIDTH, DISPLAY_HEIGHT, 1); gSprites[healthboxLeftSpriteId].oam.affineParam = healthboxRightSpriteId; @@ -698,8 +698,8 @@ u8 CreateBattlerHealthboxSprites(u8 battlerId) } else { - healthboxLeftSpriteId = CreateSprite(&sHealthboxOpponentSpriteTemplates[GetBattlerPosition(battlerId) / 2], DISPLAY_WIDTH, DISPLAY_HEIGHT, 1); - healthboxRightSpriteId = CreateSpriteAtEnd(&sHealthboxOpponentSpriteTemplates[GetBattlerPosition(battlerId) / 2], DISPLAY_WIDTH, DISPLAY_HEIGHT, 1); + healthboxLeftSpriteId = CreateSprite(&sHealthboxOpponentSpriteTemplates[GetBattlerPosition(battler) / 2], DISPLAY_WIDTH, DISPLAY_HEIGHT, 1); + healthboxRightSpriteId = CreateSpriteAtEnd(&sHealthboxOpponentSpriteTemplates[GetBattlerPosition(battler) / 2], DISPLAY_WIDTH, DISPLAY_HEIGHT, 1); gSprites[healthboxLeftSpriteId].oam.affineParam = healthboxRightSpriteId; @@ -711,16 +711,16 @@ u8 CreateBattlerHealthboxSprites(u8 battlerId) } } - healthbarSpriteId = CreateSpriteAtEnd(&sHealthbarSpriteTemplates[gBattlerPositions[battlerId]], 140, 60, 0); + healthbarSpriteId = CreateSpriteAtEnd(&sHealthbarSpriteTemplates[gBattlerPositions[battler]], 140, 60, 0); healthBarSpritePtr = &gSprites[healthbarSpriteId]; - SetSubspriteTables(healthBarSpritePtr, &sHealthBar_SubspriteTables[GetBattlerSide(battlerId)]); + SetSubspriteTables(healthBarSpritePtr, &sHealthBar_SubspriteTables[GetBattlerSide(battler)]); healthBarSpritePtr->subspriteMode = SUBSPRITES_IGNORE_PRIORITY; healthBarSpritePtr->oam.priority = 1; CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_1), (void *)(OBJ_VRAM0 + healthBarSpritePtr->oam.tileNum * TILE_SIZE_4BPP), 64); gSprites[healthboxLeftSpriteId].hMain_HealthBarSpriteId = healthbarSpriteId; - gSprites[healthboxLeftSpriteId].hMain_Battler = battlerId; + gSprites[healthboxLeftSpriteId].hMain_Battler = battler; gSprites[healthboxLeftSpriteId].invisible = TRUE; gSprites[healthboxRightSpriteId].invisible = TRUE; @@ -729,7 +729,7 @@ u8 CreateBattlerHealthboxSprites(u8 battlerId) healthBarSpritePtr->hBar_Data6 = data6; healthBarSpritePtr->invisible = TRUE; - CreateIndicatorSprite(battlerId); + CreateIndicatorSprite(battler); gBattleStruct->ballSpriteIds[0] = MAX_SPRITES; gBattleStruct->ballSpriteIds[1] = MAX_SPRITES; @@ -800,13 +800,13 @@ static void SpriteCB_HealthBoxOther(struct Sprite *sprite) sprite->y2 = gSprites[healthboxMainSpriteId].y2; } -void SetBattleBarStruct(u8 battlerId, u8 healthboxSpriteId, s32 maxVal, s32 oldVal, s32 receivedValue) +void SetBattleBarStruct(u8 battler, u8 healthboxSpriteId, s32 maxVal, s32 oldVal, s32 receivedValue) { - gBattleSpritesDataPtr->battleBars[battlerId].healthboxSpriteId = healthboxSpriteId; - gBattleSpritesDataPtr->battleBars[battlerId].maxValue = maxVal; - gBattleSpritesDataPtr->battleBars[battlerId].oldValue = oldVal; - gBattleSpritesDataPtr->battleBars[battlerId].receivedValue = receivedValue; - gBattleSpritesDataPtr->battleBars[battlerId].currValue = -32768; + gBattleSpritesDataPtr->battleBars[battler].healthboxSpriteId = healthboxSpriteId; + gBattleSpritesDataPtr->battleBars[battler].maxValue = maxVal; + gBattleSpritesDataPtr->battleBars[battler].oldValue = oldVal; + gBattleSpritesDataPtr->battleBars[battler].receivedValue = receivedValue; + gBattleSpritesDataPtr->battleBars[battler].currValue = -32768; } void SetHealthboxSpriteInvisible(u8 healthboxSpriteId) @@ -1062,14 +1062,14 @@ static void UpdateOpponentHpTextSingles(u32 healthboxSpriteId, s16 value, u32 ma void UpdateHpTextInHealthbox(u32 healthboxSpriteId, u32 maxOrCurrent, s16 currHp, s16 maxHp) { - u32 battlerId = gSprites[healthboxSpriteId].hMain_Battler; - if (WhichBattleCoords(battlerId)) + u32 battler = gSprites[healthboxSpriteId].hMain_Battler; + if (WhichBattleCoords(battler)) { UpdateHpTextInHealthboxInDoubles(healthboxSpriteId, maxOrCurrent, currHp, maxHp); } else // Single Battle { - if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) // Player + if (GetBattlerSide(battler) == B_SIDE_PLAYER) // Player { PrintHpOnHealthbox(healthboxSpriteId, currHp, maxHp, 2, 0xB00, 0x3A0); } @@ -1248,7 +1248,7 @@ void SwapHpBarsWithHpText(void) #define tIsBattleStart data[10] #define tBlend data[15] -u8 CreatePartyStatusSummarySprites(u8 battlerId, struct HpAndStatus *partyInfo, bool8 skipPlayer, bool8 isBattleStart) +u8 CreatePartyStatusSummarySprites(u8 battler, struct HpAndStatus *partyInfo, bool8 skipPlayer, bool8 isBattleStart) { bool8 isOpponent; s16 bar_X, bar_Y, bar_pos2_X, bar_data0; @@ -1257,9 +1257,9 @@ u8 CreatePartyStatusSummarySprites(u8 battlerId, struct HpAndStatus *partyInfo, u8 ballIconSpritesIds[PARTY_SIZE]; u8 taskId; - if (!skipPlayer || GetBattlerPosition(battlerId) != B_POSITION_OPPONENT_RIGHT) + if (!skipPlayer || GetBattlerPosition(battler) != B_POSITION_OPPONENT_RIGHT) { - if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) + if (GetBattlerSide(battler) == B_SIDE_PLAYER) { isOpponent = FALSE; bar_X = 136, bar_Y = 96; @@ -1270,7 +1270,7 @@ u8 CreatePartyStatusSummarySprites(u8 battlerId, struct HpAndStatus *partyInfo, { isOpponent = TRUE; - if (!skipPlayer || !WhichBattleCoords(battlerId)) + if (!skipPlayer || !WhichBattleCoords(battler)) bar_X = 104, bar_Y = 40; else bar_X = 104, bar_Y = 16; @@ -1338,7 +1338,7 @@ u8 CreatePartyStatusSummarySprites(u8 battlerId, struct HpAndStatus *partyInfo, gSprites[ballIconSpritesIds[i]].data[2] = isOpponent; } - if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) + if (GetBattlerSide(battler) == B_SIDE_PLAYER) { if (gBattleTypeFlags & BATTLE_TYPE_MULTI) { @@ -1451,7 +1451,7 @@ u8 CreatePartyStatusSummarySprites(u8 battlerId, struct HpAndStatus *partyInfo, } taskId = CreateTask(TaskDummy, 5); - gTasks[taskId].tBattler = battlerId; + gTasks[taskId].tBattler = battler; gTasks[taskId].tSummaryBarSpriteId = summaryBarSpriteId; for (i = 0; i < PARTY_SIZE; i++) @@ -1474,12 +1474,12 @@ void Task_HidePartyStatusSummary(u8 taskId) u8 ballIconSpriteIds[PARTY_SIZE]; bool8 isBattleStart; u8 summaryBarSpriteId; - u8 battlerId; + u8 battler; s32 i; isBattleStart = gTasks[taskId].tIsBattleStart; summaryBarSpriteId = gTasks[taskId].tSummaryBarSpriteId; - battlerId = gTasks[taskId].tBattler; + battler = gTasks[taskId].tBattler; for (i = 0; i < PARTY_SIZE; i++) ballIconSpriteIds[i] = gTasks[taskId].tBallIconSpriteId(i); @@ -1498,7 +1498,7 @@ void Task_HidePartyStatusSummary(u8 taskId) { for (i = 0; i < PARTY_SIZE; i++) { - if (GetBattlerSide(battlerId) != B_SIDE_PLAYER) + if (GetBattlerSide(battler) != B_SIDE_PLAYER) { gSprites[ballIconSpriteIds[PARTY_SIZE - 1 - i]].data[1] = 7 * i; gSprites[ballIconSpriteIds[PARTY_SIZE - 1 - i]].data[3] = 0; @@ -1543,7 +1543,7 @@ static void Task_HidePartyStatusSummary_BattleStart_2(u8 taskId) u8 ballIconSpriteIds[PARTY_SIZE]; s32 i; - u8 battlerId = gTasks[taskId].tBattler; + u8 battler = gTasks[taskId].tBattler; if (--gTasks[taskId].tBlend == -1) { u8 summaryBarSpriteId = gTasks[taskId].tSummaryBarSpriteId; @@ -1570,7 +1570,7 @@ static void Task_HidePartyStatusSummary_BattleStart_2(u8 taskId) } else if (gTasks[taskId].tBlend == -3) { - gBattleSpritesDataPtr->healthBoxesData[battlerId].partyStatusSummaryShown = 0; + gBattleSpritesDataPtr->healthBoxesData[battler].partyStatusSummaryShown = 0; SetGpuReg(REG_OFFSET_BLDCNT, 0); SetGpuReg(REG_OFFSET_BLDALPHA, 0); DestroyTask(taskId); @@ -1581,7 +1581,7 @@ static void Task_HidePartyStatusSummary_DuringBattle(u8 taskId) { u8 ballIconSpriteIds[PARTY_SIZE]; s32 i; - u8 battlerId = gTasks[taskId].tBattler; + u8 battler = gTasks[taskId].tBattler; if (--gTasks[taskId].tBlend >= 0) { @@ -1602,7 +1602,7 @@ static void Task_HidePartyStatusSummary_DuringBattle(u8 taskId) } else if (gTasks[taskId].tBlend == -3) { - gBattleSpritesDataPtr->healthBoxesData[battlerId].partyStatusSummaryShown = 0; + gBattleSpritesDataPtr->healthBoxesData[battler].partyStatusSummaryShown = 0; SetGpuReg(REG_OFFSET_BLDCNT, 0); SetGpuReg(REG_OFFSET_BLDALPHA, 0); DestroyTask(taskId); @@ -1769,17 +1769,17 @@ static void UpdateNickInHealthbox(u8 healthboxSpriteId, struct Pokemon *mon) static void TryAddPokeballIconToHealthbox(u8 healthboxSpriteId, bool8 noStatus) { - u8 battlerId, healthBarSpriteId; + u8 battler, healthBarSpriteId; if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL) return; if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) return; - battlerId = gSprites[healthboxSpriteId].hMain_Battler; - if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) + battler = gSprites[healthboxSpriteId].hMain_Battler; + if (GetBattlerSide(battler) == B_SIDE_PLAYER) return; - if (!GetSetPokedexFlag(SpeciesToNationalPokedexNum(GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES)), FLAG_GET_CAUGHT)) + if (!GetSetPokedexFlag(SpeciesToNationalPokedexNum(GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES)), FLAG_GET_CAUGHT)) return; healthBarSpriteId = gSprites[healthboxSpriteId].hMain_HealthBarSpriteId; @@ -1793,56 +1793,56 @@ static void TryAddPokeballIconToHealthbox(u8 healthboxSpriteId, bool8 noStatus) static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId) { s32 i; - u8 battlerId, healthBarSpriteId; + u8 battler, healthBarSpriteId; u32 status, pltAdder; const u8 *statusGfxPtr; s16 tileNumAdder; u8 statusPalId; - battlerId = gSprites[healthboxSpriteId].hMain_Battler; + battler = gSprites[healthboxSpriteId].hMain_Battler; healthBarSpriteId = gSprites[healthboxSpriteId].hMain_HealthBarSpriteId; - if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) + if (GetBattlerSide(battler) == B_SIDE_PLAYER) { - status = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_STATUS); - if (!WhichBattleCoords(battlerId)) + status = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_STATUS); + if (!WhichBattleCoords(battler)) tileNumAdder = 0x1A; else tileNumAdder = 0x12; } else { - status = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_STATUS); + status = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_STATUS); tileNumAdder = 0x11; } if (status & STATUS1_SLEEP) { - statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBattlerId(HEALTHBOX_GFX_STATUS_SLP_BATTLER0, battlerId)); + statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBattlerId(HEALTHBOX_GFX_STATUS_SLP_BATTLER0, battler)); statusPalId = PAL_STATUS_SLP; } else if (status & STATUS1_PSN_ANY) { - statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBattlerId(HEALTHBOX_GFX_STATUS_PSN_BATTLER0, battlerId)); + statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBattlerId(HEALTHBOX_GFX_STATUS_PSN_BATTLER0, battler)); statusPalId = PAL_STATUS_PSN; } else if (status & STATUS1_BURN) { - statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBattlerId(HEALTHBOX_GFX_STATUS_BRN_BATTLER0, battlerId)); + statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBattlerId(HEALTHBOX_GFX_STATUS_BRN_BATTLER0, battler)); statusPalId = PAL_STATUS_BRN; } else if (status & STATUS1_FREEZE) { - statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBattlerId(HEALTHBOX_GFX_STATUS_FRZ_BATTLER0, battlerId)); + statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBattlerId(HEALTHBOX_GFX_STATUS_FRZ_BATTLER0, battler)); statusPalId = PAL_STATUS_FRZ; } else if (status & STATUS1_FROSTBITE) { - statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBattlerId(HEALTHBOX_GFX_STATUS_FRB_BATTLER0, battlerId)); + statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBattlerId(HEALTHBOX_GFX_STATUS_FRB_BATTLER0, battler)); statusPalId = PAL_STATUS_FRZ; } else if (status & STATUS1_PARALYSIS) { - statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBattlerId(HEALTHBOX_GFX_STATUS_PRZ_BATTLER0, battlerId)); + statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBattlerId(HEALTHBOX_GFX_STATUS_PRZ_BATTLER0, battler)); statusPalId = PAL_STATUS_PAR; } else @@ -1852,7 +1852,7 @@ static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId) for (i = 0; i < 3; i++) CpuCopy32(statusGfxPtr, (void *)(OBJ_VRAM0 + (gSprites[healthboxSpriteId].oam.tileNum + tileNumAdder + i) * TILE_SIZE_4BPP), 32); - if (!gBattleSpritesDataPtr->battlerData[battlerId].hpNumbersNoBars) + if (!gBattleSpritesDataPtr->battlerData[battler].hpNumbersNoBars) CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_1), (void *)(OBJ_VRAM0 + gSprites[healthBarSpriteId].oam.tileNum * TILE_SIZE_4BPP), 64); TryAddPokeballIconToHealthbox(healthboxSpriteId, TRUE); @@ -1860,14 +1860,14 @@ static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId) } pltAdder = PLTT_ID(gSprites[healthboxSpriteId].oam.paletteNum); - pltAdder += battlerId + 12; + pltAdder += battler + 12; FillPalette(sStatusIconColors[statusPalId], OBJ_PLTT_OFFSET + pltAdder, PLTT_SIZEOF(1)); CpuCopy16(&gPlttBufferUnfaded[OBJ_PLTT_OFFSET + pltAdder], (u16 *)OBJ_PLTT + pltAdder, PLTT_SIZEOF(1)); CpuCopy32(statusGfxPtr, (void *)(OBJ_VRAM0 + (gSprites[healthboxSpriteId].oam.tileNum + tileNumAdder) * TILE_SIZE_4BPP), 96); - if (WhichBattleCoords(battlerId) == 1 || GetBattlerSide(battlerId) == B_SIDE_OPPONENT) + if (WhichBattleCoords(battler) == 1 || GetBattlerSide(battler) == B_SIDE_OPPONENT) { - if (!gBattleSpritesDataPtr->battlerData[battlerId].hpNumbersNoBars) + if (!gBattleSpritesDataPtr->battlerData[battler].hpNumbersNoBars) { CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_0), (void *)(OBJ_VRAM0 + gSprites[healthBarSpriteId].oam.tileNum * TILE_SIZE_4BPP), 32); CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_65), (void *)(OBJ_VRAM0 + (gSprites[healthBarSpriteId].oam.tileNum + 1) * TILE_SIZE_4BPP), 32); @@ -1876,68 +1876,68 @@ static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId) TryAddPokeballIconToHealthbox(healthboxSpriteId, FALSE); } -static u8 GetStatusIconForBattlerId(u8 statusElementId, u8 battlerId) +static u8 GetStatusIconForBattlerId(u8 statusElementId, u8 battler) { u8 ret = statusElementId; switch (statusElementId) { case HEALTHBOX_GFX_STATUS_PSN_BATTLER0: - if (battlerId == 0) + if (battler == 0) ret = HEALTHBOX_GFX_STATUS_PSN_BATTLER0; - else if (battlerId == 1) + else if (battler == 1) ret = HEALTHBOX_GFX_STATUS_PSN_BATTLER1; - else if (battlerId == 2) + else if (battler == 2) ret = HEALTHBOX_GFX_STATUS_PSN_BATTLER2; else ret = HEALTHBOX_GFX_STATUS_PSN_BATTLER3; break; case HEALTHBOX_GFX_STATUS_PRZ_BATTLER0: - if (battlerId == 0) + if (battler == 0) ret = HEALTHBOX_GFX_STATUS_PRZ_BATTLER0; - else if (battlerId == 1) + else if (battler == 1) ret = HEALTHBOX_GFX_STATUS_PRZ_BATTLER1; - else if (battlerId == 2) + else if (battler == 2) ret = HEALTHBOX_GFX_STATUS_PRZ_BATTLER2; else ret = HEALTHBOX_GFX_STATUS_PRZ_BATTLER3; break; case HEALTHBOX_GFX_STATUS_SLP_BATTLER0: - if (battlerId == 0) + if (battler == 0) ret = HEALTHBOX_GFX_STATUS_SLP_BATTLER0; - else if (battlerId == 1) + else if (battler == 1) ret = HEALTHBOX_GFX_STATUS_SLP_BATTLER1; - else if (battlerId == 2) + else if (battler == 2) ret = HEALTHBOX_GFX_STATUS_SLP_BATTLER2; else ret = HEALTHBOX_GFX_STATUS_SLP_BATTLER3; break; case HEALTHBOX_GFX_STATUS_FRZ_BATTLER0: - if (battlerId == 0) + if (battler == 0) ret = HEALTHBOX_GFX_STATUS_FRZ_BATTLER0; - else if (battlerId == 1) + else if (battler == 1) ret = HEALTHBOX_GFX_STATUS_FRZ_BATTLER1; - else if (battlerId == 2) + else if (battler == 2) ret = HEALTHBOX_GFX_STATUS_FRZ_BATTLER2; else ret = HEALTHBOX_GFX_STATUS_FRZ_BATTLER3; break; case HEALTHBOX_GFX_STATUS_FRB_BATTLER0: - if (battlerId == 0) + if (battler == 0) ret = HEALTHBOX_GFX_STATUS_FRB_BATTLER0; - else if (battlerId == 1) + else if (battler == 1) ret = HEALTHBOX_GFX_STATUS_FRB_BATTLER1; - else if (battlerId == 2) + else if (battler == 2) ret = HEALTHBOX_GFX_STATUS_FRB_BATTLER2; else ret = HEALTHBOX_GFX_STATUS_FRB_BATTLER3; break; case HEALTHBOX_GFX_STATUS_BRN_BATTLER0: - if (battlerId == 0) + if (battler == 0) ret = HEALTHBOX_GFX_STATUS_BRN_BATTLER0; - else if (battlerId == 1) + else if (battler == 1) ret = HEALTHBOX_GFX_STATUS_BRN_BATTLER1; - else if (battlerId == 2) + else if (battler == 2) ret = HEALTHBOX_GFX_STATUS_BRN_BATTLER2; else ret = HEALTHBOX_GFX_STATUS_BRN_BATTLER3; @@ -1977,13 +1977,13 @@ static void UpdateLeftNoOfBallsTextOnHealthbox(u8 healthboxSpriteId) void UpdateHealthboxAttribute(u8 healthboxSpriteId, struct Pokemon *mon, u8 elementId) { - u32 battlerId = gSprites[healthboxSpriteId].hMain_Battler; + u32 battler = gSprites[healthboxSpriteId].hMain_Battler; s32 maxHp = GetMonData(mon, MON_DATA_MAX_HP); s32 currHp = GetMonData(mon, MON_DATA_HP); - if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) + if (GetBattlerSide(battler) == B_SIDE_PLAYER) { - u8 isDoubles = WhichBattleCoords(battlerId); + u8 isDoubles = WhichBattleCoords(battler); if (elementId == HEALTHBOX_LEVEL || elementId == HEALTHBOX_ALL) UpdateLvlInHealthbox(healthboxSpriteId, GetMonData(mon, MON_DATA_LEVEL)); @@ -1998,8 +1998,8 @@ void UpdateHealthboxAttribute(u8 healthboxSpriteId, struct Pokemon *mon, u8 elem if (elementId == HEALTHBOX_HEALTH_BAR || elementId == HEALTHBOX_ALL) { LoadBattleBarGfx(0); - SetBattleBarStruct(battlerId, healthboxSpriteId, maxHp, currHp, 0); - MoveBattleBar(battlerId, healthboxSpriteId, HEALTH_BAR, 0); + SetBattleBarStruct(battler, healthboxSpriteId, maxHp, currHp, 0); + MoveBattleBar(battler, healthboxSpriteId, HEALTH_BAR, 0); } if (!isDoubles && (elementId == HEALTHBOX_EXP_BAR || elementId == HEALTHBOX_ALL)) @@ -2016,8 +2016,8 @@ void UpdateHealthboxAttribute(u8 healthboxSpriteId, struct Pokemon *mon, u8 elem currLevelExp = gExperienceTables[gSpeciesInfo[species].growthRate][level]; currExpBarValue = exp - currLevelExp; maxExpBarValue = gExperienceTables[gSpeciesInfo[species].growthRate][level + 1] - currLevelExp; - SetBattleBarStruct(battlerId, healthboxSpriteId, maxExpBarValue, currExpBarValue, isDoubles); - MoveBattleBar(battlerId, healthboxSpriteId, EXP_BAR, 0); + SetBattleBarStruct(battler, healthboxSpriteId, maxExpBarValue, currExpBarValue, isDoubles); + MoveBattleBar(battler, healthboxSpriteId, EXP_BAR, 0); } if (elementId == HEALTHBOX_NICK || elementId == HEALTHBOX_ALL) UpdateNickInHealthbox(healthboxSpriteId, mon); @@ -2032,7 +2032,7 @@ void UpdateHealthboxAttribute(u8 healthboxSpriteId, struct Pokemon *mon, u8 elem { if (elementId == HEALTHBOX_LEVEL || elementId == HEALTHBOX_ALL) UpdateLvlInHealthbox(healthboxSpriteId, GetMonData(mon, MON_DATA_LEVEL)); - if (gBattleSpritesDataPtr->battlerData[battlerId].hpNumbersNoBars) + if (gBattleSpritesDataPtr->battlerData[battler].hpNumbersNoBars) { if (elementId == HEALTHBOX_ALL) UpdateHpTextInHealthbox(healthboxSpriteId, HP_BOTH, currHp, maxHp); @@ -2044,8 +2044,8 @@ void UpdateHealthboxAttribute(u8 healthboxSpriteId, struct Pokemon *mon, u8 elem if (elementId == HEALTHBOX_HEALTH_BAR || elementId == HEALTHBOX_ALL) { LoadBattleBarGfx(0); - SetBattleBarStruct(battlerId, healthboxSpriteId, maxHp, currHp, 0); - MoveBattleBar(battlerId, healthboxSpriteId, HEALTH_BAR, 0); + SetBattleBarStruct(battler, healthboxSpriteId, maxHp, currHp, 0); + MoveBattleBar(battler, healthboxSpriteId, HEALTH_BAR, 0); } if (elementId == HEALTHBOX_NICK || elementId == HEALTHBOX_ALL) UpdateNickInHealthbox(healthboxSpriteId, mon); @@ -2057,45 +2057,45 @@ void UpdateHealthboxAttribute(u8 healthboxSpriteId, struct Pokemon *mon, u8 elem #define B_EXPBAR_PIXELS 64 #define B_HEALTHBAR_PIXELS 48 -s32 MoveBattleBar(u8 battlerId, u8 healthboxSpriteId, u8 whichBar, u8 unused) +s32 MoveBattleBar(u8 battler, u8 healthboxSpriteId, u8 whichBar, u8 unused) { s32 currentBarValue; if (whichBar == HEALTH_BAR) // health bar { - u16 hpFraction = B_FAST_HP_DRAIN == FALSE ? 1 : max(gBattleSpritesDataPtr->battleBars[battlerId].maxValue / (B_HEALTHBAR_PIXELS / 2), 1); - currentBarValue = CalcNewBarValue(gBattleSpritesDataPtr->battleBars[battlerId].maxValue, - gBattleSpritesDataPtr->battleBars[battlerId].oldValue, - gBattleSpritesDataPtr->battleBars[battlerId].receivedValue, - &gBattleSpritesDataPtr->battleBars[battlerId].currValue, + u16 hpFraction = B_FAST_HP_DRAIN == FALSE ? 1 : max(gBattleSpritesDataPtr->battleBars[battler].maxValue / (B_HEALTHBAR_PIXELS / 2), 1); + currentBarValue = CalcNewBarValue(gBattleSpritesDataPtr->battleBars[battler].maxValue, + gBattleSpritesDataPtr->battleBars[battler].oldValue, + gBattleSpritesDataPtr->battleBars[battler].receivedValue, + &gBattleSpritesDataPtr->battleBars[battler].currValue, B_HEALTHBAR_PIXELS / 8, hpFraction); } else // exp bar { - u16 expFraction = GetScaledExpFraction(gBattleSpritesDataPtr->battleBars[battlerId].oldValue, - gBattleSpritesDataPtr->battleBars[battlerId].receivedValue, - gBattleSpritesDataPtr->battleBars[battlerId].maxValue, 8); + u16 expFraction = GetScaledExpFraction(gBattleSpritesDataPtr->battleBars[battler].oldValue, + gBattleSpritesDataPtr->battleBars[battler].receivedValue, + gBattleSpritesDataPtr->battleBars[battler].maxValue, 8); if (expFraction == 0) expFraction = 1; - expFraction = abs(gBattleSpritesDataPtr->battleBars[battlerId].receivedValue / expFraction); + expFraction = abs(gBattleSpritesDataPtr->battleBars[battler].receivedValue / expFraction); - currentBarValue = CalcNewBarValue(gBattleSpritesDataPtr->battleBars[battlerId].maxValue, - gBattleSpritesDataPtr->battleBars[battlerId].oldValue, - gBattleSpritesDataPtr->battleBars[battlerId].receivedValue, - &gBattleSpritesDataPtr->battleBars[battlerId].currValue, + currentBarValue = CalcNewBarValue(gBattleSpritesDataPtr->battleBars[battler].maxValue, + gBattleSpritesDataPtr->battleBars[battler].oldValue, + gBattleSpritesDataPtr->battleBars[battler].receivedValue, + &gBattleSpritesDataPtr->battleBars[battler].currValue, B_EXPBAR_PIXELS / 8, expFraction); } - if (whichBar == EXP_BAR || (whichBar == HEALTH_BAR && !gBattleSpritesDataPtr->battlerData[battlerId].hpNumbersNoBars)) - MoveBattleBarGraphically(battlerId, whichBar); + if (whichBar == EXP_BAR || (whichBar == HEALTH_BAR && !gBattleSpritesDataPtr->battlerData[battler].hpNumbersNoBars)) + MoveBattleBarGraphically(battler, whichBar); if (currentBarValue == -1) - gBattleSpritesDataPtr->battleBars[battlerId].currValue = 0; + gBattleSpritesDataPtr->battleBars[battler].currValue = 0; return currentBarValue; } -static void MoveBattleBarGraphically(u8 battlerId, u8 whichBar) +static void MoveBattleBarGraphically(u8 battler, u8 whichBar) { u8 array[8]; u8 filledPixelsCount, level; @@ -2105,10 +2105,10 @@ static void MoveBattleBarGraphically(u8 battlerId, u8 whichBar) switch (whichBar) { case HEALTH_BAR: - filledPixelsCount = CalcBarFilledPixels(gBattleSpritesDataPtr->battleBars[battlerId].maxValue, - gBattleSpritesDataPtr->battleBars[battlerId].oldValue, - gBattleSpritesDataPtr->battleBars[battlerId].receivedValue, - &gBattleSpritesDataPtr->battleBars[battlerId].currValue, + filledPixelsCount = CalcBarFilledPixels(gBattleSpritesDataPtr->battleBars[battler].maxValue, + gBattleSpritesDataPtr->battleBars[battler].oldValue, + gBattleSpritesDataPtr->battleBars[battler].receivedValue, + &gBattleSpritesDataPtr->battleBars[battler].currValue, array, B_HEALTHBAR_PIXELS / 8); if (filledPixelsCount > (B_HEALTHBAR_PIXELS * 50 / 100)) // more than 50 % hp @@ -2120,7 +2120,7 @@ static void MoveBattleBarGraphically(u8 battlerId, u8 whichBar) for (i = 0; i < 6; i++) { - u8 healthbarSpriteId = gSprites[gBattleSpritesDataPtr->battleBars[battlerId].healthboxSpriteId].hMain_HealthBarSpriteId; + u8 healthbarSpriteId = gSprites[gBattleSpritesDataPtr->battleBars[battler].healthboxSpriteId].hMain_HealthBarSpriteId; if (i < 2) CpuCopy32(GetHealthboxElementGfxPtr(barElementId) + array[i] * 32, (void *)(OBJ_VRAM0 + (gSprites[healthbarSpriteId].oam.tileNum + 2 + i) * TILE_SIZE_4BPP), 32); @@ -2130,12 +2130,12 @@ static void MoveBattleBarGraphically(u8 battlerId, u8 whichBar) } break; case EXP_BAR: - CalcBarFilledPixels(gBattleSpritesDataPtr->battleBars[battlerId].maxValue, - gBattleSpritesDataPtr->battleBars[battlerId].oldValue, - gBattleSpritesDataPtr->battleBars[battlerId].receivedValue, - &gBattleSpritesDataPtr->battleBars[battlerId].currValue, + CalcBarFilledPixels(gBattleSpritesDataPtr->battleBars[battler].maxValue, + gBattleSpritesDataPtr->battleBars[battler].oldValue, + gBattleSpritesDataPtr->battleBars[battler].receivedValue, + &gBattleSpritesDataPtr->battleBars[battler].currValue, array, B_EXPBAR_PIXELS / 8); - level = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_LEVEL); + level = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_LEVEL); if (level >= MAX_LEVEL) { for (i = 0; i < 8; i++) @@ -2145,10 +2145,10 @@ static void MoveBattleBarGraphically(u8 battlerId, u8 whichBar) { if (i < 4) CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_12) + array[i] * 32, - (void *)(OBJ_VRAM0 + (gSprites[gBattleSpritesDataPtr->battleBars[battlerId].healthboxSpriteId].oam.tileNum + 0x24 + i) * TILE_SIZE_4BPP), 32); + (void *)(OBJ_VRAM0 + (gSprites[gBattleSpritesDataPtr->battleBars[battler].healthboxSpriteId].oam.tileNum + 0x24 + i) * TILE_SIZE_4BPP), 32); else CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_12) + array[i] * 32, - (void *)(OBJ_VRAM0 + 0xB80 + (i + gSprites[gBattleSpritesDataPtr->battleBars[battlerId].healthboxSpriteId].oam.tileNum) * TILE_SIZE_4BPP), 32); + (void *)(OBJ_VRAM0 + 0xB80 + (i + gSprites[gBattleSpritesDataPtr->battleBars[battler].healthboxSpriteId].oam.tileNum) * TILE_SIZE_4BPP), 32); } break; } diff --git a/src/battle_main.c b/src/battle_main.c index a5a5735cfc..d25dac1500 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -145,7 +145,7 @@ EWRAM_DATA u8 gBattleTextBuff3[TEXT_BUFF_ARRAY_COUNT + 13] = {0}; // expanded EWRAM_DATA u32 gBattleTypeFlags = 0; EWRAM_DATA u8 gBattleEnvironment = 0; EWRAM_DATA struct MultiPartnerMenuPokemon gMultiPartnerParty[MULTI_PARTY_SIZE] = {0}; -EWRAM_DATA static struct MultiPartnerMenuPokemon* sMultiPartnerPartyBuffer = NULL; +EWRAM_DATA static struct MultiPartnerMenuPokemon *sMultiPartnerPartyBuffer = NULL; EWRAM_DATA u8 *gBattleAnimBgTileBuffer = NULL; EWRAM_DATA u8 *gBattleAnimBgTilemapBuffer = NULL; EWRAM_DATA u32 gBattleControllerExecFlags = 0; @@ -362,7 +362,7 @@ const struct TrainerClass gTrainerClasses[TRAINER_CLASS_COUNT] = [TRAINER_CLASS_RS_PROTAG] = { _("宝可梦训练家") }, }; -static void (* const sTurnActionsFuncsTable[])(void) = +static void (*const sTurnActionsFuncsTable[])(void) = { [B_ACTION_USE_MOVE] = HandleAction_UseMove, [B_ACTION_USE_ITEM] = HandleAction_UseItem, @@ -381,7 +381,7 @@ static void (* const sTurnActionsFuncsTable[])(void) = [B_ACTION_THROW_BALL] = HandleAction_ThrowBall, }; -static void (* const sEndTurnFuncsTable[])(void) = +static void (*const sEndTurnFuncsTable[])(void) = { [0] = HandleEndTurn_ContinueBattle, [B_OUTCOME_WON] = HandleEndTurn_BattleWon, @@ -3320,7 +3320,7 @@ const u8* FaintClearSetData(u32 battler) u32 partner = BATTLE_PARTNER(battler); if (IsBattlerAlive(partner)) { - BtlController_EmitSpriteInvisibility(partner, BUFFER_A, FALSE); + BtlController_EmitSpriteInvisibility(partner, B_COMM_TO_CONTROLLER, FALSE); MarkBattlerForControllerExec(partner); } } @@ -3398,7 +3398,7 @@ static void DoBattleIntro(void) { case BATTLE_INTRO_STATE_GET_MON_DATA: battler = gBattleCommunication[1]; - BtlController_EmitGetMonData(battler, BUFFER_A, REQUEST_ALL_BATTLE, 0); + BtlController_EmitGetMonData(battler, B_COMM_TO_CONTROLLER, REQUEST_ALL_BATTLE, 0); MarkBattlerForControllerExec(battler); gBattleStruct->introState++; break; @@ -3415,7 +3415,7 @@ static void DoBattleIntro(void) if (!gBattleControllerExecFlags) { battler = GetBattlerAtPosition(0); - BtlController_EmitIntroSlide(battler, BUFFER_A, gBattleEnvironment); + BtlController_EmitIntroSlide(battler, B_COMM_TO_CONTROLLER, gBattleEnvironment); MarkBattlerForControllerExec(battler); gBattleCommunication[0] = 0; gBattleCommunication[1] = 0; @@ -3459,18 +3459,18 @@ static void DoBattleIntro(void) switch (GetBattlerPosition(battler)) { case B_POSITION_PLAYER_LEFT: // player sprite - BtlController_EmitDrawTrainerPic(battler, BUFFER_A); + BtlController_EmitDrawTrainerPic(battler, B_COMM_TO_CONTROLLER); MarkBattlerForControllerExec(battler); break; case B_POSITION_OPPONENT_LEFT: if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) // opponent 1 sprite { - BtlController_EmitDrawTrainerPic(battler, BUFFER_A); + BtlController_EmitDrawTrainerPic(battler, B_COMM_TO_CONTROLLER); MarkBattlerForControllerExec(battler); } else // wild mon 1 { - BtlController_EmitLoadMonSprite(battler, BUFFER_A); + BtlController_EmitLoadMonSprite(battler, B_COMM_TO_CONTROLLER); MarkBattlerForControllerExec(battler); gBattleResults.lastOpponentSpecies = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES, NULL); } @@ -3478,7 +3478,7 @@ static void DoBattleIntro(void) case B_POSITION_PLAYER_RIGHT: if (gBattleTypeFlags & (BATTLE_TYPE_MULTI | BATTLE_TYPE_INGAME_PARTNER)) // partner sprite { - BtlController_EmitDrawTrainerPic(battler, BUFFER_A); + BtlController_EmitDrawTrainerPic(battler, B_COMM_TO_CONTROLLER); MarkBattlerForControllerExec(battler); } break; @@ -3487,13 +3487,13 @@ static void DoBattleIntro(void) { if (gBattleTypeFlags & (BATTLE_TYPE_MULTI | BATTLE_TYPE_TWO_OPPONENTS) && !BATTLE_TWO_VS_ONE_OPPONENT) // opponent 2 if exists { - BtlController_EmitDrawTrainerPic(battler, BUFFER_A); + BtlController_EmitDrawTrainerPic(battler, B_COMM_TO_CONTROLLER); MarkBattlerForControllerExec(battler); } } else if (IsBattlerAlive(battler)) // wild mon 2 if alive { - BtlController_EmitLoadMonSprite(battler, BUFFER_A); + BtlController_EmitLoadMonSprite(battler, B_COMM_TO_CONTROLLER); MarkBattlerForControllerExec(battler); gBattleResults.lastOpponentSpecies = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES, NULL); } @@ -3530,7 +3530,7 @@ static void DoBattleIntro(void) } battler = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); - BtlController_EmitDrawPartyStatusSummary(battler, BUFFER_A, hpStatus, PARTY_SUMM_SKIP_DRAW_DELAY); + BtlController_EmitDrawPartyStatusSummary(battler, B_COMM_TO_CONTROLLER, hpStatus, PARTY_SUMM_SKIP_DRAW_DELAY); MarkBattlerForControllerExec(battler); for (i = 0; i < PARTY_SIZE; i++) @@ -3549,7 +3549,7 @@ static void DoBattleIntro(void) } battler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); - BtlController_EmitDrawPartyStatusSummary(battler, BUFFER_A, hpStatus, PARTY_SUMM_SKIP_DRAW_DELAY); + BtlController_EmitDrawPartyStatusSummary(battler, B_COMM_TO_CONTROLLER, hpStatus, PARTY_SUMM_SKIP_DRAW_DELAY); MarkBattlerForControllerExec(battler); gBattleStruct->introState++; @@ -3599,7 +3599,7 @@ static void DoBattleIntro(void) else battler = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); - BtlController_EmitIntroTrainerBallThrow(battler, BUFFER_A); + BtlController_EmitIntroTrainerBallThrow(battler, B_COMM_TO_CONTROLLER); MarkBattlerForControllerExec(battler); gBattleStruct->introState++; break; @@ -3611,7 +3611,7 @@ static void DoBattleIntro(void) else battler = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); - BtlController_EmitIntroTrainerBallThrow(battler, BUFFER_A); + BtlController_EmitIntroTrainerBallThrow(battler, B_COMM_TO_CONTROLLER); MarkBattlerForControllerExec(battler); } if (B_FAST_INTRO_PKMN_TEXT == TRUE @@ -3667,7 +3667,7 @@ static void DoBattleIntro(void) else battler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); - BtlController_EmitIntroTrainerBallThrow(battler, BUFFER_A); + BtlController_EmitIntroTrainerBallThrow(battler, B_COMM_TO_CONTROLLER); MarkBattlerForControllerExec(battler); gBattleStruct->introState++; break; @@ -3679,7 +3679,7 @@ static void DoBattleIntro(void) else battler = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT); - BtlController_EmitIntroTrainerBallThrow(battler, BUFFER_A); + BtlController_EmitIntroTrainerBallThrow(battler, B_COMM_TO_CONTROLLER); MarkBattlerForControllerExec(battler); } gBattleStruct->introState++; @@ -4035,7 +4035,7 @@ u8 IsRunningFromBattleImpossible(u32 battler) if (gBattleMons[battler].item == ITEM_ENIGMA_BERRY_E_READER) holdEffect = gEnigmaBerries[battler].holdEffect; else - holdEffect = ItemId_GetHoldEffect(gBattleMons[battler].item); + holdEffect = GetItemHoldEffect(gBattleMons[battler].item); gPotentialItemEffectBattler = battler; @@ -4228,7 +4228,7 @@ static void HandleTurnActionSelectionState(void) else { gBattleStruct->itemPartyIndex[battler] = PARTY_SIZE; - BtlController_EmitChooseAction(battler, BUFFER_A, gChosenActionByBattler[0], gBattleResources->bufferB[0][1] | (gBattleResources->bufferB[0][2] << 8)); + BtlController_EmitChooseAction(battler, B_COMM_TO_CONTROLLER, gChosenActionByBattler[0], gBattleResources->bufferB[0][1] | (gBattleResources->bufferB[0][2] << 8)); MarkBattlerForControllerExec(battler); gBattleCommunication[battler]++; } @@ -4279,7 +4279,7 @@ static void HandleTurnActionSelectionState(void) i); } - BtlController_EmitChooseMove(battler, BUFFER_A, IsDoubleBattle() != 0, FALSE, &moveInfo); + BtlController_EmitChooseMove(battler, B_COMM_TO_CONTROLLER, IsDoubleBattle() != 0, FALSE, &moveInfo); MarkBattlerForControllerExec(battler); } break; @@ -4311,7 +4311,7 @@ static void HandleTurnActionSelectionState(void) } else { - BtlController_EmitChooseItem(battler, BUFFER_A, gBattleStruct->battlerPartyOrders[battler]); + BtlController_EmitChooseItem(battler, B_COMM_TO_CONTROLLER, gBattleStruct->battlerPartyOrders[battler]); MarkBattlerForControllerExec(battler); } break; @@ -4320,21 +4320,21 @@ static void HandleTurnActionSelectionState(void) if (gBattleTypeFlags & BATTLE_TYPE_ARENA || !CanBattlerEscape(battler)) { - BtlController_EmitChoosePokemon(battler, BUFFER_A, PARTY_ACTION_CANT_SWITCH, PARTY_SIZE, ABILITY_NONE, gBattleStruct->battlerPartyOrders[battler]); + BtlController_EmitChoosePokemon(battler, B_COMM_TO_CONTROLLER, PARTY_ACTION_CANT_SWITCH, PARTY_SIZE, ABILITY_NONE, gBattleStruct->battlerPartyOrders[battler]); } - else if (ItemId_GetHoldEffect(gBattleMons[battler].item) != HOLD_EFFECT_SHED_SHELL + else if (GetItemHoldEffect(gBattleMons[battler].item) != HOLD_EFFECT_SHED_SHELL && (i = IsAbilityPreventingEscape(battler))) // must be last to keep i value integrity { - BtlController_EmitChoosePokemon(battler, BUFFER_A, ((i - 1) << 4) | PARTY_ACTION_ABILITY_PREVENTS, PARTY_SIZE, gBattleMons[i - 1].ability, gBattleStruct->battlerPartyOrders[battler]); + BtlController_EmitChoosePokemon(battler, B_COMM_TO_CONTROLLER, ((i - 1) << 4) | PARTY_ACTION_ABILITY_PREVENTS, PARTY_SIZE, gBattleMons[i - 1].ability, gBattleStruct->battlerPartyOrders[battler]); } else { if (battler == 2 && gChosenActionByBattler[0] == B_ACTION_SWITCH) - BtlController_EmitChoosePokemon(battler, BUFFER_A, PARTY_ACTION_CHOOSE_MON, gBattleStruct->monToSwitchIntoId[0], ABILITY_NONE, gBattleStruct->battlerPartyOrders[battler]); + BtlController_EmitChoosePokemon(battler, B_COMM_TO_CONTROLLER, PARTY_ACTION_CHOOSE_MON, gBattleStruct->monToSwitchIntoId[0], ABILITY_NONE, gBattleStruct->battlerPartyOrders[battler]); else if (battler == 3 && gChosenActionByBattler[1] == B_ACTION_SWITCH) - BtlController_EmitChoosePokemon(battler, BUFFER_A, PARTY_ACTION_CHOOSE_MON, gBattleStruct->monToSwitchIntoId[1], ABILITY_NONE, gBattleStruct->battlerPartyOrders[battler]); + BtlController_EmitChoosePokemon(battler, B_COMM_TO_CONTROLLER, PARTY_ACTION_CHOOSE_MON, gBattleStruct->monToSwitchIntoId[1], ABILITY_NONE, gBattleStruct->battlerPartyOrders[battler]); else - BtlController_EmitChoosePokemon(battler, BUFFER_A, PARTY_ACTION_CHOOSE_MON, PARTY_SIZE, ABILITY_NONE, gBattleStruct->battlerPartyOrders[battler]); + BtlController_EmitChoosePokemon(battler, B_COMM_TO_CONTROLLER, PARTY_ACTION_CHOOSE_MON, PARTY_SIZE, ABILITY_NONE, gBattleStruct->battlerPartyOrders[battler]); } MarkBattlerForControllerExec(battler); break; @@ -4349,7 +4349,7 @@ static void HandleTurnActionSelectionState(void) } break; case B_ACTION_SAFARI_POKEBLOCK: - BtlController_EmitChooseItem(battler, BUFFER_A, gBattleStruct->battlerPartyOrders[battler]); + BtlController_EmitChooseItem(battler, B_COMM_TO_CONTROLLER, gBattleStruct->battlerPartyOrders[battler]); MarkBattlerForControllerExec(battler); break; case B_ACTION_CANCEL_PARTNER: @@ -4359,7 +4359,7 @@ static void HandleTurnActionSelectionState(void) if (gBattleMons[GetPartnerBattler(battler)].status2 & STATUS2_MULTIPLETURNS || gBattleMons[GetPartnerBattler(battler)].status2 & STATUS2_RECHARGE) { - BtlController_EmitEndBounceEffect(battler, BUFFER_A); + BtlController_EmitEndBounceEffect(battler, B_COMM_TO_CONTROLLER); MarkBattlerForControllerExec(battler); return; } @@ -4389,11 +4389,11 @@ static void HandleTurnActionSelectionState(void) } gBattleStruct->gimmick.toActivate &= ~((1u << BATTLE_PARTNER(GetBattlerPosition(battler)))); - BtlController_EmitEndBounceEffect(battler, BUFFER_A); + BtlController_EmitEndBounceEffect(battler, B_COMM_TO_CONTROLLER); MarkBattlerForControllerExec(battler); return; case B_ACTION_DEBUG: - BtlController_EmitDebugMenu(battler, BUFFER_A); + BtlController_EmitDebugMenu(battler, B_COMM_TO_CONTROLLER); MarkBattlerForControllerExec(battler); break; } @@ -4508,7 +4508,7 @@ static void HandleTurnActionSelectionState(void) else { gLastUsedItem = (gBattleResources->bufferB[battler][1] | (gBattleResources->bufferB[battler][2] << 8)); - if (ItemId_GetPocket(gLastUsedItem) == POCKET_POKE_BALLS) + if (GetItemPocket(gLastUsedItem) == POCKET_POKE_BALLS) gBattleStruct->throwingPokeBall = TRUE; gBattleCommunication[battler]++; } @@ -4577,11 +4577,11 @@ static void HandleTurnActionSelectionState(void) || (position & BIT_FLANK) != B_FLANK_LEFT || gBattleStruct->battlerState[GetBattlerAtPosition(BATTLE_PARTNER(position))].absentBattlerFlags) { - BtlController_EmitLinkStandbyMsg(battler, BUFFER_A, LINK_STANDBY_MSG_STOP_BOUNCE, i); + BtlController_EmitLinkStandbyMsg(battler, B_COMM_TO_CONTROLLER, LINK_STANDBY_MSG_STOP_BOUNCE, i); } else { - BtlController_EmitLinkStandbyMsg(battler, BUFFER_A, LINK_STANDBY_STOP_BOUNCE_ONLY, i); + BtlController_EmitLinkStandbyMsg(battler, B_COMM_TO_CONTROLLER, LINK_STANDBY_STOP_BOUNCE_ONLY, i); } MarkBattlerForControllerExec(battler); gBattleCommunication[battler]++; @@ -5771,19 +5771,19 @@ void RunBattleScriptCommands(void) gBattleScriptingCommandsTable[gBattlescriptCurrInstr[0]](); } -bool32 TrySetAteType(u32 move, u32 battlerAtk, u32 attackerAbility) +u32 TrySetAteType(u32 move, u32 battlerAtk, u32 attackerAbility) { - u32 ateType; + u32 ateType = TYPE_NONE; switch (GetMoveEffect(move)) { case EFFECT_TERA_BLAST: if (GetActiveGimmick(battlerAtk) == GIMMICK_TERA) - return FALSE; + return ateType; break; case EFFECT_TERA_STARSTORM: if (gBattleMons[battlerAtk].species == SPECIES_TERAPAGOS_STELLAR) - return FALSE; + return ateType; break; case EFFECT_HIDDEN_POWER: case EFFECT_WEATHER_BALL: @@ -5791,10 +5791,9 @@ bool32 TrySetAteType(u32 move, u32 battlerAtk, u32 attackerAbility) case EFFECT_CHANGE_TYPE_ON_ITEM: case EFFECT_REVELATION_DANCE: case EFFECT_TERRAIN_PULSE: - return FALSE; + return ateType; } - ateType = TYPE_NONE; switch (attackerAbility) { case ABILITY_PIXILATE: @@ -5814,28 +5813,21 @@ bool32 TrySetAteType(u32 move, u32 battlerAtk, u32 attackerAbility) break; } - if (ateType != TYPE_NONE && GetActiveGimmick(battlerAtk) != GIMMICK_Z_MOVE) - { - gBattleStruct->dynamicMoveType = ateType | F_DYNAMIC_TYPE_SET; - return TRUE; - } - - return FALSE; + return ateType; } // Returns TYPE_NONE if type doesn't change. -// NULL can be passed to ateBoost to avoid applying ate-ability boosts when opening the summary screen in-battle. -u32 GetDynamicMoveType(struct Pokemon *mon, u32 move, u32 battler, u8 *ateBoost) +u32 GetDynamicMoveType(struct Pokemon *mon, u32 move, u32 battler, enum MonState state) { u32 moveType = GetMoveType(move); u32 moveEffect = GetMoveEffect(move); u32 species, heldItem, holdEffect, ability, type1, type2, type3; - bool32 monInBattle = gMain.inBattle && gPartyMenu.menuType != PARTY_MENU_TYPE_IN_BATTLE; + enum Gimmick gimmick = GetActiveGimmick(battler); if (move == MOVE_STRUGGLE) return TYPE_NORMAL; - if (monInBattle) + if (state == MON_IN_BATTLE) { species = gBattleMons[battler].species; heldItem = gBattleMons[battler].item; @@ -5849,7 +5841,7 @@ u32 GetDynamicMoveType(struct Pokemon *mon, u32 move, u32 battler, u8 *ateBoost) { species = GetMonData(mon, MON_DATA_SPECIES); heldItem = GetMonData(mon, MON_DATA_HELD_ITEM, 0); - holdEffect = ItemId_GetHoldEffect(heldItem); + holdEffect = GetItemHoldEffect(heldItem); ability = GetMonAbility(mon); type1 = gSpeciesInfo[species].types[0]; type2 = gSpeciesInfo[species].types[1]; @@ -5859,7 +5851,7 @@ u32 GetDynamicMoveType(struct Pokemon *mon, u32 move, u32 battler, u8 *ateBoost) switch (moveEffect) { case EFFECT_WEATHER_BALL: - if (monInBattle) + if (state == MON_IN_BATTLE) { if (HasWeatherEffect()) { @@ -5900,7 +5892,7 @@ u32 GetDynamicMoveType(struct Pokemon *mon, u32 move, u32 battler, u8 *ateBoost) case EFFECT_HIDDEN_POWER: { u32 typeBits = 0; - if (monInBattle) + if (state == MON_IN_BATTLE) { typeBits = ((gBattleMons[battler].hpIV & 1) << 0) | ((gBattleMons[battler].attackIV & 1) << 1) @@ -5932,13 +5924,13 @@ u32 GetDynamicMoveType(struct Pokemon *mon, u32 move, u32 battler, u8 *ateBoost) break; case EFFECT_CHANGE_TYPE_ON_ITEM: if (holdEffect == GetMoveEffectArg_HoldEffect(move)) - return ItemId_GetSecondaryId(heldItem); + return GetItemSecondaryId(heldItem); break; case EFFECT_REVELATION_DANCE: - if (GetActiveGimmick(battler) != GIMMICK_Z_MOVE) + if (gimmick != GIMMICK_Z_MOVE) { u32 teraType; - if (GetActiveGimmick(battler) == GIMMICK_TERA && ((teraType = GetMonData(mon, MON_DATA_TERA_TYPE)) != TYPE_STELLAR)) + if (gimmick == GIMMICK_TERA && ((teraType = GetMonData(mon, MON_DATA_TERA_TYPE)) != TYPE_STELLAR)) return teraType; else if (type1 != TYPE_MYSTERY && !(gDisableStructs[battler].roostActive && type1 == TYPE_FLYING)) return type1; @@ -5974,12 +5966,12 @@ u32 GetDynamicMoveType(struct Pokemon *mon, u32 move, u32 battler, u8 *ateBoost) } break; case EFFECT_NATURAL_GIFT: - if (ItemId_GetPocket(heldItem) == POCKET_BERRIES) + if (GetItemPocket(heldItem) == POCKET_BERRIES) return gNaturalGiftTable[ITEM_TO_BERRY(heldItem)].type; else return moveType; case EFFECT_TERRAIN_PULSE: - if (monInBattle) + if (state == MON_IN_BATTLE) { if (IsBattlerTerrainAffected(battler, STATUS_FIELD_TERRAIN_ANY)) { @@ -6013,7 +6005,7 @@ u32 GetDynamicMoveType(struct Pokemon *mon, u32 move, u32 battler, u8 *ateBoost) } break; case EFFECT_TERA_BLAST: - if (GetActiveGimmick(battler) == GIMMICK_TERA) + if (gimmick == GIMMICK_TERA) return GetMonData(mon, MON_DATA_TERA_TYPE); break; case EFFECT_TERA_STARSTORM: @@ -6031,20 +6023,23 @@ u32 GetDynamicMoveType(struct Pokemon *mon, u32 move, u32 battler, u8 *ateBoost) return TYPE_DARK; } else if (moveType == TYPE_NORMAL - && ((!gMain.inBattle || TrySetAteType(move, battler, ability)) - && GetActiveGimmick(battler) != GIMMICK_DYNAMAX)) + && ability != ABILITY_NORMALIZE + && gimmick != GIMMICK_DYNAMAX + && gimmick != GIMMICK_Z_MOVE) { - if (gMain.inBattle && ateBoost != NULL) - *ateBoost = TRUE; + u32 ateType = TrySetAteType(move, battler, ability); + if (ateType != TYPE_NONE && state == MON_IN_BATTLE) + gBattleStruct->ateBoost[battler] = TRUE; + return ateType; } else if (moveType != TYPE_NORMAL && moveEffect != EFFECT_HIDDEN_POWER && moveEffect != EFFECT_WEATHER_BALL && ability == ABILITY_NORMALIZE - && GetActiveGimmick(battler) != GIMMICK_Z_MOVE) + && gimmick != GIMMICK_Z_MOVE) { - if (gMain.inBattle && ateBoost != NULL && GetActiveGimmick(battler) != GIMMICK_DYNAMAX) - *ateBoost = TRUE; + if (state == MON_IN_BATTLE && gimmick != GIMMICK_DYNAMAX) + gBattleStruct->ateBoost[battler] = TRUE; return TYPE_NORMAL; } @@ -6064,7 +6059,8 @@ void SetTypeBeforeUsingMove(u32 move, u32 battler) moveType = GetDynamicMoveType(&GetBattlerParty(battler)[gBattlerPartyIndexes[battler]], move, battler, - &gBattleStruct->ateBoost[battler]); + MON_IN_BATTLE); + if (moveType != TYPE_NONE) gBattleStruct->dynamicMoveType = moveType | F_DYNAMIC_TYPE_SET; @@ -6074,10 +6070,12 @@ void SetTypeBeforeUsingMove(u32 move, u32 battler) gBattleStruct->dynamicMoveType = TYPE_ELECTRIC | F_DYNAMIC_TYPE_SET; // Check if a gem should activate. + u32 effect = GetMoveEffect(move); if (holdEffect == HOLD_EFFECT_GEMS - && GetBattleMoveType(move) == ItemId_GetSecondaryId(heldItem) - && GetMoveEffect(move) != EFFECT_PLEDGE - && GetMovePower(move) > 1) + && GetBattleMoveType(move) == GetItemSecondaryId(heldItem) + && effect != EFFECT_PLEDGE + && effect != EFFECT_OHKO + && effect != EFFECT_STRUGGLE) { gSpecialStatuses[battler].gemParam = GetBattlerHoldEffectParam(battler); gSpecialStatuses[battler].gemBoost = TRUE; diff --git a/src/battle_palace.c b/src/battle_palace.c index 68f01f84f7..94a266e6c8 100644 --- a/src/battle_palace.c +++ b/src/battle_palace.c @@ -26,7 +26,7 @@ static void SetRandomPalacePrize(void); static void GivePalacePrize(void); // Const rom data. -static void (* const sBattlePalaceFunctions[])(void) = +static void (*const sBattlePalaceFunctions[])(void) = { [BATTLE_PALACE_FUNC_INIT] = InitPalaceChallenge, [BATTLE_PALACE_FUNC_GET_DATA] = GetPalaceData, diff --git a/src/battle_pike.c b/src/battle_pike.c index c7c05bb5f9..581de0d5fd 100644 --- a/src/battle_pike.c +++ b/src/battle_pike.c @@ -476,7 +476,7 @@ static const u8 sFrontierBrainStreakAppearances[NUM_FRONTIER_FACILITIES][4] = [FRONTIER_FACILITY_PYRAMID] = {21, 70, 35, 0}, }; -static void (* const sBattlePikeFunctions[])(void) = +static void (*const sBattlePikeFunctions[])(void) = { [BATTLE_PIKE_FUNC_SET_ROOM_TYPE] = SetRoomType, [BATTLE_PIKE_FUNC_GET_DATA] = GetBattlePikeData, @@ -531,7 +531,7 @@ static const u8 sNumMonsToHealBeforePikeQueen[][3] = {0, 1, 2}, }; -static bool8 (* const sStatusInflictionScreenFlashFuncs[])(struct Task *) = +static bool8 (*const sStatusInflictionScreenFlashFuncs[])(struct Task *) = { StatusInflictionFadeOut, StatusInflictionFadeIn }; diff --git a/src/battle_pyramid.c b/src/battle_pyramid.c index 33f2717597..ab4e72d46c 100644 --- a/src/battle_pyramid.c +++ b/src/battle_pyramid.c @@ -791,7 +791,7 @@ static const u8 sHintTextTypes[] = HINT_EXIT_SHORT_REMAINING_ITEMS, }; -static void (* const sBattlePyramidFunctions[])(void) = +static void (*const sBattlePyramidFunctions[])(void) = { [BATTLE_PYRAMID_FUNC_INIT] = InitPyramidChallenge, [BATTLE_PYRAMID_FUNC_GET_DATA] = GetBattlePyramidData, diff --git a/src/battle_pyramid_bag.c b/src/battle_pyramid_bag.c index be6c5bf991..ee9a8e6a5b 100644 --- a/src/battle_pyramid_bag.c +++ b/src/battle_pyramid_bag.c @@ -327,7 +327,7 @@ static const union AnimCmd sAnim_PyramidBag[] = ANIMCMD_END, }; -static const union AnimCmd * const sAnims_PyramidBag[] = +static const union AnimCmd *const sAnims_PyramidBag[] = { sAnim_PyramidBag, }; @@ -352,7 +352,7 @@ enum { ANIM_BAG_SHAKE, }; -static const union AffineAnimCmd * const sAffineAnims_PyramidBag[] = +static const union AffineAnimCmd *const sAffineAnims_PyramidBag[] = { [ANIM_BAG_STILL] = sAffineAnim_PyramidBag_Still, [ANIM_BAG_SHAKE] = sAffineAnim_PyramidBag_Shake, @@ -620,7 +620,7 @@ static void SetBagItemsListTemplate(void) static void CopyBagItemName(u8 *dst, u16 itemId) { - if (ItemId_GetPocket(itemId) == POCKET_BERRIES) + if (GetItemPocket(itemId) == POCKET_BERRIES) { ConvertIntToDecimalStringN(gStringVar1, ITEM_TO_BERRY(itemId), STR_CONV_MODE_LEADING_ZEROS, MAX_PYRAMID_ITEM_DIGITS); CopyItemName(itemId, gStringVar2); @@ -681,7 +681,7 @@ static void PrintItemDescription(s32 listMenuId) const u8 *desc; if (listMenuId != LIST_CANCEL) { - desc = ItemId_GetDescription(gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode][listMenuId]); + desc = GetItemDescription(gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode][listMenuId]); } else { @@ -954,7 +954,7 @@ static void OpenContextMenu(u8 taskId) gPyramidBagMenu->menuActionsCount = ARRAY_COUNT(sMenuActionIds_Field); break; case PYRAMIDBAG_LOC_BATTLE: - if (ItemId_GetBattleUsage(gSpecialVar_ItemId)) + if (GetItemBattleUsage(gSpecialVar_ItemId)) { gPyramidBagMenu->menuActionIds = sMenuActionIds_Battle; gPyramidBagMenu->menuActionsCount = ARRAY_COUNT(sMenuActionIds_Battle); @@ -1097,7 +1097,7 @@ static void CloseMenuActionWindow(void) static void BagAction_UseOnField(u8 taskId) { - u8 pocketId = ItemId_GetPocket(gSpecialVar_ItemId); + u8 pocketId = GetItemPocket(gSpecialVar_ItemId); if (pocketId == POCKET_KEY_ITEMS || pocketId == POCKET_POKE_BALLS @@ -1107,12 +1107,12 @@ static void BagAction_UseOnField(u8 taskId) CloseMenuActionWindow(); DisplayItemMessageInBattlePyramid(taskId, gText_DadsAdvice, Task_CloseBattlePyramidBagMessage); } - else if (ItemId_GetFieldFunc(gSpecialVar_ItemId) != NULL) + else if (GetItemFieldFunc(gSpecialVar_ItemId) != NULL) { CloseMenuActionWindow(); FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); ScheduleBgCopyTilemapToVram(0); - ItemId_GetFieldFunc(gSpecialVar_ItemId)(taskId); + GetItemFieldFunc(gSpecialVar_ItemId)(taskId); } } @@ -1262,7 +1262,7 @@ static void BagAction_Give(u8 taskId) { DisplayItemMessageInBattlePyramid(taskId, gText_CantWriteMail, Task_WaitCloseErrorMessage); } - else if (!ItemId_GetImportance(gSpecialVar_ItemId)) + else if (!GetItemImportance(gSpecialVar_ItemId)) { gPyramidBagMenu->newScreenCallback = CB2_ChooseMonToGiveItem; CloseBattlePyramidBag(taskId); @@ -1303,7 +1303,7 @@ static void TryCloseBagToGiveItem(u8 taskId) { if (!IsWritingMailAllowed(gSpecialVar_ItemId)) DisplayItemMessageInBattlePyramid(taskId, gText_CantWriteMail, Task_WaitCloseErrorMessage); - else if (!ItemId_GetImportance(gSpecialVar_ItemId)) + else if (!GetItemImportance(gSpecialVar_ItemId)) CloseBattlePyramidBag(taskId); else ShowCantHoldMessage(taskId); @@ -1312,8 +1312,8 @@ static void TryCloseBagToGiveItem(u8 taskId) static void BagAction_UseInBattle(u8 taskId) { // Safety check - u16 type = ItemId_GetType(gSpecialVar_ItemId); - if (!ItemId_GetBattleUsage(gSpecialVar_ItemId)) + u16 type = GetItemType(gSpecialVar_ItemId); + if (!GetItemBattleUsage(gSpecialVar_ItemId)) return; CloseMenuActionWindow(); diff --git a/src/battle_records.c b/src/battle_records.c index bec0f48370..c829702c75 100644 --- a/src/battle_records.c +++ b/src/battle_records.c @@ -202,7 +202,7 @@ static void UpdateLinkBattleGameStats(s32 battleOutcome) IncrementGameStat(stat); } -static void UpdateLinkBattleRecords(struct LinkBattleRecords *records, const u8 *name, u16 trainerId, s32 battleOutcome, u8 battlerId) +static void UpdateLinkBattleRecords(struct LinkBattleRecords *records, const u8 *name, u16 trainerId, s32 battleOutcome, u8 battler) { s32 index; @@ -215,7 +215,7 @@ static void UpdateLinkBattleRecords(struct LinkBattleRecords *records, const u8 ClearLinkBattleRecord(&records->entries[index]); StringCopyN(records->entries[index].name, name, PLAYER_NAME_LENGTH); records->entries[index].trainerId = trainerId; - records->languages[index] = gLinkPlayers[battlerId].language; + records->languages[index] = gLinkPlayers[battler].language; } UpdateLinkBattleRecord(&records->entries[index], battleOutcome); SortLinkBattleRecords(records); @@ -230,50 +230,50 @@ void ClearPlayerLinkBattleRecords(void) } #if FREE_LINK_BATTLE_RECORDS == FALSE -static void IncTrainerCardWins(s32 battlerId) +static void IncTrainerCardWins(s32 battler) { - u16 *wins = &gTrainerCards[battlerId].linkBattleWins; + u16 *wins = &gTrainerCards[battler].linkBattleWins; (*wins)++; if (*wins > 9999) *wins = 9999; } -static void IncTrainerCardLosses(s32 battlerId) +static void IncTrainerCardLosses(s32 battler) { - u16 *losses = &gTrainerCards[battlerId].linkBattleLosses; + u16 *losses = &gTrainerCards[battler].linkBattleLosses; (*losses)++; if (*losses > 9999) *losses = 9999; } -static void UpdateTrainerCardWinsLosses(s32 battlerId) +static void UpdateTrainerCardWinsLosses(s32 battler) { switch (gBattleOutcome) { case B_OUTCOME_WON: - IncTrainerCardWins(BATTLE_OPPOSITE(battlerId)); - IncTrainerCardLosses(battlerId); + IncTrainerCardWins(BATTLE_OPPOSITE(battler)); + IncTrainerCardLosses(battler); break; case B_OUTCOME_LOST: - IncTrainerCardLosses(BATTLE_OPPOSITE(battlerId)); - IncTrainerCardWins(battlerId); + IncTrainerCardLosses(BATTLE_OPPOSITE(battler)); + IncTrainerCardWins(battler); break; } } #endif //FREE_LINK_BATTLE_RECORDS -void UpdatePlayerLinkBattleRecords(s32 battlerId) +void UpdatePlayerLinkBattleRecords(s32 battler) { #if FREE_LINK_BATTLE_RECORDS == FALSE if (InUnionRoom() != TRUE) { - UpdateTrainerCardWinsLosses(battlerId); + UpdateTrainerCardWinsLosses(battler); UpdateLinkBattleRecords( &gSaveBlock1Ptr->linkBattleRecords, - gTrainerCards[battlerId].playerName, - gTrainerCards[battlerId].trainerId, + gTrainerCards[battler].playerName, + gTrainerCards[battler].trainerId, gBattleOutcome, - battlerId); + battler); } #endif //FREE_LINK_BATTLE_RECORDS } diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 39e23021fa..5cef6550de 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -604,7 +604,7 @@ static void Cmd_unused(void); static void Cmd_tryworryseed(void); static void Cmd_callnative(void); -void (* const gBattleScriptingCommandsTable[])(void) = +void (*const gBattleScriptingCommandsTable[])(void) = { Cmd_attackcanceler, //0x0 Cmd_accuracycheck, //0x1 @@ -1354,13 +1354,13 @@ static void Cmd_attackcanceler(void) } } -static bool32 JumpIfMoveFailed(u8 adder, u16 move) +static bool32 JumpIfMoveFailed(u8 adder, u16 move, const u8 *failInstr) { if (gBattleStruct->moveResultFlags[gBattlerTarget] & MOVE_RESULT_NO_EFFECT) { gLastLandedMoves[gBattlerTarget] = 0; gLastHitByType[gBattlerTarget] = 0; - gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1); + gBattlescriptCurrInstr = failInstr; return TRUE; } else @@ -1380,7 +1380,7 @@ static void Cmd_unused5(void) if (IsBattlerProtected(gBattlerAttacker, gBattlerTarget, gCurrentMove)) { gBattleStruct->moveResultFlags[gBattlerTarget] |= MOVE_RESULT_MISSED; - JumpIfMoveFailed(sizeof(*cmd), MOVE_NONE); + JumpIfMoveFailed(sizeof(*cmd), MOVE_NONE, cmd->failInstr); gBattleCommunication[MISS_TYPE] = B_MSG_PROTECTED; } else @@ -1389,14 +1389,14 @@ static void Cmd_unused5(void) } } -static bool32 JumpIfMoveAffectedByProtect(u32 move, u32 battler, u32 shouldJump) +static bool32 JumpIfMoveAffectedByProtect(u32 move, u32 battler, u32 shouldJump, const u8 *failInstr) { bool32 affected = IsBattlerProtected(gBattlerAttacker, battler, move); if (affected) { gBattleStruct->moveResultFlags[battler] |= MOVE_RESULT_MISSED; if (shouldJump) - JumpIfMoveFailed(7, move); + JumpIfMoveFailed(7, move, failInstr); } return affected; } @@ -1623,7 +1623,7 @@ static void AccuracyCheck(bool32 recalcDragonDarts, const u8 *nextInstr, const u gBattlescriptCurrInstr = nextInstr; else if (gStatuses3[gBattlerTarget] & (STATUS3_SEMI_INVULNERABLE)) gBattlescriptCurrInstr = failInstr; - else if (!JumpIfMoveAffectedByProtect(gCurrentMove, gBattlerTarget, TRUE)) + else if (!JumpIfMoveAffectedByProtect(gCurrentMove, gBattlerTarget, TRUE, failInstr)) gBattlescriptCurrInstr = nextInstr; if (GetActiveGimmick(gBattlerAttacker) == GIMMICK_DYNAMAX) { @@ -1660,7 +1660,7 @@ static void AccuracyCheck(bool32 recalcDragonDarts, const u8 *nextInstr, const u continue; numTargets++; - if (JumpIfMoveAffectedByProtect(move, battlerDef, FALSE) || AccuracyCalcHelper(move, battlerDef)) + if (JumpIfMoveAffectedByProtect(move, battlerDef, FALSE, failInstr) || AccuracyCalcHelper(move, battlerDef)) continue; u32 accuracy = GetTotalAccuracy(gBattlerAttacker, @@ -1707,7 +1707,7 @@ static void AccuracyCheck(bool32 recalcDragonDarts, const u8 *nextInstr, const u if (calcSpreadMove) gBattleStruct->calculatedSpreadMoveAccuracy = TRUE; - JumpIfMoveFailed(7, move); + JumpIfMoveFailed(7, move, failInstr); } } @@ -1782,7 +1782,7 @@ static void Cmd_ppreduce(void) if (MOVE_IS_PERMANENT(gBattlerAttacker, gCurrMovePos)) { - BtlController_EmitSetMonData(gBattlerAttacker, BUFFER_A, REQUEST_PPMOVE1_BATTLE + gCurrMovePos, 0, + BtlController_EmitSetMonData(gBattlerAttacker, B_COMM_TO_CONTROLLER, REQUEST_PPMOVE1_BATTLE + gCurrMovePos, 0, sizeof(gBattleMons[gBattlerAttacker].pp[gCurrMovePos]), &gBattleMons[gBattlerAttacker].pp[gCurrMovePos]); MarkBattlerForControllerExec(gBattlerAttacker); @@ -2201,8 +2201,7 @@ static void Cmd_adjustdamage(void) if (gSpecialStatuses[gBattlerAttacker].gemBoost && !(gBattleStruct->moveResultFlags[gBattlerTarget] & MOVE_RESULT_NO_EFFECT) && !(gHitMarker & HITMARKER_UNABLE_TO_USE_MOVE) - && gBattleMons[gBattlerAttacker].item - && gCurrentMove != MOVE_STRUGGLE) + && gBattleMons[gBattlerAttacker].item) { BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_GemActivates; @@ -2453,7 +2452,7 @@ static void Cmd_attackanimation(void) } BtlController_EmitMoveAnimation(gBattlerAttacker, - BUFFER_A, + B_COMM_TO_CONTROLLER, gCurrentMove, gBattleScripting.animTurn, gBattleMovePower, @@ -2499,7 +2498,7 @@ static void DoublesHPBarReduction(void) s32 currDmg = gBattleStruct->moveDamage[battlerDef]; s32 healthValue = min(currDmg, 10000); // Max damage (10000) not present in R/S, ensures that huge damage values don't change sign - BtlController_EmitHealthBarUpdate(battlerDef, BUFFER_A, healthValue); + BtlController_EmitHealthBarUpdate(battlerDef, B_COMM_TO_CONTROLLER, healthValue); MarkBattlerForControllerExec(battlerDef); if (GetBattlerSide(battlerDef) == B_SIDE_PLAYER && currDmg > 0) @@ -2535,7 +2534,7 @@ static void Cmd_healthbarupdate(void) { s16 healthValue = min(gBattleStruct->moveDamage[battler], 10000); // Max damage (10000) not present in R/S, ensures that huge damage values don't change sign - BtlController_EmitHealthBarUpdate(battler, BUFFER_A, healthValue); + BtlController_EmitHealthBarUpdate(battler, B_COMM_TO_CONTROLLER, healthValue); MarkBattlerForControllerExec(battler); if (GetBattlerSide(battler) == B_SIDE_PLAYER && gBattleStruct->moveDamage[battler] > 0) @@ -2675,7 +2674,7 @@ static void Cmd_datahpupdate(void) } gHitMarker &= ~HITMARKER_PASSIVE_DAMAGE; // Send updated HP - BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_HP_BATTLE, 0, sizeof(gBattleMons[battler].hp), &gBattleMons[battler].hp); + BtlController_EmitSetMonData(battler, B_COMM_TO_CONTROLLER, REQUEST_HP_BATTLE, 0, sizeof(gBattleMons[battler].hp), &gBattleMons[battler].hp); MarkBattlerForControllerExec(battler); } @@ -2736,11 +2735,11 @@ static void Cmd_effectivenesssound(void) switch (moveResultFlags & ~MOVE_RESULT_MISSED) { case MOVE_RESULT_SUPER_EFFECTIVE: - BtlController_EmitPlaySE(gBattlerTarget, BUFFER_A, SE_SUPER_EFFECTIVE); + BtlController_EmitPlaySE(gBattlerTarget, B_COMM_TO_CONTROLLER, SE_SUPER_EFFECTIVE); MarkBattlerForControllerExec(gBattlerTarget); break; case MOVE_RESULT_NOT_VERY_EFFECTIVE: - BtlController_EmitPlaySE(gBattlerTarget, BUFFER_A, SE_NOT_EFFECTIVE); + BtlController_EmitPlaySE(gBattlerTarget, B_COMM_TO_CONTROLLER, SE_NOT_EFFECTIVE); MarkBattlerForControllerExec(gBattlerTarget); break; case MOVE_RESULT_DOESNT_AFFECT_FOE: @@ -2754,17 +2753,17 @@ static void Cmd_effectivenesssound(void) default: if (moveResultFlags & MOVE_RESULT_SUPER_EFFECTIVE) { - BtlController_EmitPlaySE(gBattlerTarget, BUFFER_A, SE_SUPER_EFFECTIVE); + BtlController_EmitPlaySE(gBattlerTarget, B_COMM_TO_CONTROLLER, SE_SUPER_EFFECTIVE); MarkBattlerForControllerExec(gBattlerTarget); } else if (moveResultFlags & MOVE_RESULT_NOT_VERY_EFFECTIVE) { - BtlController_EmitPlaySE(gBattlerTarget, BUFFER_A, SE_NOT_EFFECTIVE); + BtlController_EmitPlaySE(gBattlerTarget, B_COMM_TO_CONTROLLER, SE_NOT_EFFECTIVE); MarkBattlerForControllerExec(gBattlerTarget); } else if (!(moveResultFlags & (MOVE_RESULT_DOESNT_AFFECT_FOE | MOVE_RESULT_FAILED))) { - BtlController_EmitPlaySE(gBattlerTarget, BUFFER_A, SE_EFFECTIVE); + BtlController_EmitPlaySE(gBattlerTarget, B_COMM_TO_CONTROLLER, SE_EFFECTIVE); MarkBattlerForControllerExec(gBattlerTarget); } break; @@ -2973,7 +2972,7 @@ static void Cmd_printselectionstring(void) { CMD_ARGS(u16 id); - BtlController_EmitPrintSelectionString(gBattlerAttacker, BUFFER_A, cmd->id); + BtlController_EmitPrintSelectionString(gBattlerAttacker, B_COMM_TO_CONTROLLER, cmd->id); MarkBattlerForControllerExec(gBattlerAttacker); gBattlescriptCurrInstr = cmd->nextInstr; @@ -3029,7 +3028,7 @@ static void Cmd_printselectionstringfromtable(void) const u16 *ptr = cmd->ptr; ptr += gBattleCommunication[MULTISTRING_CHOOSER]; - BtlController_EmitPrintSelectionString(gBattlerAttacker, BUFFER_A, *ptr); + BtlController_EmitPrintSelectionString(gBattlerAttacker, B_COMM_TO_CONTROLLER, *ptr); MarkBattlerForControllerExec(gBattlerAttacker); gBattlescriptCurrInstr = cmd->nextInstr; @@ -3072,18 +3071,18 @@ void StealTargetItem(u8 battlerStealer, u8 battlerItem) } else { - RecordItemEffectBattle(battlerStealer, ItemId_GetHoldEffect(gLastUsedItem)); + RecordItemEffectBattle(battlerStealer, GetItemHoldEffect(gLastUsedItem)); gBattleMons[battlerStealer].item = gLastUsedItem; gDisableStructs[battlerStealer].unburdenActive = FALSE; - BtlController_EmitSetMonData(battlerStealer, BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(gLastUsedItem), &gLastUsedItem); // set attacker item + BtlController_EmitSetMonData(battlerStealer, B_COMM_TO_CONTROLLER, REQUEST_HELDITEM_BATTLE, 0, sizeof(gLastUsedItem), &gLastUsedItem); // set attacker item MarkBattlerForControllerExec(battlerStealer); } RecordItemEffectBattle(battlerItem, ITEM_NONE); CheckSetUnburden(battlerItem); - BtlController_EmitSetMonData(battlerItem, BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[gBattlerTarget].item), &gBattleMons[battlerItem].item); // remove target item + BtlController_EmitSetMonData(battlerItem, B_COMM_TO_CONTROLLER, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[gBattlerTarget].item), &gBattleMons[battlerItem].item); // remove target item MarkBattlerForControllerExec(battlerItem); gBattleStruct->choicedMove[battlerItem] = 0; @@ -3477,7 +3476,7 @@ void SetMoveEffect(bool32 primary, bool32 certain) gBattlescriptCurrInstr = sMoveEffectBS_Ptrs[gBattleScripting.moveEffect]; - BtlController_EmitSetMonData(gEffectBattler, BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gEffectBattler].status1), &gBattleMons[gEffectBattler].status1); + BtlController_EmitSetMonData(gEffectBattler, B_COMM_TO_CONTROLLER, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gEffectBattler].status1), &gBattleMons[gEffectBattler].status1); MarkBattlerForControllerExec(gEffectBattler); if (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT) @@ -3947,14 +3946,14 @@ void SetMoveEffect(bool32 primary, bool32 certain) gBattleMons[gEffectBattler].item = 0; CheckSetUnburden(gEffectBattler); - BtlController_EmitSetMonData(gEffectBattler, BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[gEffectBattler].item), &gBattleMons[gEffectBattler].item); + BtlController_EmitSetMonData(gEffectBattler, B_COMM_TO_CONTROLLER, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[gEffectBattler].item), &gBattleMons[gEffectBattler].item); MarkBattlerForControllerExec(gEffectBattler); BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_MoveEffectIncinerate; } break; case MOVE_EFFECT_BUG_BITE: - if (ItemId_GetPocket(gBattleMons[gEffectBattler].item) == POCKET_BERRIES + if (GetItemPocket(gBattleMons[gEffectBattler].item) == POCKET_BERRIES && battlerAbility != ABILITY_STICKY_HOLD) { // target loses their berry @@ -3962,7 +3961,7 @@ void SetMoveEffect(bool32 primary, bool32 certain) gBattleMons[gEffectBattler].item = 0; CheckSetUnburden(gEffectBattler); - BtlController_EmitSetMonData(gEffectBattler, BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[gEffectBattler].item), &gBattleMons[gEffectBattler].item); + BtlController_EmitSetMonData(gEffectBattler, B_COMM_TO_CONTROLLER, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[gEffectBattler].item), &gBattleMons[gEffectBattler].item); MarkBattlerForControllerExec(gEffectBattler); BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_MoveEffectBugBite; @@ -4264,7 +4263,7 @@ void SetMoveEffect(bool32 primary, bool32 certain) if (!(gDisableStructs[gBattlerTarget].mimickedMoves & (1u << i)) && !(gBattleMons[gBattlerTarget].status2 & STATUS2_TRANSFORMED)) { - BtlController_EmitSetMonData(gBattlerTarget, BUFFER_A, REQUEST_PPMOVE1_BATTLE + i, 0, sizeof(gBattleMons[gBattlerTarget].pp[i]), &gBattleMons[gBattlerTarget].pp[i]); + BtlController_EmitSetMonData(gBattlerTarget, B_COMM_TO_CONTROLLER, REQUEST_PPMOVE1_BATTLE + i, 0, sizeof(gBattleMons[gBattlerTarget].pp[i]), &gBattleMons[gBattlerTarget].pp[i]); MarkBattlerForControllerExec(gBattlerTarget); } @@ -4787,7 +4786,7 @@ static void Cmd_tryfaintmon(void) gBattleMons[gBattlerAttacker].pp[moveIndex] = 0; BattleScriptPush(gBattlescriptCurrInstr); gBattlescriptCurrInstr = BattleScript_GrudgeTakesPp; - BtlController_EmitSetMonData(gBattlerAttacker, BUFFER_A, moveIndex + REQUEST_PPMOVE1_BATTLE, 0, sizeof(gBattleMons[gBattlerAttacker].pp[moveIndex]), &gBattleMons[gBattlerAttacker].pp[moveIndex]); + BtlController_EmitSetMonData(gBattlerAttacker, B_COMM_TO_CONTROLLER, moveIndex + REQUEST_PPMOVE1_BATTLE, 0, sizeof(gBattleMons[gBattlerAttacker].pp[moveIndex]), &gBattleMons[gBattlerAttacker].pp[moveIndex]); MarkBattlerForControllerExec(gBattlerAttacker); PREPARE_MOVE_BUFFER(gBattleTextBuff1, gBattleMons[gBattlerAttacker].moves[moveIndex]) @@ -4820,7 +4819,7 @@ static void Cmd_dofaintanimation(void) return; } - BtlController_EmitFaintAnimation(battler, BUFFER_A); + BtlController_EmitFaintAnimation(battler, B_COMM_TO_CONTROLLER); MarkBattlerForControllerExec(battler); gBattlescriptCurrInstr = cmd->nextInstr; } @@ -4836,7 +4835,7 @@ static void Cmd_cleareffectsonfaint(void) if (!(gBattleTypeFlags & BATTLE_TYPE_ARENA) || !IsBattlerAlive(battler)) { gBattleMons[battler].status1 = 0; - BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[battler].status1), &gBattleMons[battler].status1); + BtlController_EmitSetMonData(battler, B_COMM_TO_CONTROLLER, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[battler].status1), &gBattleMons[battler].status1); MarkBattlerForControllerExec(battler); } @@ -5030,7 +5029,7 @@ static u32 GetMonHoldEffect(struct Pokemon *mon) holdEffect = 0; #endif //FREE_ENIGMA_BERRY else - holdEffect = ItemId_GetHoldEffect(item); + holdEffect = GetItemHoldEffect(item); return holdEffect; } @@ -5265,7 +5264,7 @@ static void Cmd_getexp(void) gBattleResources->beforeLvlUp->stats[STAT_SPATK] = GetMonData(&gPlayerParty[*expMonId], MON_DATA_SPATK); gBattleResources->beforeLvlUp->stats[STAT_SPDEF] = GetMonData(&gPlayerParty[*expMonId], MON_DATA_SPDEF); - BtlController_EmitExpUpdate(gBattleStruct->expGetterBattlerId, BUFFER_A, *expMonId, gBattleStruct->battlerExpReward); + BtlController_EmitExpUpdate(gBattleStruct->expGetterBattlerId, B_COMM_TO_CONTROLLER, *expMonId, gBattleStruct->battlerExpReward); MarkBattlerForControllerExec(gBattleStruct->expGetterBattlerId); } gBattleScripting.getexpState++; @@ -5345,6 +5344,27 @@ static void Cmd_getexp(void) } } +static u32 CountAliveMonsForBattlerSide(u32 battler) +{ + u32 aliveMons = 0; + struct Pokemon *party = GetBattlerParty(battler); + + for (u32 partyMon = 0; partyMon < PARTY_SIZE; partyMon++) + { + if (GetMonData(&party[partyMon], MON_DATA_SPECIES) + && GetMonData(&party[partyMon], MON_DATA_HP) > 0 + && !GetMonData(&party[partyMon], MON_DATA_IS_EGG)) + aliveMons++; + } + + return aliveMons; +} + +bool32 NoAliveMonsForBattlerSide(u32 battler) +{ + return CountAliveMonsForBattlerSide(battler) == 0; +} + bool32 NoAliveMonsForPlayer(void) { u32 i; @@ -5460,7 +5480,12 @@ static void Cmd_checkteamslost(void) } else { - if (emptyOpponentSpots != 0 && emptyPlayerSpots != 0) + u32 occupiedPlayerSpots = (gBattlersCount / 2) - emptyPlayerSpots; + u32 occupiedOpponentSpots = (gBattlersCount / 2) - emptyOpponentSpots; + u32 alivePlayerPartyMons = CountAliveMonsForBattlerSide(B_POSITION_PLAYER_LEFT) - occupiedPlayerSpots; + u32 aliveOpponentPartyMons = CountAliveMonsForBattlerSide(B_POSITION_OPPONENT_LEFT) - occupiedOpponentSpots; + + if (emptyPlayerSpots > 0 && alivePlayerPartyMons > 0 && emptyOpponentSpots > 0 && aliveOpponentPartyMons > 0) gBattlescriptCurrInstr = cmd->jumpInstr; else gBattlescriptCurrInstr = cmd->nextInstr; @@ -5836,7 +5861,7 @@ static void Cmd_absorb(void) return; u32 battler = GetBattlerForBattleScript(cmd->battler); - BtlController_EmitHealthBarUpdate(battler, BUFFER_A, gBattleStruct->moveDamage[battler]); + BtlController_EmitHealthBarUpdate(battler, B_COMM_TO_CONTROLLER, gBattleStruct->moveDamage[battler]); MarkBattlerForControllerExec(battler); if (GetBattlerSide(battler) == B_SIDE_PLAYER && gBattleStruct->moveDamage[battler] > 0) @@ -5941,7 +5966,7 @@ static void PlayAnimation(u32 battler, u8 animId, const u16 *argPtr, const u8 *n || animId == B_ANIM_TERA_CHARGE || animId == B_ANIM_TERA_ACTIVATE) { - BtlController_EmitBattleAnimation(battler, BUFFER_A, animId, &gDisableStructs[battler], *argPtr); + BtlController_EmitBattleAnimation(battler, B_COMM_TO_CONTROLLER, animId, &gDisableStructs[battler], *argPtr); MarkBattlerForControllerExec(battler); gBattlescriptCurrInstr = nextInstr; } @@ -5957,7 +5982,7 @@ static void PlayAnimation(u32 battler, u8 animId, const u16 *argPtr, const u8 *n || animId == B_ANIM_SNOW_CONTINUES || animId == B_ANIM_FOG_CONTINUES) { - BtlController_EmitBattleAnimation(battler, BUFFER_A, animId, &gDisableStructs[battler], *argPtr); + BtlController_EmitBattleAnimation(battler, B_COMM_TO_CONTROLLER, animId, &gDisableStructs[battler], *argPtr); MarkBattlerForControllerExec(battler); gBattlescriptCurrInstr = nextInstr; } @@ -5967,7 +5992,7 @@ static void PlayAnimation(u32 battler, u8 animId, const u16 *argPtr, const u8 *n } else { - BtlController_EmitBattleAnimation(battler, BUFFER_A, animId, &gDisableStructs[battler], *argPtr); + BtlController_EmitBattleAnimation(battler, B_COMM_TO_CONTROLLER, animId, &gDisableStructs[battler], *argPtr); MarkBattlerForControllerExec(battler); gBattlescriptCurrInstr = nextInstr; } @@ -6132,7 +6157,7 @@ static void Cmd_playstatchangeanimation(void) } else if (changeableStatsCount != 0 && !gBattleScripting.statAnimPlayed) { - BtlController_EmitBattleAnimation(battler, BUFFER_A, B_ANIM_STATS_CHANGE, &gDisableStructs[battler], statAnimId); + BtlController_EmitBattleAnimation(battler, B_COMM_TO_CONTROLLER, B_ANIM_STATS_CHANGE, &gDisableStructs[battler], statAnimId); MarkBattlerForControllerExec(battler); if (flags & STAT_CHANGE_MULTIPLE_STATS && changeableStatsCount > 1) gBattleScripting.statAnimPlayed = TRUE; @@ -6169,7 +6194,7 @@ static bool32 TryKnockOffBattleScript(u32 battlerDef) // In Gen 5+, Knock Off removes the target's item rather than rendering it unusable. if (B_KNOCK_OFF_REMOVAL >= GEN_5) { - BtlController_EmitSetMonData(battlerDef, BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[battlerDef].item), &gBattleMons[battlerDef].item); + BtlController_EmitSetMonData(battlerDef, B_COMM_TO_CONTROLLER, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[battlerDef].item), &gBattleMons[battlerDef].item); MarkBattlerForControllerExec(battlerDef); } else @@ -6385,7 +6410,7 @@ static void Cmd_moveend(void) { gProtectStructs[gBattlerAttacker].touchedProtectLike = FALSE; gBattleMons[gBattlerAttacker].status1 = STATUS1_BURN; - BtlController_EmitSetMonData(gBattlerAttacker, BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gBattlerAttacker].status1), &gBattleMons[gBattlerAttacker].status1); + BtlController_EmitSetMonData(gBattlerAttacker, B_COMM_TO_CONTROLLER, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gBattlerAttacker].status1), &gBattleMons[gBattlerAttacker].status1); MarkBattlerForControllerExec(gBattlerAttacker); BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_BeakBlastBurn; @@ -6454,7 +6479,7 @@ static void Cmd_moveend(void) && !(gBattleStruct->moveResultFlags[gBattlerTarget] & MOVE_RESULT_NO_EFFECT)) { gBattleMons[gBattlerTarget].status1 &= ~STATUS1_FREEZE; - BtlController_EmitSetMonData(gBattlerTarget, BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gBattlerTarget].status1), &gBattleMons[gBattlerTarget].status1); + BtlController_EmitSetMonData(gBattlerTarget, B_COMM_TO_CONTROLLER, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gBattlerTarget].status1), &gBattleMons[gBattlerTarget].status1); MarkBattlerForControllerExec(gBattlerTarget); BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_DefrostedViaFireMove; @@ -6467,7 +6492,7 @@ static void Cmd_moveend(void) && !(gBattleStruct->moveResultFlags[gBattlerTarget] & MOVE_RESULT_NO_EFFECT)) { gBattleMons[gBattlerTarget].status1 &= ~STATUS1_FROSTBITE; - BtlController_EmitSetMonData(gBattlerTarget, BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gBattlerTarget].status1), &gBattleMons[gBattlerTarget].status1); + BtlController_EmitSetMonData(gBattlerTarget, B_COMM_TO_CONTROLLER, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gBattlerTarget].status1), &gBattleMons[gBattlerTarget].status1); MarkBattlerForControllerExec(gBattlerTarget); BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_FrostbiteHealedViaFireMove; @@ -6757,7 +6782,7 @@ static void Cmd_moveend(void) if (gStatuses3[gBattlerAttacker] & (STATUS3_SEMI_INVULNERABLE) && gHitMarker & (HITMARKER_NO_ANIMATIONS | HITMARKER_DISABLE_ANIMATION)) { - BtlController_EmitSpriteInvisibility(gBattlerAttacker, BUFFER_A, TRUE); + BtlController_EmitSpriteInvisibility(gBattlerAttacker, B_COMM_TO_CONTROLLER, TRUE); MarkBattlerForControllerExec(gBattlerAttacker); gBattleScripting.moveendState++; return; @@ -6769,7 +6794,7 @@ static void Cmd_moveend(void) || !(gStatuses3[gBattlerAttacker] & (STATUS3_SEMI_INVULNERABLE)) || WasUnableToUseMove(gBattlerAttacker)) { - BtlController_EmitSpriteInvisibility(gBattlerAttacker, BUFFER_A, FALSE); + BtlController_EmitSpriteInvisibility(gBattlerAttacker, B_COMM_TO_CONTROLLER, FALSE); MarkBattlerForControllerExec(gBattlerAttacker); gStatuses3[gBattlerAttacker] &= ~STATUS3_SEMI_INVULNERABLE; gSpecialStatuses[gBattlerAttacker].restoredBattlerSprite = TRUE; @@ -6782,7 +6807,7 @@ static void Cmd_moveend(void) if (!gSpecialStatuses[gBattlerTarget].restoredBattlerSprite && gBattlerTarget < gBattlersCount && !(gStatuses3[gBattlerTarget] & STATUS3_SEMI_INVULNERABLE)) { - BtlController_EmitSpriteInvisibility(gBattlerTarget, BUFFER_A, FALSE); + BtlController_EmitSpriteInvisibility(gBattlerTarget, B_COMM_TO_CONTROLLER, FALSE); MarkBattlerForControllerExec(gBattlerTarget); gStatuses3[gBattlerTarget] &= ~STATUS3_SEMI_INVULNERABLE; gBattleScripting.moveendState++; @@ -7553,7 +7578,7 @@ static void Cmd_returnatktoball(void) if (!(gHitMarker & HITMARKER_FAINTED(gBattlerAttacker))) { - BtlController_EmitReturnMonToBall(gBattlerAttacker, BUFFER_A, FALSE); + BtlController_EmitReturnMonToBall(gBattlerAttacker, B_COMM_TO_CONTROLLER, FALSE); MarkBattlerForControllerExec(gBattlerAttacker); } gBattlescriptCurrInstr = cmd->nextInstr; @@ -7569,7 +7594,7 @@ static void Cmd_getswitchedmondata(void) gBattlerPartyIndexes[battler] = gBattleStruct->monToSwitchIntoId[battler]; - BtlController_EmitGetMonData(battler, BUFFER_A, REQUEST_ALL_BATTLE, 1u << gBattlerPartyIndexes[battler]); + BtlController_EmitGetMonData(battler, B_COMM_TO_CONTROLLER, REQUEST_ALL_BATTLE, 1u << gBattlerPartyIndexes[battler]); MarkBattlerForControllerExec(battler); gBattlescriptCurrInstr = cmd->nextInstr; @@ -7615,7 +7640,7 @@ static void Cmd_switchindataupdate(void) if (i != PARTY_SIZE) { gBattlerPartyIndexes[battler] = gBattleStruct->monToSwitchIntoId[battler] = i; - BtlController_EmitGetMonData(battler, BUFFER_A, REQUEST_ALL_BATTLE, 1u << gBattlerPartyIndexes[battler]); + BtlController_EmitGetMonData(battler, B_COMM_TO_CONTROLLER, REQUEST_ALL_BATTLE, 1u << gBattlerPartyIndexes[battler]); MarkBattlerForControllerExec(battler); return; } @@ -7690,7 +7715,7 @@ static void Cmd_switchinanim(void) gAbsentBattlerFlags &= ~(1u << battler); - BtlController_EmitSwitchInAnim(battler, BUFFER_A, gBattlerPartyIndexes[battler], cmd->dontClearTransform, cmd->dontClearSubstitute); + BtlController_EmitSwitchInAnim(battler, B_COMM_TO_CONTROLLER, gBattlerPartyIndexes[battler], cmd->dontClearTransform, cmd->dontClearSubstitute); MarkBattlerForControllerExec(battler); gBattlescriptCurrInstr = cmd->nextInstr; @@ -7869,7 +7894,7 @@ static void ChooseMonToSendOut(u32 battler, u8 slotId) gBattleStruct->monToSwitchIntoId[battler] = PARTY_SIZE; gBattleStruct->field_93 &= ~(1u << battler); - BtlController_EmitChoosePokemon(battler, BUFFER_A, PARTY_ACTION_SEND_OUT, slotId, ABILITY_NONE, gBattleStruct->battlerPartyOrders[battler]); + BtlController_EmitChoosePokemon(battler, B_COMM_TO_CONTROLLER, PARTY_ACTION_SEND_OUT, slotId, ABILITY_NONE, gBattleStruct->battlerPartyOrders[battler]); MarkBattlerForControllerExec(battler); } @@ -7894,7 +7919,7 @@ static void Cmd_openpartyscreen(void) { gAbsentBattlerFlags |= 1u << battler; gHitMarker &= ~HITMARKER_FAINTED(battler); - BtlController_EmitLinkStandbyMsg(battler, BUFFER_A, LINK_STANDBY_MSG_ONLY, FALSE); + BtlController_EmitLinkStandbyMsg(battler, B_COMM_TO_CONTROLLER, LINK_STANDBY_MSG_ONLY, FALSE); MarkBattlerForControllerExec(battler); } else if (!gSpecialStatuses[battler].faintedHasReplacement) @@ -7905,7 +7930,7 @@ static void Cmd_openpartyscreen(void) } else { - BtlController_EmitLinkStandbyMsg(battler, BUFFER_A, LINK_STANDBY_MSG_ONLY, FALSE); + BtlController_EmitLinkStandbyMsg(battler, B_COMM_TO_CONTROLLER, LINK_STANDBY_MSG_ONLY, FALSE); MarkBattlerForControllerExec(battler); } } @@ -7927,7 +7952,7 @@ static void Cmd_openpartyscreen(void) { gAbsentBattlerFlags |= 1u << battler; gHitMarker &= ~HITMARKER_FAINTED(battler); - BtlController_EmitCantSwitch(battler, BUFFER_A); + BtlController_EmitCantSwitch(battler, B_COMM_TO_CONTROLLER); MarkBattlerForControllerExec(battler); } else if (!gSpecialStatuses[battler].faintedHasReplacement) @@ -7937,7 +7962,7 @@ static void Cmd_openpartyscreen(void) } else if (battler < 2 || (battler > 1 && !(flags & BATTLE_PARTNER(battler)))) { - BtlController_EmitLinkStandbyMsg(battler, BUFFER_A, LINK_STANDBY_MSG_ONLY, FALSE); + BtlController_EmitLinkStandbyMsg(battler, B_COMM_TO_CONTROLLER, LINK_STANDBY_MSG_ONLY, FALSE); MarkBattlerForControllerExec(battler); flags |= battler; } @@ -7956,7 +7981,7 @@ static void Cmd_openpartyscreen(void) else battler = i; - BtlController_EmitLinkStandbyMsg(battler, BUFFER_A, LINK_STANDBY_MSG_ONLY, FALSE); + BtlController_EmitLinkStandbyMsg(battler, B_COMM_TO_CONTROLLER, LINK_STANDBY_MSG_ONLY, FALSE); MarkBattlerForControllerExec(battler); } } @@ -7980,7 +8005,7 @@ static void Cmd_openpartyscreen(void) { gAbsentBattlerFlags |= (1u << battler); gHitMarker &= ~(HITMARKER_FAINTED(battler)); - BtlController_EmitCantSwitch(battler, BUFFER_A); + BtlController_EmitCantSwitch(battler, B_COMM_TO_CONTROLLER); MarkBattlerForControllerExec(battler); } else if (!gSpecialStatuses[battler].faintedHasReplacement) @@ -8038,7 +8063,7 @@ static void Cmd_openpartyscreen(void) gBattleStruct->monToSwitchIntoId[battler] = PARTY_SIZE; gBattleStruct->field_93 &= ~(1u << battler); - BtlController_EmitChoosePokemon(battler, BUFFER_A, hitmarkerFaintBits, gBattleStruct->monToSwitchIntoId[BATTLE_PARTNER(battler)], ABILITY_NONE, gBattleStruct->battlerPartyOrders[battler]); + BtlController_EmitChoosePokemon(battler, B_COMM_TO_CONTROLLER, hitmarkerFaintBits, gBattleStruct->monToSwitchIntoId[BATTLE_PARTNER(battler)], ABILITY_NONE, gBattleStruct->battlerPartyOrders[battler]); MarkBattlerForControllerExec(battler); gBattlescriptCurrInstr = cmd->nextInstr; @@ -8052,7 +8077,7 @@ static void Cmd_openpartyscreen(void) { if (i != battler) { - BtlController_EmitLinkStandbyMsg(i, BUFFER_A, LINK_STANDBY_MSG_ONLY, FALSE); + BtlController_EmitLinkStandbyMsg(i, B_COMM_TO_CONTROLLER, LINK_STANDBY_MSG_ONLY, FALSE); MarkBattlerForControllerExec(i); } } @@ -8066,7 +8091,7 @@ static void Cmd_openpartyscreen(void) // Make sure we're checking a valid battler. In edge case scenarios - battler could be absent and battlerOpposite would become a non-existent one softlocking the game. if (battlerOpposite < gBattlersCount) { - BtlController_EmitLinkStandbyMsg(battlerOpposite, BUFFER_A, LINK_STANDBY_MSG_ONLY, FALSE); + BtlController_EmitLinkStandbyMsg(battlerOpposite, B_COMM_TO_CONTROLLER, LINK_STANDBY_MSG_ONLY, FALSE); MarkBattlerForControllerExec(battlerOpposite); } } @@ -8253,16 +8278,22 @@ static bool32 DoSwitchInEffectsForBattler(u32 battler) i = GetBattlerAbility(battler); if (CanBePoisoned(gBattlerAttacker, battler, i)) { - if (gSideTimers[GetBattlerSide(battler)].toxicSpikesAmount >= 2) + u32 tspikes = 0; + if (gSideTimers[GetBattlerSide(battler)].toxicSpikesAmount >= 2) { + tspikes = 1; gBattleMons[battler].status1 |= STATUS1_TOXIC_POISON; + } else gBattleMons[battler].status1 |= STATUS1_POISON; - BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[battler].status1), &gBattleMons[battler].status1); + BtlController_EmitSetMonData(battler, B_COMM_TO_CONTROLLER, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[battler].status1), &gBattleMons[battler].status1); MarkBattlerForControllerExec(battler); gBattleScripting.battler = battler; BattleScriptPushCursor(); - gBattlescriptCurrInstr = BattleScript_ToxicSpikesPoisoned; + if (tspikes == 0) + gBattlescriptCurrInstr = BattleScript_ToxicSpikesPoisoned; + else + gBattlescriptCurrInstr = BattleScript_ToxicSpikesBadlyPoisoned; } } } @@ -8422,7 +8453,7 @@ static void Cmd_trainerslidein(void) CMD_ARGS(u8 position); u32 battler = GetBattlerForBattleScript(cmd->position); - BtlController_EmitTrainerSlide(battler, BUFFER_A); + BtlController_EmitTrainerSlide(battler, B_COMM_TO_CONTROLLER); MarkBattlerForControllerExec(battler); gBattlescriptCurrInstr = cmd->nextInstr; @@ -8432,7 +8463,7 @@ static void Cmd_playse(void) { CMD_ARGS(u16 song); - BtlController_EmitPlaySE(gBattlerAttacker, BUFFER_A, cmd->song); + BtlController_EmitPlaySE(gBattlerAttacker, B_COMM_TO_CONTROLLER, cmd->song); MarkBattlerForControllerExec(gBattlerAttacker); gBattlescriptCurrInstr = cmd->nextInstr; @@ -8442,7 +8473,7 @@ static void Cmd_fanfare(void) { CMD_ARGS(u16 song); - BtlController_EmitPlayFanfareOrBGM(gBattlerAttacker, BUFFER_A, cmd->song, FALSE); + BtlController_EmitPlayFanfareOrBGM(gBattlerAttacker, B_COMM_TO_CONTROLLER, cmd->song, FALSE); MarkBattlerForControllerExec(gBattlerAttacker); gBattlescriptCurrInstr = cmd->nextInstr; @@ -8453,7 +8484,7 @@ static void Cmd_playfaintcry(void) CMD_ARGS(u8 battler); u32 battler = GetBattlerForBattleScript(cmd->battler); - BtlController_EmitFaintingCry(battler, BUFFER_A); + BtlController_EmitFaintingCry(battler, B_COMM_TO_CONTROLLER); MarkBattlerForControllerExec(battler); gBattlescriptCurrInstr = cmd->nextInstr; @@ -8464,7 +8495,7 @@ static void Cmd_endlinkbattle(void) CMD_ARGS(); u32 battler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); - BtlController_EmitEndLinkBattle(battler, BUFFER_A, gBattleOutcome); + BtlController_EmitEndLinkBattle(battler, B_COMM_TO_CONTROLLER, gBattleOutcome); MarkBattlerForControllerExec(battler); gBattlescriptCurrInstr = cmd->nextInstr; @@ -8475,7 +8506,7 @@ static void Cmd_returntoball(void) CMD_ARGS(u8 battler, bool8 changingForm); u32 battler = GetBattlerForBattleScript(cmd->battler); - BtlController_EmitReturnMonToBall(battler, BUFFER_A, TRUE); + BtlController_EmitReturnMonToBall(battler, B_COMM_TO_CONTROLLER, TRUE); MarkBattlerForControllerExec(battler); // Don't always execute a form change here otherwise we can stomp gigantamax @@ -8597,8 +8628,8 @@ static void Cmd_yesnoboxlearnmove(void) } else { - u16 moveId = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_MOVE1 + movePosition); - if (IsMoveHM(moveId)) + u16 move = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_MOVE1 + movePosition); + if (IsMoveHM(move)) { PrepareStringBattle(STRINGID_HMMOVESCANTBEFORGOTTEN, B_POSITION_PLAYER_LEFT); gBattleScripting.learnMoveState = 6; @@ -8607,7 +8638,7 @@ static void Cmd_yesnoboxlearnmove(void) { gBattlescriptCurrInstr = cmd->forgotMovePtr; - PREPARE_MOVE_BUFFER(gBattleTextBuff2, moveId) + PREPARE_MOVE_BUFFER(gBattleTextBuff2, move) RemoveMonPPBonus(&gPlayerParty[gBattleStruct->expGetterMonId], movePosition); SetMonMoveSlot(&gPlayerParty[gBattleStruct->expGetterMonId], gMoveToLearn, movePosition); @@ -8704,7 +8735,7 @@ static void Cmd_hitanimation(void) || !(DoesSubstituteBlockMove(gBattlerAttacker, battler, gCurrentMove)) || gDisableStructs[battler].substituteHP == 0) { - BtlController_EmitHitAnimation(battler, BUFFER_A); + BtlController_EmitHitAnimation(battler, B_COMM_TO_CONTROLLER); MarkBattlerForControllerExec(battler); } } @@ -8722,7 +8753,7 @@ static void Cmd_hitanimation(void) || !(DoesSubstituteBlockMove(gBattlerAttacker, battlerDef, gCurrentMove)) || gDisableStructs[battlerDef].substituteHP == 0) { - BtlController_EmitHitAnimation(battlerDef, BUFFER_A); + BtlController_EmitHitAnimation(battlerDef, B_COMM_TO_CONTROLLER); MarkBattlerForControllerExec(battlerDef); } } @@ -8809,7 +8840,7 @@ static void Cmd_updatebattlermoves(void) switch (gBattleCommunication[0]) { case 0: - BtlController_EmitGetMonData(battler, BUFFER_A, REQUEST_ALL_BATTLE, 0); + BtlController_EmitGetMonData(battler, B_COMM_TO_CONTROLLER, REQUEST_ALL_BATTLE, 0); MarkBattlerForControllerExec(battler); gBattleCommunication[0]++; break; @@ -8877,7 +8908,7 @@ static void Cmd_drawpartystatussummary(void) } } - BtlController_EmitDrawPartyStatusSummary(battler, BUFFER_A, hpStatuses, 1); + BtlController_EmitDrawPartyStatusSummary(battler, B_COMM_TO_CONTROLLER, hpStatuses, 1); MarkBattlerForControllerExec(battler); gBattlescriptCurrInstr = cmd->nextInstr; @@ -8888,7 +8919,7 @@ static void Cmd_hidepartystatussummary(void) CMD_ARGS(u8 battler); u32 battler = GetBattlerForBattleScript(cmd->battler); - BtlController_EmitHidePartyStatusSummary(battler, BUFFER_A); + BtlController_EmitHidePartyStatusSummary(battler, B_COMM_TO_CONTROLLER); MarkBattlerForControllerExec(battler); gBattlescriptCurrInstr = cmd->nextInstr; @@ -8932,7 +8963,7 @@ static void Cmd_statusanimation(void) && gDisableStructs[battler].substituteHP == 0 && !(gHitMarker & (HITMARKER_NO_ANIMATIONS | HITMARKER_DISABLE_ANIMATION))) { - BtlController_EmitStatusAnimation(battler, BUFFER_A, FALSE, gBattleMons[battler].status1); + BtlController_EmitStatusAnimation(battler, B_COMM_TO_CONTROLLER, FALSE, gBattleMons[battler].status1); MarkBattlerForControllerExec(battler); } gBattlescriptCurrInstr = cmd->nextInstr; @@ -8951,7 +8982,7 @@ static void Cmd_status2animation(void) && gDisableStructs[battler].substituteHP == 0 && !(gHitMarker & (HITMARKER_NO_ANIMATIONS | HITMARKER_DISABLE_ANIMATION))) { - BtlController_EmitStatusAnimation(battler, BUFFER_A, TRUE, gBattleMons[battler].status2 & status2ToAnim); + BtlController_EmitStatusAnimation(battler, B_COMM_TO_CONTROLLER, TRUE, gBattleMons[battler].status2 & status2ToAnim); MarkBattlerForControllerExec(battler); } gBattlescriptCurrInstr = cmd->nextInstr; @@ -8970,7 +9001,7 @@ static void Cmd_chosenstatusanimation(void) && gDisableStructs[battler].substituteHP == 0 && !(gHitMarker & (HITMARKER_NO_ANIMATIONS | HITMARKER_DISABLE_ANIMATION))) { - BtlController_EmitStatusAnimation(battler, BUFFER_A, cmd->isStatus2, wantedStatus); + BtlController_EmitStatusAnimation(battler, B_COMM_TO_CONTROLLER, cmd->isStatus2, wantedStatus); MarkBattlerForControllerExec(battler); } gBattlescriptCurrInstr = cmd->nextInstr; @@ -9052,7 +9083,7 @@ static void Cmd_setgravity(void) static bool32 TryCheekPouch(u32 battler, u32 itemId) { - if (ItemId_GetPocket(itemId) == POCKET_BERRIES + if (GetItemPocket(itemId) == POCKET_BERRIES && GetBattlerAbility(battler) == ABILITY_CHEEK_POUCH && !(gStatuses3[battler] & STATUS3_HEAL_BLOCK) && gBattleStruct->ateBerry[GetBattlerSide(battler)] & (1u << gBattlerPartyIndexes[battler]) @@ -9088,12 +9119,12 @@ static void BestowItem(u32 battlerAtk, u32 battlerDef) gLastUsedItem = gBattleMons[battlerAtk].item; gBattleMons[battlerAtk].item = ITEM_NONE; - BtlController_EmitSetMonData(battlerAtk, BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[battlerAtk].item), &gBattleMons[battlerAtk].item); + BtlController_EmitSetMonData(battlerAtk, B_COMM_TO_CONTROLLER, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[battlerAtk].item), &gBattleMons[battlerAtk].item); MarkBattlerForControllerExec(battlerAtk); CheckSetUnburden(battlerAtk); gBattleMons[battlerDef].item = gLastUsedItem; - BtlController_EmitSetMonData(battlerDef, BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[battlerDef].item), &gBattleMons[battlerDef].item); + BtlController_EmitSetMonData(battlerDef, B_COMM_TO_CONTROLLER, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[battlerDef].item), &gBattleMons[battlerDef].item); MarkBattlerForControllerExec(battlerDef); gDisableStructs[battlerDef].unburdenActive = FALSE; } @@ -9148,7 +9179,7 @@ static void Cmd_removeitem(void) gBattleStruct->canPickupItem |= (1u << battler); CheckSetUnburden(battler); - BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[battler].item), &gBattleMons[battler].item); + BtlController_EmitSetMonData(battler, B_COMM_TO_CONTROLLER, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[battler].item), &gBattleMons[battler].item); MarkBattlerForControllerExec(battler); ClearBattlerItemEffectHistory(battler); @@ -9470,7 +9501,7 @@ static void Cmd_makevisible(void) return; battler = GetBattlerForBattleScript(cmd->battler); - BtlController_EmitSpriteInvisibility(battler, BUFFER_A, FALSE); + BtlController_EmitSpriteInvisibility(battler, B_COMM_TO_CONTROLLER, FALSE); MarkBattlerForControllerExec(battler); gBattlescriptCurrInstr = cmd->nextInstr; @@ -9848,7 +9879,7 @@ static bool32 IsElectricAbilityAffected(u32 battler, u32 ability) static bool32 IsTeatimeAffected(u32 battler) { - if (ItemId_GetPocket(gBattleMons[battler].item) != POCKET_BERRIES) + if (GetItemPocket(gBattleMons[battler].item) != POCKET_BERRIES) return FALSE; // Only berries if (gStatuses3[battler] & STATUS3_SEMI_INVULNERABLE) return FALSE; // Teatime doesn't affected semi-invulnerable battlers @@ -9945,7 +9976,7 @@ static void HandleScriptMegaPrimalBurst(u32 caseId, u32 battler, u32 type) PREPARE_SPECIES_BUFFER(gBattleTextBuff1, gBattleMons[battler].species); - BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_SPECIES_BATTLE, 1u << gBattlerPartyIndexes[battler], sizeof(gBattleMons[battler].species), &gBattleMons[battler].species); + BtlController_EmitSetMonData(battler, B_COMM_TO_CONTROLLER, REQUEST_SPECIES_BATTLE, 1u << gBattlerPartyIndexes[battler], sizeof(gBattleMons[battler].species), &gBattleMons[battler].species); MarkBattlerForControllerExec(battler); } // Update healthbox and elevation and play cry. @@ -10236,7 +10267,7 @@ static void Cmd_various(void) case VARIOUS_JUMP_IF_NOT_BERRY: { VARIOUS_ARGS(const u8 *jumpInstr); - if (ItemId_GetPocket(gBattleMons[battler].item) == POCKET_BERRIES) + if (GetItemPocket(gBattleMons[battler].item) == POCKET_BERRIES) gBattlescriptCurrInstr = cmd->nextInstr; else gBattlescriptCurrInstr = cmd->jumpInstr; @@ -10443,7 +10474,7 @@ static void Cmd_various(void) case VARIOUS_EMIT_YESNOBOX: { VARIOUS_ARGS(); - BtlController_EmitYesNoBox(battler, BUFFER_A); + BtlController_EmitYesNoBox(battler, B_COMM_TO_CONTROLLER); MarkBattlerForControllerExec(battler); break; } @@ -10486,7 +10517,7 @@ static void Cmd_various(void) battler = 1; if (IsBattlerAlive(battler)) { - BtlController_EmitReturnMonToBall(battler, BUFFER_A, FALSE); + BtlController_EmitReturnMonToBall(battler, B_COMM_TO_CONTROLLER, FALSE); MarkBattlerForControllerExec(battler); } break; @@ -10499,7 +10530,7 @@ static void Cmd_various(void) battler = 3; if (IsBattlerAlive(battler)) { - BtlController_EmitReturnMonToBall(battler, BUFFER_A, FALSE); + BtlController_EmitReturnMonToBall(battler, B_COMM_TO_CONTROLLER, FALSE); MarkBattlerForControllerExec(battler); } } @@ -10557,7 +10588,7 @@ static void Cmd_various(void) case VARIOUS_PLAY_TRAINER_DEFEATED_MUSIC: { VARIOUS_ARGS(); - BtlController_EmitPlayFanfareOrBGM(battler, BUFFER_A, MUS_VICTORY_TRAINER, TRUE); + BtlController_EmitPlayFanfareOrBGM(battler, B_COMM_TO_CONTROLLER, MUS_VICTORY_TRAINER, TRUE); MarkBattlerForControllerExec(battler); break; } @@ -10579,7 +10610,7 @@ static void Cmd_various(void) case VARIOUS_INSTANT_HP_DROP: { VARIOUS_ARGS(); - BtlController_EmitHealthBarUpdate(battler, BUFFER_A, INSTANT_HP_BAR_DROP); + BtlController_EmitHealthBarUpdate(battler, B_COMM_TO_CONTROLLER, INSTANT_HP_BAR_DROP); MarkBattlerForControllerExec(battler); break; } @@ -10587,7 +10618,7 @@ static void Cmd_various(void) { VARIOUS_ARGS(); gBattleMons[battler].status1 = 0; - BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[battler].status1), &gBattleMons[battler].status1); + BtlController_EmitSetMonData(battler, B_COMM_TO_CONTROLLER, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[battler].status1), &gBattleMons[battler].status1); MarkBattlerForControllerExec(battler); break; } @@ -10600,7 +10631,7 @@ static void Cmd_various(void) data[i] = gBattleMons[battler].pp[i]; } data[i] = gBattleMons[battler].ppBonuses; - BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_PP_DATA_BATTLE, 0, 5, data); + BtlController_EmitSetMonData(battler, B_COMM_TO_CONTROLLER, REQUEST_PP_DATA_BATTLE, 0, 5, data); MarkBattlerForControllerExec(battler); break; } @@ -10731,7 +10762,7 @@ static void Cmd_various(void) case VARIOUS_PLAY_MOVE_ANIMATION: { VARIOUS_ARGS(u16 move); - BtlController_EmitMoveAnimation(battler, BUFFER_A, cmd->move, gBattleScripting.animTurn, 0, 0, gBattleMons[battler].friendship, &gDisableStructs[battler], gMultiHitCounter); + BtlController_EmitMoveAnimation(battler, B_COMM_TO_CONTROLLER, cmd->move, gBattleScripting.animTurn, 0, 0, gBattleMons[battler].friendship, &gDisableStructs[battler], gMultiHitCounter); MarkBattlerForControllerExec(battler); gBattlescriptCurrInstr = cmd->nextInstr; return; @@ -10916,7 +10947,7 @@ static void Cmd_various(void) if (!gBattleTextBuff1) PREPARE_SPECIES_BUFFER(gBattleTextBuff1, gBattleMons[battler].species); */ - BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_SPECIES_BATTLE, 1u << gBattlerPartyIndexes[battler], sizeof(gBattleMons[battler].species), &gBattleMons[battler].species); + BtlController_EmitSetMonData(battler, B_COMM_TO_CONTROLLER, REQUEST_SPECIES_BATTLE, 1u << gBattlerPartyIndexes[battler], sizeof(gBattleMons[battler].species), &gBattleMons[battler].species); MarkBattlerForControllerExec(battler); } // Change stats. @@ -11065,7 +11096,7 @@ static void Cmd_various(void) } gBattleMons[gBattlerTarget].status1 = gBattleMons[gBattlerAttacker].status1 & STATUS1_ANY; battler = gBattlerTarget; - BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[battler].status1), &gBattleMons[battler].status1); + BtlController_EmitSetMonData(battler, B_COMM_TO_CONTROLLER, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[battler].status1), &gBattleMons[battler].status1); MarkBattlerForControllerExec(battler); gBattlescriptCurrInstr = cmd->nextInstr; TryActivateSleepClause(battler, gBattlerPartyIndexes[battler]); @@ -11079,7 +11110,7 @@ static void Cmd_various(void) TryDeactivateSleepClause(GetBattlerSide(battler), gBattlerPartyIndexes[battler]); gBattleMons[battler].status1 = 0; - BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[battler].status1), &gBattleMons[battler].status1); + BtlController_EmitSetMonData(battler, B_COMM_TO_CONTROLLER, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[battler].status1), &gBattleMons[battler].status1); MarkBattlerForControllerExec(battler); break; } @@ -11136,7 +11167,7 @@ static void Cmd_various(void) VARIOUS_ARGS(u8 case_); if (cmd->case_ == PRINT_SLIDE_MESSAGE) { - BtlController_EmitPrintString(battler, BUFFER_A, STRINGID_TRAINERSLIDE); + BtlController_EmitPrintString(battler, B_COMM_TO_CONTROLLER, STRINGID_TRAINERSLIDE); MarkBattlerForControllerExec(battler); } else if (cmd->case_ == RESTORE_BATTLER_SLIDE_CONTROL) @@ -11278,7 +11309,7 @@ static void Cmd_various(void) if (GetBattlerHoldEffect(battler, TRUE) == HOLD_EFFECT_ROOM_SERVICE && TryRoomService(battler)) { BattleScriptPushCursor(); - gBattlescriptCurrInstr = BattleScript_BerryStatRaiseRet; + gBattlescriptCurrInstr = BattleScript_ConsumableStatRaiseRet; } else { @@ -11321,7 +11352,7 @@ static void Cmd_various(void) if (gBattleControllerExecFlags) break; - BtlController_EmitSpriteInvisibility(battler, BUFFER_A, TRUE); + BtlController_EmitSpriteInvisibility(battler, B_COMM_TO_CONTROLLER, TRUE); MarkBattlerForControllerExec(battler); break; } @@ -11736,7 +11767,7 @@ static void Cmd_various(void) case VARIOUS_JUMP_IF_LAST_USED_ITEM_BERRY: { VARIOUS_ARGS(const u8 *jumpInstr); - if (ItemId_GetPocket(gLastUsedItem) == POCKET_BERRIES) + if (GetItemPocket(gLastUsedItem) == POCKET_BERRIES) gBattlescriptCurrInstr = cmd->jumpInstr; else gBattlescriptCurrInstr = cmd->nextInstr; @@ -11745,7 +11776,7 @@ static void Cmd_various(void) case VARIOUS_JUMP_IF_LAST_USED_ITEM_HOLD_EFFECT: { VARIOUS_ARGS(u8 holdEffect, const u8 *jumpInstr); - if (ItemId_GetHoldEffect(gLastUsedItem) == cmd->holdEffect) + if (GetItemHoldEffect(gLastUsedItem) == cmd->holdEffect) gBattlescriptCurrInstr = cmd->jumpInstr; else gBattlescriptCurrInstr = cmd->nextInstr; @@ -11902,7 +11933,7 @@ static void Cmd_tryexplosion(void) return; gBattleStruct->moveDamage[gBattlerAttacker] = gBattleMons[gBattlerAttacker].hp; - BtlController_EmitHealthBarUpdate(gBattlerAttacker, BUFFER_A, INSTANT_HP_BAR_DROP); + BtlController_EmitHealthBarUpdate(gBattlerAttacker, B_COMM_TO_CONTROLLER, INSTANT_HP_BAR_DROP); MarkBattlerForControllerExec(gBattlerAttacker); gBattlescriptCurrInstr = cmd->nextInstr; } @@ -11915,7 +11946,7 @@ static void Cmd_setatkhptozero(void) return; gBattleMons[gBattlerAttacker].hp = 0; - BtlController_EmitSetMonData(gBattlerAttacker, BUFFER_A, REQUEST_HP_BATTLE, 0, sizeof(gBattleMons[gBattlerAttacker].hp), &gBattleMons[gBattlerAttacker].hp); + BtlController_EmitSetMonData(gBattlerAttacker, B_COMM_TO_CONTROLLER, REQUEST_HP_BATTLE, 0, sizeof(gBattleMons[gBattlerAttacker].hp), &gBattleMons[gBattlerAttacker].hp); MarkBattlerForControllerExec(gBattlerAttacker); gBattlescriptCurrInstr = cmd->nextInstr; @@ -12148,7 +12179,7 @@ static void Cmd_trysetrest(void) gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_REST; gBattleMons[gBattlerTarget].status1 = STATUS1_SLEEP_TURN(3); - BtlController_EmitSetMonData(gBattlerTarget, BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gBattlerTarget].status1), &gBattleMons[gBattlerTarget].status1); + BtlController_EmitSetMonData(gBattlerTarget, B_COMM_TO_CONTROLLER, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gBattlerTarget].status1), &gBattleMons[gBattlerTarget].status1); MarkBattlerForControllerExec(gBattlerTarget); gBattlescriptCurrInstr = cmd->nextInstr; } @@ -12468,9 +12499,8 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr return STAT_CHANGE_DIDNT_WORK; } else if (gCurrentMove != MOVE_CURSE - && notProtectAffected != TRUE && JumpIfMoveAffectedByProtect(gCurrentMove, gBattlerTarget, TRUE)) + && notProtectAffected != TRUE && JumpIfMoveAffectedByProtect(gCurrentMove, gBattlerTarget, TRUE, BattleScript_ButItFailed)) { - gBattlescriptCurrInstr = BattleScript_ButItFailed; return STAT_CHANGE_DIDNT_WORK; } else if ((battlerHoldEffect == HOLD_EFFECT_CLEAR_AMULET || CanAbilityPreventStatLoss(battlerAbility)) @@ -13233,7 +13263,7 @@ static void Cmd_updatestatusicon(void) { if (!(gAbsentBattlerFlags & (1u << battler))) { - BtlController_EmitStatusIconUpdate(battler, BUFFER_A, gBattleMons[battler].status1, gBattleMons[battler].status2); + BtlController_EmitStatusIconUpdate(battler, B_COMM_TO_CONTROLLER, gBattleMons[battler].status1, gBattleMons[battler].status2); MarkBattlerForControllerExec(battler); } } @@ -13244,7 +13274,7 @@ static void Cmd_updatestatusicon(void) battler = gBattlerAttacker; if (!(gAbsentBattlerFlags & (1u << battler))) { - BtlController_EmitStatusIconUpdate(battler, BUFFER_A, gBattleMons[battler].status1, gBattleMons[battler].status2); + BtlController_EmitStatusIconUpdate(battler, B_COMM_TO_CONTROLLER, gBattleMons[battler].status1, gBattleMons[battler].status2); MarkBattlerForControllerExec(battler); } if ((IsDoubleBattle())) @@ -13252,7 +13282,7 @@ static void Cmd_updatestatusicon(void) battler = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerAttacker))); if (!(gAbsentBattlerFlags & (1u << battler))) { - BtlController_EmitStatusIconUpdate(battler, BUFFER_A, gBattleMons[battler].status1, gBattleMons[battler].status2); + BtlController_EmitStatusIconUpdate(battler, B_COMM_TO_CONTROLLER, gBattleMons[battler].status1, gBattleMons[battler].status2); MarkBattlerForControllerExec(battler); } } @@ -13261,7 +13291,7 @@ static void Cmd_updatestatusicon(void) else { battler = GetBattlerForBattleScript(cmd->battler); - BtlController_EmitStatusIconUpdate(battler, BUFFER_A, gBattleMons[battler].status1, gBattleMons[battler].status2); + BtlController_EmitStatusIconUpdate(battler, B_COMM_TO_CONTROLLER, gBattleMons[battler].status1, gBattleMons[battler].status2); MarkBattlerForControllerExec(battler); gBattlescriptCurrInstr = cmd->nextInstr; } @@ -13366,7 +13396,7 @@ static void Cmd_transformdataexecution(void) RecordAllMoves(gBattlerAttacker); RecordAbilityBattle(gBattlerAttacker, gBattleMons[gBattlerAttacker].ability); - BtlController_EmitResetActionMoveSelection(gBattlerAttacker, BUFFER_A, RESET_MOVE_SELECTION); + BtlController_EmitResetActionMoveSelection(gBattlerAttacker, B_COMM_TO_CONTROLLER, RESET_MOVE_SELECTION); MarkBattlerForControllerExec(gBattlerAttacker); gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_TRANSFORMED; } @@ -13832,7 +13862,7 @@ static void Cmd_copymovepermanently(void) } movePpData.ppBonuses = gBattleMons[gBattlerAttacker].ppBonuses; - BtlController_EmitSetMonData(gBattlerAttacker, BUFFER_A, REQUEST_MOVES_PP_BATTLE, 0, sizeof(movePpData), &movePpData); + BtlController_EmitSetMonData(gBattlerAttacker, B_COMM_TO_CONTROLLER, REQUEST_MOVES_PP_BATTLE, 0, sizeof(movePpData), &movePpData); MarkBattlerForControllerExec(gBattlerAttacker); PREPARE_MOVE_BUFFER(gBattleTextBuff1, gLastPrintedMoves[gBattlerTarget]) @@ -14012,7 +14042,7 @@ static void Cmd_tryspiteppreduce(void) if (!(gDisableStructs[gBattlerTarget].mimickedMoves & (1u << i)) && !(gBattleMons[gBattlerTarget].status2 & STATUS2_TRANSFORMED)) { - BtlController_EmitSetMonData(gBattlerTarget, BUFFER_A, REQUEST_PPMOVE1_BATTLE + i, 0, sizeof(gBattleMons[gBattlerTarget].pp[i]), &gBattleMons[gBattlerTarget].pp[i]); + BtlController_EmitSetMonData(gBattlerTarget, B_COMM_TO_CONTROLLER, REQUEST_PPMOVE1_BATTLE + i, 0, sizeof(gBattleMons[gBattlerTarget].pp[i]), &gBattleMons[gBattlerTarget].pp[i]); MarkBattlerForControllerExec(gBattlerTarget); } @@ -14123,7 +14153,7 @@ static void Cmd_healpartystatus(void) if (toHeal) { - BtlController_EmitSetMonData(gBattlerAttacker, BUFFER_A, REQUEST_STATUS_BATTLE, toHeal, sizeof(zero), &zero); + BtlController_EmitSetMonData(gBattlerAttacker, B_COMM_TO_CONTROLLER, REQUEST_STATUS_BATTLE, toHeal, sizeof(zero), &zero); MarkBattlerForControllerExec(gBattlerAttacker); } @@ -14809,7 +14839,7 @@ static void Cmd_trymemento(void) { // Success, drop user's HP bar to 0 gBattleStruct->moveDamage[gBattlerAttacker] = gBattleMons[gBattlerAttacker].hp; - BtlController_EmitHealthBarUpdate(gBattlerAttacker, BUFFER_A, INSTANT_HP_BAR_DROP); + BtlController_EmitHealthBarUpdate(gBattlerAttacker, B_COMM_TO_CONTROLLER, INSTANT_HP_BAR_DROP); MarkBattlerForControllerExec(gBattlerAttacker); gBattlescriptCurrInstr = cmd->nextInstr; } @@ -14891,7 +14921,7 @@ static void Cmd_curestatuswithmove(void) gBattleMons[gBattlerAttacker].status1 = 0; gBattlescriptCurrInstr = cmd->nextInstr; - BtlController_EmitSetMonData(gBattlerAttacker, BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gBattlerAttacker].status1), &gBattleMons[gBattlerAttacker].status1); + BtlController_EmitSetMonData(gBattlerAttacker, B_COMM_TO_CONTROLLER, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gBattlerAttacker].status1), &gBattleMons[gBattlerAttacker].status1); MarkBattlerForControllerExec(gBattlerAttacker); } else @@ -15048,12 +15078,12 @@ static void Cmd_tryswapitems(void) gBattleMons[gBattlerTarget].item = oldItemAtk; RecordItemEffectBattle(gBattlerAttacker, 0); - RecordItemEffectBattle(gBattlerTarget, ItemId_GetHoldEffect(oldItemAtk)); + RecordItemEffectBattle(gBattlerTarget, GetItemHoldEffect(oldItemAtk)); - BtlController_EmitSetMonData(gBattlerAttacker, BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(*newItemAtk), newItemAtk); + BtlController_EmitSetMonData(gBattlerAttacker, B_COMM_TO_CONTROLLER, REQUEST_HELDITEM_BATTLE, 0, sizeof(*newItemAtk), newItemAtk); MarkBattlerForControllerExec(gBattlerAttacker); - BtlController_EmitSetMonData(gBattlerTarget, BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[gBattlerTarget].item), &gBattleMons[gBattlerTarget].item); + BtlController_EmitSetMonData(gBattlerTarget, B_COMM_TO_CONTROLLER, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[gBattlerTarget].item), &gBattleMons[gBattlerTarget].item); MarkBattlerForControllerExec(gBattlerTarget); gBattleStruct->choicedMove[gBattlerTarget] = MOVE_NONE; @@ -15120,7 +15150,7 @@ static void Cmd_trycopyability(void) static void Cmd_trywish(void) { - CMD_ARGS(u8 turnNumber, const u8 *failInstr); + CMD_ARGS(u8 turnNumber, const u8 *failInstr, const u8 *healBlockedInstr); switch (cmd->turnNumber) { @@ -15144,7 +15174,9 @@ static void Cmd_trywish(void) gBattleStruct->moveDamage[gBattlerTarget] = max(1, GetNonDynamaxMaxHP(gBattlerAttacker) / 2); gBattleStruct->moveDamage[gBattlerTarget] *= -1; - if (gBattleMons[gBattlerTarget].hp == gBattleMons[gBattlerTarget].maxHP) + if (gStatuses3[gBattlerTarget] & STATUS3_HEAL_BLOCK) + gBattlescriptCurrInstr = cmd->healBlockedInstr; + else if (gBattleMons[gBattlerTarget].hp == gBattleMons[gBattlerTarget].maxHP) gBattlescriptCurrInstr = cmd->failInstr; else gBattlescriptCurrInstr = cmd->nextInstr; @@ -15493,7 +15525,7 @@ static void Cmd_switchoutabilities(void) TryDeactivateSleepClause(GetBattlerSide(battler), gBattlerPartyIndexes[battler]); gBattleMons[battler].status1 = 0; - BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_STATUS_BATTLE, + BtlController_EmitSetMonData(battler, B_COMM_TO_CONTROLLER, REQUEST_STATUS_BATTLE, 1u << gBattleStruct->battlerPartyIndexes[battler], sizeof(gBattleMons[battler].status1), &gBattleMons[battler].status1); @@ -15505,7 +15537,7 @@ static void Cmd_switchoutabilities(void) regenerate += gBattleMons[battler].hp; if (regenerate > gBattleMons[battler].maxHP) regenerate = gBattleMons[battler].maxHP; - BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_HP_BATTLE, + BtlController_EmitSetMonData(battler, B_COMM_TO_CONTROLLER, REQUEST_HP_BATTLE, 1u << gBattleStruct->battlerPartyIndexes[battler], sizeof(regenerate), ®enerate); @@ -15733,7 +15765,7 @@ static void Cmd_tryrecycleitem(void) *usedHeldItem = ITEM_NONE; gBattleMons[gBattlerAttacker].item = gLastUsedItem; - BtlController_EmitSetMonData(gBattlerAttacker, BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[gBattlerAttacker].item), &gBattleMons[gBattlerAttacker].item); + BtlController_EmitSetMonData(gBattlerAttacker, B_COMM_TO_CONTROLLER, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[gBattlerAttacker].item), &gBattleMons[gBattlerAttacker].item); MarkBattlerForControllerExec(gBattlerAttacker); gBattlescriptCurrInstr = cmd->nextInstr; @@ -15882,13 +15914,13 @@ static void Cmd_handleballthrow(void) if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) { - BtlController_EmitBallThrowAnim(gBattlerAttacker, BUFFER_A, BALL_TRAINER_BLOCK); + BtlController_EmitBallThrowAnim(gBattlerAttacker, B_COMM_TO_CONTROLLER, BALL_TRAINER_BLOCK); MarkBattlerForControllerExec(gBattlerAttacker); gBattlescriptCurrInstr = BattleScript_TrainerBallBlock; } else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL) { - BtlController_EmitBallThrowAnim(gBattlerAttacker, BUFFER_A, BALL_3_SHAKES_SUCCESS); + BtlController_EmitBallThrowAnim(gBattlerAttacker, B_COMM_TO_CONTROLLER, BALL_3_SHAKES_SUCCESS); MarkBattlerForControllerExec(gBattlerAttacker); gBattlescriptCurrInstr = BattleScript_WallyBallThrow; } @@ -16091,7 +16123,7 @@ static void Cmd_handleballthrow(void) if (odds > 254) // mon caught { - BtlController_EmitBallThrowAnim(gBattlerAttacker, BUFFER_A, BALL_3_SHAKES_SUCCESS); + BtlController_EmitBallThrowAnim(gBattlerAttacker, B_COMM_TO_CONTROLLER, BALL_3_SHAKES_SUCCESS); MarkBattlerForControllerExec(gBattlerAttacker); TryBattleFormChange(gBattlerTarget, FORM_CHANGE_END_BATTLE); gBattlescriptCurrInstr = BattleScript_SuccessBallThrow; @@ -16144,7 +16176,7 @@ static void Cmd_handleballthrow(void) for (shakes = 0; shakes < maxShakes && Random() < odds; shakes++); } - BtlController_EmitBallThrowAnim(gBattlerAttacker, BUFFER_A, shakes); + BtlController_EmitBallThrowAnim(gBattlerAttacker, B_COMM_TO_CONTROLLER, shakes); MarkBattlerForControllerExec(gBattlerAttacker); if (shakes == maxShakes) // mon caught, copy of the code above @@ -16253,7 +16285,7 @@ static void Cmd_givecaughtmon(void) case GIVECAUGHTMON_DO_CHOOSE_MON: if (!gPaletteFade.active) { - BtlController_EmitChoosePokemon(gBattlerAttacker, BUFFER_A, PARTY_ACTION_SEND_MON_TO_BOX, PARTY_SIZE, ABILITY_NONE, gBattleStruct->battlerPartyOrders[gBattlerAttacker]); + BtlController_EmitChoosePokemon(gBattlerAttacker, B_COMM_TO_CONTROLLER, PARTY_ACTION_SEND_MON_TO_BOX, PARTY_SIZE, ABILITY_NONE, gBattleStruct->battlerPartyOrders[gBattlerAttacker]); MarkBattlerForControllerExec(gBattlerAttacker); gBattleCommunication[MULTIUSE_STATE] = GIVECAUGHTMON_HANDLE_CHOSEN_MON; } @@ -16292,7 +16324,7 @@ static void Cmd_givecaughtmon(void) if (B_RESTORE_HELD_BATTLE_ITEMS >= GEN_9) { u16 lostItem = gBattleStruct->itemLost[B_SIDE_OPPONENT][gBattlerPartyIndexes[GetCatchingBattler()]].originalItem; - if (lostItem != ITEM_NONE && ItemId_GetPocket(lostItem) != POCKET_BERRIES) + if (lostItem != ITEM_NONE && GetItemPocket(lostItem) != POCKET_BERRIES) SetMonData(&gEnemyParty[gBattlerPartyIndexes[GetCatchingBattler()]], MON_DATA_HELD_ITEM, &lostItem); // Restore non-berry items } @@ -16582,7 +16614,7 @@ static void Cmd_trainerslideout(void) CMD_ARGS(u8 position); u32 battler = GetBattlerForBattleScript(cmd->position); - BtlController_EmitTrainerSlideBack(battler, BUFFER_A); + BtlController_EmitTrainerSlideBack(battler, B_COMM_TO_CONTROLLER); MarkBattlerForControllerExec(battler); gBattlescriptCurrInstr = cmd->nextInstr; @@ -16699,7 +16731,6 @@ static void Cmd_tryworryseed(void) || gBattleMons[gBattlerTarget].ability == ABILITY_INSOMNIA) { RecordAbilityBattle(gBattlerTarget, gBattleMons[gBattlerTarget].ability); - gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = cmd->failInstr; } else if (GetBattlerHoldEffect(gBattlerTarget, TRUE) == HOLD_EFFECT_ABILITY_SHIELD) @@ -17157,7 +17188,7 @@ void BS_ItemRestoreHP(void) NATIVE_ARGS(const u8 *alreadyMaxHpInstr, const u8 *restoreBattlerInstr); u16 healAmount; u32 battler = MAX_BATTLERS_COUNT; - u32 healParam = ItemId_GetEffect(gLastUsedItem)[6]; + u32 healParam = GetItemEffect(gLastUsedItem)[6]; u32 side = GetBattlerSide(gBattlerAttacker); struct Pokemon *party = GetSideParty(side); u16 hp = GetMonData(&party[gBattleStruct->itemPartyIndex[gBattlerAttacker]], MON_DATA_HP); @@ -17276,8 +17307,8 @@ void BS_ItemCureStatus(void) void BS_ItemIncreaseStat(void) { NATIVE_ARGS(); - u16 statId = ItemId_GetEffect(gLastUsedItem)[1]; - u16 stages = ItemId_GetHoldEffectParam(gLastUsedItem); + u16 statId = GetItemEffect(gLastUsedItem)[1]; + u16 stages = GetItemHoldEffectParam(gLastUsedItem); SET_STATCHANGER(statId, stages, FALSE); gBattlescriptCurrInstr = cmd->nextInstr; } @@ -17285,7 +17316,7 @@ void BS_ItemIncreaseStat(void) void BS_ItemRestorePP(void) { NATIVE_ARGS(); - const u8 *effect = ItemId_GetEffect(gLastUsedItem); + const u8 *effect = GetItemEffect(gLastUsedItem); u32 i, pp, maxPP, moveId, loopEnd; u32 battler = MAX_BATTLERS_COUNT; struct Pokemon *mon = (GetBattlerSide(gBattlerAttacker) == B_SIDE_PLAYER) ? &gPlayerParty[gBattleStruct->itemPartyIndex[gBattlerAttacker]] : &gEnemyParty[gBattleStruct->itemPartyIndex[gBattlerAttacker]]; @@ -18241,7 +18272,7 @@ void BS_TeatimeInvul(void) NATIVE_ARGS(u8 battler, const u8 *jumpInstr); u32 battler = GetBattlerForBattleScript(cmd->battler); - if (ItemId_GetPocket(gBattleMons[battler].item) == POCKET_BERRIES && !(gStatuses3[gBattlerTarget] & (STATUS3_SEMI_INVULNERABLE))) + if (GetItemPocket(gBattleMons[battler].item) == POCKET_BERRIES && !(gStatuses3[gBattlerTarget] & (STATUS3_SEMI_INVULNERABLE))) gBattlescriptCurrInstr = cmd->nextInstr; else gBattlescriptCurrInstr = cmd->jumpInstr; @@ -18332,7 +18363,7 @@ void BS_TryRevivalBlessing(void) struct Pokemon *party = GetSideParty(side); u16 hp = GetMonData(&party[gSelectedMonPartyId], MON_DATA_MAX_HP) / 2; - BtlController_EmitSetMonData(gBattlerAttacker, BUFFER_A, REQUEST_HP_BATTLE, 1u << gSelectedMonPartyId, sizeof(hp), &hp); + BtlController_EmitSetMonData(gBattlerAttacker, B_COMM_TO_CONTROLLER, REQUEST_HP_BATTLE, 1u << gSelectedMonPartyId, sizeof(hp), &hp); MarkBattlerForControllerExec(gBattlerAttacker); PREPARE_SPECIES_BUFFER(gBattleTextBuff1, GetMonData(&party[gSelectedMonPartyId], MON_DATA_SPECIES)); @@ -18353,7 +18384,7 @@ void BS_TryRevivalBlessing(void) else { // Open party menu, wait to go to next instruction. - BtlController_EmitChoosePokemon(gBattlerAttacker, BUFFER_A, PARTY_ACTION_CHOOSE_FAINTED_MON, PARTY_SIZE, ABILITY_NONE, gBattleStruct->battlerPartyOrders[gBattlerAttacker]); + BtlController_EmitChoosePokemon(gBattlerAttacker, B_COMM_TO_CONTROLLER, PARTY_ACTION_CHOOSE_FAINTED_MON, PARTY_SIZE, ABILITY_NONE, gBattleStruct->battlerPartyOrders[gBattlerAttacker]); MarkBattlerForControllerExec(gBattlerAttacker); } } @@ -18392,7 +18423,7 @@ static void UpdatePokeFlutePartyStatus(struct Pokemon* party, u8 position) { battler = GetBattlerAtPosition(position); status = 0; - BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_STATUS_BATTLE, monToCheck, 4, &status); + BtlController_EmitSetMonData(battler, B_COMM_TO_CONTROLLER, REQUEST_STATUS_BATTLE, monToCheck, 4, &status); MarkBattlerForControllerExec(battler); gBattleCommunication[MULTISTRING_CHOOSER] = 1; } @@ -18593,7 +18624,7 @@ static void TrySetParalysis(const u8 *nextInstr, const u8 *failInstr) gBattleMons[gBattlerTarget].status1 |= STATUS1_PARALYSIS; gBattleCommunication[MULTISTRING_CHOOSER] = 3; gEffectBattler = gBattlerTarget; - BtlController_EmitSetMonData(gBattlerTarget, BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gBattlerTarget].status1), &gBattleMons[gBattlerTarget].status1); + BtlController_EmitSetMonData(gBattlerTarget, B_COMM_TO_CONTROLLER, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gBattlerTarget].status1), &gBattleMons[gBattlerTarget].status1); MarkBattlerForControllerExec(gBattlerTarget); gBattlescriptCurrInstr = nextInstr; } @@ -18610,7 +18641,7 @@ static void TrySetPoison(const u8 *nextInstr, const u8 *failInstr) gBattleMons[gBattlerTarget].status1 |= STATUS1_POISON; gBattleCommunication[MULTISTRING_CHOOSER] = 0; gEffectBattler = gBattlerTarget; - BtlController_EmitSetMonData(gBattlerTarget, BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gBattlerTarget].status1), &gBattleMons[gBattlerTarget].status1); + BtlController_EmitSetMonData(gBattlerTarget, B_COMM_TO_CONTROLLER, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gBattlerTarget].status1), &gBattleMons[gBattlerTarget].status1); MarkBattlerForControllerExec(gBattlerTarget); gBattlescriptCurrInstr = nextInstr; } @@ -18632,7 +18663,7 @@ static void TrySetSleep(const u8 *nextInstr, const u8 *failInstr) TryActivateSleepClause(gBattlerTarget, gBattlerPartyIndexes[gBattlerTarget]); gBattleCommunication[MULTISTRING_CHOOSER] = 4; gEffectBattler = gBattlerTarget; - BtlController_EmitSetMonData(gBattlerTarget, BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gBattlerTarget].status1), &gBattleMons[gBattlerTarget].status1); + BtlController_EmitSetMonData(gBattlerTarget, B_COMM_TO_CONTROLLER, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gBattlerTarget].status1), &gBattleMons[gBattlerTarget].status1); MarkBattlerForControllerExec(gBattlerTarget); gBattlescriptCurrInstr = nextInstr; } @@ -18780,13 +18811,13 @@ void BS_TryRecycleBerry(void) u16* usedHeldItem = &gBattleStruct->usedHeldItems[gBattlerPartyIndexes[gBattlerTarget]][GetBattlerSide(gBattlerTarget)]; if (gBattleMons[gBattlerTarget].item == ITEM_NONE && gBattleStruct->changedItems[gBattlerTarget] == ITEM_NONE // Will not inherit an item - && ItemId_GetPocket(*usedHeldItem) == POCKET_BERRIES) + && GetItemPocket(*usedHeldItem) == POCKET_BERRIES) { gLastUsedItem = *usedHeldItem; *usedHeldItem = ITEM_NONE; gBattleMons[gBattlerTarget].item = gLastUsedItem; - BtlController_EmitSetMonData(gBattlerTarget, BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[gBattlerTarget].item), &gBattleMons[gBattlerTarget].item); + BtlController_EmitSetMonData(gBattlerTarget, B_COMM_TO_CONTROLLER, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[gBattlerTarget].item), &gBattleMons[gBattlerTarget].item); MarkBattlerForControllerExec(gBattlerTarget); gBattlescriptCurrInstr = cmd->nextInstr; diff --git a/src/battle_tower.c b/src/battle_tower.c index bd3ba03702..37fc2d0750 100644 --- a/src/battle_tower.c +++ b/src/battle_tower.c @@ -704,7 +704,7 @@ const struct Trainer gBattlePartners[DIFFICULTY_COUNT][PARTNER_COUNT] = #include "data/battle_partners.h" }; -static void (* const sBattleTowerFuncs[])(void) = +static void (*const sBattleTowerFuncs[])(void) = { [BATTLE_TOWER_FUNC_INIT] = InitTowerChallenge, [BATTLE_TOWER_FUNC_GET_DATA] = GetTowerData, @@ -2393,7 +2393,7 @@ static void LoadMultiPartnerCandidatesData(void) static void GetPotentialPartnerMoveAndSpecies(u16 trainerId, u16 monId) { - u16 move = 0; + u16 move = MOVE_NONE; u16 species = 0; SetFacilityPtrsGetLevel(); diff --git a/src/battle_transition.c b/src/battle_transition.c index b131769ba4..58882327f8 100644 --- a/src/battle_transition.c +++ b/src/battle_transition.c @@ -81,7 +81,7 @@ struct RectangularSpiralLine { u8 state; s16 position; - u8 moveIdx; + u8 moveIndex; s16 reboundPosition; bool8 outward; }; @@ -274,7 +274,7 @@ static s16 IsTrainerPicSlideDone(s16); static bool8 TransitionIntro_FadeToGray(struct Task *); static bool8 TransitionIntro_FadeFromGray(struct Task *); static bool8 IsIntroTaskDone(void); -static bool16 UpdateRectangularSpiralLine(const s16 * const *, struct RectangularSpiralLine *); +static bool16 UpdateRectangularSpiralLine(const s16 *const *, struct RectangularSpiralLine *); static void SpriteCB_FldEffPokeballTrail(struct Sprite *); static void SpriteCB_MugshotTrainerPic(struct Sprite *); static void SpriteCB_WhiteBarFade(struct Sprite *); @@ -3125,28 +3125,28 @@ static bool8 RectangularSpiral_Init(struct Task *task) // Line starting in top left sRectangularSpiralLines[0].state = SPIRAL_INWARD_START; sRectangularSpiralLines[0].position = -1; - sRectangularSpiralLines[0].moveIdx = 1; + sRectangularSpiralLines[0].moveIndex = 1; sRectangularSpiralLines[0].reboundPosition = 308; sRectangularSpiralLines[0].outward = FALSE; // Line starting in bottom right sRectangularSpiralLines[1].state = SPIRAL_INWARD_START; sRectangularSpiralLines[1].position = -1; - sRectangularSpiralLines[1].moveIdx = 1; + sRectangularSpiralLines[1].moveIndex = 1; sRectangularSpiralLines[1].reboundPosition = 308; sRectangularSpiralLines[1].outward = FALSE; // Line starting in top right sRectangularSpiralLines[2].state = SPIRAL_INWARD_START; sRectangularSpiralLines[2].position = -3; - sRectangularSpiralLines[2].moveIdx = 1; + sRectangularSpiralLines[2].moveIndex = 1; sRectangularSpiralLines[2].reboundPosition = 307; sRectangularSpiralLines[2].outward = FALSE; // Line starting in bottom left sRectangularSpiralLines[3].state = SPIRAL_INWARD_START; sRectangularSpiralLines[3].position = -3; - sRectangularSpiralLines[3].moveIdx = 1; + sRectangularSpiralLines[3].moveIndex = 1; sRectangularSpiralLines[3].reboundPosition = 307; sRectangularSpiralLines[3].outward = FALSE; @@ -3202,14 +3202,14 @@ static bool8 RectangularSpiral_End(struct Task *task) } // Returns TRUE if a tile should be drawn, FALSE otherwise -static bool16 UpdateRectangularSpiralLine(const s16 * const *moveDataTable, struct RectangularSpiralLine *line) +static bool16 UpdateRectangularSpiralLine(const s16 *const *moveDataTable, struct RectangularSpiralLine *line) { const s16 *moveData = moveDataTable[line->state]; // Has spiral finished? // Note that most move data arrays endsin SPIRAL_END but it is // only ever reached on the final array of spiraling outward. - if (moveData[line->moveIdx] == SPIRAL_END) + if (moveData[line->moveIndex] == SPIRAL_END) return FALSE; // Presumably saving data for debug. @@ -3240,21 +3240,21 @@ static bool16 UpdateRectangularSpiralLine(const s16 * const *moveDataTable, stru // Below check is never true. // SPIRAL_END was already checked, and position is never >= 640 - if (line->position >= 640 || moveData[line->moveIdx] == SPIRAL_END) + if (line->position >= 640 || moveData[line->moveIndex] == SPIRAL_END) return FALSE; - if (!line->outward && moveData[line->moveIdx] == SPIRAL_REBOUND) + if (!line->outward && moveData[line->moveIndex] == SPIRAL_REBOUND) { // Line has reached the final point of spiraling inward. // Time to flip and start spiraling outward. line->outward = TRUE; - line->moveIdx = 1; + line->moveIndex = 1; line->position = line->reboundPosition; line->state = SPIRAL_OUTWARD_START; } // Reached move target, advance to next movement. - if (line->position == moveData[line->moveIdx]) + if (line->position == moveData[line->moveIndex]) { line->state++; if (line->outward == TRUE) @@ -3264,7 +3264,7 @@ static bool16 UpdateRectangularSpiralLine(const s16 * const *moveDataTable, stru // Still spiraling outward, loop back to the first state // but use the second set of move targets. // For example, the 28 in sRectangularSpiral_Major_OutwardUp - line->moveIdx++; + line->moveIndex++; line->state = SPIRAL_OUTWARD_START; } } @@ -3275,7 +3275,7 @@ static bool16 UpdateRectangularSpiralLine(const s16 * const *moveDataTable, stru // Still spiraling inward, loop back to the first state // but use the second set of move targets. // For example, the 275 in sRectangularSpiral_Major_InwardRight - line->moveIdx++; + line->moveIndex++; line->state = SPIRAL_INWARD_START; } } diff --git a/src/battle_tv.c b/src/battle_tv.c index bdf3359b84..d43345fca5 100644 --- a/src/battle_tv.c +++ b/src/battle_tv.c @@ -15,8 +15,8 @@ static bool8 IsNotSpecialBattleString(u16 stringId); static void AddMovePoints(u8 caseId, u16 arg1, u8 arg2, u8 arg3); static void TrySetBattleSeminarShow(void); static void AddPointsOnFainting(bool8 targetFainted); -static void AddPointsBasedOnWeather(u16 weatherFlags, u16 moveId, u8 moveSlot); -static bool8 ShouldCalculateDamage(u16 moveId, s32 *dmg, u16 *powerOverride); +static void AddPointsBasedOnWeather(u16 weatherFlags, u16 move, u8 moveSlot); +static bool8 ShouldCalculateDamage(u16 move, s32 *dmg, u16 *powerOverride); #define TABLE_END ((u16)-1) @@ -829,7 +829,7 @@ void TryPutLinkBattleTvShowOnAir(void) u8 countPlayer = 0, countOpponent = 0; s16 sum = 0; u16 species = 0; - u16 moveId = 0; + u16 move = MOVE_NONE; s32 i, j; int zero = 0, one = 1; //needed for matching @@ -897,8 +897,8 @@ void TryPutLinkBattleTvShowOnAir(void) } } - moveId = GetMonData(&gPlayerParty[playerBestMonId], MON_DATA_MOVE1 + i, NULL); - if (playerBestSum == 0 || moveId == 0) + move = GetMonData(&gPlayerParty[playerBestMonId], MON_DATA_MOVE1 + i, NULL); + if (playerBestSum == 0 || move == MOVE_NONE) return; if (gBattleTypeFlags & BATTLE_TYPE_MULTI) @@ -907,12 +907,12 @@ void TryPutLinkBattleTvShowOnAir(void) || (playerBestMonId >= MULTI_PARTY_SIZE && GetLinkTrainerFlankId(gBattleScripting.multiplayerId))) { j = (opponentBestMonId < MULTI_PARTY_SIZE) ? FALSE : TRUE; - PutBattleUpdateOnTheAir(GetOpposingLinkMultiBattlerId(j, gBattleScripting.multiplayerId), moveId, playerBestSpecies, opponentBestSpecies); + PutBattleUpdateOnTheAir(GetOpposingLinkMultiBattlerId(j, gBattleScripting.multiplayerId), move, playerBestSpecies, opponentBestSpecies); } } else { - PutBattleUpdateOnTheAir(gBattleScripting.multiplayerId ^ 1, moveId, playerBestSpecies, opponentBestSpecies); + PutBattleUpdateOnTheAir(gBattleScripting.multiplayerId ^ 1, move, playerBestSpecies, opponentBestSpecies); } } @@ -1295,9 +1295,9 @@ static void TrySetBattleSeminarShow(void) gCurrentMove = currMoveSaved; } -static bool8 ShouldCalculateDamage(u16 moveId, s32 *dmg, u16 *powerOverride) +static bool8 ShouldCalculateDamage(u16 move, s32 *dmg, u16 *powerOverride) { - if (IsBattleMoveStatus(moveId)) + if (IsBattleMoveStatus(move)) { *dmg = 0; return FALSE; @@ -1307,7 +1307,7 @@ static bool8 ShouldCalculateDamage(u16 moveId, s32 *dmg, u16 *powerOverride) s32 i = 0; do { - if (moveId == sVariableDmgMoves[i]) + if (move == sVariableDmgMoves[i]) break; i++; } while (sVariableDmgMoves[i] != TABLE_END); @@ -1317,13 +1317,13 @@ static bool8 ShouldCalculateDamage(u16 moveId, s32 *dmg, u16 *powerOverride) *dmg = 0; return FALSE; } - else if (moveId == MOVE_PSYWAVE) + else if (move == MOVE_PSYWAVE) { *dmg = gBattleMons[gBattlerAttacker].level; *dmg /= 2; return FALSE; } - else if (moveId == MOVE_MAGNITUDE) + else if (move == MOVE_MAGNITUDE) { *powerOverride = 10; return TRUE; @@ -1358,18 +1358,18 @@ void BattleTv_ClearExplosionFaintCause(void) } } -u8 GetBattlerMoveSlotId(u8 battlerId, u16 moveId) +u8 GetBattlerMoveSlotId(u8 battler, u16 move) { s32 i; struct Pokemon *party; - party = GetBattlerParty(battlerId); + party = GetBattlerParty(battler); i = 0; while (1) { if (i >= MAX_MON_MOVES) break; - if (GetMonData(&party[gBattlerPartyIndexes[battlerId]], MON_DATA_MOVE1 + i, NULL) == moveId) + if (GetMonData(&party[gBattlerPartyIndexes[battler]], MON_DATA_MOVE1 + i, NULL) == move) break; i++; } @@ -1377,14 +1377,14 @@ u8 GetBattlerMoveSlotId(u8 battlerId, u16 moveId) return i; } -static void AddPointsBasedOnWeather(u16 weatherFlags, u16 moveId, u8 moveSlot) +static void AddPointsBasedOnWeather(u16 weatherFlags, u16 move, u8 moveSlot) { if (weatherFlags & B_WEATHER_RAIN) - AddMovePoints(PTS_RAIN, moveId, moveSlot, 0); + AddMovePoints(PTS_RAIN, move, moveSlot, 0); else if (weatherFlags & B_WEATHER_SUN) - AddMovePoints(PTS_SUN, moveId, moveSlot, 0); + AddMovePoints(PTS_SUN, move, moveSlot, 0); else if (weatherFlags & B_WEATHER_SANDSTORM) - AddMovePoints(PTS_SANDSTORM, moveId, moveSlot, 0); - else if (weatherFlags & (B_WEATHER_HAIL | B_WEATHER_SNOW)) - AddMovePoints(PTS_HAIL, moveId, moveSlot, 0); + AddMovePoints(PTS_SANDSTORM, move, moveSlot, 0); + else if (weatherFlags & B_WEATHER_HAIL) + AddMovePoints(PTS_HAIL, move, moveSlot, 0); } diff --git a/src/battle_util.c b/src/battle_util.c index ccd4d6fb2d..ee08535a9d 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -528,7 +528,7 @@ void HandleAction_UseItem(void) ClearVariousBattlerFlags(gBattlerAttacker); gLastUsedItem = gBattleResources->bufferB[gBattlerAttacker][1] | (gBattleResources->bufferB[gBattlerAttacker][2] << 8); - gBattlescriptCurrInstr = gBattlescriptsForUsingItem[ItemId_GetBattleUsage(gLastUsedItem) - 1]; + gBattlescriptCurrInstr = gBattlescriptsForUsingItem[GetItemBattleUsage(gLastUsedItem) - 1]; gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT; } @@ -546,7 +546,7 @@ bool32 TryRunFromBattle(u32 battler) if (gBattleMons[battler].item == ITEM_ENIGMA_BERRY_E_READER) holdEffect = gEnigmaBerries[battler].holdEffect; else - holdEffect = ItemId_GetHoldEffect(gBattleMons[battler].item); + holdEffect = GetItemHoldEffect(gBattleMons[battler].item); gPotentialItemEffectBattler = battler; @@ -702,7 +702,7 @@ void HandleAction_ThrowBall(void) gBattle_BG0_X = 0; gBattle_BG0_Y = 0; gLastUsedItem = gBallToDisplay; - if (!ItemId_GetImportance(gLastUsedItem)) + if (!GetItemImportance(gLastUsedItem)) RemoveBagItem(gLastUsedItem, 1); gBattlescriptCurrInstr = BattleScript_BallThrow; gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT; @@ -1148,7 +1148,7 @@ void PrepareStringBattle(u16 stringId, u32 battler) if ((stringId == STRINGID_ITDOESNTAFFECT || stringId == STRINGID_PKMNWASNTAFFECTED || stringId == STRINGID_PKMNUNAFFECTED)) TryInitializeTrainerSlideEnemyMonUnaffected(gBattlerTarget); - BtlController_EmitPrintString(battler, BUFFER_A, stringId); + BtlController_EmitPrintString(battler, B_COMM_TO_CONTROLLER, stringId); MarkBattlerForControllerExec(battler); } @@ -1376,7 +1376,7 @@ u32 TrySetCantSelectMoveBattleScript(u32 battler) } } - if (DYNAMAX_BYPASS_CHECK && moveEffect == EFFECT_STUFF_CHEEKS && ItemId_GetPocket(gBattleMons[battler].item) != POCKET_BERRIES) + if (DYNAMAX_BYPASS_CHECK && moveEffect == EFFECT_STUFF_CHEEKS && GetItemPocket(gBattleMons[battler].item) != POCKET_BERRIES) { gCurrentMove = move; if (gBattleTypeFlags & BATTLE_TYPE_PALACE) @@ -1544,7 +1544,7 @@ u8 CheckMoveLimitations(u32 battler, u8 unusableMoves, u16 check) else if (check & MOVE_LIMITATION_THROAT_CHOP && gDisableStructs[battler].throatChopTimer && IsSoundMove(move)) unusableMoves |= 1u << i; // Stuff Cheeks - else if (check & MOVE_LIMITATION_STUFF_CHEEKS && moveEffect == EFFECT_STUFF_CHEEKS && ItemId_GetPocket(gBattleMons[battler].item) != POCKET_BERRIES) + else if (check & MOVE_LIMITATION_STUFF_CHEEKS && moveEffect == EFFECT_STUFF_CHEEKS && GetItemPocket(gBattleMons[battler].item) != POCKET_BERRIES) unusableMoves |= 1u << i; // Gorilla Tactics else if (check & MOVE_LIMITATION_CHOICE_ITEM && GetBattlerAbility(battler) == ABILITY_GORILLA_TACTICS && *choicedMove != MOVE_NONE && *choicedMove != MOVE_UNAVAILABLE && *choicedMove != move) @@ -2580,7 +2580,7 @@ u8 DoBattlerEndTurnEffects(void) gBattleMons[gBattlerAttacker].status2 &= ~STATUS2_NIGHTMARE; gBattleCommunication[MULTISTRING_CHOOSER] = 1; BattleScriptExecute(BattleScript_MonWokeUpInUproar); - BtlController_EmitSetMonData(gBattlerAttacker, BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gBattlerAttacker].status1); + BtlController_EmitSetMonData(gBattlerAttacker, B_COMM_TO_CONTROLLER, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gBattlerAttacker].status1); MarkBattlerForControllerExec(gBattlerAttacker); break; } @@ -2737,7 +2737,7 @@ u8 DoBattlerEndTurnEffects(void) gBattleMons[battler].status1 |= ((Random() % 4) + 3); TryActivateSleepClause(battler, gBattlerPartyIndexes[battler]); - BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1); + BtlController_EmitSetMonData(battler, B_COMM_TO_CONTROLLER, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1); MarkBattlerForControllerExec(battler); BattleScriptExecute(BattleScript_YawnMakesAsleep); } @@ -2832,7 +2832,7 @@ u8 DoBattlerEndTurnEffects(void) gBattleStruct->turnEffectsTracker++; break; case ENDTURN_CUD_CHEW: - if (GetBattlerAbility(battler) == ABILITY_CUD_CHEW && !gDisableStructs[battler].cudChew && ItemId_GetPocket(GetUsedHeldItem(battler)) == POCKET_BERRIES) + if (GetBattlerAbility(battler) == ABILITY_CUD_CHEW && !gDisableStructs[battler].cudChew && GetItemPocket(GetUsedHeldItem(battler)) == POCKET_BERRIES) gDisableStructs[battler].cudChew = TRUE; gBattleStruct->turnEffectsTracker++; break; @@ -2909,7 +2909,7 @@ u8 DoBattlerEndTurnEffects(void) if (IsBattlerAlive(battler) && gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_SEA_OF_FIRE) { gBattleStruct->moveDamage[battler] = GetNonDynamaxMaxHP(battler) / 8; - BtlController_EmitStatusAnimation(battler, BUFFER_A, FALSE, STATUS1_BURN); + BtlController_EmitStatusAnimation(battler, B_COMM_TO_CONTROLLER, FALSE, STATUS1_BURN); MarkBattlerForControllerExec(battler); BattleScriptExecute(BattleScript_HurtByTheSeaOfFire); effect++; @@ -3870,7 +3870,7 @@ u32 AtkCanceller_MoveSuccessOrder(void) if (effect == 2) { - BtlController_EmitSetMonData(gBattlerAttacker, BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gBattlerAttacker].status1); + BtlController_EmitSetMonData(gBattlerAttacker, B_COMM_TO_CONTROLLER, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gBattlerAttacker].status1); MarkBattlerForControllerExec(gBattlerAttacker); } @@ -4313,6 +4313,7 @@ bool32 CanAbilityBlockMove(u32 battlerAtk, u32 battlerDef, u32 move, u32 ability if (option == ABILITY_RUN_SCRIPT) { + gMultiHitCounter = 0; // Prevent multi-hit moves from hitting more than once after move has been absorbed. gBattleScripting.battler = gBattlerAbility = battlerAbility; gBattlescriptCurrInstr = battleScriptBlocksMove; } @@ -4846,10 +4847,11 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32 } break; case ABILITY_UNNERVE: - if (!gSpecialStatuses[battler].switchInAbilityDone) + if (!gSpecialStatuses[battler].switchInAbilityDone && !gDisableStructs[battler].unnerveActivated) { gBattlerTarget = GetOppositeBattler(battler); gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_UNNERVE; + gDisableStructs[battler].unnerveActivated = TRUE; gSpecialStatuses[battler].switchInAbilityDone = TRUE; BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg); effect++; @@ -4857,10 +4859,11 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32 break; case ABILITY_AS_ONE_ICE_RIDER: case ABILITY_AS_ONE_SHADOW_RIDER: - if (!gSpecialStatuses[battler].switchInAbilityDone) + if (!gSpecialStatuses[battler].switchInAbilityDone && !gDisableStructs[battler].unnerveActivated) { gBattlerTarget = GetOppositeBattler(battler); gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_ASONE; + gDisableStructs[battler].unnerveActivated = TRUE; gSpecialStatuses[battler].switchInAbilityDone = TRUE; BattleScriptPushCursorAndCallback(BattleScript_ActivateAsOne); effect++; @@ -5396,7 +5399,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32 if (gBattleMons[battler].status2 & STATUS2_CONFUSION && !(gStatuses4[battler] & STATUS4_INFINITE_CONFUSION)) gBattleMons[battler].status2 -= STATUS2_CONFUSION_TURN(1); - BtlController_EmitSpriteInvisibility(battler, BUFFER_A, TRUE); + BtlController_EmitSpriteInvisibility(battler, B_COMM_TO_CONTROLLER, TRUE); MarkBattlerForControllerExec(battler); BattleScriptPushCursorAndCallback(BattleScript_CommanderActivates); effect++; @@ -5425,7 +5428,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32 if ((IsBattlerWeatherAffected(battler, B_WEATHER_SUN) || RandomPercentage(RNG_HARVEST, 50)) && gBattleMons[battler].item == ITEM_NONE && gBattleStruct->changedItems[battler] == ITEM_NONE // Will not inherit an item - && ItemId_GetPocket(GetUsedHeldItem(battler)) == POCKET_BERRIES) + && GetItemPocket(GetUsedHeldItem(battler)) == POCKET_BERRIES) { gLastUsedItem = GetUsedHeldItem(battler); BattleScriptPushCursorAndCallback(BattleScript_HarvestActivates); @@ -5480,7 +5483,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32 gBattleMons[battler].status2 &= ~STATUS2_NIGHTMARE; gBattleScripting.battler = battler; BattleScriptPushCursorAndCallback(BattleScript_ShedSkinActivates); - BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1); + BtlController_EmitSetMonData(battler, B_COMM_TO_CONTROLLER, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1); MarkBattlerForControllerExec(battler); effect++; } @@ -5573,7 +5576,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32 && !gHasFetchedBall) { gBattleScripting.battler = battler; - BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, 2, &gLastUsedBall); + BtlController_EmitSetMonData(battler, B_COMM_TO_CONTROLLER, REQUEST_HELDITEM_BATTLE, 0, 2, &gLastUsedBall); MarkBattlerForControllerExec(battler); gHasFetchedBall = TRUE; gLastUsedItem = gLastUsedBall; @@ -5613,7 +5616,8 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32 // prankster check if (effect == 0 - && GetChosenMovePriority(gBattlerAttacker) > 0 + && IsBattleMoveStatus(move) + && GetChosenMovePriority(gBattlerAttacker) > 0 && BlocksPrankster(move, gBattlerAttacker, gBattlerTarget, TRUE) && !(IsBattleMoveStatus(move) && (gLastUsedAbility == ABILITY_MAGIC_BOUNCE || gProtectStructs[gBattlerTarget].bounceMove))) { @@ -6428,7 +6432,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32 } gBattleScripting.battler = gBattlerAbility = battler; - BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1); + BtlController_EmitSetMonData(battler, B_COMM_TO_CONTROLLER, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1); MarkBattlerForControllerExec(battler); return effect; } @@ -6906,7 +6910,7 @@ bool32 CanBeConfused(u32 battler) // second argument is 1/X of current hp compared to max hp bool32 HasEnoughHpToEatBerry(u32 battler, u32 hpFraction, u32 itemId) { - bool32 isBerry = (ItemId_GetPocket(itemId) == POCKET_BERRIES); + bool32 isBerry = (GetItemPocket(itemId) == POCKET_BERRIES); if (!IsBattlerAlive(battler)) return FALSE; @@ -6972,7 +6976,7 @@ static enum ItemEffect StatRaiseBerry(u32 battler, u32 itemId, u32 statId, enum if (CompareStat(battler, statId, MAX_STAT_STAGE, CMP_LESS_THAN) && HasEnoughHpToEatBerry(battler, GetBattlerItemHoldEffectParam(battler, itemId), itemId)) { BufferStatChange(battler, statId, STRINGID_STATROSE); - gEffectBattler = battler; + gEffectBattler = gBattleScripting.battler = battler; if (GetBattlerAbility(battler) == ABILITY_RIPEN) SET_STATCHANGER(statId, 2, FALSE); else @@ -6983,12 +6987,12 @@ static enum ItemEffect StatRaiseBerry(u32 battler, u32 itemId, u32 statId, enum if (caseID == ITEMEFFECT_ON_SWITCH_IN_FIRST_TURN || caseID == ITEMEFFECT_NORMAL) { - BattleScriptExecute(BattleScript_BerryStatRaiseEnd2); + BattleScriptExecute(BattleScript_ConsumableStatRaiseEnd2); } else { BattleScriptPushCursor(); - gBattlescriptCurrInstr = BattleScript_BerryStatRaiseRet; + gBattlescriptCurrInstr = BattleScript_ConsumableStatRaiseRet; } return ITEM_STATS_CHANGE; } @@ -7010,7 +7014,7 @@ static enum ItemEffect RandomStatRaiseBerry(u32 battler, u32 itemId, enum ItemCa u16 battlerAbility = GetBattlerAbility(battler); u32 savedAttacker = gBattlerAttacker; // MoodyCantRaiseStat requires that the battler is set to gBattlerAttacker - gBattlerAttacker = battler; + gBattlerAttacker = gBattleScripting.battler = battler; stat = RandomUniformExcept(RNG_RANDOM_STAT_UP, STAT_ATK, NUM_STATS - 1, MoodyCantRaiseStat); gBattlerAttacker = savedAttacker; @@ -7034,12 +7038,12 @@ static enum ItemEffect RandomStatRaiseBerry(u32 battler, u32 itemId, enum ItemCa gBattleScripting.animArg2 = 0; if (caseID == ITEMEFFECT_ON_SWITCH_IN_FIRST_TURN || caseID == ITEMEFFECT_NORMAL) { - BattleScriptExecute(BattleScript_BerryStatRaiseEnd2); + BattleScriptExecute(BattleScript_ConsumableStatRaiseEnd2); } else { BattleScriptPushCursor(); - gBattlescriptCurrInstr = BattleScript_BerryStatRaiseRet; + gBattlescriptCurrInstr = BattleScript_ConsumableStatRaiseRet; } return ITEM_STATS_CHANGE; @@ -7109,7 +7113,7 @@ static enum ItemEffect DamagedStatBoostBerryEffect(u32 battler, u8 statId, u8 ca gBattleScripting.animArg1 = STAT_ANIM_PLUS1 + statId; gBattleScripting.animArg2 = 0; BattleScriptPushCursor(); - gBattlescriptCurrInstr = BattleScript_BerryStatRaiseRet; + gBattlescriptCurrInstr = BattleScript_ConsumableStatRaiseRet; return ITEM_STATS_CHANGE; } return ITEM_NO_EFFECT; @@ -7127,12 +7131,12 @@ enum ItemEffect TryHandleSeed(u32 battler, u32 terrainFlag, u32 statId, u32 item gBattleScripting.animArg2 = 0; if (caseID == ITEMEFFECT_ON_SWITCH_IN_FIRST_TURN) { - BattleScriptExecute(BattleScript_BerryStatRaiseEnd2); + BattleScriptExecute(BattleScript_ConsumableStatRaiseEnd2); } else { BattleScriptPushCursor(); - gBattlescriptCurrInstr = BattleScript_BerryStatRaiseRet; + gBattlescriptCurrInstr = BattleScript_ConsumableStatRaiseRet; } return ITEM_STATS_CHANGE; } @@ -7163,6 +7167,28 @@ static enum ItemEffect TryEjectPack(u32 battler, enum ItemCaseId caseID) return ITEM_NO_EFFECT; } +static enum ItemEffect ConsumeBerserkGene(u32 battler, enum ItemCaseId caseID) +{ + if (CanBeInfinitelyConfused(battler)) + gStatuses4[battler] |= STATUS4_INFINITE_CONFUSION; + + BufferStatChange(battler, STAT_ATK, STRINGID_STATROSE); + gBattlerAttacker = gEffectBattler = battler; + SET_STATCHANGER(STAT_ATK, 2, FALSE); + gBattleScripting.animArg1 = STAT_ANIM_PLUS1 + STAT_ATK; + gBattleScripting.animArg2 = 0; + if (caseID == ITEMEFFECT_ON_SWITCH_IN_FIRST_TURN || caseID == ITEMEFFECT_NORMAL) + { + BattleScriptExecute(BattleScript_BerserkGeneRetEnd2); + } + else + { + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_BerserkGeneRet; + } + return ITEM_STATS_CHANGE; +} + static u32 ItemRestorePp(u32 battler, u32 itemId, enum ItemCaseId caseID) { struct Pokemon *party = GetBattlerParty(battler); @@ -7200,7 +7226,7 @@ static u32 ItemRestorePp(u32 battler, u32 itemId, enum ItemCaseId caseID) BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_BerryPPHealRet; } - BtlController_EmitSetMonData(battler, BUFFER_A, i + REQUEST_PPMOVE1_BATTLE, 0, 1, &changedPP); + BtlController_EmitSetMonData(battler, B_COMM_TO_CONTROLLER, i + REQUEST_PPMOVE1_BATTLE, 0, 1, &changedPP); MarkBattlerForControllerExec(battler); if (MOVE_IS_PERMANENT(battler, i)) gBattleMons[battler].pp[i] = changedPP; @@ -7222,7 +7248,7 @@ static u32 ItemHealHp(u32 battler, u32 itemId, enum ItemCaseId caseID, bool32 pe gBattleStruct->moveDamage[battler] = GetBattlerItemHoldEffectParam(battler, itemId) * -1; // check ripen - if (ItemId_GetPocket(itemId) == POCKET_BERRIES && GetBattlerAbility(battler) == ABILITY_RIPEN) + if (GetItemPocket(itemId) == POCKET_BERRIES && GetBattlerAbility(battler) == ABILITY_RIPEN) gBattleStruct->moveDamage[battler] *= 2; gBattlerAbility = battler; // in SWSH, berry juice shows ability pop up but has no effect. This is mimicked here @@ -7246,7 +7272,7 @@ static bool32 UnnerveOn(u32 battler, u32 itemId) if (gBattleScripting.overrideBerryRequirements > 0) // Berries that aren't eaten naturally ignore unnerve return FALSE; - if (ItemId_GetPocket(itemId) == POCKET_BERRIES && IsUnnerveAbilityOnOpposingSide(battler)) + if (GetItemPocket(itemId) == POCKET_BERRIES && IsUnnerveAbilityOnOpposingSide(battler)) return TRUE; return FALSE; } @@ -7577,19 +7603,7 @@ static u8 ItemEffectMoveEnd(u32 battler, u16 holdEffect) } break; case HOLD_EFFECT_BERSERK_GENE: - BufferStatChange(battler, STAT_ATK, STRINGID_STATROSE); - gEffectBattler = battler; - if (CanBeInfinitelyConfused(gEffectBattler)) - { - gStatuses4[gEffectBattler] |= STATUS4_INFINITE_CONFUSION; - } - SET_STATCHANGER(STAT_ATK, 2, FALSE); - - gBattleScripting.animArg1 = STAT_ANIM_PLUS1 + STAT_ATK; - gBattleScripting.animArg2 = 0; - - BattleScriptPushCursorAndCallback(BattleScript_BerserkGeneRet); - effect = ITEM_STATS_CHANGE; + effect = ConsumeBerserkGene(battler, ITEMEFFECT_NONE); break; case HOLD_EFFECT_MIRROR_HERB: effect = TryConsumeMirrorHerb(battler, ITEMEFFECT_NONE); @@ -7835,7 +7849,7 @@ u32 ItemBattleEffects(enum ItemCaseId caseID, u32 battler, bool32 moveTurn) case HOLD_EFFECT_ROOM_SERVICE: if (TryRoomService(battler)) { - BattleScriptExecute(BattleScript_BerryStatRaiseEnd2); + BattleScriptExecute(BattleScript_ConsumableStatRaiseEnd2); effect = ITEM_STATS_CHANGE; } break; @@ -7860,19 +7874,7 @@ u32 ItemBattleEffects(enum ItemCaseId caseID, u32 battler, bool32 moveTurn) effect = TryEjectPack(battler, caseID); break; case HOLD_EFFECT_BERSERK_GENE: - BufferStatChange(battler, STAT_ATK, STRINGID_STATROSE); - gEffectBattler = battler; - if (CanBeInfinitelyConfused(gEffectBattler)) - { - gStatuses4[gEffectBattler] |= STATUS4_INFINITE_CONFUSION; - } - SET_STATCHANGER(STAT_ATK, 2, FALSE); - - gBattleScripting.animArg1 = STAT_ANIM_PLUS1 + STAT_ATK; - gBattleScripting.animArg2 = 0; - - BattleScriptPushCursorAndCallback(BattleScript_BerserkGeneRet); - effect = ITEM_STATS_CHANGE; + effect = ConsumeBerserkGene(battler, caseID); break; case HOLD_EFFECT_MIRROR_HERB: effect = TryConsumeMirrorHerb(battler, caseID); @@ -7887,7 +7889,7 @@ u32 ItemBattleEffects(enum ItemCaseId caseID, u32 battler, bool32 moveTurn) gBattlerAttacker = gPotentialItemEffectBattler = gBattleScripting.battler = battler; if (effect == ITEM_STATUS_CHANGE) { - BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1); + BtlController_EmitSetMonData(battler, B_COMM_TO_CONTROLLER, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1); MarkBattlerForControllerExec(battler); } } @@ -8072,19 +8074,7 @@ u32 ItemBattleEffects(enum ItemCaseId caseID, u32 battler, bool32 moveTurn) effect = TrySetMicleBerry(battler, gLastUsedItem, caseID); break; case HOLD_EFFECT_BERSERK_GENE: - BufferStatChange(battler, STAT_ATK, STRINGID_STATROSE); - gEffectBattler = battler; - if (CanBeInfinitelyConfused(gEffectBattler)) - { - gStatuses4[gEffectBattler] |= STATUS4_INFINITE_CONFUSION; - } - SET_STATCHANGER(STAT_ATK, 2, FALSE); - - gBattleScripting.animArg1 = STAT_ANIM_PLUS1 + STAT_ATK; - gBattleScripting.animArg2 = 0; - - BattleScriptPushCursorAndCallback(BattleScript_BerserkGeneRet); - effect = ITEM_STATS_CHANGE; + effect = ConsumeBerserkGene(battler, caseID); break; case HOLD_EFFECT_MIRROR_HERB: effect = TryConsumeMirrorHerb(battler, caseID); @@ -8099,21 +8089,21 @@ u32 ItemBattleEffects(enum ItemCaseId caseID, u32 battler, bool32 moveTurn) gBattlerAttacker = gPotentialItemEffectBattler = gBattleScripting.battler = battler; if (effect == ITEM_STATUS_CHANGE) { - BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1); + BtlController_EmitSetMonData(battler, B_COMM_TO_CONTROLLER, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1); MarkBattlerForControllerExec(battler); } } } break; case ITEMEFFECT_USE_LAST_ITEM: - effect = ItemEffectMoveEnd(battler, ItemId_GetHoldEffect(gLastUsedItem)); + effect = ItemEffectMoveEnd(battler, GetItemHoldEffect(gLastUsedItem)); gBattleScripting.overrideBerryRequirements = 2; // to exit VARIOUS_CONSUME_BERRIES if (effect) { gPotentialItemEffectBattler = gBattleScripting.battler = battler; if (effect == ITEM_STATUS_CHANGE) { - BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1); + BtlController_EmitSetMonData(battler, B_COMM_TO_CONTROLLER, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1); MarkBattlerForControllerExec(battler); } break; @@ -8129,7 +8119,7 @@ u32 ItemBattleEffects(enum ItemCaseId caseID, u32 battler, bool32 moveTurn) gPotentialItemEffectBattler = gBattleScripting.battler = battler; if (effect == ITEM_STATUS_CHANGE) { - BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1); + BtlController_EmitSetMonData(battler, B_COMM_TO_CONTROLLER, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1); MarkBattlerForControllerExec(battler); } break; @@ -8181,6 +8171,7 @@ u32 ItemBattleEffects(enum ItemCaseId caseID, u32 battler, bool32 moveTurn) { case HOLD_EFFECT_SHELL_BELL: if (gBattleScripting.savedDmg > 0 + && !(gHitMarker & HITMARKER_UNABLE_TO_USE_MOVE) && !(gBattleStruct->moveResultFlags[gBattlerTarget] & MOVE_RESULT_NO_EFFECT) && gBattlerAttacker != gBattlerTarget && !IsBattlerAtMaxHp(gBattlerAttacker) @@ -8202,6 +8193,7 @@ u32 ItemBattleEffects(enum ItemCaseId caseID, u32 battler, bool32 moveTurn) break; case HOLD_EFFECT_LIFE_ORB: if (IsBattlerAlive(gBattlerAttacker) + && !(gHitMarker & HITMARKER_UNABLE_TO_USE_MOVE) && !IsBattleMoveStatus(gCurrentMove) && (IsBattlerTurnDamaged(gBattlerTarget) || !(gBattleStruct->moveResultFlags[gBattlerTarget] & MOVE_RESULT_NO_EFFECT)) // Needs the second check in case of Substitute && !(TestIfSheerForceAffected(gBattlerAttacker, gCurrentMove)) @@ -8441,7 +8433,7 @@ u32 ItemBattleEffects(enum ItemCaseId caseID, u32 battler, bool32 moveTurn) if (effect == ITEM_STATUS_CHANGE) { - BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1); + BtlController_EmitSetMonData(battler, B_COMM_TO_CONTROLLER, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1); MarkBattlerForControllerExec(battler); } } @@ -8726,7 +8718,7 @@ u32 GetBattlerHoldEffectInternal(u32 battler, bool32 checkNegating, bool32 check if (gBattleMons[battler].item == ITEM_ENIGMA_BERRY_E_READER) return gEnigmaBerries[battler].holdEffect; else - return ItemId_GetHoldEffect(gBattleMons[battler].item); + return GetItemHoldEffect(gBattleMons[battler].item); } static u32 GetBattlerItemHoldEffectParam(u32 battler, u32 item) @@ -8734,7 +8726,7 @@ static u32 GetBattlerItemHoldEffectParam(u32 battler, u32 item) if (item == ITEM_ENIGMA_BERRY_E_READER) return gEnigmaBerries[battler].holdEffectParam; else - return ItemId_GetHoldEffectParam(item); + return GetItemHoldEffectParam(item); } u32 GetBattlerHoldEffectParam(u32 battler) @@ -8742,7 +8734,7 @@ u32 GetBattlerHoldEffectParam(u32 battler) if (gBattleMons[battler].item == ITEM_ENIGMA_BERRY_E_READER) return gEnigmaBerries[battler].holdEffectParam; else - return ItemId_GetHoldEffectParam(gBattleMons[battler].item); + return GetItemHoldEffectParam(gBattleMons[battler].item); } bool32 IsMoveMakingContact(u32 move, u32 battlerAtk) @@ -9634,7 +9626,7 @@ static inline u32 CalcMoveBasePowerAfterModifiers(struct DamageCalculationData * } break; case HOLD_EFFECT_PLATE: - if (moveType == ItemId_GetSecondaryId(gBattleMons[battlerAtk].item)) + if (moveType == GetItemSecondaryId(gBattleMons[battlerAtk].item)) modifier = uq4_12_multiply(modifier, holdEffectModifier); break; case HOLD_EFFECT_PUNCHING_GLOVE: @@ -11255,10 +11247,11 @@ bool32 DoBattlersShareType(u32 battler1, u32 battler2) bool32 CanBattlerGetOrLoseItem(u32 battler, u16 itemId) { u16 species = gBattleMons[battler].species; - u16 holdEffect = ItemId_GetHoldEffect(itemId); + u16 holdEffect = GetItemHoldEffect(itemId); - // Mail can be stolen now - if (itemId == ITEM_ENIGMA_BERRY_E_READER) + if (ItemIsMail(itemId)) + return FALSE; + else if (itemId == ITEM_ENIGMA_BERRY_E_READER) return FALSE; else if (DoesSpeciesUseHoldItemToChangeForm(species, itemId)) return FALSE; @@ -11441,7 +11434,7 @@ static u32 GetFlingPowerFromItemId(u32 itemId) return 10; // Status moves and moves with variable power always return 10 power. } else - return ItemId_GetFlingPower(itemId); + return GetItemFlingPower(itemId); } bool32 CanFling(u32 battler) @@ -11512,11 +11505,11 @@ void TryRestoreHeldItems(void) u16 lostItem = gBattleStruct->itemLost[B_SIDE_PLAYER][i].originalItem; // Check if the lost item is a berry and the mon is not holding it - if (ItemId_GetPocket(lostItem) == POCKET_BERRIES && GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM) != lostItem) + if (GetItemPocket(lostItem) == POCKET_BERRIES && GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM) != lostItem) lostItem = ITEM_NONE; // Check if the lost item should be restored - if ((lostItem != ITEM_NONE || returnNPCItems) && ItemId_GetPocket(lostItem) != POCKET_BERRIES) + if ((lostItem != ITEM_NONE || returnNPCItems) && GetItemPocket(lostItem) != POCKET_BERRIES) SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &lostItem); } } @@ -11554,7 +11547,7 @@ bool32 CanStealItem(u32 battlerStealing, u32 battlerItem, u16 item) } // It's supposed to pop before trying to steal but this also works - if (ItemId_GetHoldEffect(item) == HOLD_EFFECT_AIR_BALLOON) + if (GetItemHoldEffect(item) == HOLD_EFFECT_AIR_BALLOON) return FALSE; if (!CanBattlerGetOrLoseItem(battlerItem, item) // Battler with item cannot have it stolen diff --git a/src/battle_util2.c b/src/battle_util2.c index 6d7c82cbe5..73b1dfc94a 100644 --- a/src/battle_util2.c +++ b/src/battle_util2.c @@ -206,7 +206,7 @@ u32 BattlePalace_TryEscapeStatus(u8 battler) if (effect == 2) { - BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1); + BtlController_EmitSetMonData(battler, B_COMM_TO_CONTROLLER, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1); MarkBattlerForControllerExec(battler); } diff --git a/src/battle_z_move.c b/src/battle_z_move.c index b99b51e66d..a6e9f00279 100644 --- a/src/battle_z_move.c +++ b/src/battle_z_move.c @@ -151,7 +151,7 @@ u32 GetUsableZMove(u32 battler, u32 move) if (zMove != MOVE_NONE) return zMove; // Signature z move exists - if (move != MOVE_NONE && zMove != MOVE_Z_STATUS && GetMoveType(move) == ItemId_GetSecondaryId(item)) + if (move != MOVE_NONE && zMove != MOVE_Z_STATUS && GetMoveType(move) == GetItemSecondaryId(item)) return GetTypeBasedZMove(move); } @@ -195,7 +195,7 @@ bool32 IsViableZMove(u32 battler, u32 move) if (zMove != MOVE_NONE) return TRUE; - if (move != MOVE_NONE && GetMoveType(move) == ItemId_GetSecondaryId(item)) + if (move != MOVE_NONE && GetMoveType(move) == GetItemSecondaryId(item)) return TRUE; } diff --git a/src/berry_blender.c b/src/berry_blender.c index d547919df9..74741b32bf 100644 --- a/src/berry_blender.c +++ b/src/berry_blender.c @@ -1206,7 +1206,7 @@ static void CreateBerrySprite(u32 itemId, u32 playerId) berryId); } -static void ConvertItemToBlenderBerry(struct BlenderBerry* berry, u16 itemId) +static void ConvertItemToBlenderBerry(struct BlenderBerry *berry, u16 itemId) { const struct Berry *berryInfo = GetBerryInfo(ITEM_TO_BERRY(itemId)); @@ -1538,7 +1538,7 @@ static u8 GetArrowProximity(u16 arrowPos, u8 playerId) return PROXIMITY_MISS; } -static void SetOpponentsBerryData(u16 playerBerryItemId, u8 playersNum, struct BlenderBerry* playerBerry) +static void SetOpponentsBerryData(u16 playerBerryItemId, u8 playersNum, struct BlenderBerry *playerBerry) { u16 opponentSetId = 0; u16 opponentBerryId; @@ -2243,7 +2243,7 @@ static void Blender_DummiedOutFunc(s16 bgX, s16 bgY) } -static bool8 AreBlenderBerriesSame(struct BlenderBerry* berries, u8 a, u8 b) +static bool8 AreBlenderBerriesSame(struct BlenderBerry *berries, u8 a, u8 b) { // First check to itemId is pointless (and wrong anyway?), always false when this is called // Only used to determine if two enigma berries are equivalent @@ -2260,7 +2260,7 @@ static bool8 AreBlenderBerriesSame(struct BlenderBerry* berries, u8 a, u8 b) return FALSE; } -static u32 CalculatePokeblockColor(struct BlenderBerry* berries, s16 *_flavors, u8 numPlayers, u8 negativeFlavors) +static u32 CalculatePokeblockColor(struct BlenderBerry *berries, s16 *_flavors, u8 numPlayers, u8 negativeFlavors) { s16 flavors[FLAVOR_COUNT + 1]; s32 i, j; @@ -2491,7 +2491,7 @@ static void CalculatePokeblock(struct BlenderBerry *berries, struct Pokeblock *p flavors[i] = sPokeblockFlavors[i]; } -static void UNUSED Debug_CalculatePokeblock(struct BlenderBerry* berries, struct Pokeblock* pokeblock, u8 numPlayers, u8 *flavors, u16 maxRPM) +static void UNUSED Debug_CalculatePokeblock(struct BlenderBerry *berries, struct Pokeblock *pokeblock, u8 numPlayers, u8 *flavors, u16 maxRPM) { CalculatePokeblock(berries, pokeblock, numPlayers, flavors, maxRPM); } diff --git a/src/berry_crush.c b/src/berry_crush.c index 8010639840..3a2274f189 100644 --- a/src/berry_crush.c +++ b/src/berry_crush.c @@ -914,7 +914,7 @@ static const u8 *const sResultsTexts[] = [RESULTS_PAGE_POWER + NUM_RESULTS_PAGES] = gText_PressingPowerRankings, }; -static u32 (*const sBerryCrushCommands[])(struct BerryCrushGame * game, u8 *data) = +static u32 (*const sBerryCrushCommands[])(struct BerryCrushGame *game, u8 *data) = { [CMD_NONE] = NULL, [CMD_FADE] = Cmd_BeginNormalPaletteFade, @@ -1590,14 +1590,14 @@ static void PrintTextCentered(u8 windowId, u8 left, u8 colorId, const u8 *string AddTextPrinterParameterized3(windowId, FONT_SHORT, left, 0, sTextColorTable[colorId], 0, string); } -static void PrintResultsText(struct BerryCrushGame * game, u8 page, u8 sp14, u8 baseY) +static void PrintResultsText(struct BerryCrushGame *game, u8 page, u8 sp14, u8 baseY) { u8 i, j; u8 playerId = 0; u8 ranking = 0; s32 x; u8 stat; - struct BerryCrushGame_Results * results = &game->results; + struct BerryCrushGame_Results *results = &game->results; u32 xOffset; s32 y; diff --git a/src/berry_fix_program.c b/src/berry_fix_program.c index 6a6f6f650b..e43455ef49 100644 --- a/src/berry_fix_program.c +++ b/src/berry_fix_program.c @@ -26,7 +26,7 @@ struct { u8 curScene; u16 timer; struct MultiBootParam mb; -} static * sBerryFix; +} static *sBerryFix; static void BerryFix_Main(void); static void BerryFix_GpuSet(void); diff --git a/src/bg.c b/src/bg.c index 73b5be14e8..ab7b48c58d 100644 --- a/src/bg.c +++ b/src/bg.c @@ -920,7 +920,7 @@ void CopyToBgTilemapBufferRect(u32 bg, const void *src, u8 destX, u8 destY, u8 w { case BG_TYPE_NORMAL: { - const u16 * srcCopy = src; + const u16 *srcCopy = src; for (destY16 = destY; destY16 < (destY + height); destY16++) { for (destX16 = destX; destX16 < (destX + width); destX16++) diff --git a/src/contest.c b/src/contest.c index d0c99562d4..0522a92aa2 100644 --- a/src/contest.c +++ b/src/contest.c @@ -420,7 +420,7 @@ static const union AffineAnimCmd sAffineAnim_SliderHeart_SpinAppear[] = AFFINEANIMCMD_END }; -static const union AffineAnimCmd* const sAffineAnims_SliderHeart[] = +static const union AffineAnimCmd *const sAffineAnims_SliderHeart[] = { [SLIDER_HEART_ANIM_NORMAL] = sAffineAnim_SliderHeart_Normal, [SLIDER_HEART_ANIM_DISAPPEAR] = sAffineAnim_SliderHeart_SpinDisappear, @@ -1449,13 +1449,13 @@ static bool8 SetupContestGraphics(u8 *stateVar) CreateApplauseMeterSprite(); CreateJudgeAttentionEyeTask(); CreateUnusedBlendTask(); - gBattlerPositions[0] = B_POSITION_PLAYER_LEFT; - gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT; - gBattlerPositions[2] = B_POSITION_OPPONENT_RIGHT; - gBattlerPositions[3] = B_POSITION_PLAYER_RIGHT; + gBattlerPositions[B_BATTLER_0] = B_POSITION_PLAYER_LEFT; + gBattlerPositions[B_BATTLER_1] = B_POSITION_OPPONENT_LEFT; + gBattlerPositions[B_BATTLER_2] = B_POSITION_OPPONENT_RIGHT; + gBattlerPositions[B_BATTLER_3] = B_POSITION_PLAYER_RIGHT; gBattleTypeFlags = 0; - gBattlerAttacker = B_POSITION_PLAYER_RIGHT; - gBattlerTarget = B_POSITION_OPPONENT_RIGHT; + gBattlerAttacker = B_BATTLER_2; + gBattlerTarget = B_BATTLER_3; // Unclear why judge sprite is assigned here // Overwritten in APPEALSTATE_SLIDE_MON_IN with the attacking contest mon gBattlerSpriteIds[gBattlerAttacker] = CreateJudgeSprite(); diff --git a/src/contest_ai.c b/src/contest_ai.c index 4386aeee64..77f27fcc91 100644 --- a/src/contest_ai.c +++ b/src/contest_ai.c @@ -326,8 +326,8 @@ u8 ContestAI_GetActionToUse(void) { // Randomly choose a move index. If it's the move // with the highest (or tied highest) score, return - u8 moveIdx = MOD(Random(), MAX_MON_MOVES); - u8 score = eContestAI.moveScores[moveIdx]; + u8 moveIndex = MOD(Random(), MAX_MON_MOVES); + u8 score = eContestAI.moveScores[moveIndex]; int i; for (i = 0; i < MAX_MON_MOVES; i++) { @@ -335,7 +335,7 @@ u8 ContestAI_GetActionToUse(void) break; } if (i == MAX_MON_MOVES) - return moveIdx; + return moveIndex; } } diff --git a/src/data/battle_frontier/apprentice.h b/src/data/battle_frontier/apprentice.h index 34fc15d2b0..ccaa75c174 100644 --- a/src/data/battle_frontier/apprentice.h +++ b/src/data/battle_frontier/apprentice.h @@ -587,7 +587,7 @@ static const u8 sQuestionPossibilities[MAX_APPRENTICE_QUESTIONS] = QUESTION_ID_WIN_SPEECH }; -static void (* const sApprenticeFunctions[])(void) = +static void (*const sApprenticeFunctions[])(void) = { [APPRENTICE_FUNC_GAVE_LVLMODE] = Script_GivenApprenticeLvlMode, [APPRENTICE_FUNC_SET_LVLMODE] = Script_SetApprenticeLvlMode, diff --git a/src/data/battle_move_effects.h b/src/data/battle_move_effects.h index d5b3d5dc54..6b4741ab5e 100644 --- a/src/data/battle_move_effects.h +++ b/src/data/battle_move_effects.h @@ -1876,9 +1876,9 @@ const struct BattleMoveEffect gBattleMoveEffects[NUM_BATTLE_MOVE_EFFECTS] = .battleTvScore = 0, // TODO: Assign points }, - [EFFECT_RECOIL_HP_25] = + [EFFECT_STRUGGLE] = { - .battleScript = BattleScript_EffectRecoilHP25, + .battleScript = BattleScript_EffectStruggle, .battleTvScore = 0, // TODO: Assign points }, diff --git a/src/data/graphics/pokemon.h b/src/data/graphics/pokemon.h index e7686d8b90..ea1e49cda7 100644 --- a/src/data/graphics/pokemon.h +++ b/src/data/graphics/pokemon.h @@ -25932,7 +25932,7 @@ const u32 gObjectEventPic_Substitute[] = INCBIN_COMP("graphics/pokemon/question_ #endif //P_FAMILY_DONDOZO #if P_FAMILY_GREAT_TUSK - const u32 gMonFrontPic_GreatTusk[] = INCBIN_U32("graphics/pokemon/great_tusk/anim_front.4bpp.lz"); + const u32 gMonFrontPic_GreatTusk[] = INCBIN_U32("graphics/pokemon/great_tusk/front.4bpp.lz"); const u32 gMonPalette_GreatTusk[] = INCBIN_U32("graphics/pokemon/great_tusk/normal.gbapal.lz"); const u32 gMonBackPic_GreatTusk[] = INCBIN_U32("graphics/pokemon/great_tusk/back.4bpp.lz"); const u32 gMonShinyPalette_GreatTusk[] = INCBIN_U32("graphics/pokemon/great_tusk/shiny.gbapal.lz"); @@ -26148,7 +26148,7 @@ const u32 gObjectEventPic_Substitute[] = INCBIN_COMP("graphics/pokemon/question_ #endif //P_FAMILY_IRON_THORNS #if P_FAMILY_FRIGIBAX - const u32 gMonFrontPic_Frigibax[] = INCBIN_U32("graphics/pokemon/frigibax/anim_front.4bpp.lz"); + const u32 gMonFrontPic_Frigibax[] = INCBIN_U32("graphics/pokemon/frigibax/front.4bpp.lz"); const u32 gMonPalette_Frigibax[] = INCBIN_U32("graphics/pokemon/frigibax/normal.gbapal.lz"); const u32 gMonBackPic_Frigibax[] = INCBIN_U32("graphics/pokemon/frigibax/back.4bpp.lz"); const u32 gMonShinyPalette_Frigibax[] = INCBIN_U32("graphics/pokemon/frigibax/shiny.gbapal.lz"); @@ -26665,7 +26665,7 @@ const u32 gObjectEventPic_Substitute[] = INCBIN_COMP("graphics/pokemon/question_ #endif //P_FAMILY_IRON_CROWN #if P_FAMILY_TERAPAGOS - const u32 gMonFrontPic_TerapagosNormal[] = INCBIN_U32("graphics/pokemon/terapagos/anim_front.4bpp.lz"); + const u32 gMonFrontPic_TerapagosNormal[] = INCBIN_U32("graphics/pokemon/terapagos/front.4bpp.lz"); const u32 gMonPalette_TerapagosNormal[] = INCBIN_U32("graphics/pokemon/terapagos/normal.gbapal.lz"); const u32 gMonBackPic_TerapagosNormal[] = INCBIN_U32("graphics/pokemon/terapagos/back.4bpp.lz"); const u32 gMonShinyPalette_TerapagosNormal[] = INCBIN_U32("graphics/pokemon/terapagos/shiny.gbapal.lz"); @@ -26681,7 +26681,7 @@ const u32 gObjectEventPic_Substitute[] = INCBIN_COMP("graphics/pokemon/question_ #endif //OW_PKMN_OBJECTS_SHARE_PALETTES #endif //OW_POKEMON_OBJECT_EVENTS - const u32 gMonFrontPic_TerapagosTerastal[] = INCBIN_U32("graphics/pokemon/terapagos/terastal/anim_front.4bpp.lz"); + const u32 gMonFrontPic_TerapagosTerastal[] = INCBIN_U32("graphics/pokemon/terapagos/terastal/front.4bpp.lz"); const u32 gMonPalette_TerapagosTerastal[] = INCBIN_U32("graphics/pokemon/terapagos/terastal/normal.gbapal.lz"); const u32 gMonBackPic_TerapagosTerastal[] = INCBIN_U32("graphics/pokemon/terapagos/terastal/back.4bpp.lz"); const u32 gMonShinyPalette_TerapagosTerastal[] = INCBIN_U32("graphics/pokemon/terapagos/terastal/shiny.gbapal.lz"); diff --git a/src/data/moves_info.h b/src/data/moves_info.h index d52021a911..713df68839 100644 --- a/src/data/moves_info.h +++ b/src/data/moves_info.h @@ -104,6 +104,14 @@ static const u8 sFeintDescription[] = _( "能够攻击使用守住类招式的\n" "对手。解除其守护效果。"); +static const u8 sProtectDescription[] = _( + "Evades attack, but may fail\n" + "if used in succession."); + +static const u8 sGMaxOneBlowDescription[] = _( + "G-max Urshifu attack.\n" + "Ignores Max Guard."); + const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = { [MOVE_NONE] = @@ -4301,7 +4309,7 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = "当PP耗尽时,努力挣扎攻击\n" "对手。自己也会受到伤害。"), #if B_UPDATED_MOVE_DATA >= GEN_4 - .effect = EFFECT_RECOIL_HP_25, + .effect = EFFECT_STRUGGLE, .accuracy = 0, .mirrorMoveBanned = TRUE, .additionalEffects = ADDITIONAL_EFFECTS({ @@ -4750,9 +4758,7 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_PROTECT] = { .name = COMPOUND_STRING("守住"), - .description = COMPOUND_STRING( - "完全抵挡对手的攻击。\n" - "连续使出则容易失败。"), + .description = sProtectDescription, .effect = EFFECT_PROTECT, .power = 0, .type = TYPE_NORMAL, @@ -5140,9 +5146,7 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_DETECT] = { .name = COMPOUND_STRING("看穿"), - .description = COMPOUND_STRING( - "完全抵挡对手的攻击。\n" - "连续使出则容易失败。"), + .description = sProtectDescription, .effect = EFFECT_PROTECT, .power = 0, .type = TYPE_FIGHTING, @@ -13127,7 +13131,7 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = .category = DAMAGE_CATEGORY_STATUS, .zMove = { .effect = Z_EFFECT_SPD_UP_2 }, .ignoresProtect = B_UPDATED_MOVE_FLAGS >= GEN_6, - .ignoresSubstitute = TRUE, + .ignoresSubstitute = B_UPDATED_MOVE_FLAGS >= GEN_6, .metronomeBanned = TRUE, .copycatBanned = TRUE, .assistBanned = TRUE, @@ -20964,10 +20968,13 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = }, // Z-Moves + //todo汉化 [MOVE_BREAKNECK_BLITZ] = { .name = COMPOUND_STRING("究极无敌大冲撞"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Builds momentum and crashes\n" + "into the foe. Power varies."), .effect = EFFECT_HIT, .power = 1, .type = TYPE_NORMAL, @@ -20981,7 +20988,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_ALL_OUT_PUMMELING] = { .name = COMPOUND_STRING("全力无双激烈拳"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Rams an energy orb into\n" + "the target. Power varies."), .effect = EFFECT_HIT, .power = 1, .type = TYPE_FIGHTING, @@ -20995,7 +21004,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_SUPERSONIC_SKYSTRIKE] = { .name = COMPOUND_STRING("极速俯冲轰烈撞"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Soars up and plummets toward\n" + "the target. Power varies."), .effect = EFFECT_HIT, .power = 1, .type = TYPE_FLYING, @@ -21009,7 +21020,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_ACID_DOWNPOUR] = { .name = COMPOUND_STRING("强酸剧毒灭绝雨"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Sinks the target in a poison\n" + "swamp. Power varies."), .effect = EFFECT_HIT, .power = 1, .type = TYPE_POISON, @@ -21023,7 +21036,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_TECTONIC_RAGE] = { .name = COMPOUND_STRING("地隆啸天大终结"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Burrows deep and slams into\n" + "the target. Power varies."), .effect = EFFECT_HIT, .power = 1, .type = TYPE_GROUND, @@ -21038,7 +21053,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_CONTINENTAL_CRUSH] = { .name = COMPOUND_STRING("毁天灭地巨岩坠"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Drops a huge rock mountain\n" + "on the foe. Power varies."), .effect = EFFECT_HIT, .power = 1, .type = TYPE_ROCK, @@ -21052,7 +21069,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_SAVAGE_SPIN_OUT] = { .name = COMPOUND_STRING("绝对捕食回旋斩"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Spits threads of silk to\n" + "bind the foe. Power varies."), .effect = EFFECT_HIT, .power = 1, .type = TYPE_BUG, @@ -21066,7 +21085,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_NEVER_ENDING_NIGHTMARE] = { .name = COMPOUND_STRING("无尽暗夜之诱惑"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Deep-seated grudges trap\n" + "the target. Power varies."), .effect = EFFECT_HIT, .power = 1, .type = TYPE_GHOST, @@ -21080,7 +21101,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_CORKSCREW_CRASH] = { .name = COMPOUND_STRING("超绝螺旋连击"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Spins very fast and rams\n" + "the target. Power varies."), .effect = EFFECT_HIT, .power = 1, .type = TYPE_STEEL, @@ -21094,7 +21117,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_INFERNO_OVERDRIVE] = { .name = COMPOUND_STRING("超强极限爆焰弹"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Breathes intense fire at\n" + "the target. Power varies."), .effect = EFFECT_HIT, .power = 1, .type = TYPE_FIRE, @@ -21108,7 +21133,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_HYDRO_VORTEX] = { .name = COMPOUND_STRING("超级水流大漩涡"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "A huge whirlpool swallows\n" + "the target. Power varies."), .effect = EFFECT_HIT, .power = 1, .type = TYPE_WATER, @@ -21122,7 +21149,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_BLOOM_DOOM] = { .name = COMPOUND_STRING("绚烂缤纷花怒放"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Uses plant energy to attack\n" + "the target. Power varies."), .effect = EFFECT_HIT, .power = 1, .type = TYPE_GRASS, @@ -21136,7 +21165,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_GIGAVOLT_HAVOC] = { .name = COMPOUND_STRING("终极伏特狂雷闪"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Hits the foe with powerful\n" + "electricity. Power varies."), .effect = EFFECT_HIT, .power = 1, .type = TYPE_ELECTRIC, @@ -21150,7 +21181,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_SHATTERED_PSYCHE] = { .name = COMPOUND_STRING("至高精神破坏波"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Controls the target to\n" + "hurt it. Power varies."), .effect = EFFECT_HIT, .power = 1, .type = TYPE_PSYCHIC, @@ -21164,7 +21197,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_SUBZERO_SLAMMER] = { .name = COMPOUND_STRING("激狂大地万里冰"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Drops the temp and freezes\n" + "the target. Power varies."), .effect = EFFECT_HIT, .power = 1, .type = TYPE_ICE, @@ -21178,7 +21213,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_DEVASTATING_DRAKE] = { .name = COMPOUND_STRING("究极巨龙震天地"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Develops aura and attacks\n" + "the target. Power varies."), .effect = EFFECT_HIT, .power = 1, .type = TYPE_DRAGON, @@ -21192,7 +21229,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_BLACK_HOLE_ECLIPSE] = { .name = COMPOUND_STRING("黑洞吞噬万物灭"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Sucks the target into dark\n" + "energy. Power varies."), .effect = EFFECT_HIT, .power = 1, .type = TYPE_DARK, @@ -21206,7 +21245,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_TWINKLE_TACKLE] = { .name = COMPOUND_STRING("可爱星星飞天撞"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Toys with the target in a\n" + "charming space. Power varies."), .effect = EFFECT_HIT, .power = 1, .type = TYPE_FAIRY, @@ -21220,7 +21261,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_CATASTROPIKA] = { .name = COMPOUND_STRING("皮卡皮卡必杀击"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Pikachu uses the max amount\n" + "of electricity and pounces."), .effect = EFFECT_HIT, .power = 210, .type = TYPE_ELECTRIC, @@ -21234,7 +21277,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_10000000_VOLT_THUNDERBOLT] = { .name = COMPOUND_STRING("千万伏特"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Cap Pikachu unleashes jolt.\n" + "High critical-hit ratio."), .effect = EFFECT_HIT, .power = 195, .type = TYPE_ELECTRIC, @@ -21249,7 +21294,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_STOKED_SPARKSURFER] = { .name = COMPOUND_STRING("驾雷驭电戏冲浪"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Alolan Raichu attacks with\n" + "full force. Causes paralysis."), .effect = EFFECT_HIT, .power = 175, .type = TYPE_ELECTRIC, @@ -21267,7 +21314,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_EXTREME_EVOBOOST] = { .name = COMPOUND_STRING("九彩升华齐聚顶"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Eevee gets energy from\n" + "its friends. Boosts stats."), .effect = EFFECT_EXTREME_EVOBOOST, .power = 0, .type = TYPE_NORMAL, @@ -21281,7 +21330,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_PULVERIZING_PANCAKE] = { .name = COMPOUND_STRING("认真起来大爆击"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Snorlax energetically moves\n" + "and attacks with full force."), .effect = EFFECT_HIT, .power = 210, .type = TYPE_NORMAL, @@ -21295,7 +21346,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_GENESIS_SUPERNOVA] = { .name = COMPOUND_STRING("起源超新星大爆炸"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Mew attacks with full force.\n" + "Psychically charges terrain."), .effect = EFFECT_HIT_SET_REMOVE_TERRAIN, .power = 185, .type = TYPE_PSYCHIC, @@ -21310,7 +21363,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_SINISTER_ARROW_RAID] = { .name = COMPOUND_STRING("遮天蔽日暗影箭"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Decidueye shoots countless\n" + "arrows with full force."), .effect = EFFECT_HIT, .power = 180, .type = TYPE_GHOST, @@ -21324,7 +21379,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_MALICIOUS_MOONSAULT] = { .name = COMPOUND_STRING("极恶飞跃粉碎击"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Incineroar crashes into\n" + "the target with full force."), .effect = EFFECT_HIT, .power = 180, .type = TYPE_DARK, @@ -21338,7 +21395,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_OCEANIC_OPERETTA] = { .name = COMPOUND_STRING("海神庄严交响乐"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Primarina summons a massive\n" + "amount of water at the foe."), .effect = EFFECT_HIT, .power = 195, .type = TYPE_WATER, @@ -21352,7 +21411,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_SPLINTERED_STORMSHARDS] = { .name = COMPOUND_STRING("狼啸石牙飓风暴"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Lycanroc attacks with full\n" + "force. Removes all terrain."), .effect = EFFECT_HIT_SET_REMOVE_TERRAIN, .power = 190, .type = TYPE_ROCK, @@ -21367,7 +21428,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_LETS_SNUGGLE_FOREVER] = { .name = COMPOUND_STRING("亲密无间大乱揍"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Mimikyu punches the target\n" + "with full force."), .effect = EFFECT_HIT, .power = 190, .type = TYPE_FAIRY, @@ -21381,7 +21444,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_CLANGOROUS_SOULBLAZE] = { .name = COMPOUND_STRING("炽魂热舞烈音爆"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Kommo-o attacks with full\n" + "force. Boosts all stats."), .effect = EFFECT_HIT, .power = 185, .type = TYPE_DRAGON, @@ -21402,7 +21467,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_GUARDIAN_OF_ALOLA] = { .name = COMPOUND_STRING("巨人卫士阿罗拉"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "The Land Spirit Pokémon\n" + "greatly reduces the foe's HP."), .effect = EFFECT_GUARDIAN_OF_ALOLA, .power = 1, .type = TYPE_FAIRY, @@ -21416,7 +21483,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_SEARING_SUNRAZE_SMASH] = { .name = COMPOUND_STRING("日光回旋下苍穹"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Solgaleo attacks with full\n" + "force. Ignores abilities."), .effect = EFFECT_HIT, .power = 200, .type = TYPE_STEEL, @@ -21431,7 +21500,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_MENACING_MOONRAZE_MAELSTROM] = { .name = COMPOUND_STRING("月华飞溅落灵霄"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Lunala attacks with full\n" + "force. Ignores abilities."), .effect = EFFECT_HIT, .power = 200, .type = TYPE_GHOST, @@ -21446,7 +21517,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_LIGHT_THAT_BURNS_THE_SKY] = { .name = COMPOUND_STRING("焚天灭世炽光爆"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Uses Necrozma's highest\n" + "attack. Ignores abilities."), .effect = EFFECT_PHOTON_GEYSER, .power = 200, .type = TYPE_PSYCHIC, @@ -21461,7 +21534,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_SOUL_STEALING_7_STAR_STRIKE] = { .name = COMPOUND_STRING("七星夺魂腿"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Marshadow punches and\n" + "kicks with full force."), .effect = EFFECT_HIT, .power = 195, .type = TYPE_GHOST, @@ -21476,7 +21551,7 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_MAX_GUARD] = { .name = COMPOUND_STRING("极巨防壁"), - .description = sNullDescription, + .description = sProtectDescription, .effect = EFFECT_PROTECT, .power = 0, .type = TYPE_NORMAL, @@ -21491,7 +21566,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_MAX_FLARE] = { .name = COMPOUND_STRING("极巨火爆"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Fire Dynamax attack.\n" + "Intensifies sun for 5 turns."), .effect = EFFECT_MAX_MOVE, .power = 1, .type = TYPE_FIRE, @@ -21511,7 +21588,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_MAX_FLUTTERBY] = { .name = COMPOUND_STRING("极巨虫蛊"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Bug Dynamax attack.\n" + "Lowers foe's Sp. Atk stat."), .effect = EFFECT_MAX_MOVE, .power = 1, .type = TYPE_BUG, @@ -21531,7 +21610,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_MAX_LIGHTNING] = { .name = COMPOUND_STRING("极巨闪电"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Electric Dynamax attack.\n" + "Turns the terrain electric."), .effect = EFFECT_MAX_MOVE, .power = 1, .type = TYPE_ELECTRIC, @@ -21551,7 +21632,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_MAX_STRIKE] = { .name = COMPOUND_STRING("极巨攻击"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Normal Dynamax attack.\n" + "Lowers foe's Speed stat."), .effect = EFFECT_MAX_MOVE, .power = 1, .type = TYPE_NORMAL, @@ -21571,7 +21654,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_MAX_KNUCKLE] = { .name = COMPOUND_STRING("极巨拳斗"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Fighting Dynamax attack.\n" + "Boosts ally Attack stats."), .effect = EFFECT_MAX_MOVE, .power = 1, .type = TYPE_FIGHTING, @@ -21591,7 +21676,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_MAX_PHANTASM] = { .name = COMPOUND_STRING("极巨幽魂"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Ghost Dynamax attack.\n" + "Lowers foe's Defense stat."), .effect = EFFECT_MAX_MOVE, .power = 1, .type = TYPE_GHOST, @@ -21611,7 +21698,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_MAX_HAILSTORM] = { .name = COMPOUND_STRING("极巨寒冰"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Ice Dynamax attack.\n" + "Summons hail for 5 turns."), .effect = EFFECT_MAX_MOVE, .power = 1, .type = TYPE_ICE, @@ -21631,7 +21720,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_MAX_OOZE] = { .name = COMPOUND_STRING("极巨酸毒"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Poison Dynamax attack.\n" + "Boosts ally Sp. Atk stats."), .effect = EFFECT_MAX_MOVE, .power = 1, .type = TYPE_POISON, @@ -21651,7 +21742,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_MAX_GEYSER] = { .name = COMPOUND_STRING("极巨水流"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Water Dynamax attack.\n" + "Summons rain for 5 turns."), .effect = EFFECT_MAX_MOVE, .power = 1, .type = TYPE_WATER, @@ -21671,7 +21764,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_MAX_AIRSTREAM] = { .name = COMPOUND_STRING("极巨飞冲"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Flying Dynamax attack.\n" + "Boosts ally Speed stats."), .effect = EFFECT_MAX_MOVE, .power = 1, .type = TYPE_FLYING, @@ -21691,7 +21786,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_MAX_STARFALL] = { .name = COMPOUND_STRING("极巨妖精"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Fairy Dynamax attack.\n" + "Turns the terrain misty."), .effect = EFFECT_MAX_MOVE, .power = 1, .type = TYPE_FAIRY, @@ -21711,7 +21808,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_MAX_WYRMWIND] = { .name = COMPOUND_STRING("极巨龙骑"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Dragon Dynamax attack.\n" + "Lowers foe's Attack stat."), .effect = EFFECT_MAX_MOVE, .power = 1, .type = TYPE_DRAGON, @@ -21731,7 +21830,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_MAX_MINDSTORM] = { .name = COMPOUND_STRING("极巨超能"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Psychic Dynamax attack.\n" + "Turns the terrain psychic."), .effect = EFFECT_MAX_MOVE, .power = 1, .type = TYPE_PSYCHIC, @@ -21751,7 +21852,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_MAX_ROCKFALL] = { .name = COMPOUND_STRING("极巨岩石"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Rock Dynamax attack.\n" + "Summons a sandstorm."), .effect = EFFECT_MAX_MOVE, .power = 1, .type = TYPE_ROCK, @@ -21771,7 +21874,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_MAX_QUAKE] = { .name = COMPOUND_STRING("极巨大地"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Ground Dynamax attack.\n" + "Boosts ally Sp. Def stats."), .effect = EFFECT_MAX_MOVE, .power = 1, .type = TYPE_GROUND, @@ -21792,7 +21897,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_MAX_DARKNESS] = { .name = COMPOUND_STRING("极巨恶霸"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Dark Dynamax attack.\n" + "Lowers foe's Sp. Def stat."), .effect = EFFECT_MAX_MOVE, .power = 1, .type = TYPE_DARK, @@ -21812,7 +21919,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_MAX_OVERGROWTH] = { .name = COMPOUND_STRING("极巨草原"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Grass Dynamax attack.\n" + "Turns the terrain grassy."), .effect = EFFECT_MAX_MOVE, .power = 10, .type = TYPE_GRASS, @@ -21832,7 +21941,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_MAX_STEELSPIKE] = { .name = COMPOUND_STRING("极巨钢铁"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "Steel Dynamax attack.\n" + "Boosts ally Defense stats."), .effect = EFFECT_MAX_MOVE, .power = 10, .type = TYPE_STEEL, @@ -21852,7 +21963,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_G_MAX_VINE_LASH] = { .name = COMPOUND_STRING("超极巨灰飞鞭灭"), - .description = sNullDescription, //ANIM TODO + .description = COMPOUND_STRING( + "G-max Venusaur attack.\n" + "Damages for 4 turns."), //ANIM TODO .effect = EFFECT_MAX_MOVE, .power = 10, .type = TYPE_GRASS, @@ -21872,7 +21985,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_G_MAX_WILDFIRE] = { .name = COMPOUND_STRING("超极巨深渊灭焰"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "G-max Charizard attack.\n" + "Damages for 4 turns."), //ANIM TODO .effect = EFFECT_MAX_MOVE, .power = 10, .type = TYPE_FIRE, @@ -21892,7 +22007,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_G_MAX_CANNONADE] = { .name = COMPOUND_STRING("超极巨水炮轰灭"), - .description = sNullDescription, //ANIM TODO + .description = COMPOUND_STRING( + "G-max Blastoise attack.\n" + "Damages for 4 turns."), //ANIM TODO .effect = EFFECT_MAX_MOVE, .power = 10, .type = TYPE_WATER, @@ -21912,7 +22029,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_G_MAX_BEFUDDLE] = { .name = COMPOUND_STRING("超极巨蝶影蛊惑"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "G-max Butterfree attack.\n" + "Poison, paralysis, or sleep."), //ANIM TODO .effect = EFFECT_MAX_MOVE, .power = 10, .type = TYPE_BUG, @@ -21932,7 +22051,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_G_MAX_VOLT_CRASH] = { .name = COMPOUND_STRING("超极巨万雷轰顶"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "G-max Pikachu attack.\n" + "Paralyzes opponents."), //ANIM TODO .effect = EFFECT_MAX_MOVE, .power = 10, .type = TYPE_ELECTRIC, @@ -21952,7 +22073,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_G_MAX_GOLD_RUSH] = { .name = COMPOUND_STRING("超极巨特大金币"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "G-max Meowth attack.\n" + "Confuses and earns money."), //ANIM TODO .effect = EFFECT_MAX_MOVE, .power = 10, .type = TYPE_NORMAL, @@ -21972,7 +22095,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_G_MAX_CHI_STRIKE] = { .name = COMPOUND_STRING("超极巨会心一击"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "G-max Machamp attack.\n" + "Boosts critical-hit ratio."), //ANIM TODO .effect = EFFECT_MAX_MOVE, .power = 10, .type = TYPE_FIGHTING, @@ -21992,7 +22117,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_G_MAX_TERROR] = { .name = COMPOUND_STRING("超极巨幻影幽魂"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "G-max Gengar attack.\n" + "Prevents foes from escaping."), //ANIM TODO .effect = EFFECT_MAX_MOVE, .power = 10, .type = TYPE_GHOST, @@ -22012,7 +22139,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_G_MAX_FOAM_BURST] = { .name = COMPOUND_STRING("超极巨激漩泡涡"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "G-max Kingler attack.\n" + "Harshly lowers foe's Speed."), //ANIM TODO .effect = EFFECT_MAX_MOVE, .power = 10, .type = TYPE_WATER, @@ -22032,7 +22161,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_G_MAX_RESONANCE] = { .name = COMPOUND_STRING("超极巨极光旋律"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "G-max Lapras attack.\n" + "Reduces damage for 5 turns."), //ANIM TODO .effect = EFFECT_MAX_MOVE, .power = 10, .type = TYPE_ICE, @@ -22052,7 +22183,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_G_MAX_CUDDLE] = { .name = COMPOUND_STRING("超极巨热情拥抱"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "G-max Eevee attack.\n" + "Infatuates opponents."), //ANIM TODO .effect = EFFECT_MAX_MOVE, .power = 10, .type = TYPE_NORMAL, @@ -22072,7 +22205,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_G_MAX_REPLENISH] = { .name = COMPOUND_STRING("超极巨资源再生"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "G-max Snorlax attack.\n" + "Restores eaten Berries."), //ANIM TODO .effect = EFFECT_MAX_MOVE, .power = 10, .type = TYPE_NORMAL, @@ -22092,7 +22227,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_G_MAX_MALODOR] = { .name = COMPOUND_STRING("超极巨臭气冲天"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "G-max Garbodor attack.\n" + "Poisons opponents."), //ANIM TODO .effect = EFFECT_MAX_MOVE, .power = 10, .type = TYPE_POISON, @@ -22112,7 +22249,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_G_MAX_MELTDOWN] = { .name = COMPOUND_STRING("超极巨液金熔击"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "G-max Melmetal attack.\n" + "Prevents repeat move use."), //ANIM TODO .effect = EFFECT_MAX_MOVE, .power = 10, .type = TYPE_STEEL, @@ -22132,7 +22271,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_G_MAX_DRUM_SOLO] = { .name = COMPOUND_STRING("超极巨狂擂乱打"), - .description = sNullDescription, //ANIM TODO + .description = COMPOUND_STRING( + "G-max Rillaboom attack.\n" + "Ignores target's abilities."), //ANIM TODO .effect = EFFECT_MAX_MOVE, .power = 10, .type = TYPE_GRASS, @@ -22153,7 +22294,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_G_MAX_FIREBALL] = { .name = COMPOUND_STRING("超极巨破阵火球"), - .description = sNullDescription, //ANIM TODO + .description = COMPOUND_STRING( + "G-max Cinderace attack.\n" + "Ignores target's abilities."), //ANIM TODO .effect = EFFECT_MAX_MOVE, .power = 10, .type = TYPE_FIRE, @@ -22174,7 +22317,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_G_MAX_HYDROSNIPE] = { .name = COMPOUND_STRING("超极巨狙击神射"), - .description = sNullDescription, //ANIM TODO + .description = COMPOUND_STRING( + "G-max Inteleon attack.\n" + "Ignores target's abilities."), //ANIM TODO .effect = EFFECT_MAX_MOVE, .power = 10, .type = TYPE_WATER, @@ -22195,7 +22340,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_G_MAX_WIND_RAGE] = { .name = COMPOUND_STRING("超极巨旋风袭卷"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "G-max Corviknight attack.\n" + "Removes opponent screens."), //ANIM TODO .effect = EFFECT_MAX_MOVE, .power = 10, .type = TYPE_FLYING, @@ -22215,7 +22362,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_G_MAX_GRAVITAS] = { .name = COMPOUND_STRING("超极巨天道七星"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "G-max Orbeetle attack.\n" + "Changes gravity for 5 turns."), //ANIM TODO .effect = EFFECT_MAX_MOVE, .power = 10, .type = TYPE_PSYCHIC, @@ -22235,7 +22384,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_G_MAX_STONESURGE] = { .name = COMPOUND_STRING("超极巨岩阵以待"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "G-max Drednaw attack.\n" + "Scatters sharp rocks."), //ANIM TODO .effect = EFFECT_MAX_MOVE, .power = 10, .type = TYPE_WATER, @@ -22255,7 +22406,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_G_MAX_VOLCALITH] = { .name = COMPOUND_STRING("超极巨炎石喷发"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "G-max Coalossal attack.\n" + "Damages for 4 turns."), //ANIM TODO .effect = EFFECT_MAX_MOVE, .power = 10, .type = TYPE_ROCK, @@ -22275,7 +22428,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_G_MAX_TARTNESS] = { .name = COMPOUND_STRING("超极巨酸不溜丢"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "G-max Flapple attack.\n" + "Lowers foe's evasiveness."), //ANIM TODO .effect = EFFECT_MAX_MOVE, .power = 10, .type = TYPE_GRASS, @@ -22295,7 +22450,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_G_MAX_SWEETNESS] = { .name = COMPOUND_STRING("超极巨琼浆玉液"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "G-max Appletun attack.\n" + "Heals ally status conditions."), //ANIM TODO .effect = EFFECT_MAX_MOVE, .power = 10, .type = TYPE_GRASS, @@ -22315,7 +22472,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_G_MAX_SANDBLAST] = { .name = COMPOUND_STRING("超极巨沙尘漫天"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "G-max Sandaconda attack.\n" + "Traps foes in a sandstorm."), //ANIM TODO .effect = EFFECT_MAX_MOVE, .power = 10, .type = TYPE_GROUND, @@ -22335,7 +22494,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_G_MAX_STUN_SHOCK] = { .name = COMPOUND_STRING("超极巨异毒电场"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "G-max Toxtricity attack.\n" + "Poisons or paralyzes foes."), //ANIM TODO .effect = EFFECT_MAX_MOVE, .power = 10, .type = TYPE_ELECTRIC, @@ -22355,7 +22516,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_G_MAX_CENTIFERNO] = { .name = COMPOUND_STRING("超极巨百火焚野"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "G-max Toxtricity attack.\n" + "Traps foes in flames."), //ANIM TODO .effect = EFFECT_MAX_MOVE, .power = 10, .type = TYPE_FIRE, @@ -22375,7 +22538,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_G_MAX_SMITE] = { .name = COMPOUND_STRING("超极巨天谴雷诛"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "G-max Hatterene attack.\n" + "Confuses opponents."), //ANIM TODO .effect = EFFECT_MAX_MOVE, .power = 10, .type = TYPE_FAIRY, @@ -22396,7 +22561,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_G_MAX_SNOOZE] = { .name = COMPOUND_STRING("超极巨睡魔降临"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "G-max Grimmsnarl attack.\n" + "Lulls foes into sleep."), //ANIM TODO .effect = EFFECT_MAX_MOVE, .power = 10, .type = TYPE_DARK, @@ -22416,7 +22583,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_G_MAX_FINALE] = { .name = COMPOUND_STRING("超极巨幸福圆满"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "G-max Alcremie attack.\n" + "Heals ally HP."), //ANIM TODO .effect = EFFECT_MAX_MOVE, .power = 10, .type = TYPE_FAIRY, @@ -22436,7 +22605,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_G_MAX_STEELSURGE] = { .name = COMPOUND_STRING("超极巨钢铁阵法"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "G-max Copperajah attack.\n" + "Scatters sharp spikes."), //ANIM TODO .effect = EFFECT_MAX_MOVE, .power = 10, .type = TYPE_STEEL, @@ -22456,7 +22627,9 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_G_MAX_DEPLETION] = { .name = COMPOUND_STRING("超极巨劣化衰变"), - .description = sNullDescription, + .description = COMPOUND_STRING( + "G-max Duraludon attack.\n" + "Reduces target's PP."), //ANIM TODO .effect = EFFECT_MAX_MOVE, .power = 10, .type = TYPE_DRAGON, @@ -22476,7 +22649,7 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_G_MAX_ONE_BLOW] = { .name = COMPOUND_STRING("超极巨夺命一击"), - .description = sNullDescription, + .description = sGMaxOneBlowDescription, //ANIM TODO .effect = EFFECT_MAX_MOVE, .power = 10, .type = TYPE_DARK, @@ -22492,7 +22665,6 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = [MOVE_G_MAX_RAPID_FLOW] = { .name = COMPOUND_STRING("超极巨流水连击"), - .description = sNullDescription, .effect = EFFECT_MAX_MOVE, .power = 10, .type = TYPE_WATER, @@ -22505,3 +22677,4 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] = .battleAnimScript = gBattleAnimMove_GMaxRapidFlow, }, }; +//todo汉化 \ No newline at end of file diff --git a/src/data/pokemon/species_info/gen_8_families.h b/src/data/pokemon/species_info/gen_8_families.h index 3407696570..75c3f57fca 100644 --- a/src/data/pokemon/species_info/gen_8_families.h +++ b/src/data/pokemon/species_info/gen_8_families.h @@ -2738,13 +2738,13 @@ const struct SpeciesInfo gSpeciesInfoGen8[] = .trainerOffset = 0, .frontPic = gMonFrontPic_Hydrapple, .frontPicSize = MON_COORDS_SIZE(64, 64), - .frontPicYOffset = 1, + .frontPicYOffset = 0, .frontAnimFrames = sAnims_SingleFramePlaceHolder, - .frontAnimId = ANIM_V_SQUISH_AND_BOUNCE, + //.frontAnimId = ANIM_V_SQUISH_AND_BOUNCE, .backPic = gMonBackPic_Hydrapple, .backPicSize = MON_COORDS_SIZE(64, 64), - .backPicYOffset = 0, - .backAnimId = BACK_ANIM_NONE, + .backPicYOffset = 2, + //.backAnimId = BACK_ANIM_NONE, .palette = gMonPalette_Hydrapple, .shinyPalette = gMonShinyPalette_Hydrapple, .iconSprite = gMonIcon_Hydrapple, diff --git a/src/data/pokemon/species_info/gen_9_families.h b/src/data/pokemon/species_info/gen_9_families.h index 7fbd30229c..6ef916ebf4 100644 --- a/src/data/pokemon/species_info/gen_9_families.h +++ b/src/data/pokemon/species_info/gen_9_families.h @@ -665,18 +665,18 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .trainerOffset = 0, .frontPic = gMonFrontPic_OinkologneM, .frontPicSize = MON_COORDS_SIZE(64, 64), - .frontPicYOffset = 6, + .frontPicYOffset = 7, .frontAnimFrames = sAnims_SingleFramePlaceHolder, //.frontAnimId = ANIM_V_SQUISH_AND_BOUNCE, .backPic = gMonBackPic_OinkologneM, .backPicSize = MON_COORDS_SIZE(64, 64), - .backPicYOffset = 8, + .backPicYOffset = 12, //.backAnimId = BACK_ANIM_NONE, .palette = gMonPalette_OinkologneM, .shinyPalette = gMonShinyPalette_OinkologneM, .iconSprite = gMonIcon_OinkologneM, .iconPalIndex = 1, - SHADOW(-2, 6, SHADOW_SIZE_M) + SHADOW(5, 6, SHADOW_SIZE_M) FOOTPRINT(Oinkologne) OVERWORLD( sPicTable_OinkologneM, @@ -727,18 +727,18 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .trainerOffset = 0, .frontPic = gMonFrontPic_OinkologneF, .frontPicSize = MON_COORDS_SIZE(64, 64), - .frontPicYOffset = 6, + .frontPicYOffset = 7, .frontAnimFrames = sAnims_SingleFramePlaceHolder, //.frontAnimId = ANIM_V_SQUISH_AND_BOUNCE, .backPic = gMonBackPic_OinkologneF, .backPicSize = MON_COORDS_SIZE(64, 64), - .backPicYOffset = 7, + .backPicYOffset = 12, //.backAnimId = BACK_ANIM_NONE, .palette = gMonPalette_OinkologneF, .shinyPalette = gMonShinyPalette_OinkologneF, .iconSprite = gMonIcon_OinkologneF, .iconPalIndex = 0, - SHADOW(3, 7, SHADOW_SIZE_M) + SHADOW(5, 6, SHADOW_SIZE_M) FOOTPRINT(Oinkologne) OVERWORLD( sPicTable_OinkologneF, @@ -3879,10 +3879,9 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .trainerOffset = 0, .frontPic = gMonFrontPic_Bombirdier, .frontPicSize = MON_COORDS_SIZE(64, 64), - .frontPicYOffset = 1, + .frontPicYOffset = 0, .frontAnimFrames = sAnims_SingleFramePlaceHolder, //.frontAnimId = ANIM_V_SQUISH_AND_BOUNCE, - .enemyMonElevation = 8, .backPic = gMonBackPic_Bombirdier, .backPicSize = MON_COORDS_SIZE(64, 64), .backPicYOffset = 4, @@ -3891,7 +3890,7 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .shinyPalette = gMonShinyPalette_Bombirdier, .iconSprite = gMonIcon_Bombirdier, .iconPalIndex = 0, - SHADOW(1, 18, SHADOW_SIZE_M) + SHADOW(8, 12, SHADOW_SIZE_M) FOOTPRINT(Bombirdier) OVERWORLD( sPicTable_Bombirdier, @@ -5151,18 +5150,18 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .trainerOffset = 0, .frontPic = gMonFrontPic_GreatTusk, .frontPicSize = MON_COORDS_SIZE(64, 64), - .frontPicYOffset = 5, - .frontAnimFrames = sAnims_TwoFramePlaceHolder, + .frontPicYOffset = 0, + .frontAnimFrames = sAnims_SingleFramePlaceHolder, //.frontAnimId = ANIM_V_SQUISH_AND_BOUNCE, .backPic = gMonBackPic_GreatTusk, .backPicSize = MON_COORDS_SIZE(64, 64), - .backPicYOffset = 4, + .backPicYOffset = 9, //.backAnimId = BACK_ANIM_NONE, .palette = gMonPalette_GreatTusk, .shinyPalette = gMonShinyPalette_GreatTusk, .iconSprite = gMonIcon_GreatTusk, .iconPalIndex = 0, - SHADOW(3, 6, SHADOW_SIZE_L) + SHADOW(2, 13, SHADOW_SIZE_XL_BATTLE_ONLY) FOOTPRINT(GreatTusk) OVERWORLD( sPicTable_GreatTusk, @@ -5930,18 +5929,18 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .trainerOffset = 0, .frontPic = gMonFrontPic_Frigibax, .frontPicSize = MON_COORDS_SIZE(64, 64), - .frontPicYOffset = 7, - .frontAnimFrames = sAnims_TwoFramePlaceHolder, + .frontPicYOffset = 13, + .frontAnimFrames = sAnims_SingleFramePlaceHolder, //.frontAnimId = ANIM_V_SQUISH_AND_BOUNCE, .backPic = gMonBackPic_Frigibax, .backPicSize = MON_COORDS_SIZE(64, 64), - .backPicYOffset = 11, + .backPicYOffset = 13, //.backAnimId = BACK_ANIM_NONE, .palette = gMonPalette_Frigibax, .shinyPalette = gMonShinyPalette_Frigibax, .iconSprite = gMonIcon_Frigibax, .iconPalIndex = 0, - SHADOW(0, 7, SHADOW_SIZE_S) + SHADOW(2, -1, SHADOW_SIZE_S) FOOTPRINT(Frigibax) OVERWORLD( sPicTable_Frigibax, @@ -6759,6 +6758,7 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .frontPicYOffset = 0, .frontAnimFrames = sAnims_SingleFramePlaceHolder, //.frontAnimId = ANIM_V_SQUISH_AND_BOUNCE, + .enemyMonElevation = 8, .backPic = gMonBackPic_Miraidon, .backPicSize = MON_COORDS_SIZE(64, 64), .backPicYOffset = 0, @@ -6767,7 +6767,7 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .shinyPalette = gMonShinyPalette_Miraidon, .iconSprite = gMonIcon_Miraidon, .iconPalIndex = 2, - SHADOW(10, 14, SHADOW_SIZE_L) + SHADOW(3, 22, SHADOW_SIZE_L) FOOTPRINT(Miraidon) OVERWORLD( sPicTable_Miraidon, @@ -7426,10 +7426,10 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .perfectIVCount = LEGENDARY_PERFECT_IV_COUNT, \ } - [SPECIES_OGERPON_TEAL] = OGERPON_SPECIES_INFO(Teal, Teal, TYPE_GRASS, ABILITY_DEFIANT, BODY_COLOR_GREEN, 1, 7, 1, FALSE), - [SPECIES_OGERPON_WELLSPRING] = OGERPON_SPECIES_INFO(Wellspring, Wellspring, TYPE_WATER, ABILITY_WATER_ABSORB, BODY_COLOR_BLUE, 1, 7, 0, FALSE), - [SPECIES_OGERPON_HEARTHFLAME] = OGERPON_SPECIES_INFO(Hearthflame, Hearthflame, TYPE_FIRE, ABILITY_MOLD_BREAKER, BODY_COLOR_RED, 1, 7, 0, FALSE), - [SPECIES_OGERPON_CORNERSTONE] = OGERPON_SPECIES_INFO(Cornerstone, Cornerstone, TYPE_ROCK, ABILITY_STURDY, BODY_COLOR_GRAY, 1, 7, 0, FALSE), + [SPECIES_OGERPON_TEAL] = OGERPON_SPECIES_INFO(Teal, Teal, TYPE_GRASS, ABILITY_DEFIANT, BODY_COLOR_GREEN, 1, 6, 1, FALSE), + [SPECIES_OGERPON_WELLSPRING] = OGERPON_SPECIES_INFO(Wellspring, Wellspring, TYPE_WATER, ABILITY_WATER_ABSORB, BODY_COLOR_BLUE, 1, 6, 0, FALSE), + [SPECIES_OGERPON_HEARTHFLAME] = OGERPON_SPECIES_INFO(Hearthflame, Hearthflame, TYPE_FIRE, ABILITY_MOLD_BREAKER, BODY_COLOR_RED, 1, 6, 0, FALSE), + [SPECIES_OGERPON_CORNERSTONE] = OGERPON_SPECIES_INFO(Cornerstone, Cornerstone, TYPE_ROCK, ABILITY_STURDY, BODY_COLOR_GRAY, 1, 6, 0, FALSE), #if P_TERA_FORMS [SPECIES_OGERPON_TEAL_TERA] = OGERPON_SPECIES_INFO(Teal, TealTera, TYPE_GRASS, ABILITY_EMBODY_ASPECT_TEAL_MASK, BODY_COLOR_GREEN, 0, 0, 1, TRUE), [SPECIES_OGERPON_WELLSPRING_TERA] = OGERPON_SPECIES_INFO(Wellspring, WellspringTera, TYPE_WATER, ABILITY_EMBODY_ASPECT_WELLSPRING_MASK, BODY_COLOR_BLUE, 0, 0, 0, TRUE), @@ -7734,19 +7734,18 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .trainerOffset = 7, .frontPic = gMonFrontPic_TerapagosNormal, .frontPicSize = MON_COORDS_SIZE(64, 64), - .frontPicYOffset = 0, - .frontAnimFrames = sAnims_TwoFramePlaceHolder, - .frontAnimId = ANIM_V_SQUISH_AND_BOUNCE, - .enemyMonElevation = 1, + .frontPicYOffset = 10, + .frontAnimFrames = sAnims_SingleFramePlaceHolder, + //.frontAnimId = ANIM_V_SQUISH_AND_BOUNCE, .backPic = gMonBackPic_TerapagosNormal, .backPicSize = MON_COORDS_SIZE(64, 64), - .backPicYOffset = 0, - .backAnimId = BACK_ANIM_NONE, + .backPicYOffset = 9, + //.backAnimId = BACK_ANIM_NONE, .palette = gMonPalette_TerapagosNormal, .shinyPalette = gMonShinyPalette_TerapagosNormal, .iconSprite = gMonIcon_TerapagosNormal, .iconPalIndex = 0, - SHADOW(3, 13, SHADOW_SIZE_L) + SHADOW(0, 2, SHADOW_SIZE_M) FOOTPRINT(TerapagosNormal) OVERWORLD( sPicTable_TerapagosNormal, @@ -7804,18 +7803,18 @@ const struct SpeciesInfo gSpeciesInfoGen9[] = .frontPic = gMonFrontPic_TerapagosTerastal, .frontPicSize = MON_COORDS_SIZE(64, 64), .frontPicYOffset = 8, - .frontAnimFrames = sAnims_TwoFramePlaceHolder, - .frontAnimId = ANIM_V_SQUISH_AND_BOUNCE, - .enemyMonElevation = 1, + .frontAnimFrames = sAnims_SingleFramePlaceHolder, + //.frontAnimId = ANIM_V_SQUISH_AND_BOUNCE, + .enemyMonElevation = 8, .backPic = gMonBackPic_TerapagosTerastal, .backPicSize = MON_COORDS_SIZE(64, 64), - .backPicYOffset = 0, - .backAnimId = BACK_ANIM_NONE, + .backPicYOffset = 11, + //.backAnimId = BACK_ANIM_NONE, .palette = gMonPalette_TerapagosTerastal, .shinyPalette = gMonShinyPalette_TerapagosTerastal, .iconSprite = gMonIcon_TerapagosTerastal, .iconPalIndex = 0, - SHADOW(-4, 4, SHADOW_SIZE_L) + SHADOW(-4, 8, SHADOW_SIZE_L) FOOTPRINT(TerapagosTerastal) OVERWORLD( sPicTable_TerapagosTerastal, diff --git a/src/data/tilesets/headers.h b/src/data/tilesets/headers.h index 2eae1be1ea..f6cac20c05 100644 --- a/src/data/tilesets/headers.h +++ b/src/data/tilesets/headers.h @@ -636,8 +636,8 @@ const struct Tileset gTileset_SecretBase = .callback = NULL, }; -const struct Tileset * const gTilesetPointer_SecretBase = &gTileset_SecretBase; -const struct Tileset * const gTilesetPointer_SecretBaseRedCave = &gTileset_SecretBaseRedCave; +const struct Tileset *const gTilesetPointer_SecretBase = &gTileset_SecretBase; +const struct Tileset *const gTilesetPointer_SecretBaseRedCave = &gTileset_SecretBaseRedCave; const struct Tileset gTileset_EliteFour = { diff --git a/src/daycare.c b/src/daycare.c index bedaf35dd2..e2f6f8f070 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -537,7 +537,7 @@ static s32 GetParentToInheritNature(struct DayCare *daycare) for (i = 0; i < DAYCARE_MON_COUNT; i++) { - if (ItemId_GetHoldEffect(GetBoxMonData(&daycare->mons[i].mon, MON_DATA_HELD_ITEM)) == HOLD_EFFECT_PREVENT_EVOLVE + if (GetItemHoldEffect(GetBoxMonData(&daycare->mons[i].mon, MON_DATA_HELD_ITEM)) == HOLD_EFFECT_PREVENT_EVOLVE && (P_NATURE_INHERITANCE != GEN_3 || GetBoxMonGender(&daycare->mons[i].mon) == MON_FEMALE || IS_DITTO(GetBoxMonData(&daycare->mons[i].mon, MON_DATA_SPECIES)))) { slot = i; @@ -627,26 +627,26 @@ static void InheritIVs(struct Pokemon *egg, struct DayCare *daycare) } start = 0; - if (ItemId_GetHoldEffect(motherItem) == HOLD_EFFECT_POWER_ITEM && - ItemId_GetHoldEffect(fatherItem) == HOLD_EFFECT_POWER_ITEM) + if (GetItemHoldEffect(motherItem) == HOLD_EFFECT_POWER_ITEM && + GetItemHoldEffect(fatherItem) == HOLD_EFFECT_POWER_ITEM) { whichParents[0] = Random() % DAYCARE_MON_COUNT; - selectedIvs[0] = ItemId_GetSecondaryId( + selectedIvs[0] = GetItemSecondaryId( GetBoxMonData(&daycare->mons[whichParents[0]].mon, MON_DATA_HELD_ITEM)); RemoveIVIndexFromList(availableIVs, selectedIvs[0]); start++; } - else if (ItemId_GetHoldEffect(motherItem) == HOLD_EFFECT_POWER_ITEM) + else if (GetItemHoldEffect(motherItem) == HOLD_EFFECT_POWER_ITEM) { whichParents[0] = 0; - selectedIvs[0] = ItemId_GetSecondaryId(motherItem); + selectedIvs[0] = GetItemSecondaryId(motherItem); RemoveIVIndexFromList(availableIVs, selectedIvs[0]); start++; } - else if (ItemId_GetHoldEffect(fatherItem) == HOLD_EFFECT_POWER_ITEM) + else if (GetItemHoldEffect(fatherItem) == HOLD_EFFECT_POWER_ITEM) { whichParents[0] = 1; - selectedIvs[0] = ItemId_GetSecondaryId(fatherItem); + selectedIvs[0] = GetItemSecondaryId(fatherItem); RemoveIVIndexFromList(availableIVs, selectedIvs[0]); start++; } @@ -1019,8 +1019,8 @@ static u16 DetermineEggSpeciesAndParentSlots(struct DayCare *daycare, u8 *parent motherEggSpecies = GetEggSpecies(species[parentSlots[0]]); fatherEggSpecies = GetEggSpecies(species[parentSlots[1]]); - hasMotherEverstone = ItemId_GetHoldEffect(GetBoxMonData(&daycare->mons[parentSlots[0]].mon, MON_DATA_HELD_ITEM)) == HOLD_EFFECT_PREVENT_EVOLVE; - hasFatherEverstone = ItemId_GetHoldEffect(GetBoxMonData(&daycare->mons[parentSlots[1]].mon, MON_DATA_HELD_ITEM)) == HOLD_EFFECT_PREVENT_EVOLVE; + hasMotherEverstone = GetItemHoldEffect(GetBoxMonData(&daycare->mons[parentSlots[0]].mon, MON_DATA_HELD_ITEM)) == HOLD_EFFECT_PREVENT_EVOLVE; + hasFatherEverstone = GetItemHoldEffect(GetBoxMonData(&daycare->mons[parentSlots[1]].mon, MON_DATA_HELD_ITEM)) == HOLD_EFFECT_PREVENT_EVOLVE; motherIsForeign = IsSpeciesForeignRegionalForm(motherEggSpecies, currentRegion); fatherIsForeign = IsSpeciesForeignRegionalForm(fatherEggSpecies, currentRegion); diff --git a/src/debug.c b/src/debug.c index f829f6e9e6..d0b6138739 100644 --- a/src/debug.c +++ b/src/debug.c @@ -3620,7 +3620,7 @@ static void DebugAction_PCBag_Fill_PocketItems(u8 taskId) for (itemId = 1; itemId < ITEMS_COUNT; itemId++) { - if (ItemId_GetPocket(itemId) == POCKET_ITEMS && CheckBagHasSpace(itemId, MAX_BAG_ITEM_CAPACITY)) + if (GetItemPocket(itemId) == POCKET_ITEMS && CheckBagHasSpace(itemId, MAX_BAG_ITEM_CAPACITY)) AddBagItem(itemId, MAX_BAG_ITEM_CAPACITY); } } @@ -3664,7 +3664,7 @@ static void DebugAction_PCBag_Fill_PocketKeyItems(u8 taskId) for (itemId = 1; itemId < ITEMS_COUNT; itemId++) { - if (ItemId_GetPocket(itemId) == POCKET_KEY_ITEMS && CheckBagHasSpace(itemId, 1)) + if (GetItemPocket(itemId) == POCKET_KEY_ITEMS && CheckBagHasSpace(itemId, 1)) AddBagItem(itemId, 1); } } diff --git a/src/dodrio_berry_picking.c b/src/dodrio_berry_picking.c index ce1877c6cd..16ea035c7c 100644 --- a/src/dodrio_berry_picking.c +++ b/src/dodrio_berry_picking.c @@ -275,13 +275,13 @@ struct DodrioGame /*0x3308*/ struct DodrioGame_ScoreResults scoreResults[MAX_RFU_PLAYERS]; }; // size = 0x3330 -EWRAM_DATA static struct DodrioGame * sGame = NULL; -EWRAM_DATA static u16 * sDodrioSpriteIds[MAX_RFU_PLAYERS] = {NULL}; -EWRAM_DATA static u16 * sCloudSpriteIds[NUM_CLOUDS] = {NULL}; -EWRAM_DATA static u16 * sBerrySpriteIds[NUM_BERRY_COLUMNS] = {NULL}; -EWRAM_DATA static u16 * sBerryIconSpriteIds[NUM_BERRY_TYPES] = {NULL}; -EWRAM_DATA static struct StatusBar * sStatusBar = NULL; -EWRAM_DATA static struct DodrioGame_Gfx * sGfx = NULL; +EWRAM_DATA static struct DodrioGame *sGame = NULL; +EWRAM_DATA static u16 *sDodrioSpriteIds[MAX_RFU_PLAYERS] = {NULL}; +EWRAM_DATA static u16 *sCloudSpriteIds[NUM_CLOUDS] = {NULL}; +EWRAM_DATA static u16 *sBerrySpriteIds[NUM_BERRY_COLUMNS] = {NULL}; +EWRAM_DATA static u16 *sBerryIconSpriteIds[NUM_BERRY_TYPES] = {NULL}; +EWRAM_DATA static struct StatusBar *sStatusBar = NULL; +EWRAM_DATA static struct DodrioGame_Gfx *sGfx = NULL; static bool32 sExitingGame; @@ -695,7 +695,7 @@ static void ResetTasksAndSprites(void) FreeAllSpritePalettes(); } -static void InitDodrioGame(struct DodrioGame * game) +static void InitDodrioGame(struct DodrioGame *game) { u8 i; @@ -1433,7 +1433,7 @@ static void Task_NewGameIntro(u8 taskId) static void Task_CommunicateMonInfo(u8 taskId) { - s16 * data = gTasks[taskId].data; + s16 *data = gTasks[taskId].data; u8 i; switch (tState) @@ -1759,7 +1759,7 @@ static void HandleSound_Member(void) } for (i = berryStart; i < berryEnd; i++) { - struct DodrioGame_Berries * berries = &sGame->players[sGame->multiplayerId].berries; + struct DodrioGame_Berries *berries = &sGame->players[sGame->multiplayerId].berries; if (berries->fallDist[i] >= MAX_FALL_DIST) { if (!sGame->playingSquishSound[i]) @@ -1802,7 +1802,7 @@ static void VBlankCB_DodrioGame(void) ProcessSpriteCopyRequests(); } -static void InitMonInfo(struct DodrioGame_MonInfo * monInfo, struct Pokemon *mon) +static void InitMonInfo(struct DodrioGame_MonInfo *monInfo, struct Pokemon *mon) { monInfo->isShiny = IsMonShiny(mon); } @@ -1861,7 +1861,7 @@ static void InitFirstWaveOfBerries(void) for (i = berryStart; i < berryEnd; i++) { - struct DodrioGame_Berries * berries = &sGame->player.berries; + struct DodrioGame_Berries *berries = &sGame->player.berries; berries->fallDist[i] = (i % 2 == 0) ? 1 : 0; berries->ids[i] = BERRY_BLUE; } @@ -1995,7 +1995,7 @@ static bool32 TryPickBerry(u8 playerId, u8 pickState, u8 column) { s32 pick = 0; u8 numPlayersIdx = sGame->numPlayers - 1; - struct DodrioGame_Berries * berries = &sGame->player.berries; + struct DodrioGame_Berries *berries = &sGame->player.berries; switch (pickState) { @@ -3841,7 +3841,7 @@ static void LoadDodrioGfx(void) LoadSpritePalette(&shiny); } -static void CreateDodrioSprite(struct DodrioGame_MonInfo * monInfo, u8 playerId, u8 id, u8 numPlayers) +static void CreateDodrioSprite(struct DodrioGame_MonInfo *monInfo, u8 playerId, u8 id, u8 numPlayers) { struct SpriteTemplate template = { diff --git a/src/ereader_helpers.c b/src/ereader_helpers.c index d28940538f..139e861a34 100755 --- a/src/ereader_helpers.c +++ b/src/ereader_helpers.c @@ -382,7 +382,7 @@ static u8 GetTrainerHillUnkVal(void) #endif //FREE_TRAINER_HILL } -static bool32 ValidateTrainerChecksum(struct EReaderTrainerHillTrainer * hillTrainer) +static bool32 ValidateTrainerChecksum(struct EReaderTrainerHillTrainer *hillTrainer) { int checksum = CalcByteArraySum((u8 *)hillTrainer, offsetof(typeof(*hillTrainer), checksum)); if (checksum != hillTrainer->checksum) @@ -391,7 +391,7 @@ static bool32 ValidateTrainerChecksum(struct EReaderTrainerHillTrainer * hillTra return TRUE; } -bool8 ValidateTrainerHillData(struct EReaderTrainerHillSet * hillSet) +bool8 ValidateTrainerHillData(struct EReaderTrainerHillSet *hillSet) { u32 i; u32 checksum; @@ -430,7 +430,7 @@ static bool32 ValidateTrainerHillChecksum(struct EReaderTrainerHillSet *hillSet) return TRUE; } -static bool32 TryWriteTrainerHill_Internal(struct EReaderTrainerHillSet * hillSet, struct TrainerHillChallenge * challenge) +static bool32 TryWriteTrainerHill_Internal(struct EReaderTrainerHillSet *hillSet, struct TrainerHillChallenge *challenge) { int i; @@ -469,7 +469,7 @@ static bool32 TryWriteTrainerHill_Internal(struct EReaderTrainerHillSet * hillSe return TRUE; } -bool32 TryWriteTrainerHill(struct EReaderTrainerHillSet * hillSet) +bool32 TryWriteTrainerHill(struct EReaderTrainerHillSet *hillSet) { void *buffer = AllocZeroed(SECTOR_SIZE); bool32 result = TryWriteTrainerHill_Internal(hillSet, buffer); @@ -477,7 +477,7 @@ bool32 TryWriteTrainerHill(struct EReaderTrainerHillSet * hillSet) return result; } -static bool32 TryReadTrainerHill_Internal(struct EReaderTrainerHillSet * dest, u8 *buffer) +static bool32 TryReadTrainerHill_Internal(struct EReaderTrainerHillSet *dest, u8 *buffer) { if (TryReadSpecialSaveSector(SECTOR_ID_TRAINER_HILL, buffer) != SAVE_STATUS_OK) return FALSE; @@ -489,7 +489,7 @@ static bool32 TryReadTrainerHill_Internal(struct EReaderTrainerHillSet * dest, u return TRUE; } -static bool32 TryReadTrainerHill(struct EReaderTrainerHillSet * hillSet) +static bool32 TryReadTrainerHill(struct EReaderTrainerHillSet *hillSet) { u8 *buffer = AllocZeroed(SECTOR_SIZE); bool32 result = TryReadTrainerHill_Internal(hillSet, buffer); @@ -505,7 +505,7 @@ bool32 ReadTrainerHillAndValidate(void) return result; } -int EReader_Send(int size, const void * src) +int EReader_Send(int size, const void *src) { int result; int sendStatus; @@ -546,7 +546,7 @@ int EReader_Send(int size, const void * src) return result; } -int EReader_Recv(void * dest) +int EReader_Recv(void *dest) { int result; int recvStatus; @@ -623,7 +623,7 @@ static void OpenSerial32(void) sCounter2 = 0; } -int EReaderHandleTransfer(u8 mode, size_t size, const void * data, void * recvBuffer) +int EReaderHandleTransfer(u8 mode, size_t size, const void *data, void *recvBuffer) { switch (sSendRecvMgr.state) { @@ -716,7 +716,7 @@ static u16 DetermineSendRecvState(u8 mode) return resp; } -static void SetUpTransferManager(size_t size, const void * data, void * recvBuffer) +static void SetUpTransferManager(size_t size, const void *data, void *recvBuffer) { if (sSendRecvMgr.isParent) { diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c index 51522726ea..c7eafff57f 100644 --- a/src/field_player_avatar.c +++ b/src/field_player_avatar.c @@ -39,14 +39,13 @@ EWRAM_DATA struct ObjectEvent gObjectEvents[OBJECT_EVENTS_COUNT] = {}; EWRAM_DATA struct PlayerAvatar gPlayerAvatar = {}; // static declarations - -static u8 ObjectEventCB2_NoMovement2(); +static u8 ObjectEventCB2_NoMovement2(void); static bool8 TryInterruptObjectEventSpecialAnim(struct ObjectEvent *, u8); static void npc_clear_strange_bits(struct ObjectEvent *); static void MovePlayerAvatarUsingKeypadInput(u8, u16, u16); -static void PlayerAllowForcedMovementIfMovingSameDirection(); -static bool8 TryDoMetatileBehaviorForcedMovement(); -static u8 GetForcedMovementByMetatileBehavior(); +static void PlayerAllowForcedMovementIfMovingSameDirection(void); +static bool8 TryDoMetatileBehaviorForcedMovement(void); +static u8 GetForcedMovementByMetatileBehavior(void); static bool8 ForcedMovement_None(void); static bool8 ForcedMovement_Slip(void); @@ -339,7 +338,7 @@ static bool8 (*const sPlayerAvatarSecretBaseMatSpin[])(struct Task *, struct Obj void MovementType_Player(struct Sprite *sprite) { - UpdateObjectEventCurrentMovement(&gObjectEvents[sprite->data[0]], sprite, ObjectEventCB2_NoMovement2); + UpdateObjectEventCurrentMovement(&gObjectEvents[sprite->data[0]], sprite, (bool8 (*)(struct ObjectEvent *, struct Sprite *))ObjectEventCB2_NoMovement2); } static u8 ObjectEventCB2_NoMovement2(void) diff --git a/src/frontier_util.c b/src/frontier_util.c index ca29f2f033..77060c7a34 100644 --- a/src/frontier_util.c +++ b/src/frontier_util.c @@ -690,7 +690,7 @@ static const u8 sBattlePointAwards[NUM_FRONTIER_FACILITIES][FRONTIER_MODE_COUNT] }, }; -static void (* const sFrontierUtilFuncs[])(void) = +static void (*const sFrontierUtilFuncs[])(void) = { [FRONTIER_UTIL_FUNC_GET_STATUS] = GetChallengeStatus, [FRONTIER_UTIL_FUNC_GET_DATA] = GetFrontierData, diff --git a/src/hall_of_fame.c b/src/hall_of_fame.c index 1a8906d975..1beb7054c5 100644 --- a/src/hall_of_fame.c +++ b/src/hall_of_fame.c @@ -84,7 +84,7 @@ static void Task_HofPC_HandlePaletteOnExit(u8 taskId); static void Task_HofPC_HandleExit(u8 taskId); static void Task_HofPC_ExitOnButtonPress(u8 taskId); static void SpriteCB_GetOnScreenAndAnimate(struct Sprite *sprite); -static void HallOfFame_PrintMonInfo(struct HallofFameMon* currMon, u8 unused1, u8 unused2); +static void HallOfFame_PrintMonInfo(struct HallofFameMon *currMon, u8 unused1, u8 unused2); static void HallOfFame_PrintWelcomeText(u8 unusedPossiblyWindowId, u8 unused2); static void HallOfFame_PrintPlayerInfo(u8 unused1, u8 unused2); static void Task_DoDomeConfetti(u8 taskId); @@ -283,7 +283,7 @@ static const union AnimCmd sAnim_WhiteConfettiC[] = ANIMCMD_END }; -static const union AnimCmd * const sAnims_Confetti[] = +static const union AnimCmd *const sAnims_Confetti[] = { sAnim_PinkConfettiA, sAnim_RedConfettiA, @@ -565,7 +565,7 @@ static void Task_Hof_DisplayMon(u8 taskId) s16 startX, startY, destX, destY; u16 currMonId = gTasks[taskId].tDisplayedMonId; - struct HallofFameMon* currMon = &sHofMonPtr->mon[currMonId]; + struct HallofFameMon *currMon = &sHofMonPtr->mon[currMonId]; if (gTasks[taskId].tMonNumber > PARTY_SIZE / 2) { @@ -599,7 +599,7 @@ static void Task_Hof_DisplayMon(u8 taskId) static void Task_Hof_PrintMonInfoAfterAnimating(u8 taskId) { u16 currMonId = gTasks[taskId].tDisplayedMonId; - struct HallofFameMon* currMon = &sHofMonPtr->mon[currMonId]; + struct HallofFameMon *currMon = &sHofMonPtr->mon[currMonId]; struct Sprite *monSprite = &gSprites[gTasks[taskId].tMonSpriteId(currMonId)]; if (monSprite->callback == SpriteCallbackDummy) @@ -614,7 +614,7 @@ static void Task_Hof_PrintMonInfoAfterAnimating(u8 taskId) static void Task_Hof_TryDisplayAnotherMon(u8 taskId) { u16 currPokeID = gTasks[taskId].tDisplayedMonId; - struct HallofFameMon* currMon = &sHofMonPtr->mon[currPokeID]; + struct HallofFameMon *currMon = &sHofMonPtr->mon[currPokeID]; if (gTasks[taskId].tFrameCount != 0) { @@ -887,7 +887,7 @@ static void Task_HofPC_CopySaveData(u8 taskId) static void Task_HofPC_DrawSpritesPrintText(u8 taskId) { struct HallofFameTeam *savedTeams = gHoFSaveBuffer; - struct HallofFameMon* currMon; + struct HallofFameMon *currMon; u16 i; for (i = 0; i < gTasks[taskId].tCurrTeamNo; i++) @@ -953,7 +953,7 @@ static void Task_HofPC_DrawSpritesPrintText(u8 taskId) static void Task_HofPC_PrintMonInfo(u8 taskId) { struct HallofFameTeam *savedTeams = gHoFSaveBuffer; - struct HallofFameMon* currMon; + struct HallofFameMon *currMon; u16 i; u16 currMonID; @@ -1108,7 +1108,7 @@ static void HallOfFame_PrintWelcomeText(u8 unusedPossiblyWindowId, u8 unused2) CopyWindowToVram(0, COPYWIN_FULL); } -static void HallOfFame_PrintMonInfo(struct HallofFameMon* currMon, u8 unused1, u8 unused2) +static void HallOfFame_PrintMonInfo(struct HallofFameMon *currMon, u8 unused1, u8 unused2) { u8 text[max(32, POKEMON_NAME_LENGTH + 1)]; u8 *stringPtr; diff --git a/src/item.c b/src/item.c index dda679d33d..5a0f60c1e8 100644 --- a/src/item.c +++ b/src/item.c @@ -23,8 +23,8 @@ static bool8 CheckPyramidBagHasItem(u16 itemId, u16 count); static bool8 CheckPyramidBagHasSpace(u16 itemId, u16 count); -//static const u8 *ItemId_GetPluralName(u16); -//static bool32 DoesItemHavePluralName(u16); +static const u8 *GetItemPluralName(u16); +static bool32 DoesItemHavePluralName(u16); EWRAM_DATA struct BagPocket gBagPockets[POCKETS_COUNT] = {0}; @@ -86,7 +86,7 @@ void SetBagItemsPointers(void) u8 *CopyItemName(u16 itemId, u8 *dst) { - return StringCopy(dst, ItemId_GetName(itemId)); + return StringCopy(dst, GetItemName(itemId)); } const u8 sText_s[] =_("s"); @@ -94,17 +94,17 @@ const u8 sText_s[] =_("s"); u8 *CopyItemNameHandlePlural(u16 itemId, u8 *dst, u32 quantity) { //修改,删去英文中出现于词汇末尾的「s」 - //if (quantity == 1) - //{ - return StringCopy(dst, ItemId_GetName(itemId)); - //} - /*else if (DoesItemHavePluralName(itemId)) + if (quantity == 1) { - return StringCopy(dst, ItemId_GetPluralName(itemId)); + return StringCopy(dst, GetItemName(itemId)); + } + else if (DoesItemHavePluralName(itemId)) + { + return StringCopy(dst, GetItemPluralName(itemId)); } else { - u8 *end = StringCopy(dst, ItemId_GetName(itemId)); + u8 *end = StringCopy(dst, GetItemName(itemId)); return StringCopy(end, sText_s); }*/ } @@ -126,11 +126,11 @@ bool8 CheckBagHasItem(u16 itemId, u16 count) u8 i; u8 pocket; - if (ItemId_GetPocket(itemId) == 0) + if (GetItemPocket(itemId) == 0) return FALSE; if (InBattlePyramid() || FlagGet(FLAG_STORING_ITEMS_IN_PYRAMID_BAG) == TRUE) return CheckPyramidBagHasItem(itemId, count); - pocket = ItemId_GetPocket(itemId) - 1; + pocket = GetItemPocket(itemId) - 1; // Check for item slots that contain the item for (i = 0; i < gBagPockets[pocket].capacity; i++) { @@ -180,7 +180,7 @@ bool8 HasAtLeastOnePokeBall(void) bool8 CheckBagHasSpace(u16 itemId, u16 count) { - if (ItemId_GetPocket(itemId) == POCKET_NONE) + if (GetItemPocket(itemId) == POCKET_NONE) return FALSE; if (InBattlePyramid() || FlagGet(FLAG_STORING_ITEMS_IN_PYRAMID_BAG) == TRUE) @@ -192,11 +192,11 @@ bool8 CheckBagHasSpace(u16 itemId, u16 count) u32 GetFreeSpaceForItemInBag(u16 itemId) { u8 i; - u8 pocket = ItemId_GetPocket(itemId) - 1; + u8 pocket = GetItemPocket(itemId) - 1; u16 ownedCount; u32 spaceForItem = 0; - if (ItemId_GetPocket(itemId) == POCKET_NONE) + if (GetItemPocket(itemId) == POCKET_NONE) return 0; // Check space in any existing item slots that already contain this item @@ -219,7 +219,7 @@ bool8 AddBagItem(u16 itemId, u16 count) { u8 i; - if (ItemId_GetPocket(itemId) == POCKET_NONE) + if (GetItemPocket(itemId) == POCKET_NONE) return FALSE; // check Battle Pyramid Bag @@ -232,7 +232,7 @@ bool8 AddBagItem(u16 itemId, u16 count) struct BagPocket *itemPocket; struct ItemSlot *newItems; u16 ownedCount; - u8 pocket = ItemId_GetPocket(itemId) - 1; + u8 pocket = GetItemPocket(itemId) - 1; itemPocket = &gBagPockets[pocket]; newItems = AllocZeroed(itemPocket->capacity * sizeof(struct ItemSlot)); @@ -321,7 +321,7 @@ bool8 RemoveBagItem(u16 itemId, u16 count) u8 i; u16 totalQuantity = 0; - if (ItemId_GetPocket(itemId) == POCKET_NONE || itemId == ITEM_NONE) + if (GetItemPocket(itemId) == POCKET_NONE || itemId == ITEM_NONE) return FALSE; // check Battle Pyramid Bag @@ -336,7 +336,7 @@ bool8 RemoveBagItem(u16 itemId, u16 count) u16 ownedCount; struct BagPocket *itemPocket; - pocket = ItemId_GetPocket(itemId) - 1; + pocket = GetItemPocket(itemId) - 1; itemPocket = &gBagPockets[pocket]; for (i = 0; i < itemPocket->capacity; i++) @@ -406,7 +406,7 @@ bool8 RemoveBagItem(u16 itemId, u16 count) u8 GetPocketByItemId(u16 itemId) { - return ItemId_GetPocket(itemId); + return GetItemPocket(itemId); } void ClearItemSlots(struct ItemSlot *itemSlots, u8 itemCount) @@ -606,7 +606,7 @@ void SortBerriesOrTMHMs(struct BagPocket *bagPocket) } } -void MoveItemSlotInList(struct ItemSlot* itemSlots_, u32 from, u32 to_) +void MoveItemSlotInList(struct ItemSlot *itemSlots_, u32 from, u32 to_) { // dumb assignments needed to match struct ItemSlot *itemSlots = itemSlots_; @@ -646,7 +646,7 @@ u16 CountTotalItemQuantityInBag(u16 itemId) { u16 i; u16 ownedCount = 0; - struct BagPocket *bagPocket = &gBagPockets[ItemId_GetPocket(itemId) - 1]; + struct BagPocket *bagPocket = &gBagPockets[GetItemPocket(itemId) - 1]; for (i = 0; i < bagPocket->capacity; i++) { @@ -866,12 +866,12 @@ static u16 SanitizeItemId(u16 itemId) return itemId; } -const u8 *ItemId_GetName(u16 itemId) +const u8 *GetItemName(u16 itemId) { return gItemsInfo[SanitizeItemId(itemId)].name; } -u32 ItemId_GetPrice(u16 itemId) +u32 GetItemPrice(u16 itemId) { return gItemsInfo[SanitizeItemId(itemId)].price; } @@ -881,12 +881,12 @@ u32 ItemId_GetPrice(u16 itemId) return (gItemsInfo[SanitizeItemId(itemId)].pluralName[0] != '\0'); } -static const u8 *ItemId_GetPluralName(u16 itemId) +static const u8 *GetItemPluralName(u16 itemId) { return gItemsInfo[SanitizeItemId(itemId)].pluralName; }*/ -const u8 *ItemId_GetEffect(u32 itemId) +const u8 *GetItemEffect(u32 itemId) { if (itemId == ITEM_ENIGMA_BERRY_E_READER) #if FREE_ENIGMA_BERRY == FALSE @@ -898,48 +898,48 @@ const u8 *ItemId_GetEffect(u32 itemId) return gItemsInfo[SanitizeItemId(itemId)].effect; } -u32 ItemId_GetHoldEffect(u32 itemId) +u32 GetItemHoldEffect(u32 itemId) { return gItemsInfo[SanitizeItemId(itemId)].holdEffect; } -u32 ItemId_GetHoldEffectParam(u32 itemId) +u32 GetItemHoldEffectParam(u32 itemId) { return gItemsInfo[SanitizeItemId(itemId)].holdEffectParam; } -const u8 *ItemId_GetDescription(u16 itemId) +const u8 *GetItemDescription(u16 itemId) { return gItemsInfo[SanitizeItemId(itemId)].description; } -u8 ItemId_GetImportance(u16 itemId) +u8 GetItemImportance(u16 itemId) { return gItemsInfo[SanitizeItemId(itemId)].importance; } -u8 ItemId_GetConsumability(u16 itemId) +u8 GetItemConsumability(u16 itemId) { return !gItemsInfo[SanitizeItemId(itemId)].notConsumed; } -u8 ItemId_GetPocket(u16 itemId) +u8 GetItemPocket(u16 itemId) { return gItemsInfo[SanitizeItemId(itemId)].pocket; } -u8 ItemId_GetType(u16 itemId) +u8 GetItemType(u16 itemId) { return gItemsInfo[SanitizeItemId(itemId)].type; } -ItemUseFunc ItemId_GetFieldFunc(u16 itemId) +ItemUseFunc GetItemFieldFunc(u16 itemId) { return gItemsInfo[SanitizeItemId(itemId)].fieldUseFunc; } // Returns an item's battle effect script ID. -u8 ItemId_GetBattleUsage(u16 itemId) +u8 GetItemBattleUsage(u16 itemId) { u16 item = SanitizeItemId(itemId); // Handle E-Reader berries. @@ -970,12 +970,12 @@ u8 ItemId_GetBattleUsage(u16 itemId) return gItemsInfo[item].battleUsage; } -u32 ItemId_GetSecondaryId(u32 itemId) +u32 GetItemSecondaryId(u32 itemId) { return gItemsInfo[SanitizeItemId(itemId)].secondaryId; } -u32 ItemId_GetFlingPower(u32 itemId) +u32 GetItemFlingPower(u32 itemId) { return gItemsInfo[SanitizeItemId(itemId)].flingPower; } @@ -983,7 +983,7 @@ u32 ItemId_GetFlingPower(u32 itemId) u32 GetItemStatus1Mask(u16 itemId) { - const u8 *effect = ItemId_GetEffect(itemId); + const u8 *effect = GetItemEffect(itemId); switch (effect[3]) { case ITEM3_PARALYSIS: @@ -1004,7 +1004,7 @@ u32 GetItemStatus1Mask(u16 itemId) u32 GetItemStatus2Mask(u16 itemId) { - const u8 *effect = ItemId_GetEffect(itemId); + const u8 *effect = GetItemEffect(itemId); if (effect[3] & ITEM3_STATUS_ALL) return STATUS2_INFATUATION | STATUS2_CONFUSION; else if (effect[0] & ITEM0_INFATUATION) diff --git a/src/item_menu.c b/src/item_menu.c index bdb71804e7..59d5251a21 100755 --- a/src/item_menu.c +++ b/src/item_menu.c @@ -138,7 +138,7 @@ static void PrepareTMHMMoveWindow(void); static bool8 IsWallysBag(void); static void Task_WallyTutorialBagMenu(u8); static void Task_BagMenu_HandleInput(u8); -static void GetItemName(u8 *, u16); +static void GetItemNameFromPocket(u8 *, u16); static void PrintItemDescription(int); static void BagMenu_PrintCursorAtPos(u8, u8); static void BagMenu_Print(u8, u8, const u8 *, u8, u8, u8, u8, u8, u8); @@ -883,7 +883,7 @@ static void LoadBagItemListBuffers(u8 pocketId) { for (i = 0; i < gBagMenu->numItemStacks[pocketId] - 1; i++) { - GetItemName(sListBuffer2->name[i], pocket->itemSlots[i].itemId); + GetItemNameFromPocket(sListBuffer2->name[i], pocket->itemSlots[i].itemId); subBuffer = sListBuffer1->subBuffers; subBuffer[i].name = sListBuffer2->name[i]; subBuffer[i].id = i; @@ -897,7 +897,7 @@ static void LoadBagItemListBuffers(u8 pocketId) { for (i = 0; i < gBagMenu->numItemStacks[pocketId]; i++) { - GetItemName(sListBuffer2->name[i], pocket->itemSlots[i].itemId); + GetItemNameFromPocket(sListBuffer2->name[i], pocket->itemSlots[i].itemId); subBuffer = sListBuffer1->subBuffers; subBuffer[i].name = sListBuffer2->name[i]; subBuffer[i].id = i; @@ -909,7 +909,7 @@ static void LoadBagItemListBuffers(u8 pocketId) gMultiuseListMenuTemplate.maxShowed = gBagMenu->numShownItems[pocketId]; } -static void GetItemName(u8 *dest, u16 itemId) +static void GetItemNameFromPocket(u8 *dest, u16 itemId) { u8 *end; switch (gBagPosition.pocket) @@ -987,7 +987,7 @@ static void BagMenu_ItemPrintCallback(u8 windowId, u32 itemIndex, u8 y) if (itemId >= ITEM_HM01 && itemId <= ITEM_HM08) BlitBitmapToWindow(windowId, gBagMenuHMIcon_Gfx, 8, y - 1, 16, 16); - if (gBagPosition.pocket != KEYITEMS_POCKET && ItemId_GetImportance(itemId) == FALSE) + if (gBagPosition.pocket != KEYITEMS_POCKET && GetItemImportance(itemId) == FALSE) { // Print item quantity ConvertIntToDecimalStringN(gStringVar1, itemQuantity, STR_CONV_MODE_RIGHT_ALIGN, MAX_ITEM_DIGITS); @@ -1009,7 +1009,7 @@ static void PrintItemDescription(int itemIndex) const u8 *str; if (itemIndex != LIST_CANCEL) { - str = ItemId_GetDescription(BagGetItemIdByPocketPosition(gBagPosition.pocket + 1, itemIndex)); + str = GetItemDescription(BagGetItemIdByPocketPosition(gBagPosition.pocket + 1, itemIndex)); } else { @@ -1559,7 +1559,7 @@ static void OpenContextMenu(u8 taskId) { case ITEMMENULOCATION_BATTLE: case ITEMMENULOCATION_WALLY: - if (ItemId_GetBattleUsage(gSpecialVar_ItemId)) + if (GetItemBattleUsage(gSpecialVar_ItemId)) { gBagMenu->contextMenuItemsPtr = sContextMenuItems_BattleUse; gBagMenu->contextMenuNumItems = ARRAY_COUNT(sContextMenuItems_BattleUse); @@ -1575,7 +1575,7 @@ static void OpenContextMenu(u8 taskId) gBagMenu->contextMenuNumItems = ARRAY_COUNT(sContextMenuItems_BerryBlenderCrush); break; case ITEMMENULOCATION_APPRENTICE: - if (!ItemId_GetImportance(gSpecialVar_ItemId) && gSpecialVar_ItemId != ITEM_ENIGMA_BERRY_E_READER) + if (!GetItemImportance(gSpecialVar_ItemId) && gSpecialVar_ItemId != ITEM_ENIGMA_BERRY_E_READER) { gBagMenu->contextMenuItemsPtr = sContextMenuItems_Apprentice; gBagMenu->contextMenuNumItems = ARRAY_COUNT(sContextMenuItems_Apprentice); @@ -1587,7 +1587,7 @@ static void OpenContextMenu(u8 taskId) } break; case ITEMMENULOCATION_FAVOR_LADY: - if (!ItemId_GetImportance(gSpecialVar_ItemId) && gSpecialVar_ItemId != ITEM_ENIGMA_BERRY_E_READER) + if (!GetItemImportance(gSpecialVar_ItemId) && gSpecialVar_ItemId != ITEM_ENIGMA_BERRY_E_READER) { gBagMenu->contextMenuItemsPtr = sContextMenuItems_FavorLady; gBagMenu->contextMenuNumItems = ARRAY_COUNT(sContextMenuItems_FavorLady); @@ -1599,7 +1599,7 @@ static void OpenContextMenu(u8 taskId) } break; case ITEMMENULOCATION_QUIZ_LADY: - if (!ItemId_GetImportance(gSpecialVar_ItemId) && gSpecialVar_ItemId != ITEM_ENIGMA_BERRY_E_READER) + if (!GetItemImportance(gSpecialVar_ItemId) && gSpecialVar_ItemId != ITEM_ENIGMA_BERRY_E_READER) { gBagMenu->contextMenuItemsPtr = sContextMenuItems_QuizLady; gBagMenu->contextMenuNumItems = ARRAY_COUNT(sContextMenuItems_QuizLady); @@ -1813,10 +1813,10 @@ static void RemoveContextWindow(void) static void ItemMenu_UseOutOfBattle(u8 taskId) { - if (ItemId_GetFieldFunc(gSpecialVar_ItemId)) + if (GetItemFieldFunc(gSpecialVar_ItemId)) { RemoveContextWindow(); - if (CalculatePlayerPartyCount() == 0 && ItemId_GetType(gSpecialVar_ItemId) == ITEM_USE_PARTY_MENU) + if (CalculatePlayerPartyCount() == 0 && GetItemType(gSpecialVar_ItemId) == ITEM_USE_PARTY_MENU) { PrintThereIsNoPokemon(taskId); } @@ -1825,7 +1825,7 @@ static void ItemMenu_UseOutOfBattle(u8 taskId) FillWindowPixelBuffer(WIN_DESCRIPTION, PIXEL_FILL(0)); ScheduleBgCopyTilemapToVram(0); if (gBagPosition.pocket != BERRIES_POCKET) - ItemId_GetFieldFunc(gSpecialVar_ItemId)(taskId); + GetItemFieldFunc(gSpecialVar_ItemId)(taskId); else ItemUseOutOfBattle_Berry(taskId); } @@ -1957,7 +1957,7 @@ static void ItemMenu_Give(u8 taskId) { DisplayItemMessage(taskId, FONT_NORMAL, gText_CantWriteMail, HandleErrorMessage); } - else if (!ItemId_GetImportance(gSpecialVar_ItemId)) + else if (!GetItemImportance(gSpecialVar_ItemId)) { if (CalculatePlayerPartyCount() == 0) { @@ -2017,8 +2017,8 @@ static void ItemMenu_Cancel(u8 taskId) static void ItemMenu_UseInBattle(u8 taskId) { // Safety check - u16 type = ItemId_GetType(gSpecialVar_ItemId); - if (!ItemId_GetBattleUsage(gSpecialVar_ItemId)) + u16 type = GetItemType(gSpecialVar_ItemId); + if (!GetItemBattleUsage(gSpecialVar_ItemId)) return; RemoveContextWindow(); @@ -2047,7 +2047,7 @@ static void Task_ItemContext_GiveToParty(u8 taskId) StringExpandPlaceholders(gStringVar4, sText_Var1CantBeHeldHere); DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, HandleErrorMessage); } - else if (gBagPosition.pocket != KEYITEMS_POCKET && !ItemId_GetImportance(gSpecialVar_ItemId)) + else if (gBagPosition.pocket != KEYITEMS_POCKET && !GetItemImportance(gSpecialVar_ItemId)) { Task_FadeAndCloseBagMenu(taskId); } @@ -2062,7 +2062,7 @@ static void Task_ItemContext_GiveToPC(u8 taskId) { if (ItemIsMail(gSpecialVar_ItemId) == TRUE) DisplayItemMessage(taskId, FONT_NORMAL, gText_CantWriteMail, HandleErrorMessage); - else if (gBagPosition.pocket != KEYITEMS_POCKET && !ItemId_GetImportance(gSpecialVar_ItemId)) + else if (gBagPosition.pocket != KEYITEMS_POCKET && !GetItemImportance(gSpecialVar_ItemId)) gTasks[taskId].func = Task_FadeAndCloseBagMenu; else PrintItemCantBeHeld(taskId); @@ -2087,7 +2087,7 @@ bool8 UseRegisteredKeyItemOnField(void) PlayerFreeze(); StopPlayerAvatar(); gSpecialVar_ItemId = gSaveBlock1Ptr->registeredItem; - taskId = CreateTask(ItemId_GetFieldFunc(gSaveBlock1Ptr->registeredItem), 8); + taskId = CreateTask(GetItemFieldFunc(gSaveBlock1Ptr->registeredItem), 8); gTasks[taskId].tUsingRegisteredKeyItem = TRUE; return TRUE; } @@ -2106,7 +2106,7 @@ static void Task_ItemContext_Sell(u8 taskId) { s16 *data = gTasks[taskId].data; - if (ItemId_GetPrice(gSpecialVar_ItemId) == 0 || ItemId_GetImportance(gSpecialVar_ItemId)) + if (GetItemPrice(gSpecialVar_ItemId) == 0 || GetItemImportance(gSpecialVar_ItemId)) { CopyItemName(gSpecialVar_ItemId, gStringVar2); StringExpandPlaceholders(gStringVar4, gText_CantBuyKeyItem); @@ -2135,7 +2135,7 @@ static void DisplaySellItemPriceAndConfirm(u8 taskId) { s16 *data = gTasks[taskId].data; - ConvertIntToDecimalStringN(gStringVar1, (ItemId_GetPrice(gSpecialVar_ItemId) / ITEM_SELL_FACTOR) * tItemCount, STR_CONV_MODE_LEFT_ALIGN, MAX_MONEY_DIGITS); + ConvertIntToDecimalStringN(gStringVar1, (GetItemPrice(gSpecialVar_ItemId) / ITEM_SELL_FACTOR) * tItemCount, STR_CONV_MODE_LEFT_ALIGN, MAX_MONEY_DIGITS); StringExpandPlaceholders(gStringVar4, gText_ICanPayVar1); DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, AskSellItems); } @@ -2160,7 +2160,7 @@ static void InitSellHowManyInput(u8 taskId) s16 *data = gTasks[taskId].data; u8 windowId = BagMenu_AddWindow(ITEMWIN_QUANTITY_WIDE); - PrintItemSoldAmount(windowId, 1, (ItemId_GetPrice(gSpecialVar_ItemId) / ITEM_SELL_FACTOR) * tItemCount); + PrintItemSoldAmount(windowId, 1, (GetItemPrice(gSpecialVar_ItemId) / ITEM_SELL_FACTOR) * tItemCount); DisplayCurrentMoneyWindow(); gTasks[taskId].func = Task_ChooseHowManyToSell; } @@ -2171,7 +2171,7 @@ static void Task_ChooseHowManyToSell(u8 taskId) if (AdjustQuantityAccordingToDPadInput(&tItemCount, tQuantity) == TRUE) { - PrintItemSoldAmount(gBagMenu->windowIds[ITEMWIN_QUANTITY_WIDE], tItemCount, (ItemId_GetPrice(gSpecialVar_ItemId) / ITEM_SELL_FACTOR) * tItemCount); + PrintItemSoldAmount(gBagMenu->windowIds[ITEMWIN_QUANTITY_WIDE], tItemCount, (GetItemPrice(gSpecialVar_ItemId) / ITEM_SELL_FACTOR) * tItemCount); } else if (JOY_NEW(A_BUTTON)) { @@ -2195,7 +2195,7 @@ static void ConfirmSell(u8 taskId) s16 *data = gTasks[taskId].data; CopyItemName(gSpecialVar_ItemId, gStringVar2); - ConvertIntToDecimalStringN(gStringVar1, (ItemId_GetPrice(gSpecialVar_ItemId) / ITEM_SELL_FACTOR) * tItemCount, STR_CONV_MODE_LEFT_ALIGN, MAX_MONEY_DIGITS); + ConvertIntToDecimalStringN(gStringVar1, (GetItemPrice(gSpecialVar_ItemId) / ITEM_SELL_FACTOR) * tItemCount, STR_CONV_MODE_LEFT_ALIGN, MAX_MONEY_DIGITS); StringExpandPlaceholders(gStringVar4, gText_TurnedOverVar1ForVar2); DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, SellItem); } @@ -2208,7 +2208,7 @@ static void SellItem(u8 taskId) PlaySE(SE_SHOP); RemoveBagItem(gSpecialVar_ItemId, tItemCount); - AddMoney(&gSaveBlock1Ptr->money, (ItemId_GetPrice(gSpecialVar_ItemId) / ITEM_SELL_FACTOR) * tItemCount); + AddMoney(&gSaveBlock1Ptr->money, (GetItemPrice(gSpecialVar_ItemId) / ITEM_SELL_FACTOR) * tItemCount); DestroyListMenuTask(tListTaskId, scrollPos, cursorPos); UpdatePocketItemList(gBagPosition.pocket); UpdatePocketListPosition(gBagPosition.pocket); @@ -2279,7 +2279,7 @@ static void TryDepositItem(u8 taskId) s16 *data = gTasks[taskId].data; FillWindowPixelBuffer(WIN_DESCRIPTION, PIXEL_FILL(0)); - if (ItemId_GetImportance(gSpecialVar_ItemId)) + if (GetItemImportance(gSpecialVar_ItemId)) { // Can't deposit important items BagMenu_Print(WIN_DESCRIPTION, FONT_NORMAL, sText_CantStoreImportantItems, 3, 1, 0, 0, 0, COLORID_NORMAL); @@ -2591,7 +2591,7 @@ static void PrepareTMHMMoveWindow(void) static void PrintTMHMMoveData(u16 itemId) { u8 i; - u16 moveId; + u16 move; const u8 *text; FillWindowPixelBuffer(WIN_TMHM_INFO, PIXEL_FILL(0)); @@ -2603,11 +2603,11 @@ static void PrintTMHMMoveData(u16 itemId) } else { - moveId = ItemIdToBattleMoveId(itemId); - BlitMenuInfoIcon(WIN_TMHM_INFO, GetMoveType(moveId) + 1, 0, 0); + move = ItemIdToBattleMoveId(itemId); + BlitMenuInfoIcon(WIN_TMHM_INFO, GetMoveType(move) + 1, 0, 0); // Print TMHM power - u32 power = GetMovePower(moveId); + u32 power = GetMovePower(move); if (power <= 1) { text = gText_ThreeDashes; @@ -2619,7 +2619,7 @@ static void PrintTMHMMoveData(u16 itemId) } BagMenu_Print(WIN_TMHM_INFO, FONT_NORMAL, text, 7, 12, 0, 0, TEXT_SKIP_DRAW, COLORID_TMHM_INFO); - u32 accuracy = GetMoveAccuracy(moveId); + u32 accuracy = GetMoveAccuracy(move); // Print TMHM accuracy if (accuracy == 0) { @@ -2633,7 +2633,7 @@ static void PrintTMHMMoveData(u16 itemId) BagMenu_Print(WIN_TMHM_INFO, FONT_NORMAL, text, 7, 24, 0, 0, TEXT_SKIP_DRAW, COLORID_TMHM_INFO); // Print TMHM pp - ConvertIntToDecimalStringN(gStringVar1, GetMovePP(moveId), STR_CONV_MODE_RIGHT_ALIGN, 3); + ConvertIntToDecimalStringN(gStringVar1, GetMovePP(move), STR_CONV_MODE_RIGHT_ALIGN, 3); BagMenu_Print(WIN_TMHM_INFO, FONT_NORMAL, gStringVar1, 7, 36, 0, 0, TEXT_SKIP_DRAW, COLORID_TMHM_INFO); CopyWindowToVram(WIN_TMHM_INFO, COPYWIN_GFX); diff --git a/src/item_use.c b/src/item_use.c index 0c728b928d..033311cfa3 100644 --- a/src/item_use.c +++ b/src/item_use.c @@ -126,7 +126,7 @@ static void SetUpItemUseCallback(u8 taskId) if (gSpecialVar_ItemId == ITEM_ENIGMA_BERRY_E_READER) type = gTasks[taskId].tEnigmaBerryType - 1; else - type = ItemId_GetType(gSpecialVar_ItemId) - 1; + type = GetItemType(gSpecialVar_ItemId) - 1; if (!InBattlePyramid()) { gBagMenu->newScreenCallback = sItemUseCallbacks[type]; @@ -200,9 +200,9 @@ static void Task_CloseCantUseKeyItemMessage(u8 taskId) u8 CheckIfItemIsTMHMOrEvolutionStone(u16 itemId) { - if (ItemId_GetFieldFunc(itemId) == ItemUseOutOfBattle_TMHM) + if (GetItemFieldFunc(itemId) == ItemUseOutOfBattle_TMHM) return 1; - else if (ItemId_GetFieldFunc(itemId) == ItemUseOutOfBattle_EvolutionStone) + else if (GetItemFieldFunc(itemId) == ItemUseOutOfBattle_EvolutionStone) return 2; else return 0; @@ -277,7 +277,7 @@ void ItemUseOutOfBattle_Bike(u8 taskId) static void ItemUseOnFieldCB_Bike(u8 taskId) { - if (ItemId_GetSecondaryId(gSpecialVar_ItemId) == MACH_BIKE) + if (GetItemSecondaryId(gSpecialVar_ItemId) == MACH_BIKE) GetOnOffBike(PLAYER_AVATAR_FLAG_MACH_BIKE); else // ACRO_BIKE GetOnOffBike(PLAYER_AVATAR_FLAG_ACRO_BIKE); @@ -331,7 +331,7 @@ void ItemUseOutOfBattle_Rod(u8 taskId) static void ItemUseOnFieldCB_Rod(u8 taskId) { - StartFishing(ItemId_GetSecondaryId(gSpecialVar_ItemId)); + StartFishing(GetItemSecondaryId(gSpecialVar_ItemId)); DestroyTask(taskId); } @@ -756,7 +756,7 @@ void ItemUseOutOfBattle_Berry(u8 taskId) } else { - ItemId_GetFieldFunc(gSpecialVar_ItemId)(taskId); + GetItemFieldFunc(gSpecialVar_ItemId)(taskId); } } @@ -922,8 +922,8 @@ static void RemoveUsedItem(void) StringExpandPlaceholders(gStringVar4, gText_PlayerUsedVar2); if (!InBattlePyramid()) { - UpdatePocketItemList(ItemId_GetPocket(gSpecialVar_ItemId)); - UpdatePocketListPosition(ItemId_GetPocket(gSpecialVar_ItemId)); + UpdatePocketItemList(GetItemPocket(gSpecialVar_ItemId)); + UpdatePocketListPosition(GetItemPocket(gSpecialVar_ItemId)); } else { @@ -958,7 +958,7 @@ static void Task_UseRepel(u8 taskId) { if (!IsSEPlaying()) { - VarSet(VAR_REPEL_STEP_COUNT, ItemId_GetHoldEffectParam(gSpecialVar_ItemId)); + VarSet(VAR_REPEL_STEP_COUNT, GetItemHoldEffectParam(gSpecialVar_ItemId)); #if VAR_LAST_REPEL_LURE_USED != 0 VarSet(VAR_LAST_REPEL_LURE_USED, gSpecialVar_ItemId); #endif @@ -972,7 +972,7 @@ static void Task_UseRepel(u8 taskId) void HandleUseExpiredRepel(struct ScriptContext *ctx) { #if VAR_LAST_REPEL_LURE_USED != 0 - VarSet(VAR_REPEL_STEP_COUNT, ItemId_GetHoldEffectParam(VarGet(VAR_LAST_REPEL_LURE_USED))); + VarSet(VAR_REPEL_STEP_COUNT, GetItemHoldEffectParam(VarGet(VAR_LAST_REPEL_LURE_USED))); #endif } @@ -1002,7 +1002,7 @@ static void Task_UseLure(u8 taskId) { if (!IsSEPlaying()) { - VarSet(VAR_REPEL_STEP_COUNT, ItemId_GetHoldEffectParam(gSpecialVar_ItemId) | REPEL_LURE_MASK); + VarSet(VAR_REPEL_STEP_COUNT, GetItemHoldEffectParam(gSpecialVar_ItemId) | REPEL_LURE_MASK); #if VAR_LAST_REPEL_LURE_USED != 0 VarSet(VAR_LAST_REPEL_LURE_USED, gSpecialVar_ItemId); #endif @@ -1017,7 +1017,7 @@ static void Task_UseLure(u8 taskId) void HandleUseExpiredLure(struct ScriptContext *ctx) { #if VAR_LAST_REPEL_LURE_USED != 0 - VarSet(VAR_REPEL_STEP_COUNT, ItemId_GetHoldEffectParam(VarGet(VAR_LAST_REPEL_LURE_USED)) | REPEL_LURE_MASK); + VarSet(VAR_REPEL_STEP_COUNT, GetItemHoldEffectParam(VarGet(VAR_LAST_REPEL_LURE_USED)) | REPEL_LURE_MASK); #endif } @@ -1198,7 +1198,7 @@ static bool32 SelectedMonHasStatus2(u16 itemId) // Returns whether an item can be used in battle and sets the fail text. bool32 CannotUseItemsInBattle(u16 itemId, struct Pokemon *mon) { - u16 battleUsage = ItemId_GetBattleUsage(itemId); + u16 battleUsage = GetItemBattleUsage(itemId); bool8 cannotUse = FALSE; const u8* failStr = NULL; u32 i; @@ -1215,7 +1215,7 @@ bool32 CannotUseItemsInBattle(u16 itemId, struct Pokemon *mon) switch (battleUsage) { case EFFECT_ITEM_INCREASE_STAT: - if (gBattleMons[gBattlerInMenuId].statStages[ItemId_GetEffect(itemId)[1]] == MAX_STAT_STAGE) + if (gBattleMons[gBattlerInMenuId].statStages[GetItemEffect(itemId)[1]] == MAX_STAT_STAGE) cannotUse = TRUE; break; case EFFECT_ITEM_SET_FOCUS_ENERGY: @@ -1281,7 +1281,7 @@ bool32 CannotUseItemsInBattle(u16 itemId, struct Pokemon *mon) cannotUse = TRUE; break; case EFFECT_ITEM_RESTORE_PP: - if (ItemId_GetEffect(itemId)[4] == ITEM4_HEAL_PP) + if (GetItemEffect(itemId)[4] == ITEM4_HEAL_PP) { for (i = 0; i < MAX_MON_MOVES; i++) { @@ -1318,7 +1318,7 @@ void ItemUseInBattle_BagMenu(u8 taskId) else { PlaySE(SE_SELECT); - if (!ItemId_GetImportance(gSpecialVar_ItemId) && !(B_TRY_CATCH_TRAINER_BALL >= GEN_4 && (ItemId_GetBattleUsage(gSpecialVar_ItemId) == EFFECT_ITEM_THROW_BALL) && (gBattleTypeFlags & BATTLE_TYPE_TRAINER))) + if (!GetItemImportance(gSpecialVar_ItemId) && !(B_TRY_CATCH_TRAINER_BALL >= GEN_4 && (GetItemBattleUsage(gSpecialVar_ItemId) == EFFECT_ITEM_THROW_BALL) && (gBattleTypeFlags & BATTLE_TYPE_TRAINER))) RemoveUsedItem(); ScheduleBgCopyTilemapToVram(2); if (!InBattlePyramid()) diff --git a/src/libisagbprn.c b/src/libisagbprn.c index 6724059ff8..0cf51a18d5 100644 --- a/src/libisagbprn.c +++ b/src/libisagbprn.c @@ -224,7 +224,7 @@ void MgbaClose(void) *REG_DEBUG_ENABLE = 0; } -void MgbaPrintf(s32 level, const char* ptr, ...) +void MgbaPrintf(s32 level, const char *ptr, ...) { va_list args; diff --git a/src/librfu_intr.c b/src/librfu_intr.c index ab4392e229..5ae53ab4e3 100644 --- a/src/librfu_intr.c +++ b/src/librfu_intr.c @@ -7,7 +7,11 @@ static u16 handshake_wait(u16 slot); static void STWI_set_timer_in_RAM(u8 count); static void STWI_stop_timer_in_RAM(void); static void STWI_init_slave(void); +#if __STDC_VERSION__ < 202311L static void Callback_Dummy_M(int reqCommandId, int error, void (*callbackM)()); +#else +static void Callback_Dummy_M(int reqCommandId, int error, void (*callbackM)(...)); +#endif static void Callback_Dummy_S(u16 reqCommandId, void (*callbackS)(u16)); static void Callback_Dummy_ID(void (*callbackId)(void)); @@ -135,7 +139,11 @@ static void sio32intr_clock_master(void) } gSTWIStatus->sending = 0; if (gSTWIStatus->callbackM != NULL) +#if __STDC_VERSION__ < 202311L Callback_Dummy_M(gSTWIStatus->reqActiveCommand, gSTWIStatus->error, gSTWIStatus->callbackM); +#else + Callback_Dummy_M(gSTWIStatus->reqActiveCommand, gSTWIStatus->error, (void (*)(...))gSTWIStatus->callbackM); +#endif } else { @@ -388,7 +396,11 @@ static void STWI_init_slave(void) } NAKED +#if __STDC_VERSION__ < 202311L static void Callback_Dummy_M(int reqCommandId, int error, void (*callbackM)()) +#else +static void Callback_Dummy_M(int reqCommandId, int error, void (*callbackM)(...)) +#endif { asm("bx r2"); } diff --git a/src/lilycove_lady.c b/src/lilycove_lady.c index 1c0ba16302..d9ee092409 100644 --- a/src/lilycove_lady.c +++ b/src/lilycove_lady.c @@ -192,7 +192,7 @@ bool8 HasAnotherPlayerGivenFavorLadyItem(void) static void BufferItemName(u8 *dest, u16 itemId) { - StringCopy(dest, ItemId_GetName(itemId)); + StringCopy(dest, GetItemName(itemId)); } void BufferFavorLadyItemName(void) @@ -451,7 +451,7 @@ static u8 GetPlayerNameLength(const u8 *playerName) void BufferQuizPrizeName(void) { - StringCopy(gStringVar1, ItemId_GetName(sQuizLadyPtr->prize)); + StringCopy(gStringVar1, GetItemName(sQuizLadyPtr->prize)); } bool8 BufferQuizAuthorNameAndCheckIfLady(void) diff --git a/src/load_save.c b/src/load_save.c index 9c94808536..97b81e61dc 100644 --- a/src/load_save.c +++ b/src/load_save.c @@ -78,7 +78,7 @@ void ClearSav1(void) // Offset is the sum of the trainer id bytes void SetSaveBlocksPointers(u16 offset) { - struct SaveBlock1** sav1_LocalVar = &gSaveBlock1Ptr; + struct SaveBlock1 **sav1_LocalVar = &gSaveBlock1Ptr; offset = (offset + Random()) & (SAVEBLOCK_MOVE_RANGE - 4); diff --git a/src/m4a.c b/src/m4a.c index 493577cc23..24f9f3e16c 100644 --- a/src/m4a.c +++ b/src/m4a.c @@ -1,4 +1,4 @@ -#include +#include "global.h" #include "gba/m4a_internal.h" #include "global.h" @@ -280,6 +280,7 @@ void MPlayExtender(struct CgbChannel *cgbChans) soundInfo->ident++; +#if __STDC_VERSION__ < 202311L gMPlayJumpTable[8] = ply_memacc; gMPlayJumpTable[17] = ply_lfos; gMPlayJumpTable[19] = ply_mod; @@ -289,6 +290,17 @@ void MPlayExtender(struct CgbChannel *cgbChans) gMPlayJumpTable[31] = TrackStop; gMPlayJumpTable[32] = FadeOutBody; gMPlayJumpTable[33] = TrkVolPitSet; +#else + gMPlayJumpTable[8] = (void (*)(...))ply_memacc; + gMPlayJumpTable[17] = (void (*)(...))ply_lfos; + gMPlayJumpTable[19] = (void (*)(...))ply_mod; + gMPlayJumpTable[28] = (void (*)(...))ply_xcmd; + gMPlayJumpTable[29] = (void (*)(...))ply_endtie; + gMPlayJumpTable[30] = (void (*)(...))SampleFreqSet; + gMPlayJumpTable[31] = (void (*)(...))TrackStop; + gMPlayJumpTable[32] = (void (*)(...))FadeOutBody; + gMPlayJumpTable[33] = (void (*)(...))TrkVolPitSet; +#endif soundInfo->cgbChans = cgbChans; soundInfo->CgbSound = CgbSound; @@ -317,13 +329,21 @@ void MusicPlayerJumpTableCopy(void) void ClearChain(void *x) { +#if __STDC_VERSION__ < 202311L void (*func)(void *) = *(&gMPlayJumpTable[34]); +#else + void (*func)(...) = *(&gMPlayJumpTable[34]); +#endif func(x); } void Clear64byte(void *x) { +#if __STDC_VERSION__ < 202311L void (*func)(void *) = *(&gMPlayJumpTable[35]); +#else + void (*func)(...) = *(&gMPlayJumpTable[35]); +#endif func(x); } diff --git a/src/m4a_tables.c b/src/m4a_tables.c index 4d012cea28..6fb3b273a3 100644 --- a/src/m4a_tables.c +++ b/src/m4a_tables.c @@ -3,7 +3,7 @@ // Some of these functions have different signatures, so we need to make this // an array of void pointers or a struct. It's simpler to just make it an array // for now. -void * const gMPlayJumpTableTemplate[] = +void *const gMPlayJumpTableTemplate[] = { ply_fine, ply_goto, diff --git a/src/main.c b/src/main.c index c27d56bacd..3fd080c75b 100644 --- a/src/main.c +++ b/src/main.c @@ -89,7 +89,7 @@ void EnableVCountIntrAtLine150(void); #define B_START_SELECT (B_BUTTON | START_BUTTON | SELECT_BUTTON) -void AgbMain() +void AgbMain(void) { *(vu16 *)BG_PLTT = RGB_WHITE; // Set the backdrop to white on startup InitGpuRegManager(); diff --git a/src/main_menu.c b/src/main_menu.c index a3ff520de4..d58b741afb 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -237,7 +237,7 @@ static void SpriteCB_MovePlayerDownWhileShrinking(struct Sprite *); static void Task_NewGameBirchSpeech_WaitForPlayerShrink(u8); static void Task_NewGameBirchSpeech_FadePlayerToWhite(u8); static void Task_NewGameBirchSpeech_Cleanup(u8); -static void SpriteCB_Null(); +static void SpriteCB_Null(struct Sprite *); static void Task_NewGameBirchSpeech_ReturnFromNamingScreenShowTextbox(u8); static void MainMenu_FormatSavegamePlayer(void); static void MainMenu_FormatSavegamePokedex(void); diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c index 1871cf971f..d193b035b4 100644 --- a/src/mauville_old_man.c +++ b/src/mauville_old_man.c @@ -34,7 +34,7 @@ static u8 sSelectedStory; COMMON_DATA struct BardSong gBardSong = {0}; static EWRAM_DATA u16 sUnusedPitchTableIndex = 0; -static EWRAM_DATA struct MauvilleManStoryteller * sStorytellerPtr = NULL; +static EWRAM_DATA struct MauvilleManStoryteller *sStorytellerPtr = NULL; static EWRAM_DATA u8 sStorytellerWindowId = 0; static const u16 sDefaultBardSongLyrics[NUM_BARD_SONG_WORDS] = { @@ -176,7 +176,7 @@ void SaveBardSongLyrics(void) static void PrepareSongText(void) { struct MauvilleManBard *bard = &gSaveBlock1Ptr->oldMan.bard; - u16 * lyrics = !gSpecialVar_0x8004 ? bard->songLyrics : bard->newSongLyrics; + u16 *lyrics = !gSpecialVar_0x8004 ? bard->songLyrics : bard->newSongLyrics; u8 *wordEnd = gStringVar4; u8 *str = wordEnd; u16 paragraphNum; @@ -450,7 +450,7 @@ static void EnableTextPrinters(void) gDisableTextPrinters = FALSE; } -static void DisableTextPrinters(struct TextPrinterTemplate * printer, u16 renderCmd) +static void DisableTextPrinters(struct TextPrinterTemplate *printer, u16 renderCmd) { gDisableTextPrinters = TRUE; } @@ -746,7 +746,7 @@ void SetMauvilleOldManObjEventGfx(void) // Language fixers? -void SanitizeMauvilleOldManForRuby(union OldMan * oldMan) +void SanitizeMauvilleOldManForRuby(union OldMan *oldMan) { s32 i; u8 playerName[PLAYER_NAME_LENGTH + 1]; @@ -755,7 +755,7 @@ void SanitizeMauvilleOldManForRuby(union OldMan * oldMan) { case MAUVILLE_MAN_TRADER: { - struct MauvilleOldManTrader * trader = &oldMan->trader; + struct MauvilleOldManTrader *trader = &oldMan->trader; for (i = 0; i < NUM_TRADER_ITEMS; i++) { if (trader->language[i] == LANGUAGE_JAPANESE) @@ -765,7 +765,7 @@ void SanitizeMauvilleOldManForRuby(union OldMan * oldMan) } case MAUVILLE_MAN_STORYTELLER: { - struct MauvilleManStoryteller * storyteller = &oldMan->storyteller; + struct MauvilleManStoryteller *storyteller = &oldMan->storyteller; for (i = 0; i < NUM_STORYTELLER_TALES; i++) { if (storyteller->gameStatIDs[i] != 0) @@ -786,7 +786,7 @@ void SanitizeMauvilleOldManForRuby(union OldMan * oldMan) } } -static void UNUSED SetMauvilleOldManLanguage(union OldMan * oldMan, u32 language1, u32 language2, u32 language3) +static void UNUSED SetMauvilleOldManLanguage(union OldMan *oldMan, u32 language1, u32 language2, u32 language3) { s32 i; @@ -794,7 +794,7 @@ static void UNUSED SetMauvilleOldManLanguage(union OldMan * oldMan, u32 language { case MAUVILLE_MAN_TRADER: { - struct MauvilleOldManTrader * trader = &oldMan->trader; + struct MauvilleOldManTrader *trader = &oldMan->trader; for (i = 0; i < NUM_TRADER_ITEMS; i++) { @@ -807,7 +807,7 @@ static void UNUSED SetMauvilleOldManLanguage(union OldMan * oldMan, u32 language break; case MAUVILLE_MAN_STORYTELLER: { - struct MauvilleManStoryteller * storyteller = &oldMan->storyteller; + struct MauvilleManStoryteller *storyteller = &oldMan->storyteller; for (i = 0; i < NUM_STORYTELLER_TALES; i++) { @@ -820,7 +820,7 @@ static void UNUSED SetMauvilleOldManLanguage(union OldMan * oldMan, u32 language break; case MAUVILLE_MAN_BARD: { - struct MauvilleManBard * bard = &oldMan->bard; + struct MauvilleManBard *bard = &oldMan->bard; if (language3 == LANGUAGE_JAPANESE) bard->language = language1; @@ -830,7 +830,7 @@ static void UNUSED SetMauvilleOldManLanguage(union OldMan * oldMan, u32 language break; case MAUVILLE_MAN_HIPSTER: { - struct MauvilleManHipster * hipster = &oldMan->hipster; + struct MauvilleManHipster *hipster = &oldMan->hipster; if (language3 == LANGUAGE_JAPANESE) hipster->language = language1; @@ -840,7 +840,7 @@ static void UNUSED SetMauvilleOldManLanguage(union OldMan * oldMan, u32 language break; case MAUVILLE_MAN_GIDDY: { - struct MauvilleManGiddy * giddy = &oldMan->giddy; + struct MauvilleManGiddy *giddy = &oldMan->giddy; if (language3 == LANGUAGE_JAPANESE) giddy->language = language1; @@ -851,13 +851,13 @@ static void UNUSED SetMauvilleOldManLanguage(union OldMan * oldMan, u32 language } } -void SanitizeReceivedEmeraldOldMan(union OldMan * oldMan, u32 version, u32 language) +void SanitizeReceivedEmeraldOldMan(union OldMan *oldMan, u32 version, u32 language) { u8 playerName[PLAYER_NAME_LENGTH + 1]; s32 i; if (oldMan->common.id == MAUVILLE_MAN_STORYTELLER && language == LANGUAGE_JAPANESE) { - struct MauvilleManStoryteller * storyteller = &oldMan->storyteller; + struct MauvilleManStoryteller *storyteller = &oldMan->storyteller; for (i = 0; i < NUM_STORYTELLER_TALES; i++) { @@ -874,7 +874,7 @@ void SanitizeReceivedEmeraldOldMan(union OldMan * oldMan, u32 version, u32 langu } } -void SanitizeReceivedRubyOldMan(union OldMan * oldMan, u32 version, u32 language) +void SanitizeReceivedRubyOldMan(union OldMan *oldMan, u32 version, u32 language) { bool32 isRuby = (version == VERSION_SAPPHIRE || version == VERSION_RUBY); @@ -882,7 +882,7 @@ void SanitizeReceivedRubyOldMan(union OldMan * oldMan, u32 version, u32 language { case MAUVILLE_MAN_TRADER: { - struct MauvilleOldManTrader * trader = &oldMan->trader; + struct MauvilleOldManTrader *trader = &oldMan->trader; s32 i; if (isRuby) @@ -916,7 +916,7 @@ void SanitizeReceivedRubyOldMan(union OldMan * oldMan, u32 version, u32 language case MAUVILLE_MAN_STORYTELLER: { - struct MauvilleManStoryteller * storyteller = &oldMan->storyteller; + struct MauvilleManStoryteller *storyteller = &oldMan->storyteller; s32 i; if (isRuby) @@ -931,7 +931,7 @@ void SanitizeReceivedRubyOldMan(union OldMan * oldMan, u32 version, u32 language break; case MAUVILLE_MAN_BARD: { - struct MauvilleManBard * bard = &oldMan->bard; + struct MauvilleManBard *bard = &oldMan->bard; if (isRuby) { @@ -941,7 +941,7 @@ void SanitizeReceivedRubyOldMan(union OldMan * oldMan, u32 version, u32 language break; case MAUVILLE_MAN_HIPSTER: { - struct MauvilleManHipster * hipster = &oldMan->hipster; + struct MauvilleManHipster *hipster = &oldMan->hipster; if (isRuby) { @@ -951,7 +951,7 @@ void SanitizeReceivedRubyOldMan(union OldMan * oldMan, u32 version, u32 language break; case MAUVILLE_MAN_GIDDY: { - struct MauvilleManGiddy * giddy = &oldMan->giddy; + struct MauvilleManGiddy *giddy = &oldMan->giddy; if (isRuby) { diff --git a/src/menu_specialized.c b/src/menu_specialized.c index 7b6d94b5f2..194f523334 100644 --- a/src/menu_specialized.c +++ b/src/menu_specialized.c @@ -1192,7 +1192,7 @@ void LoadConditionMonPicTemplate(struct SpriteSheet *sheet, struct SpriteTemplat *pal = dataPal; } -void LoadConditionSelectionIcons(struct SpriteSheet *sheets, struct SpriteTemplate * template, struct SpritePalette *pals) +void LoadConditionSelectionIcons(struct SpriteSheet *sheets, struct SpriteTemplate *template, struct SpritePalette *pals) { u8 i; diff --git a/src/metatile_behavior.c b/src/metatile_behavior.c index e432827f31..2d61e9a75a 100644 --- a/src/metatile_behavior.c +++ b/src/metatile_behavior.c @@ -328,7 +328,7 @@ bool8 MetatileBehavior_IsSouthArrowWarp(u8 metatileBehavior) return FALSE; } -bool8 Unref_MetatileBehavior_IsArrowWarp(u8 metatileBehavior) +bool8 UNUSED Unref_MetatileBehavior_IsArrowWarp(u8 metatileBehavior) { u8 isArrowWarp = FALSE; diff --git a/src/mini_printf.c b/src/mini_printf.c index c2e35354f1..ded744ce85 100644 --- a/src/mini_printf.c +++ b/src/mini_printf.c @@ -214,11 +214,11 @@ static s32 mini_itoa(s32 value, u32 radix, s32 uppercase, bool32 unsig, char *bu return len; } -static s32 mini_pad(char* ptr, s32 len, char pad_char, s32 pad_to, char *buffer) +static s32 mini_pad(char *ptr, s32 len, char pad_char, s32 pad_to, char *buffer) { s32 i; bool32 overflow = FALSE; - char * pbuffer = buffer; + char *pbuffer = buffer; if(pad_to == 0) pad_to = len; if (len > pad_to) @@ -260,7 +260,7 @@ s32 mini_vsnprintf(char *buffer, u32 buffer_len, const char *fmt, va_list va) return b.pbuffer - b.buffer; } -s32 mini_vpprintf(void* buf, const char *fmt, va_list va) +s32 mini_vpprintf(void *buf, const char *fmt, va_list va) { char bf[24]; char bf2[24]; diff --git a/src/move_relearner.c b/src/move_relearner.c index 7d3b61213c..6acfee0cb5 100644 --- a/src/move_relearner.c +++ b/src/move_relearner.c @@ -733,10 +733,10 @@ static void DoMoveRelearnerMain(void) } else { - u16 moveId = GetMonData(&gPlayerParty[sMoveRelearnerStruct->partyMon], MON_DATA_MOVE1 + sMoveRelearnerStruct->moveSlot); + u16 move = GetMonData(&gPlayerParty[sMoveRelearnerStruct->partyMon], MON_DATA_MOVE1 + sMoveRelearnerStruct->moveSlot); u8 originalPP = GetMonData(&gPlayerParty[sMoveRelearnerStruct->partyMon], MON_DATA_PP1 + sMoveRelearnerStruct->moveSlot); - StringCopy(gStringVar3, GetMoveName(moveId)); + StringCopy(gStringVar3, GetMoveName(move)); RemoveMonPPBonus(&gPlayerParty[sMoveRelearnerStruct->partyMon], sMoveRelearnerStruct->moveSlot); SetMonMoveSlot(&gPlayerParty[sMoveRelearnerStruct->partyMon], GetCurrentSelectedMove(), sMoveRelearnerStruct->moveSlot); u8 newPP = GetMonData(&gPlayerParty[sMoveRelearnerStruct->partyMon], MON_DATA_PP1 + sMoveRelearnerStruct->moveSlot); @@ -955,19 +955,19 @@ static void CreateLearnableMovesList(void) sMoveRelearnerStruct->numToShowAtOnce = LoadMoveRelearnerMovesList(sMoveRelearnerStruct->menuItems, sMoveRelearnerStruct->numMenuChoices); } -void MoveRelearnerShowHideHearts(s32 moveId) +void MoveRelearnerShowHideHearts(s32 move) { u16 numHearts; u16 i; - if (!sMoveRelearnerMenuSate.showContestInfo || moveId == LIST_CANCEL) + if (!sMoveRelearnerMenuSate.showContestInfo || move == LIST_CANCEL) { for (i = 0; i < 16; i++) gSprites[sMoveRelearnerStruct->heartSpriteIds[i]].invisible = TRUE; } else { - numHearts = (u8)(gContestEffects[GetMoveContestEffect(moveId)].appeal / 10); + numHearts = (u8)(gContestEffects[GetMoveContestEffect(move)].appeal / 10); if (numHearts == 0xFF) numHearts = 0; @@ -981,7 +981,7 @@ void MoveRelearnerShowHideHearts(s32 moveId) gSprites[sMoveRelearnerStruct->heartSpriteIds[i]].invisible = FALSE; } - numHearts = (u8)(gContestEffects[GetMoveContestEffect(moveId)].jam / 10); + numHearts = (u8)(gContestEffects[GetMoveContestEffect(move)].jam / 10); if (numHearts == 0xFF) numHearts = 0; diff --git a/src/mystery_gift_client.c b/src/mystery_gift_client.c index 3663df43d5..2d2ccec545 100644 --- a/src/mystery_gift_client.c +++ b/src/mystery_gift_client.c @@ -19,7 +19,7 @@ enum { FUNC_RUN_BUFFER, }; -EWRAM_DATA static struct MysteryGiftClient * sClient = NULL; +EWRAM_DATA static struct MysteryGiftClient *sClient = NULL; static void MysteryGiftClient_Init(struct MysteryGiftClient *, u32, u32); static u32 MysteryGiftClient_CallFunc(struct MysteryGiftClient *); @@ -34,7 +34,7 @@ void MysteryGiftClient_Create(bool32 isWonderNews) sClient->isWonderNews = isWonderNews; } -u32 MysteryGiftClient_Run(u16 * endVal) +u32 MysteryGiftClient_Run(u16 *endVal) { u32 result; if (sClient == NULL) @@ -64,7 +64,7 @@ void MysteryGiftClient_SetParam(u32 val) sClient->param = val; } -static void MysteryGiftClient_Init(struct MysteryGiftClient * client, u32 sendPlayerId, u32 recvPlayerId) +static void MysteryGiftClient_Init(struct MysteryGiftClient *client, u32 sendPlayerId, u32 recvPlayerId) { client->unused = 0; client->funcId = FUNC_INIT; @@ -76,7 +76,7 @@ static void MysteryGiftClient_Init(struct MysteryGiftClient * client, u32 sendPl MysteryGiftLink_Init(&client->link, sendPlayerId, recvPlayerId); } -static void MysteryGiftClient_Free(struct MysteryGiftClient * client) +static void MysteryGiftClient_Free(struct MysteryGiftClient *client) { Free(client->sendBuffer); Free(client->recvBuffer); @@ -84,20 +84,20 @@ static void MysteryGiftClient_Free(struct MysteryGiftClient * client) Free(client->msg); } -static void MysteryGiftClient_CopyRecvScript(struct MysteryGiftClient * client) +static void MysteryGiftClient_CopyRecvScript(struct MysteryGiftClient *client) { memcpy(client->script, client->recvBuffer, MG_LINK_BUFFER_SIZE); client->cmdidx = 0; } -static void MysteryGiftClient_InitSendWord(struct MysteryGiftClient * client, u32 ident, u32 word) +static void MysteryGiftClient_InitSendWord(struct MysteryGiftClient *client, u32 ident, u32 word) { CpuFill32(0, client->sendBuffer, MG_LINK_BUFFER_SIZE); *(u32 *)client->sendBuffer = word; MysteryGiftLink_InitSend(&client->link, ident, client->sendBuffer, sizeof(word)); } -static u32 Client_Init(struct MysteryGiftClient * client) +static u32 Client_Init(struct MysteryGiftClient *client) { memcpy(client->script, gMysteryGiftClientScript_Init, MG_LINK_BUFFER_SIZE); client->cmdidx = 0; @@ -106,13 +106,13 @@ static u32 Client_Init(struct MysteryGiftClient * client) return CLI_RET_INIT; } -static u32 Client_Done(struct MysteryGiftClient * client) +static u32 Client_Done(struct MysteryGiftClient *client) { return CLI_RET_END; } -static u32 Client_Recv(struct MysteryGiftClient * client) +static u32 Client_Recv(struct MysteryGiftClient *client) { if (MysteryGiftLink_Recv(&client->link)) { @@ -122,7 +122,7 @@ static u32 Client_Recv(struct MysteryGiftClient * client) return CLI_RET_ACTIVE; } -static u32 Client_Send(struct MysteryGiftClient * client) +static u32 Client_Send(struct MysteryGiftClient *client) { if (MysteryGiftLink_Send(&client->link)) { @@ -132,10 +132,10 @@ static u32 Client_Send(struct MysteryGiftClient * client) return CLI_RET_ACTIVE; } -static u32 Client_Run(struct MysteryGiftClient * client) +static u32 Client_Run(struct MysteryGiftClient *client) { // process command - struct MysteryGiftClientCmd * cmd = &client->script[client->cmdidx]; + struct MysteryGiftClientCmd *cmd = &client->script[client->cmdidx]; client->cmdidx++; switch (cmd->instr) { @@ -247,7 +247,7 @@ static u32 Client_Run(struct MysteryGiftClient * client) return CLI_RET_ACTIVE; } -static u32 Client_Wait(struct MysteryGiftClient * client) +static u32 Client_Wait(struct MysteryGiftClient *client) { if (client->funcState) { @@ -257,7 +257,7 @@ static u32 Client_Wait(struct MysteryGiftClient * client) return CLI_RET_ACTIVE; } -static u32 Client_RunMysteryEventScript(struct MysteryGiftClient * client) +static u32 Client_RunMysteryEventScript(struct MysteryGiftClient *client) { switch (client->funcState) { @@ -276,7 +276,7 @@ static u32 Client_RunMysteryEventScript(struct MysteryGiftClient * client) return CLI_RET_ACTIVE; } -static u32 Client_RunBufferScript(struct MysteryGiftClient * client) +static u32 Client_RunBufferScript(struct MysteryGiftClient *client) { // exec arbitrary code u32 (*func)(u32 *, struct SaveBlock2 *, struct SaveBlock1 *) = (void *)client->bufferScript; @@ -288,7 +288,7 @@ static u32 Client_RunBufferScript(struct MysteryGiftClient * client) return CLI_RET_ACTIVE; } -static u32 MysteryGiftClient_CallFunc(struct MysteryGiftClient * client) +static u32 MysteryGiftClient_CallFunc(struct MysteryGiftClient *client) { u32 (*funcs[])(struct MysteryGiftClient *) = { [FUNC_INIT] = Client_Init, diff --git a/src/mystery_gift_link.c b/src/mystery_gift_link.c index 55f4b78527..2e0031722d 100644 --- a/src/mystery_gift_link.c +++ b/src/mystery_gift_link.c @@ -26,17 +26,17 @@ struct SendRecvHeader static u32 MGL_Receive(struct MysteryGiftLink *); static u32 MGL_Send(struct MysteryGiftLink *); -u32 MysteryGiftLink_Recv(struct MysteryGiftLink * link) +u32 MysteryGiftLink_Recv(struct MysteryGiftLink *link) { return link->recvFunc(link); } -u32 MysteryGiftLink_Send(struct MysteryGiftLink * link) +u32 MysteryGiftLink_Send(struct MysteryGiftLink *link) { return link->sendFunc(link); } -void MysteryGiftLink_Init(struct MysteryGiftLink * link, u32 sendPlayerId, u32 recvPlayerId) +void MysteryGiftLink_Init(struct MysteryGiftLink *link, u32 sendPlayerId, u32 recvPlayerId) { link->sendPlayerId = sendPlayerId; link->recvPlayerId = recvPlayerId; @@ -53,7 +53,7 @@ void MysteryGiftLink_Init(struct MysteryGiftLink * link, u32 sendPlayerId, u32 r link->recvFunc = MGL_Receive; } -void MysteryGiftLink_InitSend(struct MysteryGiftLink * link, u32 ident, const void * src, u32 size) +void MysteryGiftLink_InitSend(struct MysteryGiftLink *link, u32 ident, const void *src, u32 size) { link->state = 0; link->sendIdent = ident; @@ -66,7 +66,7 @@ void MysteryGiftLink_InitSend(struct MysteryGiftLink * link, u32 ident, const vo link->sendBuffer = src; } -void MysteryGiftLink_InitRecv(struct MysteryGiftLink * link, u32 ident, void * dest) +void MysteryGiftLink_InitRecv(struct MysteryGiftLink *link, u32 ident, void *dest) { link->state = 0; link->recvIdent = ident; @@ -76,7 +76,7 @@ void MysteryGiftLink_InitRecv(struct MysteryGiftLink * link, u32 ident, void * d link->recvBuffer = dest; } -static void MGL_ReceiveBlock(u32 playerId, void * dest, size_t size) +static void MGL_ReceiveBlock(u32 playerId, void *dest, size_t size) { memcpy(dest, gBlockRecvBuffer[playerId], size); } @@ -94,7 +94,7 @@ static void MGL_ResetReceived(u32 playerId) ResetBlockReceivedFlag(playerId); } -static bool32 MGL_Receive(struct MysteryGiftLink * link) +static bool32 MGL_Receive(struct MysteryGiftLink *link) { struct SendRecvHeader header; @@ -159,7 +159,7 @@ static bool32 MGL_Receive(struct MysteryGiftLink * link) return FALSE; } -static bool32 MGL_Send(struct MysteryGiftLink * link) +static bool32 MGL_Send(struct MysteryGiftLink *link) { struct SendRecvHeader header; diff --git a/src/mystery_gift_menu.c b/src/mystery_gift_menu.c index 179be0d56b..8cbbbac3f9 100644 --- a/src/mystery_gift_menu.c +++ b/src/mystery_gift_menu.c @@ -631,7 +631,7 @@ static bool32 PrintStringAndWait2Seconds(u8 *counter, const u8 *str) } } -static u32 MysteryGift_HandleThreeOptionMenu(u8 *unused0, u16 * unused1, u8 whichMenu) +static u32 MysteryGift_HandleThreeOptionMenu(u8 *unused0, u16 *unused1, u8 whichMenu) { struct ListMenuTemplate listMenuTemplate = sListMenuTemplate_ThreeOptions; struct WindowTemplate windowTemplate = sWindowTemplate_ThreeOptions; @@ -662,7 +662,7 @@ static u32 MysteryGift_HandleThreeOptionMenu(u8 *unused0, u16 * unused1, u8 whic return response; } -s8 DoMysteryGiftYesNo(u8 *textState, u16 * windowId, bool8 yesNoBoxPlacement, const u8 *str) +s8 DoMysteryGiftYesNo(u8 *textState, u16 *windowId, bool8 yesNoBoxPlacement, const u8 *str) { struct WindowTemplate windowTemplate; s8 input; @@ -719,7 +719,7 @@ s8 DoMysteryGiftYesNo(u8 *textState, u16 * windowId, bool8 yesNoBoxPlacement, co } // Handle the "Receive/Send/Toss" menu that appears when selecting Wonder Card/News -static s32 HandleGiftSelectMenu(u8 *textState, u16 * windowId, bool32 cannotToss, bool32 cannotSend) +static s32 HandleGiftSelectMenu(u8 *textState, u16 *windowId, bool32 cannotToss, bool32 cannotSend) { struct WindowTemplate UNUSED windowTemplate; s32 input; @@ -852,7 +852,7 @@ static bool32 ExitWonderCardOrNews(bool32 isWonderNews, bool32 useCancel) } } -static s32 AskDiscardGift(u8 *textState, u16 * windowId, bool32 isWonderNews) +static s32 AskDiscardGift(u8 *textState, u16 *windowId, bool32 isWonderNews) { if (!isWonderNews) return DoMysteryGiftYesNo(textState, windowId, TRUE, gText_IfThrowAwayCardEventWontHappen); @@ -897,7 +897,7 @@ static bool32 SaveOnMysteryGiftMenu(u8 *state) return FALSE; } -static const u8 *GetClientResultMessage(bool32 * successMsg, bool8 isWonderNews, bool8 sourceIsFriend, u32 msgId) +static const u8 *GetClientResultMessage(bool32 *successMsg, bool8 isWonderNews, bool8 sourceIsFriend, u32 msgId) { const u8 *msg = NULL; *successMsg = FALSE; @@ -969,7 +969,7 @@ static const u8 *GetClientResultMessage(bool32 * successMsg, bool8 isWonderNews, return msg; } -static bool32 PrintSuccessMessage(u8 *state, const u8 *msg, u16 * timer) +static bool32 PrintSuccessMessage(u8 *state, const u8 *msg, u16 *timer) { switch (*state) { @@ -996,7 +996,7 @@ static bool32 PrintSuccessMessage(u8 *state, const u8 *msg, u16 * timer) return FALSE; } -static const u8 *GetServerResultMessage(bool32 * wonderSuccess, bool8 sourceIsFriend, u32 msgId) +static const u8 *GetServerResultMessage(bool32 *wonderSuccess, bool8 sourceIsFriend, u32 msgId) { const u8 *result = gText_CommunicationError; *wonderSuccess = FALSE; @@ -1053,7 +1053,7 @@ static const u8 *GetServerResultMessage(bool32 * wonderSuccess, bool8 sourceIsFr return result; } -static bool32 PrintServerResultMessage(u8 *state, u16 * timer, bool8 sourceIsFriend, u32 msgId) +static bool32 PrintServerResultMessage(u8 *state, u16 *timer, bool8 sourceIsFriend, u32 msgId) { bool32 wonderSuccess; const u8 *str = GetServerResultMessage(&wonderSuccess, sourceIsFriend, msgId); @@ -1111,7 +1111,7 @@ enum { static void CreateMysteryGiftTask(void) { u8 taskId = CreateTask(Task_MysteryGift, 0); - struct MysteryGiftTaskData * data = (void *)gTasks[taskId].data; + struct MysteryGiftTaskData *data = (void *)gTasks[taskId].data; data->state = MG_STATE_TO_MAIN_MENU; data->textState = 0; data->unused4 = 0; diff --git a/src/mystery_gift_server.c b/src/mystery_gift_server.c index 891870659d..c90e43dee0 100644 --- a/src/mystery_gift_server.c +++ b/src/mystery_gift_server.c @@ -13,7 +13,7 @@ enum { FUNC_RUN, }; -EWRAM_DATA static struct MysteryGiftServer * sServer = NULL; +EWRAM_DATA static struct MysteryGiftServer *sServer = NULL; static void MysteryGiftServer_Init(struct MysteryGiftServer *, const void *, u32, u32); static void MysteryGiftServer_Free(struct MysteryGiftServer *); @@ -34,7 +34,7 @@ void MysterGiftServer_CreateForCard(void) MysteryGiftServer_Init(sServer, gMysteryGiftServerScript_SendWonderCard, 0, 1); } -u32 MysterGiftServer_Run(u16 * endVal) +u32 MysterGiftServer_Run(u16 *endVal) { u32 result; if (sServer == NULL) @@ -49,7 +49,7 @@ u32 MysterGiftServer_Run(u16 * endVal) return result; } -static void MysteryGiftServer_Init(struct MysteryGiftServer * svr, const void * script, u32 sendPlayerId, u32 recvPlayerId) +static void MysteryGiftServer_Init(struct MysteryGiftServer *svr, const void *script, u32 sendPlayerId, u32 recvPlayerId) { svr->unused = 0; svr->funcId = FUNC_INIT; @@ -62,7 +62,7 @@ static void MysteryGiftServer_Init(struct MysteryGiftServer * svr, const void * MysteryGiftLink_Init(&svr->link, sendPlayerId, recvPlayerId); } -static void MysteryGiftServer_Free(struct MysteryGiftServer * svr) +static void MysteryGiftServer_Free(struct MysteryGiftServer *svr) { Free(svr->card); Free(svr->news); @@ -70,7 +70,7 @@ static void MysteryGiftServer_Free(struct MysteryGiftServer * svr) Free(svr->linkGameData); } -static void MysteryGiftServer_InitSend(struct MysteryGiftServer * svr, u32 ident, const void * src, u32 size) +static void MysteryGiftServer_InitSend(struct MysteryGiftServer *svr, u32 ident, const void *src, u32 size) { AGB_ASSERT(size <= MG_LINK_BUFFER_SIZE); MysteryGiftLink_InitSend(&svr->link, ident, src, size); @@ -78,7 +78,7 @@ static void MysteryGiftServer_InitSend(struct MysteryGiftServer * svr, u32 ident // Given the command pointer parameter and the 'default' normal data. // If the command's pointer is not empty use that as the send data, otherwise use the default. -static const void * MysteryGiftServer_GetSendData(const void * dynamicData, const void * defaultData) +static const void * MysteryGiftServer_GetSendData(const void *dynamicData, const void *defaultData) { if (dynamicData != NULL) return dynamicData; @@ -86,7 +86,7 @@ static const void * MysteryGiftServer_GetSendData(const void * dynamicData, cons return defaultData; } -static u32 MysteryGiftServer_Compare(const void * a, const void * b) +static u32 MysteryGiftServer_Compare(const void *a, const void *b) { if (b < a) return 0; @@ -96,36 +96,36 @@ static u32 MysteryGiftServer_Compare(const void * a, const void * b) return 2; } -static u32 Server_Init(struct MysteryGiftServer * svr) +static u32 Server_Init(struct MysteryGiftServer *svr) { svr->funcId = FUNC_RUN; return SVR_RET_INIT; } -static u32 Server_Done(struct MysteryGiftServer * svr) +static u32 Server_Done(struct MysteryGiftServer *svr) { return SVR_RET_END; } -static u32 Server_Recv(struct MysteryGiftServer * svr) +static u32 Server_Recv(struct MysteryGiftServer *svr) { if (MysteryGiftLink_Recv(&svr->link)) svr->funcId = FUNC_RUN; return SVR_RET_ACTIVE; } -static u32 Server_Send(struct MysteryGiftServer * svr) +static u32 Server_Send(struct MysteryGiftServer *svr) { if (MysteryGiftLink_Send(&svr->link)) svr->funcId = FUNC_RUN; return SVR_RET_ACTIVE; } -static u32 Server_Run(struct MysteryGiftServer * svr) +static u32 Server_Run(struct MysteryGiftServer *svr) { // process command - const struct MysteryGiftServerCmd * cmd = &svr->script[svr->cmdidx]; - const void * ptr; + const struct MysteryGiftServerCmd *cmd = &svr->script[svr->cmdidx]; + const void *ptr; svr->cmdidx++; switch (cmd->instr) @@ -280,7 +280,7 @@ static u32 (*const sFuncTable[])(struct MysteryGiftServer *) = { [FUNC_RUN] = Server_Run }; -static u32 MysteryGiftServer_CallFunc(struct MysteryGiftServer * svr) +static u32 MysteryGiftServer_CallFunc(struct MysteryGiftServer *svr) { u32 response; AGB_ASSERT(svr->funcId < ARRAY_COUNT(sFuncTable)); diff --git a/src/mystery_gift_view.c b/src/mystery_gift_view.c index bc1939adf1..9d1ae836dc 100644 --- a/src/mystery_gift_view.c +++ b/src/mystery_gift_view.c @@ -23,9 +23,9 @@ struct WonderGraphics u8 bodyTextPal:4; u8 footerTextPal:4; // Card only u8 stampShadowPal:4; // Card only - const u32 * tiles; - const u32 * map; - const u16 * pal; + const u32 *tiles; + const u32 *map; + const u16 *pal; }; //====================== @@ -52,7 +52,7 @@ struct WonderCardData { /*0000*/ struct WonderCard card; /*014c*/ struct WonderCardMetadata cardMetadata; - /*0170*/ const struct WonderGraphics * gfx; + /*0170*/ const struct WonderGraphics *gfx; /*0174*/ u8 enterExitState; /*0175*/ u8 statFooterWidth; /*0176*/ u16 windowIds[CARD_WIN_COUNT]; @@ -68,7 +68,7 @@ struct WonderCardData /*045C*/ u8 bgTilemapBuffer[0x1000]; }; -EWRAM_DATA static struct WonderCardData * sWonderCardData = NULL; +EWRAM_DATA static struct WonderCardData *sWonderCardData = NULL; static void BufferCardText(void); static void DrawCardWindow(u8 whichWindow); @@ -184,7 +184,7 @@ static const struct WonderGraphics sCardGraphics[NUM_WONDER_BGS] = { {.titleTextPal = 1, .bodyTextPal = 0, .footerTextPal = 0, .stampShadowPal = 7, .tiles = sWonderCardBgGfx8, .map = sWonderCardBgTilemap8, .pal = sWonderCardBgPal8} }; -bool32 WonderCard_Init(struct WonderCard * card, struct WonderCardMetadata * metadata) +bool32 WonderCard_Init(struct WonderCard *card, struct WonderCardMetadata *metadata) { if (card == NULL || metadata == NULL) return FALSE; @@ -551,7 +551,7 @@ enum { struct WonderNewsData { /*0000*/ struct WonderNews news; - /*01bc*/ const struct WonderGraphics * gfx; + /*01bc*/ const struct WonderGraphics *gfx; /*01c0*/ u8 arrowsRemoved:1; u8 enterExitState:7; /*01c1*/ u8 arrowTaskId; @@ -569,7 +569,7 @@ struct WonderNewsData /*03a4*/ u8 bgTilemapBuffer[0x1000]; }; -EWRAM_DATA static struct WonderNewsData * sWonderNewsData = NULL; +EWRAM_DATA static struct WonderNewsData *sWonderNewsData = NULL; static void BufferNewsText(void); static void DrawNewsWindows(void); @@ -640,7 +640,7 @@ static const struct WonderGraphics sNewsGraphics[NUM_WONDER_BGS] = { {.titleTextPal = 1, .bodyTextPal = 0, .tiles = sWonderNewsGfx8, .map = sWonderNewsTilemap8, .pal = sWonderNewsPal8} }; -bool32 WonderNews_Init(const struct WonderNews * news) +bool32 WonderNews_Init(const struct WonderNews *news) { if (news == NULL) return FALSE; diff --git a/src/party_menu.c b/src/party_menu.c index 8fe201e6aa..ba070de9f3 100644 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -4558,7 +4558,7 @@ static void Task_SetSacredAshCB(u8 taskId) static bool8 IsHPRecoveryItem(u16 item) { - const u8 *effect = ItemId_GetEffect(item); + const u8 *effect = GetItemEffect(item); if (effect == NULL) return FALSE; @@ -5033,7 +5033,7 @@ void ItemUseCB_Mint(u8 taskId, TaskFunc task) tState = 0; tMonId = gPartyMenu.slotId; tOldNature = GetMonData(&gPlayerParty[tMonId], MON_DATA_HIDDEN_NATURE); - tNewNature = ItemId_GetSecondaryId(gSpecialVar_ItemId); + tNewNature = GetItemSecondaryId(gSpecialVar_ItemId); SetWordTaskArg(taskId, tOldFunc, (uintptr_t)(gTasks[taskId].func)); gTasks[taskId].func = Task_Mint; } @@ -5224,7 +5224,7 @@ static void Task_HandleWhichMoveInput(u8 taskId) void ItemUseCB_PPRecovery(u8 taskId, TaskFunc task) { - const u8 *effect = ItemId_GetEffect(gSpecialVar_ItemId); + const u8 *effect = GetItemEffect(gSpecialVar_ItemId); if (effect == NULL || !(effect[4] & ITEM4_HEAL_PP_ONE)) { @@ -5320,7 +5320,7 @@ void ItemUseCB_PPUp(u8 taskId, TaskFunc task) u16 ItemIdToBattleMoveId(u16 item) { - return (ItemId_GetPocket(item) == POCKET_TM_HM) ? gItemsInfo[item].secondaryId : MOVE_NONE; + return (GetItemPocket(item) == POCKET_TM_HM) ? gItemsInfo[item].secondaryId : MOVE_NONE; } bool8 MonKnowsMove(struct Pokemon *mon, u16 move) @@ -5407,7 +5407,7 @@ static void Task_LearnedMove(u8 taskId) if (move[1] == 0) { AdjustFriendship(mon, FRIENDSHIP_EVENT_LEARN_TMHM); - if (!ItemId_GetImportance(item)) + if (!GetItemImportance(item)) RemoveBagItem(item, 1); } GetMonNickname(mon, gStringVar1); @@ -5488,7 +5488,7 @@ static void CB2_ReturnToPartyMenuWhileLearningMove(void) { if (sFinalLevel != 0) SetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_LEVEL, &sFinalLevel); // to avoid displaying incorrect level - if (ItemId_GetFieldFunc(gSpecialVar_ItemId) == ItemUseOutOfBattle_RareCandy && gPartyMenu.menuType == PARTY_MENU_TYPE_FIELD && CheckBagHasItem(gSpecialVar_ItemId, 1)) + if (GetItemFieldFunc(gSpecialVar_ItemId) == ItemUseOutOfBattle_RareCandy && gPartyMenu.menuType == PARTY_MENU_TYPE_FIELD && CheckBagHasItem(gSpecialVar_ItemId, 1)) InitPartyMenu(PARTY_MENU_TYPE_FIELD, PARTY_LAYOUT_SINGLE, PARTY_ACTION_USE_ITEM, TRUE, PARTY_MSG_NONE, Task_ReturnToPartyMenuWhileLearningMove, gPartyMenu.exitCallback); else InitPartyMenu(PARTY_MENU_TYPE_FIELD, PARTY_LAYOUT_SINGLE, PARTY_ACTION_CHOOSE_MON, TRUE, PARTY_MSG_NONE, Task_ReturnToPartyMenuWhileLearningMove, gPartyMenu.exitCallback); @@ -5606,7 +5606,7 @@ void ItemUseCB_RareCandy(u8 taskId, TaskFunc task) s16 *arrayPtr = ptr->data; u16 *itemPtr = &gSpecialVar_ItemId; bool8 cannotUseEffect; - u8 holdEffectParam = ItemId_GetHoldEffectParam(*itemPtr); + u8 holdEffectParam = GetItemHoldEffectParam(*itemPtr); sInitialLevel = GetMonData(mon, MON_DATA_LEVEL); if (!(B_RARE_CANDY_CAP && sInitialLevel >= GetCurrentLevelCap())) @@ -5835,7 +5835,7 @@ static void PartyMenuTryEvolution(u8 taskId) if (targetSpecies != SPECIES_NONE) { FreePartyPointers(); - if (ItemId_GetFieldFunc(gSpecialVar_ItemId) == ItemUseOutOfBattle_RareCandy && gPartyMenu.menuType == PARTY_MENU_TYPE_FIELD && CheckBagHasItem(gSpecialVar_ItemId, 1)) + if (GetItemFieldFunc(gSpecialVar_ItemId) == ItemUseOutOfBattle_RareCandy && gPartyMenu.menuType == PARTY_MENU_TYPE_FIELD && CheckBagHasItem(gSpecialVar_ItemId, 1)) gCB2_AfterEvolution = CB2_ReturnToPartyMenuUsingRareCandy; else gCB2_AfterEvolution = gPartyMenu.exitCallback; @@ -6047,7 +6047,7 @@ void ItemUseCB_EvolutionStone(u8 taskId, TaskFunc task) } else { - if (ItemId_GetPocket(gSpecialVar_ItemId) != POCKET_KEY_ITEMS) + if (GetItemPocket(gSpecialVar_ItemId) != POCKET_KEY_ITEMS) RemoveBagItem(gSpecialVar_ItemId, 1); FreePartyPointers(); } @@ -6691,7 +6691,7 @@ void TryItemHoldFormChange(struct Pokemon *mon) u8 GetItemEffectType(u16 item) { u32 statusCure; - const u8 *itemEffect = ItemId_GetEffect(item); + const u8 *itemEffect = GetItemEffect(item); if (itemEffect == NULL) return ITEM_EFFECT_NONE; @@ -7350,20 +7350,20 @@ static void BufferBattlePartyOrder(u8 *partyBattleOrder, u8 flankId) partyBattleOrder[i] = (partyIds[0 + (i * 2)] << 4) | partyIds[1 + (i * 2)]; } -void BufferBattlePartyCurrentOrderBySide(u8 battlerId, u8 flankId) +void BufferBattlePartyCurrentOrderBySide(u8 battler, u8 flankId) { - BufferBattlePartyOrderBySide(gBattleStruct->battlerPartyOrders[battlerId], flankId, battlerId); + BufferBattlePartyOrderBySide(gBattleStruct->battlerPartyOrders[battler], flankId, battler); } -// when GetBattlerSide(battlerId) == B_SIDE_PLAYER, this function is identical the one above -static void BufferBattlePartyOrderBySide(u8 *partyBattleOrder, u8 flankId, u8 battlerId) +// when GetBattlerSide(battler) == B_SIDE_PLAYER, this function is identical the one above +static void BufferBattlePartyOrderBySide(u8 *partyBattleOrder, u8 flankId, u8 battler) { u8 partyIndexes[PARTY_SIZE]; int i, j; u8 leftBattler; u8 rightBattler; - if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) + if (GetBattlerSide(battler) == B_SIDE_PLAYER) { leftBattler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); rightBattler = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT); @@ -7422,7 +7422,7 @@ static void BufferBattlePartyOrderBySide(u8 *partyBattleOrder, u8 flankId, u8 ba partyBattleOrder[i] = (partyIndexes[0 + (i * 2)] << 4) | partyIndexes[1 + (i * 2)]; } -void SwitchPartyOrderLinkMulti(u8 battlerId, u8 slot, u8 slot2) +void SwitchPartyOrderLinkMulti(u8 battler, u8 slot, u8 slot2) { u8 partyIds[PARTY_SIZE]; u8 tempSlot = 0; @@ -7432,7 +7432,7 @@ void SwitchPartyOrderLinkMulti(u8 battlerId, u8 slot, u8 slot2) if (IsMultiBattle()) { - partyBattleOrder = gBattleStruct->battlerPartyOrders[battlerId]; + partyBattleOrder = gBattleStruct->battlerPartyOrders[battler]; for (i = j = 0; i < PARTY_SIZE / 2; j++, i++) { partyIds[j] = partyBattleOrder[i] >> 4; diff --git a/src/player_pc.c b/src/player_pc.c index bcf55df0b6..bac3f612c3 100644 --- a/src/player_pc.c +++ b/src/player_pc.c @@ -1062,7 +1062,7 @@ static void ItemStorage_PrintDescription(s32 id) // Get item description (or Cancel text) if (id != LIST_CANCEL) - description = (u8 *)ItemId_GetDescription(gSaveBlock1Ptr->pcItems[id].itemId); + description = (u8 *)GetItemDescription(gSaveBlock1Ptr->pcItems[id].itemId); else description = ItemStorage_GetMessage(MSG_GO_BACK_TO_PREV); @@ -1206,7 +1206,7 @@ static const u8 *ItemStorage_GetMessage(u16 itemId) string = gText_MoveVar1Where; break; default: - string = ItemId_GetDescription(itemId); + string = GetItemDescription(itemId); break; } return string; @@ -1462,7 +1462,7 @@ static void ItemStorage_DoItemToss(u8 taskId) s16 *data = gTasks[taskId].data; u16 pos = gPlayerPCItemPageInfo.cursorPos + gPlayerPCItemPageInfo.itemsAbove; - if (!ItemId_GetImportance(gSaveBlock1Ptr->pcItems[pos].itemId)) + if (!GetItemImportance(gSaveBlock1Ptr->pcItems[pos].itemId)) { // Show toss confirmation prompt u8 *end = CopyItemNameHandlePlural(gSaveBlock1Ptr->pcItems[pos].itemId, gStringVar1, tQuantity); diff --git a/src/pokeball.c b/src/pokeball.c index 6db184b496..1d03676dbe 100644 --- a/src/pokeball.c +++ b/src/pokeball.c @@ -44,7 +44,7 @@ static void SpriteCB_TradePokeballEnd(struct Sprite *sprite); static void SpriteCB_HealthboxSlideInDelayed(struct Sprite *sprite); static void SpriteCB_HealthboxSlideIn(struct Sprite *sprite); static void SpriteCB_HitAnimHealthoxEffect(struct Sprite *sprite); -static u16 GetBattlerPokeballItemId(u8 battlerId); +static u16 GetBattlerPokeballItemId(u8 battler); // rom const data @@ -563,7 +563,7 @@ u8 DoPokeballSendOutAnimation(u32 battler, s16 pan, u8 kindOfThrow) static void Task_DoPokeballSendOutAnim(u8 taskId) { - u32 throwCaseId, ballId, battlerId, ballSpriteId; + u32 throwCaseId, ballId, battler, ballSpriteId; bool32 notSendOut = FALSE; u32 throwXoffset = (B_ENEMY_THROW_BALLS >= GEN_6) ? 24 : 0; s32 throwYoffset = (B_ENEMY_THROW_BALLS >= GEN_6) ? -16 : 24; @@ -575,8 +575,8 @@ static void Task_DoPokeballSendOutAnim(u8 taskId) } throwCaseId = gTasks[taskId].tThrowId; - battlerId = gTasks[taskId].tBattler; - ballId = GetBattlerPokeballItemId(battlerId); + battler = gTasks[taskId].tBattler; + ballId = GetBattlerPokeballItemId(battler); LoadBallGfx(ballId); ballSpriteId = CreateSprite(&gBallSpriteTemplates[ballId], 32, 80, 29); gSprites[ballSpriteId].data[0] = 0x80; @@ -586,24 +586,24 @@ static void Task_DoPokeballSendOutAnim(u8 taskId) switch (throwCaseId) { case POKEBALL_PLAYER_SLIDEIN: // don't actually send out, trigger the slide-in animation - gBattlerTarget = battlerId; + gBattlerTarget = battler; gSprites[ballSpriteId].callback = HandleBallAnimEnd; gSprites[ballSpriteId].invisible = TRUE; break; case POKEBALL_PLAYER_SENDOUT: - gBattlerTarget = battlerId; + gBattlerTarget = battler; gSprites[ballSpriteId].x = 24; gSprites[ballSpriteId].y = 68; gSprites[ballSpriteId].callback = SpriteCB_MonSendOut_1; - DoPokeballSendOutSoundEffect(battlerId); + DoPokeballSendOutSoundEffect(battler); break; case POKEBALL_OPPONENT_SENDOUT: - gSprites[ballSpriteId].x = GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X) + throwXoffset; - gSprites[ballSpriteId].y = GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y) + throwYoffset; - gBattlerTarget = battlerId; + gSprites[ballSpriteId].x = GetBattlerSpriteCoord(battler, BATTLER_COORD_X) + throwXoffset; + gSprites[ballSpriteId].y = GetBattlerSpriteCoord(battler, BATTLER_COORD_Y) + throwYoffset; + gBattlerTarget = battler; gSprites[ballSpriteId].data[0] = 0; gSprites[ballSpriteId].callback = GetOpponentMonSendOutCallback(); - DoPokeballSendOutSoundEffect(battlerId); + DoPokeballSendOutSoundEffect(battler); break; default: gBattlerTarget = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); @@ -895,7 +895,7 @@ static void Task_PlayCryWhenReleasedFromBall(u8 taskId) u8 wantedCry = gTasks[taskId].tCryTaskWantedCry; s8 pan = gTasks[taskId].tCryTaskPan; u16 species = gTasks[taskId].tCryTaskSpecies; - u8 battlerId = gTasks[taskId].tCryTaskBattler; + u8 battler = gTasks[taskId].tCryTaskBattler; u8 monSpriteId = gTasks[taskId].tCryTaskMonSpriteId; struct Pokemon *mon = (void *)(u32)((gTasks[taskId].tCryTaskMonPtr1 << 16) | (u16)(gTasks[taskId].tCryTaskMonPtr2)); @@ -912,7 +912,7 @@ static void Task_PlayCryWhenReleasedFromBall(u8 taskId) PlayCry_ByMode(species, pan, CRY_MODE_NORMAL); else PlayCry_ByMode(species, pan, CRY_MODE_WEAK); - gBattleSpritesDataPtr->healthBoxesData[battlerId].waitForCry = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].waitForCry = FALSE; DestroyTask(taskId); break; case 2: @@ -929,7 +929,7 @@ static void Task_PlayCryWhenReleasedFromBall(u8 taskId) else PlayCry_ReleaseDouble(species, pan, CRY_MODE_WEAK_DOUBLES); - gBattleSpritesDataPtr->healthBoxesData[battlerId].waitForCry = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].waitForCry = FALSE; DestroyTask(taskId); } else @@ -969,7 +969,7 @@ static void Task_PlayCryWhenReleasedFromBall(u8 taskId) else PlayCry_ReleaseDouble(species, pan, CRY_MODE_WEAK); - gBattleSpritesDataPtr->healthBoxesData[battlerId].waitForCry = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].waitForCry = FALSE; DestroyTask(taskId); break; } @@ -977,11 +977,11 @@ static void Task_PlayCryWhenReleasedFromBall(u8 taskId) static void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite) { - u8 battlerId = sprite->sBattler; + u8 battler = sprite->sBattler; u32 ballId; StartSpriteAnim(sprite, 1); - ballId = GetBattlerPokeballItemId(battlerId); + ballId = GetBattlerPokeballItemId(battler); AnimateBallOpenParticles(sprite->x, sprite->y - 5, 1, 28, ballId); sprite->data[0] = LaunchBallFadeMonTask(TRUE, sprite->sBattler, 14, ballId); sprite->callback = HandleBallAnimEnd; @@ -993,13 +993,13 @@ static void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite) u16 wantedCryCase; u8 taskId; - mon = GetPartyBattlerData(battlerId); - if (GetBattlerSide(battlerId) != B_SIDE_PLAYER) + mon = GetPartyBattlerData(battler); + if (GetBattlerSide(battler) != B_SIDE_PLAYER) pan = 25; else pan = -25; - if ((battlerId == GetBattlerAtPosition(B_POSITION_PLAYER_LEFT) || battlerId == GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT)) + if ((battler == GetBattlerAtPosition(B_POSITION_PLAYER_LEFT) || battler == GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT)) && IsDoubleBattle() && gBattleSpritesDataPtr->animationData->introAnimActive) { if (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK) @@ -1015,16 +1015,16 @@ static void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite) if (!IsDoubleBattle() || !gBattleSpritesDataPtr->animationData->introAnimActive) wantedCryCase = 0; - else if (battlerId == GetBattlerAtPosition(B_POSITION_PLAYER_LEFT) || battlerId == GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT)) + else if (battler == GetBattlerAtPosition(B_POSITION_PLAYER_LEFT) || battler == GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT)) wantedCryCase = 1; else wantedCryCase = 2; - gBattleSpritesDataPtr->healthBoxesData[battlerId].waitForCry = TRUE; + gBattleSpritesDataPtr->healthBoxesData[battler].waitForCry = TRUE; taskId = CreateTask(Task_PlayCryWhenReleasedFromBall, 3); - illusionMon = GetIllusionMonPtr(battlerId); + illusionMon = GetIllusionMonPtr(battler); if (illusionMon != NULL) gTasks[taskId].tCryTaskSpecies = GetMonData(illusionMon, MON_DATA_SPECIES); else @@ -1032,7 +1032,7 @@ static void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite) gTasks[taskId].tCryTaskPan = pan; gTasks[taskId].tCryTaskWantedCry = wantedCryCase; - gTasks[taskId].tCryTaskBattler = battlerId; + gTasks[taskId].tCryTaskBattler = battler; gTasks[taskId].tCryTaskMonSpriteId = gBattlerSpriteIds[sprite->sBattler]; gTasks[taskId].tCryTaskMonPtr1 = (u32)(mon) >> 16; gTasks[taskId].tCryTaskMonPtr2 = (u32)(mon); @@ -1072,35 +1072,35 @@ static void SpriteCB_BallThrow_StartCaptureMon(struct Sprite *sprite) static void HandleBallAnimEnd(struct Sprite *sprite) { bool8 affineAnimEnded = FALSE; - u8 battlerId = sprite->sBattler; + u8 battler = sprite->sBattler; if (sprite->data[7] == POKEBALL_PLAYER_SLIDEIN) { - gSprites[gBattlerSpriteIds[sprite->sBattler]].callback = SpriteCB_PlayerMonSlideIn; - AnimateSprite(&gSprites[gBattlerSpriteIds[sprite->sBattler]]); - gSprites[gBattlerSpriteIds[sprite->sBattler]].data[1] = 0x1000; + gSprites[gBattlerSpriteIds[battler]].callback = SpriteCB_PlayerMonSlideIn; + AnimateSprite(&gSprites[gBattlerSpriteIds[battler]]); + gSprites[gBattlerSpriteIds[battler]].data[1] = 0x1000; } - gSprites[gBattlerSpriteIds[battlerId]].invisible = FALSE; + gSprites[gBattlerSpriteIds[battler]].invisible = FALSE; if (sprite->animEnded) sprite->invisible = TRUE; - if (gSprites[gBattlerSpriteIds[battlerId]].affineAnimEnded) + if (gSprites[gBattlerSpriteIds[battler]].affineAnimEnded) { - StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[battlerId]], BATTLER_AFFINE_NORMAL); + StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[battler]], BATTLER_AFFINE_NORMAL); affineAnimEnded = TRUE; } else { - gSprites[gBattlerSpriteIds[battlerId]].data[1] -= 288; - gSprites[gBattlerSpriteIds[battlerId]].y2 = gSprites[gBattlerSpriteIds[battlerId]].data[1] >> 8; + gSprites[gBattlerSpriteIds[battler]].data[1] -= 288; + gSprites[gBattlerSpriteIds[battler]].y2 = gSprites[gBattlerSpriteIds[battler]].data[1] >> 8; } if (sprite->animEnded && affineAnimEnded) { s32 i, doneBattlers; - gSprites[gBattlerSpriteIds[battlerId]].y2 = 0; + gSprites[gBattlerSpriteIds[battler]].y2 = 0; gDoingBattleAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[battlerId].ballAnimActive = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].ballAnimActive = FALSE; FreeSpriteOamMatrix(sprite); DestroySprite(sprite); @@ -1119,7 +1119,7 @@ static void HandleBallAnimEnd(struct Sprite *sprite) static void SpriteCB_BallThrow_CaptureMon(struct Sprite *sprite) { - u8 battlerId = sprite->sBattler; + u8 battler = sprite->sBattler; sprite->data[4]++; if (sprite->data[4] == 40) @@ -1134,11 +1134,11 @@ static void SpriteCB_BallThrow_CaptureMon(struct Sprite *sprite) } else if (sprite->data[4] == 315) { - FreeOamMatrix(gSprites[gBattlerSpriteIds[sprite->sBattler]].oam.matrixNum); - DestroySprite(&gSprites[gBattlerSpriteIds[sprite->sBattler]]); + FreeOamMatrix(gSprites[gBattlerSpriteIds[battler]].oam.matrixNum); + DestroySprite(&gSprites[gBattlerSpriteIds[battler]]); DestroySpriteAndFreeResources(sprite); if (gMain.inBattle) - gBattleSpritesDataPtr->healthBoxesData[battlerId].ballAnimActive = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].ballAnimActive = FALSE; } } @@ -1482,16 +1482,16 @@ static void UNUSED DestroySpriteAndFreeResources_Ball(struct Sprite *sprite) #define sDelayTimer data[1] -void StartHealthboxSlideIn(u8 battlerId) +void StartHealthboxSlideIn(u8 battler) { - struct Sprite *healthboxSprite = &gSprites[gHealthboxSpriteIds[battlerId]]; + struct Sprite *healthboxSprite = &gSprites[gHealthboxSpriteIds[battler]]; healthboxSprite->sSpeedX = 5; healthboxSprite->sSpeedY = 0; healthboxSprite->x2 = 0x73; healthboxSprite->y2 = 0; healthboxSprite->callback = SpriteCB_HealthboxSlideIn; - if (GetBattlerSide(battlerId) != B_SIDE_PLAYER) + if (GetBattlerSide(battler) != B_SIDE_PLAYER) { healthboxSprite->sSpeedX = -healthboxSprite->sSpeedX; healthboxSprite->sSpeedY = -healthboxSprite->sSpeedY; @@ -1499,7 +1499,7 @@ void StartHealthboxSlideIn(u8 battlerId) healthboxSprite->y2 = -healthboxSprite->y2; } gSprites[healthboxSprite->data[5]].callback(&gSprites[healthboxSprite->data[5]]); - if (GetBattlerPosition(battlerId) == B_POSITION_PLAYER_RIGHT) + if (GetBattlerPosition(battler) == B_POSITION_PLAYER_RIGHT) healthboxSprite->callback = SpriteCB_HealthboxSlideInDelayed; } @@ -1525,13 +1525,13 @@ static void SpriteCB_HealthboxSlideIn(struct Sprite *sprite) #undef sSpeedY #undef sDelayTimer -void DoHitAnimHealthboxEffect(u8 battlerId) +void DoHitAnimHealthboxEffect(u8 battler) { u8 spriteId; spriteId = CreateInvisibleSpriteWithCallback(SpriteCB_HitAnimHealthoxEffect); gSprites[spriteId].data[0] = 1; - gSprites[spriteId].data[1] = gHealthboxSpriteIds[battlerId]; + gSprites[spriteId].data[1] = gHealthboxSpriteIds[battler]; gSprites[spriteId].callback = SpriteCB_HitAnimHealthoxEffect; } @@ -1578,12 +1578,12 @@ void FreeBallGfx(u8 ballId) FreeSpritePaletteByTag(gBallSpritePalettes[ballId].tag); } -static u16 GetBattlerPokeballItemId(u8 battlerId) +static u16 GetBattlerPokeballItemId(u8 battler) { struct Pokemon *illusionMon; - struct Pokemon *mon = GetPartyBattlerData(battlerId); + struct Pokemon *mon = GetPartyBattlerData(battler); - illusionMon = GetIllusionMonPtr(battlerId); + illusionMon = GetIllusionMonPtr(battler); if (illusionMon != NULL) mon = illusionMon; @@ -1592,7 +1592,7 @@ static u16 GetBattlerPokeballItemId(u8 battlerId) enum PokeBall ItemIdToBallId(u32 ballItem) { - enum PokeBall secondaryId = ItemId_GetSecondaryId(ballItem); + enum PokeBall secondaryId = GetItemSecondaryId(ballItem); if (secondaryId <= BALL_STRANGE || secondaryId >= POKEBALL_COUNT) return BALL_STRANGE; diff --git a/src/pokeblock.c b/src/pokeblock.c index 82eafec7bc..f6c3ba57c4 100644 --- a/src/pokeblock.c +++ b/src/pokeblock.c @@ -704,7 +704,7 @@ static void DrawPokeblockMenuTitleText(void) { u8 i; - const u8 *itemName = ItemId_GetName(ITEM_POKEBLOCK_CASE); + const u8 *itemName = GetItemName(ITEM_POKEBLOCK_CASE); PrintOnPokeblockWindow(WIN_TITLE, itemName, GetStringCenterAlignXOffset(FONT_NORMAL, itemName, 0x48)); PrintOnPokeblockWindow(WIN_SPICY, COMPOUND_STRING("辣味"), 0); diff --git a/src/pokedex_area_region_map.c b/src/pokedex_area_region_map.c index cd2975473a..06bd05a87b 100644 --- a/src/pokedex_area_region_map.c +++ b/src/pokedex_area_region_map.c @@ -17,7 +17,7 @@ static const u32 sPokedexAreaMapAffine_Tilemap[] = INCBIN_U32("graphics/pokedex/ void LoadPokedexAreaMapGfx(const struct PokedexAreaMapTemplate *template) { u8 mode; - void * tilemap; + void *tilemap; sPokedexAreaMapBgNum = Alloc(sizeof(sPokedexAreaMapBgNum)); mode = template->mode; diff --git a/src/pokedex_area_screen.c b/src/pokedex_area_screen.c index dd45335afb..21562bfc67 100644 --- a/src/pokedex_area_screen.c +++ b/src/pokedex_area_screen.c @@ -88,7 +88,7 @@ struct /*0x6E8*/ u8 *screenSwitchState; /*0x6EC*/ struct RegionMap regionMap; /*0xF70*/ u8 charBuffer[64]; - /*0xFB0*/ struct Sprite * areaUnknownSprites[3]; + /*0xFB0*/ struct Sprite *areaUnknownSprites[3]; /*0xFBC*/ u8 areaUnknownGraphicsBuffer[0x600]; } static EWRAM_DATA *sPokedexAreaScreen = NULL; diff --git a/src/pokemon.c b/src/pokemon.c index c8d94c3f8c..5960433e06 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -1170,7 +1170,7 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV, isShiny = GET_SHINY_VALUE(value, personality) < SHINY_ODDS; } } - + if (hasFixedPersonality) personality = fixedPersonality; @@ -1619,7 +1619,7 @@ static void CreateEventMon(struct Pokemon *mon, u16 species, u8 level, u8 fixedI } // If FALSE, should load this game's Deoxys form. If TRUE, should load normal Deoxys form -bool8 ShouldIgnoreDeoxysForm(u8 caseId, u8 battlerId) +bool8 ShouldIgnoreDeoxysForm(u8 caseId, u8 battler) { switch (caseId) { @@ -1631,7 +1631,7 @@ bool8 ShouldIgnoreDeoxysForm(u8 caseId, u8 battlerId) return FALSE; if (!gMain.inBattle) return FALSE; - if (gLinkPlayers[GetMultiplayerId()].id == battlerId) + if (gLinkPlayers[GetMultiplayerId()].id == battler) return FALSE; break; case 2: @@ -1641,7 +1641,7 @@ bool8 ShouldIgnoreDeoxysForm(u8 caseId, u8 battlerId) return FALSE; if (!gMain.inBattle) return FALSE; - if (battlerId == 1 || battlerId == 4 || battlerId == 5) + if (battler == 1 || battler == 4 || battler == 5) return TRUE; return FALSE; case 4: @@ -1653,12 +1653,12 @@ bool8 ShouldIgnoreDeoxysForm(u8 caseId, u8 battlerId) return FALSE; if (gBattleTypeFlags & BATTLE_TYPE_MULTI) { - if (gLinkPlayers[GetMultiplayerId()].id == battlerId) + if (gLinkPlayers[GetMultiplayerId()].id == battler) return FALSE; } else { - if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) + if (GetBattlerSide(battler) == B_SIDE_PLAYER) return FALSE; } } @@ -1666,7 +1666,7 @@ bool8 ShouldIgnoreDeoxysForm(u8 caseId, u8 battlerId) { if (!gMain.inBattle) return FALSE; - if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) + if (GetBattlerSide(battler) == B_SIDE_PLAYER) return FALSE; } break; @@ -3358,7 +3358,7 @@ u8 CopyMonToPC(struct Pokemon *mon) { for (boxPos = 0; boxPos < IN_BOX_COUNT; boxPos++) { - struct BoxPokemon* checkingMon = GetBoxedMonPtr(boxNo, boxPos); + struct BoxPokemon *checkingMon = GetBoxedMonPtr(boxNo, boxPos); if (GetBoxMonData(checkingMon, MON_DATA_SPECIES, NULL) == SPECIES_NONE) { MonRestorePP(mon); @@ -3720,14 +3720,14 @@ void PokemonToBattleMon(struct Pokemon *src, struct BattlePokemon *dst) dst->status2 = 0; } -void CopyPartyMonToBattleData(u32 battlerId, u32 partyIndex) +void CopyPartyMonToBattleData(u32 battler, u32 partyIndex) { - u32 side = GetBattlerSide(battlerId); + u32 side = GetBattlerSide(battler); struct Pokemon *party = GetSideParty(side); - PokemonToBattleMon(&party[partyIndex], &gBattleMons[battlerId]); - gBattleStruct->hpOnSwitchout[side] = gBattleMons[battlerId].hp; - UpdateSentPokesToOpponentValue(battlerId); - ClearTemporarySpeciesSpriteData(battlerId, FALSE, FALSE); + PokemonToBattleMon(&party[partyIndex], &gBattleMons[battler]); + gBattleStruct->hpOnSwitchout[side] = gBattleMons[battler].hp; + UpdateSentPokesToOpponentValue(battler); + ClearTemporarySpeciesSpriteData(battler, FALSE, FALSE); } bool8 ExecuteTableBasedItemEffect(struct Pokemon *mon, u16 item, u8 partyIndex, u8 moveIndex) @@ -3783,7 +3783,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov u32 temp1, temp2; s8 friendshipChange = 0; u8 holdEffect; - u8 battlerId = MAX_BATTLERS_COUNT; + u8 battler = MAX_BATTLERS_COUNT; u32 friendshipOnly = FALSE; u16 heldItem; u8 effectFlags; @@ -3802,14 +3802,14 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov holdEffect = 0; #endif //FREE_ENIGMA_BERRY else - holdEffect = ItemId_GetHoldEffect(heldItem); + holdEffect = GetItemHoldEffect(heldItem); // Skip using the item if it won't do anything - if (ItemId_GetEffect(item) == NULL && item != ITEM_ENIGMA_BERRY_E_READER) + if (GetItemEffect(item) == NULL && item != ITEM_ENIGMA_BERRY_E_READER) return TRUE; // Get item effect - itemEffect = ItemId_GetEffect(item); + itemEffect = GetItemEffect(item); // Do item effect for (i = 0; i < ITEM_EFFECT_ARG_START; i++) @@ -3836,7 +3836,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov if ((itemEffect[i] & ITEM3_LEVEL_UP) && GetMonData(mon, MON_DATA_LEVEL, NULL) != MAX_LEVEL) { - u8 param = ItemId_GetHoldEffectParam(item); + u8 param = GetItemHoldEffectParam(item); dataUnsigned = 0; if (param == 0) // Rare Candy @@ -3869,15 +3869,15 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov } // Cure status - if ((itemEffect[i] & ITEM3_SLEEP) && HealStatusConditions(mon, STATUS1_SLEEP, battlerId) == 0) + if ((itemEffect[i] & ITEM3_SLEEP) && HealStatusConditions(mon, STATUS1_SLEEP, battler) == 0) retVal = FALSE; - if ((itemEffect[i] & ITEM3_POISON) && HealStatusConditions(mon, STATUS1_PSN_ANY | STATUS1_TOXIC_COUNTER, battlerId) == 0) + if ((itemEffect[i] & ITEM3_POISON) && HealStatusConditions(mon, STATUS1_PSN_ANY | STATUS1_TOXIC_COUNTER, battler) == 0) retVal = FALSE; - if ((itemEffect[i] & ITEM3_BURN) && HealStatusConditions(mon, STATUS1_BURN, battlerId) == 0) + if ((itemEffect[i] & ITEM3_BURN) && HealStatusConditions(mon, STATUS1_BURN, battler) == 0) retVal = FALSE; - if ((itemEffect[i] & ITEM3_FREEZE) && HealStatusConditions(mon, STATUS1_FREEZE | STATUS1_FROSTBITE, battlerId) == 0) + if ((itemEffect[i] & ITEM3_FREEZE) && HealStatusConditions(mon, STATUS1_FREEZE | STATUS1_FROSTBITE, battler) == 0) retVal = FALSE; - if ((itemEffect[i] & ITEM3_PARALYSIS) && HealStatusConditions(mon, STATUS1_PARALYSIS, battlerId) == 0) + if ((itemEffect[i] & ITEM3_PARALYSIS) && HealStatusConditions(mon, STATUS1_PARALYSIS, battler) == 0) retVal = FALSE; break; @@ -4027,14 +4027,14 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov // Heal PP for all moves for (temp2 = 0; (signed)(temp2) < (signed)(MAX_MON_MOVES); temp2++) { - u16 moveId; + u16 move; dataUnsigned = GetMonData(mon, MON_DATA_PP1 + temp2, NULL); - moveId = GetMonData(mon, MON_DATA_MOVE1 + temp2, NULL); - if (dataUnsigned != CalculatePPWithBonus(moveId, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), temp2)) + move = GetMonData(mon, MON_DATA_MOVE1 + temp2, NULL); + if (dataUnsigned != CalculatePPWithBonus(move, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), temp2)) { dataUnsigned += itemEffect[itemEffectParam]; - if (dataUnsigned > CalculatePPWithBonus(moveId, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), temp2)) - dataUnsigned = CalculatePPWithBonus(moveId, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), temp2); + if (dataUnsigned > CalculatePPWithBonus(move, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), temp2)) + dataUnsigned = CalculatePPWithBonus(move, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), temp2); SetMonData(mon, MON_DATA_PP1 + temp2, &dataUnsigned); retVal = FALSE; } @@ -4044,14 +4044,14 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov else { // Heal PP for one move - u16 moveId; + u16 move; dataUnsigned = GetMonData(mon, MON_DATA_PP1 + moveIndex, NULL); - moveId = GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL); - if (dataUnsigned != CalculatePPWithBonus(moveId, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex)) + move = GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL); + if (dataUnsigned != CalculatePPWithBonus(move, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex)) { dataUnsigned += itemEffect[itemEffectParam++]; - if (dataUnsigned > CalculatePPWithBonus(moveId, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex)) - dataUnsigned = CalculatePPWithBonus(moveId, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex); + if (dataUnsigned > CalculatePPWithBonus(move, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex)) + dataUnsigned = CalculatePPWithBonus(move, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex); SetMonData(mon, MON_DATA_PP1 + moveIndex, &dataUnsigned); retVal = FALSE; } @@ -4209,7 +4209,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov return retVal; } -bool8 HealStatusConditions(struct Pokemon *mon, u32 healMask, u8 battlerId) +bool8 HealStatusConditions(struct Pokemon *mon, u32 healMask, u8 battler) { u32 status = GetMonData(mon, MON_DATA_STATUS, 0); @@ -4217,13 +4217,13 @@ bool8 HealStatusConditions(struct Pokemon *mon, u32 healMask, u8 battlerId) { status &= ~healMask; SetMonData(mon, MON_DATA_STATUS, &status); - if (gMain.inBattle && battlerId != MAX_BATTLERS_COUNT) + if (gMain.inBattle && battler != MAX_BATTLERS_COUNT) { - gBattleMons[battlerId].status1 &= ~healMask; + gBattleMons[battler].status1 &= ~healMask; if((healMask & STATUS1_SLEEP)) { u32 i = 0; - u32 battlerSide = GetBattlerSide(battlerId); + u32 battlerSide = GetBattlerSide(battler); struct Pokemon *party = GetSideParty(battlerSide); for (i = 0; i < PARTY_SIZE; i++) @@ -4255,7 +4255,7 @@ u8 GetItemEffectParamOffset(u32 battler, u16 itemId, u8 effectByte, u8 effectBit offset = ITEM_EFFECT_ARG_START; - temp = ItemId_GetEffect(itemId); + temp = GetItemEffect(itemId); if (temp != NULL && !temp && itemId != ITEM_ENIGMA_BERRY_E_READER) return 0; @@ -4391,7 +4391,7 @@ u8 *UseStatIncreaseItem(u16 itemId) } else { - itemEffect = ItemId_GetEffect(itemId); + itemEffect = GetItemEffect(itemId); } gPotentialItemEffectBattler = gBattlerInMenuId; @@ -4486,7 +4486,7 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, enum EvolutionMode mode, u16 partnerHoldEffect = 0; #endif //FREE_ENIGMA_BERRY else - partnerHoldEffect = ItemId_GetHoldEffect(partnerHeldItem); + partnerHoldEffect = GetItemHoldEffect(partnerHeldItem); } else { @@ -4502,7 +4502,7 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, enum EvolutionMode mode, u16 holdEffect = 0; #endif //FREE_ENIGMA_BERRY else - holdEffect = ItemId_GetHoldEffect(heldItem); + holdEffect = GetItemHoldEffect(heldItem); // Prevent evolution with Everstone, unless we're just viewing the party menu with an evolution item if (holdEffect == HOLD_EFFECT_PREVENT_EVOLVE @@ -5197,7 +5197,7 @@ void AdjustFriendship(struct Pokemon *mon, u8 event) } else { - holdEffect = ItemId_GetHoldEffect(heldItem); + holdEffect = GetItemHoldEffect(heldItem); } if (species && species != SPECIES_EGG) @@ -5277,11 +5277,11 @@ void MonGainEVs(struct Pokemon *mon, u16 defeatedSpecies) } else { - holdEffect = ItemId_GetHoldEffect(heldItem); + holdEffect = GetItemHoldEffect(heldItem); } - stat = ItemId_GetSecondaryId(heldItem); - bonus = ItemId_GetHoldEffectParam(heldItem); + stat = GetItemSecondaryId(heldItem); + bonus = GetItemHoldEffectParam(heldItem); for (i = 0; i < NUM_STATS; i++) { @@ -6238,22 +6238,22 @@ void BattleAnimateBackSprite(struct Sprite *sprite, u16 species) static u8 UNUSED GetOwnOpposingLinkMultiBattlerId(bool8 rightSide) { s32 i; - s32 battlerId = 0; + s32 battler = 0; u8 multiplayerId = GetMultiplayerId(); switch (gLinkPlayers[multiplayerId].id) { case 0: case 2: - battlerId = rightSide ? 1 : 3; + battler = rightSide ? 1 : 3; break; case 1: case 3: - battlerId = rightSide ? 2 : 0; + battler = rightSide ? 2 : 0; break; } for (i = 0; i < MAX_LINK_PLAYERS; i++) { - if (gLinkPlayers[i].id == (s16)battlerId) + if (gLinkPlayers[i].id == (s16)battler) break; } return i; @@ -6262,21 +6262,21 @@ static u8 UNUSED GetOwnOpposingLinkMultiBattlerId(bool8 rightSide) u8 GetOpposingLinkMultiBattlerId(bool8 rightSide, u8 multiplayerId) { s32 i; - s32 battlerId = 0; + s32 battler = 0; switch (gLinkPlayers[multiplayerId].id) { case 0: case 2: - battlerId = rightSide ? 1 : 3; + battler = rightSide ? 1 : 3; break; case 1: case 3: - battlerId = rightSide ? 2 : 0; + battler = rightSide ? 2 : 0; break; } for (i = 0; i < MAX_LINK_PLAYERS; i++) { - if (gLinkPlayers[i].id == (s16)battlerId) + if (gLinkPlayers[i].id == (s16)battler) break; } return i; @@ -6339,7 +6339,7 @@ static bool8 ShouldSkipFriendshipChange(void) #define ALLOC_FAIL_STRUCT (1 << 1) #define GFX_MANAGER_ACTIVE 0xA3 // Arbitrary value -static void InitMonSpritesGfx_Battle(struct MonSpritesGfxManager* gfx) +static void InitMonSpritesGfx_Battle(struct MonSpritesGfxManager *gfx) { u16 i, j; for (i = 0; i < gfx->numSprites; i++) @@ -6352,7 +6352,7 @@ static void InitMonSpritesGfx_Battle(struct MonSpritesGfxManager* gfx) } } -static void InitMonSpritesGfx_FullParty(struct MonSpritesGfxManager* gfx) +static void InitMonSpritesGfx_FullParty(struct MonSpritesGfxManager *gfx) { u16 i, j; for (i = 0; i < gfx->numSprites; i++) @@ -7005,9 +7005,9 @@ void UpdateDaysPassedSinceFormChange(u16 days) } } -u32 CheckDynamicMoveType(struct Pokemon *mon, u32 move, u32 battler) +u32 CheckDynamicMoveType(struct Pokemon *mon, u32 move, u32 battler, enum MonState state) { - u32 moveType = GetDynamicMoveType(mon, move, battler, NULL); + u32 moveType = GetDynamicMoveType(mon, move, battler, state); if (moveType != TYPE_NONE) return moveType; return GetMoveType(move); diff --git a/src/pokemon_animation.c b/src/pokemon_animation.c index 6bd32ee514..ae92091537 100644 --- a/src/pokemon_animation.c +++ b/src/pokemon_animation.c @@ -239,7 +239,7 @@ static const u8 sVerticalShakeData[][2] = {-1, 0} }; -static void (* const sMonAnimFunctions[])(struct Sprite *sprite) = +static void (*const sMonAnimFunctions[])(struct Sprite *sprite) = { [ANIM_V_SQUISH_AND_BOUNCE] = Anim_VerticalSquishBounce, [ANIM_CIRCULAR_STRETCH_TWICE] = Anim_CircularStretchTwice, @@ -544,14 +544,14 @@ void StartMonSummaryAnimation(struct Sprite *sprite, u8 frontAnimId) void LaunchAnimationTaskForBackSprite(struct Sprite *sprite, u8 backAnimSet) { - u8 nature, taskId, animId, battlerId; + u8 nature, taskId, animId, battler; taskId = CreateTask(Task_HandleMonAnimation, 128); gTasks[taskId].tPtrHi = (u32)(sprite) >> 16; gTasks[taskId].tPtrLo = (u32)(sprite); - battlerId = sprite->data[0]; - nature = GetNature(&gPlayerParty[gBattlerPartyIndexes[battlerId]]); + battler = sprite->data[0]; + nature = GetNature(&gPlayerParty[gBattlerPartyIndexes[battler]]); // * 3 below because each back anim has 3 variants depending on nature animId = 3 * backAnimSet + gNaturesInfo[nature].backAnim; diff --git a/src/pokemon_jump.c b/src/pokemon_jump.c index 9492a4a9f8..e6154a392e 100755 --- a/src/pokemon_jump.c +++ b/src/pokemon_jump.c @@ -1076,7 +1076,7 @@ static void RecvLinkData_Leader(void) sPokemonJump->allPlayersReady = TRUE; } -static bool32 (* const sPokeJumpLeaderFuncs[])(void) = +static bool32 (*const sPokeJumpLeaderFuncs[])(void) = { [FUNC_GAME_INTRO] = GameIntro_Leader, [FUNC_WAIT_ROUND] = WaitRound_Leader, @@ -1175,7 +1175,7 @@ static void RecvLinkData_Member(void) } } -static bool32 (* const sPokeJumpMemberFuncs[])(void) = +static bool32 (*const sPokeJumpMemberFuncs[])(void) = { [FUNC_GAME_INTRO] = GameIntro_Member, [FUNC_WAIT_ROUND] = WaitRound_Member, diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index d9b3e1fe7a..2472b6b41c 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -7051,7 +7051,7 @@ static void SetDisplayMonData(void *pokemon, u8 mode) txtPtr[1] = EOS; if (sStorage->displayMonItemId != ITEM_NONE) - StringCopyPadded(sStorage->displayMonItemName, ItemId_GetName(sStorage->displayMonItemId), CHAR_SPACE, 8); + StringCopyPadded(sStorage->displayMonItemName, GetItemName(sStorage->displayMonItemId), CHAR_SPACE, 8); else StringFill(sStorage->displayMonItemName, CHAR_SPACE, 8); } @@ -9082,7 +9082,7 @@ static bool8 IsMovingItem(void) static const u8 *GetMovingItemName(void) { - return ItemId_GetName(sStorage->movingItemId); + return GetItemName(sStorage->movingItemId); } static u16 GetMovingItemId(void) @@ -9267,9 +9267,9 @@ static void PrintItemDescription(void) const u8 *description; if (IsMovingItem()) - description = ItemId_GetDescription(sStorage->movingItemId); + description = GetItemDescription(sStorage->movingItemId); else - description = ItemId_GetDescription(sStorage->displayMonItemId); + description = GetItemDescription(sStorage->displayMonItemId); FillWindowPixelBuffer(WIN_ITEM_DESC, PIXEL_FILL(1)); AddTextPrinterParameterized5(WIN_ITEM_DESC, FONT_NORMAL, description, 4, 0, 0, NULL, 0, 1); @@ -9719,9 +9719,9 @@ u32 CountAllStorageMons(void) return count; } -bool32 AnyStorageMonWithMove(u16 moveId) +bool32 AnyStorageMonWithMove(u16 move) { - u16 moves[] = {moveId, MOVES_COUNT}; + u16 moves[] = {move, MOVES_COUNT}; s32 i, j; for (i = 0; i < TOTAL_BOXES_COUNT; i++) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 679356e434..ae6908baad 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -1720,7 +1720,7 @@ static void Task_HandleInput(u8 taskId) PlaySE(SE_SELECT); BeginCloseSummaryScreen(taskId); } - else if (sMonSummaryScreen->currPageIndex == PSS_PAGE_BATTLE_MOVES + else if (sMonSummaryScreen->currPageIndex == PSS_PAGE_BATTLE_MOVES || sMonSummaryScreen->currPageIndex == PSS_PAGE_CONTEST_MOVES) { PlaySE(SE_SELECT); @@ -1773,7 +1773,7 @@ static u8 IncrementSkillsStatsMode(u8 mode) sMonSummaryScreen->skillsPageMode = SUMMARY_SKILLS_MODE_EVS; return SUMMARY_SKILLS_MODE_EVS; } - else + else { sMonSummaryScreen->skillsPageMode = SUMMARY_SKILLS_MODE_IVS; return SUMMARY_SKILLS_MODE_IVS; @@ -1956,7 +1956,7 @@ static void Task_ChangeSummaryMon(u8 taskId) if (P_SUMMARY_SCREEN_RENAME && sMonSummaryScreen->currPageIndex == PSS_PAGE_INFO) ShowUtilityPrompt(SUMMARY_MODE_NORMAL); if (ShouldShowIvEvPrompt() && sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS) - { + { sMonSummaryScreen->skillsPageMode = SUMMARY_SKILLS_MODE_STATS; ChangeStatLabel(SUMMARY_SKILLS_MODE_STATS); } @@ -2108,7 +2108,7 @@ static void ChangePage(u8 taskId, s8 delta) CreateTextPrinterTask(sMonSummaryScreen->currPageIndex); HidePageSpecificSprites(); - if (sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS + if (sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS || (sMonSummaryScreen->currPageIndex + delta) == PSS_PAGE_SKILLS) { struct Pokemon *mon = &sMonSummaryScreen->currentMon; @@ -2244,7 +2244,7 @@ static void SwitchToMoveSelection(u8 taskId) { if (ShouldShowMoveRelearner()) ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); - + ShowUtilityPrompt(SUMMARY_MODE_SELECT_MOVE); } else @@ -2476,7 +2476,7 @@ static void ExitMovePositionSwitchMode(u8 taskId, bool8 swapMoves) static void SwapMonMoves(struct Pokemon *mon, u8 moveIndex1, u8 moveIndex2) { - struct PokeSummary* summary = &sMonSummaryScreen->summary; + struct PokeSummary *summary = &sMonSummaryScreen->summary; u16 move1 = summary->moves[moveIndex1]; u16 move2 = summary->moves[moveIndex2]; @@ -2511,7 +2511,7 @@ static void SwapMonMoves(struct Pokemon *mon, u8 moveIndex1, u8 moveIndex2) static void SwapBoxMonMoves(struct BoxPokemon *mon, u8 moveIndex1, u8 moveIndex2) { - struct PokeSummary* summary = &sMonSummaryScreen->summary; + struct PokeSummary *summary = &sMonSummaryScreen->summary; u16 move1 = summary->moves[moveIndex1]; u16 move2 = summary->moves[moveIndex2]; @@ -3721,7 +3721,7 @@ static void PrintHeldItemName(void) && IsMultiBattle() == TRUE && (sMonSummaryScreen->curMonIndex == 1 || sMonSummaryScreen->curMonIndex == 4 || sMonSummaryScreen->curMonIndex == 5)) { - text = ItemId_GetName(ITEM_ENIGMA_BERRY_E_READER); + text = GetItemName(ITEM_ENIGMA_BERRY_E_READER); } else if (sMonSummaryScreen->summary.item == ITEM_NONE) { @@ -3774,10 +3774,10 @@ static void BufferStat(u8 *dst, u8 statIndex, u32 stat, u32 strId, u32 n) else txtPtr = StringCopy(dst, sTextNatureNeutral); - if (!P_SUMMARY_SCREEN_IV_EV_VALUES + if (!P_SUMMARY_SCREEN_IV_EV_VALUES && sMonSummaryScreen->skillsPageMode == SUMMARY_SKILLS_MODE_IVS) StringAppend(dst, GetLetterGrade(stat)); - else + else ConvertIntToDecimalStringN(txtPtr, stat, STR_CONV_MODE_RIGHT_ALIGN, n); DynamicPlaceholderTextUtil_SetPlaceholderPtr(strId, dst); @@ -3791,7 +3791,7 @@ static const u8 *GetLetterGrade(u32 stat) static const u8 gText_GradeB[] = _("B"); static const u8 gText_GradeA[] = _("A"); static const u8 gText_GradeS[] = _("S"); - + if (stat > 0 && stat <= 15) return gText_GradeD; else if (stat > 15 && stat <= 25) @@ -3833,7 +3833,7 @@ static void BufferLeftColumnIvEvStats(void) u8 *hpIvEvString = Alloc(20); u8 *attackIvEvString = Alloc(20); u8 *defenseIvEvString = Alloc(20); - + DynamicPlaceholderTextUtil_Reset(); BufferStat(hpIvEvString, STAT_HP, sMonSummaryScreen->summary.currentHP, 0, 7); @@ -3850,7 +3850,7 @@ static void BufferLeftColumnIvEvStats(void) static void PrintLeftColumnStats(void) { int x; - + if (sMonSummaryScreen->skillsPageMode == SUMMARY_SKILLS_MODE_IVS && !P_SUMMARY_SCREEN_IV_EV_VALUES) x = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 46); else @@ -3873,7 +3873,7 @@ static void BufferRightColumnStats(void) static void PrintRightColumnStats(void) { int x; - + if (sMonSummaryScreen->skillsPageMode == SUMMARY_SKILLS_MODE_IVS && !P_SUMMARY_SCREEN_IV_EV_VALUES) x = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 20); else @@ -4306,7 +4306,11 @@ static void SetMoveTypeIcons(void) { type = GetMoveType(summary->moves[i]); if (P_SHOW_DYNAMIC_TYPES) - type = CheckDynamicMoveType(mon, summary->moves[i], 0); + { + enum MonState state = gMain.inBattle ? MON_IN_BATTLE : MON_OUTSIDE_BATTLE; + type = CheckDynamicMoveType(mon, summary->moves[i], 0, state); // Bug: in battle, this only shows the dynamic type of battler in position 0 + } + SetTypeSpritePosAndPal(type, 85, 32 + (i * 16), i + SPRITE_ARR_ID_TYPE); } else @@ -4335,7 +4339,10 @@ static void SetNewMoveTypeIcon(void) struct Pokemon *mon = &sMonSummaryScreen->currentMon; if (P_SHOW_DYNAMIC_TYPES) - type = CheckDynamicMoveType(mon, sMonSummaryScreen->newMove, 0); + { + enum MonState state = gMain.inBattle ? MON_IN_BATTLE : MON_OUTSIDE_BATTLE; + type = CheckDynamicMoveType(mon, sMonSummaryScreen->newMove, 0, state); // Bug: in battle, this only shows the dynamic type of battler in position 0 + } if (sMonSummaryScreen->newMove == MOVE_NONE) { diff --git a/src/pokenav_conditions_search_results.c b/src/pokenav_conditions_search_results.c index 09ad43706b..e7b317d7ea 100644 --- a/src/pokenav_conditions_search_results.c +++ b/src/pokenav_conditions_search_results.c @@ -240,27 +240,27 @@ static u32 GetReturningFromGraph(void) static struct PokenavMonListItem * GetSearchResultsMonDataList(void) { - struct Pokenav_SearchResults * menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS); + struct Pokenav_SearchResults *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS); return menu->monList->monData; } static u16 GetSearchResultsMonListCount(void) { - struct Pokenav_SearchResults * menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS); + struct Pokenav_SearchResults *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS); return menu->monList->listCount; } // data below has been set by ConvertConditionsToListRanks static s32 GetSearchResultsSelectedMonRank(void) { - struct Pokenav_SearchResults * menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS); + struct Pokenav_SearchResults *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS); s32 i = PokenavList_GetSelectedIndex(); return menu->monList->monData[i].data; } static u16 GetSearchResultsCurrentListIndex(void) { - struct Pokenav_SearchResults * menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS); + struct Pokenav_SearchResults *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS); return menu->monList->currIndex; } @@ -273,7 +273,7 @@ static u32 BuildPartyMonSearchResults(s32 state) { s32 i; struct PokenavMonListItem item; - struct Pokenav_SearchResults * menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS); + struct Pokenav_SearchResults *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS); menu->monList->listCount = 0; menu->monList->currIndex = 0; @@ -296,7 +296,7 @@ static u32 BuildPartyMonSearchResults(s32 state) static u32 InitBoxMonSearchResults(s32 state) { - struct Pokenav_SearchResults * menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS); + struct Pokenav_SearchResults *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS); menu->monId = 0; menu->boxId = 0; return LT_INC_AND_CONTINUE; @@ -304,7 +304,7 @@ static u32 InitBoxMonSearchResults(s32 state) static u32 BuildBoxMonSearchResults(s32 state) { - struct Pokenav_SearchResults * menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS); + struct Pokenav_SearchResults *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS); s32 boxId = menu->boxId; s32 monId = menu->monId; s32 boxCount = 0; @@ -342,7 +342,7 @@ static u32 BuildBoxMonSearchResults(s32 state) // The condition value in data is then overwritten with their ranking. static u32 ConvertConditionsToListRanks(s32 state) { - struct Pokenav_SearchResults * menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS); + struct Pokenav_SearchResults *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS); s32 listCount = menu->monList->listCount; s32 prevCondition = menu->monList->monData[0].data; s32 i; @@ -700,7 +700,7 @@ static void CreateSearchResultsList(void) CreatePokenavList(&sConditionSearchResultBgTemplates[1], &template, 0); } -static void BufferSearchMonListItem(struct PokenavMonListItem * item, u8 *dest) +static void BufferSearchMonListItem(struct PokenavMonListItem *item, u8 *dest) { u8 gender; u8 level; @@ -719,7 +719,7 @@ static void BufferSearchMonListItem(struct PokenavMonListItem * item, u8 *dest) // Mon is in PC else { - struct BoxPokemon * mon = GetBoxedMonPtr(item->boxId, item->monId); + struct BoxPokemon *mon = GetBoxedMonPtr(item->boxId, item->monId); gender = GetBoxMonGender(mon); level = GetLevelFromBoxMonExp(mon); GetBoxMonData(mon, MON_DATA_NICKNAME, gStringVar3); diff --git a/src/pokenav_list.c b/src/pokenav_list.c index 97d13d92fb..c6378f30e7 100644 --- a/src/pokenav_list.c +++ b/src/pokenav_list.c @@ -34,7 +34,7 @@ struct PokenavListWindowState { u16 selectedIndexOffset; u16 entriesOnscreen; u32 listItemSize; - void * listPtr; + void *listPtr; }; struct PokenavListSub @@ -43,7 +43,7 @@ struct PokenavListSub u32 printStart; u32 printIndex; u32 itemSize; - void * listPtr; + void *listPtr; s32 startBgY; s32 endBgY; u32 loopedTaskId; @@ -196,7 +196,7 @@ static void InitListItems(struct PokenavListWindowState *windowState, struct Pok PrintListItems(windowState->listPtr, windowState->windowTopIndex, numToPrint, windowState->listItemSize, 0, subPtr); } -static void PrintListItems(void * listPtr, u32 topIndex, u32 numItems, u32 itemSize, u32 printStart, struct PokenavListSub *list) +static void PrintListItems(void *listPtr, u32 topIndex, u32 numItems, u32 itemSize, u32 printStart, struct PokenavListSub *list) { if (numItems == 0) return; diff --git a/src/pokenav_menu_handler_gfx.c b/src/pokenav_menu_handler_gfx.c index cff5d1c64e..4e9cb630ac 100644 --- a/src/pokenav_menu_handler_gfx.c +++ b/src/pokenav_menu_handler_gfx.c @@ -45,8 +45,8 @@ struct Pokenav_MenuGfx u8 numIconsBlending; bool8 pokenavAlreadyOpen; bool32 iconVisible[MAX_POKENAV_MENUITEMS]; - struct Sprite * blueLightSprite; - struct Sprite * iconSprites[MAX_POKENAV_MENUITEMS][NUM_OPTION_SUBSPRITES]; + struct Sprite *blueLightSprite; + struct Sprite *iconSprites[MAX_POKENAV_MENUITEMS][NUM_OPTION_SUBSPRITES]; u8 bg1TilemapBuffer[BG_SCREEN_SIZE]; }; @@ -384,7 +384,7 @@ static bool32 AreAnyTrainerRematchesNearby(void) bool32 OpenPokenavMenuInitial(void) { - struct Pokenav_MenuGfx * gfx = OpenPokenavMenu(); + struct Pokenav_MenuGfx *gfx = OpenPokenavMenu(); if (gfx == NULL) return FALSE; @@ -395,7 +395,7 @@ bool32 OpenPokenavMenuInitial(void) bool32 OpenPokenavMenuNotInitial(void) { - struct Pokenav_MenuGfx * gfx = OpenPokenavMenu(); + struct Pokenav_MenuGfx *gfx = OpenPokenavMenu(); if (gfx == NULL) return FALSE; @@ -406,7 +406,7 @@ bool32 OpenPokenavMenuNotInitial(void) static struct Pokenav_MenuGfx * OpenPokenavMenu(void) { - struct Pokenav_MenuGfx * gfx = AllocSubstruct(POKENAV_SUBSTRUCT_MENU_GFX, sizeof(struct Pokenav_MenuGfx)); + struct Pokenav_MenuGfx *gfx = AllocSubstruct(POKENAV_SUBSTRUCT_MENU_GFX, sizeof(struct Pokenav_MenuGfx)); if (gfx != NULL) { @@ -420,20 +420,20 @@ static struct Pokenav_MenuGfx * OpenPokenavMenu(void) void CreateMenuHandlerLoopedTask(s32 ltIdx) { - struct Pokenav_MenuGfx * gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_MENU_GFX); + struct Pokenav_MenuGfx *gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_MENU_GFX); gfx->loopedTaskId = CreateLoopedTask(sMenuHandlerLoopTaskFuncs[ltIdx], 1); gfx->isTaskActiveCB = GetCurrentLoopedTaskActive; } bool32 IsMenuHandlerLoopedTaskActive(void) { - struct Pokenav_MenuGfx * gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_MENU_GFX); + struct Pokenav_MenuGfx *gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_MENU_GFX); return gfx->isTaskActiveCB(); } void FreeMenuHandlerSubstruct2(void) { - struct Pokenav_MenuGfx * gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_MENU_GFX); + struct Pokenav_MenuGfx *gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_MENU_GFX); DestroyMovingDotsBgTask(); RemoveWindow(gfx->optionDescWindowId); @@ -444,14 +444,14 @@ void FreeMenuHandlerSubstruct2(void) static bool32 GetCurrentLoopedTaskActive(void) { - struct Pokenav_MenuGfx * gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_MENU_GFX); + struct Pokenav_MenuGfx *gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_MENU_GFX); return IsLoopedTaskActive(gfx->loopedTaskId); } static u32 LoopedTask_OpenMenu(s32 state) { - struct Pokenav_MenuGfx * gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_MENU_GFX); + struct Pokenav_MenuGfx *gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_MENU_GFX); switch (state) { @@ -821,7 +821,7 @@ static void FreeAndDestroyMainMenuSprites(void) static void CreateMenuOptionSprites(void) { s32 i, j; - struct Pokenav_MenuGfx * gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_MENU_GFX); + struct Pokenav_MenuGfx *gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_MENU_GFX); for (i = 0; i < MAX_POKENAV_MENUITEMS; i++) { @@ -837,7 +837,7 @@ static void CreateMenuOptionSprites(void) static void DestroyMenuOptionSprites(void) { s32 i, j; - struct Pokenav_MenuGfx * gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_MENU_GFX); + struct Pokenav_MenuGfx *gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_MENU_GFX); for (i = 0; i < MAX_POKENAV_MENUITEMS; i++) { @@ -858,7 +858,7 @@ static void DrawCurrentMenuOptionLabels(void) static void DrawOptionLabelGfx(const u16 *const *optionGfx, s32 yPos, s32 deltaY) { s32 i, j; - struct Pokenav_MenuGfx * gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_MENU_GFX); + struct Pokenav_MenuGfx *gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_MENU_GFX); s32 baseTile = GetSpriteTileStartByTag(GFXTAG_OPTIONS); for (i = 0; i < MAX_POKENAV_MENUITEMS; i++) @@ -991,7 +991,7 @@ static bool32 AreMenuOptionSpritesMoving(void) #define sSlideSpeed data[2] #define sSlideEndX data[7] -static void StartOptionSlide(struct Sprite ** sprites, s32 startX, s32 endX, s32 time) +static void StartOptionSlide(struct Sprite **sprites, s32 startX, s32 endX, s32 time) { s32 i; @@ -1020,10 +1020,10 @@ static void StartOptionSlide(struct Sprite ** sprites, s32 startX, s32 endX, s32 // When an option is selected it zooms in and blends away as part // of the transition to the next screen. -static void StartOptionZoom(struct Sprite ** sprites) +static void StartOptionZoom(struct Sprite **sprites) { s32 i; - struct Pokenav_MenuGfx * gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_MENU_GFX); + struct Pokenav_MenuGfx *gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_MENU_GFX); u8 taskId; for (i = 0; i < NUM_OPTION_SUBSPRITES; i++) @@ -1045,7 +1045,7 @@ static void StartOptionZoom(struct Sprite ** sprites) gfx->numIconsBlending++; } -static void SetOptionInvisibility(struct Sprite ** sprites, bool32 invisible) +static void SetOptionInvisibility(struct Sprite **sprites, bool32 invisible) { s32 i; @@ -1056,7 +1056,7 @@ static void SetOptionInvisibility(struct Sprite ** sprites, bool32 invisible) } } -static void SpriteCB_OptionSlide(struct Sprite * sprite) +static void SpriteCB_OptionSlide(struct Sprite *sprite) { sprite->sSlideTime--; if (sprite->sSlideTime != -1) @@ -1076,7 +1076,7 @@ static void SpriteCB_OptionSlide(struct Sprite * sprite) #undef sSlideSpeed #undef sSlideEndX -static void SpriteCB_OptionZoom(struct Sprite * sprite) +static void SpriteCB_OptionZoom(struct Sprite *sprite) { s32 temp; s32 x; @@ -1137,7 +1137,7 @@ static void SpriteCB_OptionZoom(struct Sprite * sprite) static void Task_OptionBlend(u8 taskId) { - s16 * data = gTasks[taskId].data; + s16 *data = gTasks[taskId].data; if (tBlendDelay == 0) { @@ -1189,7 +1189,7 @@ static void Task_OptionBlend(u8 taskId) // Blue light that blinks if there are available rematches nearby static void CreateMatchCallBlueLightSprite(void) { - struct Pokenav_MenuGfx * gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_MENU_GFX); + struct Pokenav_MenuGfx *gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_MENU_GFX); u8 spriteId = CreateSprite(&sMatchCallBlueLightSpriteTemplate, 0x10, 0x60, 4); gfx->blueLightSprite = &gSprites[spriteId]; if (AreAnyTrainerRematchesNearby()) @@ -1204,7 +1204,7 @@ static void DestroyRematchBlueLightSprite(void) DestroySprite(gfx->blueLightSprite); } -static void SpriteCB_BlinkingBlueLight(struct Sprite * sprite) +static void SpriteCB_BlinkingBlueLight(struct Sprite *sprite) { sprite->data[0]++; if (sprite->data[0] > 8) @@ -1216,7 +1216,7 @@ static void SpriteCB_BlinkingBlueLight(struct Sprite * sprite) static void AddOptionDescriptionWindow(void) { - struct Pokenav_MenuGfx * gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_MENU_GFX); + struct Pokenav_MenuGfx *gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_MENU_GFX); gfx->optionDescWindowId = AddWindow(&sOptionDescWindowTemplate); PutWindowTilemap(gfx->optionDescWindowId); @@ -1226,7 +1226,7 @@ static void AddOptionDescriptionWindow(void) static void PrintCurrentOptionDescription(void) { - struct Pokenav_MenuGfx * gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_MENU_GFX); + struct Pokenav_MenuGfx *gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_MENU_GFX); int menuItem = GetCurrentMenuItemId(); const u8 *desc = sPageDescriptions[menuItem]; u32 width = GetStringWidth(FONT_NORMAL, desc, -1); @@ -1238,7 +1238,7 @@ static void PrintCurrentOptionDescription(void) // Can occur by obtaining a mon with a ribbon and then releasing all ribbon winners static void PrintNoRibbonWinners(void) { - struct Pokenav_MenuGfx * gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_MENU_GFX); + struct Pokenav_MenuGfx *gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_MENU_GFX); const u8 *s = gText_NoRibbonWinners; u32 width = GetStringWidth(FONT_NORMAL, s, -1); FillWindowPixelBuffer(gfx->optionDescWindowId, PIXEL_FILL(6)); @@ -1252,13 +1252,13 @@ static bool32 IsDma3ManagerBusyWithBgCopy_(void) static void CreateMovingBgDotsTask(void) { - struct Pokenav_MenuGfx * gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_MENU_GFX); + struct Pokenav_MenuGfx *gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_MENU_GFX); gfx->bg3ScrollTaskId = CreateTask(Task_MoveBgDots, 2); } static void DestroyMovingDotsBgTask(void) { - struct Pokenav_MenuGfx * gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_MENU_GFX); + struct Pokenav_MenuGfx *gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_MENU_GFX); DestroyTask(gfx->bg3ScrollTaskId); } @@ -1294,9 +1294,9 @@ static bool32 IsTaskActive_UpdateBgDotsPalette(void) static void Task_UpdateBgDotsPalette(u8 taskId) { u16 sp8[2]; - s16 * data = gTasks[taskId].data; - const u16 * pal1 = (const u16 *)GetWordTaskArg(taskId, 1); - const u16 * pal2 = (const u16 *)GetWordTaskArg(taskId, 3); + s16 *data = gTasks[taskId].data; + const u16 *pal1 = (const u16 *)GetWordTaskArg(taskId, 1); + const u16 *pal2 = (const u16 *)GetWordTaskArg(taskId, 3); PokenavCopyPalette(pal1, pal2, 2, 12, ++data[0], sp8); LoadPalette(sp8, BG_PLTT_ID(3) + 1, PLTT_SIZEOF(2)); @@ -1349,7 +1349,7 @@ static void InitMenuOptionGlow(void) static void Task_CurrentMenuOptionGlow(u8 taskId) { - s16 * data = gTasks[taskId].data; + s16 *data = gTasks[taskId].data; data[0]++; if (data[0] > 0) { diff --git a/src/pokenav_ribbons_list.c b/src/pokenav_ribbons_list.c index 834dc926ad..6b4ce42824 100644 --- a/src/pokenav_ribbons_list.c +++ b/src/pokenav_ribbons_list.c @@ -217,26 +217,26 @@ static u32 UpdateMonListBgs(void) static struct PokenavMonListItem *GetMonRibbonMonListData(void) { - struct Pokenav_RibbonsMonList * list = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST); + struct Pokenav_RibbonsMonList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST); return list->monList->monData; } static s32 GetRibbonsMonListCount(void) { - struct Pokenav_RibbonsMonList * list = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST); + struct Pokenav_RibbonsMonList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST); return list->monList->listCount; } static s32 UNUSED GetMonRibbonSelectedMonData(void) { - struct Pokenav_RibbonsMonList * list = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST); + struct Pokenav_RibbonsMonList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST); s32 idx = PokenavList_GetSelectedIndex(); return list->monList->monData[idx].data; } static s32 GetRibbonListMenuCurrIndex(void) { - struct Pokenav_RibbonsMonList * list = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST); + struct Pokenav_RibbonsMonList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST); return list->monList->currIndex; } @@ -249,7 +249,7 @@ static u32 BuildPartyMonRibbonList(s32 state) { s32 i; struct PokenavMonListItem item; - struct Pokenav_RibbonsMonList * list = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST); + struct Pokenav_RibbonsMonList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST); list->monList->listCount = 0; list->monList->currIndex = 0; @@ -284,7 +284,7 @@ static u32 InitBoxMonRibbonList(s32 state) static u32 BuildBoxMonRibbonList(s32 state) { - struct Pokenav_RibbonsMonList * list = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST); + struct Pokenav_RibbonsMonList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST); s32 boxId = list->boxId; s32 monId = list->monId; s32 boxCount = 0; @@ -408,13 +408,13 @@ bool32 IsRibbonsMonListLoopedTaskActive(void) bool32 GetRibbonsMonCurrentLoopedTaskActive(void) { - struct Pokenav_RibbonsMonMenu * menu = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_MENU); + struct Pokenav_RibbonsMonMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_MENU); return IsLoopedTaskActive(menu->loopedTaskId); } void FreeRibbonsMonMenu(void) { - struct Pokenav_RibbonsMonMenu * menu = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_MENU); + struct Pokenav_RibbonsMonMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_MENU); DestroyPokenavList(); RemoveWindow(menu->winid); FreePokenavSubstruct(POKENAV_SUBSTRUCT_RIBBONS_MON_MENU); @@ -695,13 +695,13 @@ static void CreateRibbonMonsList(void) } // Buffers the "Nickname gender/level" text for the ribbon mon list -static void BufferRibbonMonInfoText(struct PokenavListItem * listItem, u8 *dest) +static void BufferRibbonMonInfoText(struct PokenavListItem *listItem, u8 *dest) { u8 gender; u8 level; u8 *s, *end; const u8 *genderStr; - struct PokenavMonListItem * item = (struct PokenavMonListItem *)listItem; + struct PokenavMonListItem *item = (struct PokenavMonListItem *)listItem; u32 fontId; // Mon is in party @@ -715,7 +715,7 @@ static void BufferRibbonMonInfoText(struct PokenavListItem * listItem, u8 *dest) // Mon is in PC else { - struct BoxPokemon * mon = GetBoxedMonPtr(item->boxId, item->monId); + struct BoxPokemon *mon = GetBoxedMonPtr(item->boxId, item->monId); gender = GetBoxMonGender(mon); level = GetLevelFromBoxMonExp(mon); GetBoxMonData(mon, MON_DATA_NICKNAME, gStringVar3); diff --git a/src/recorded_battle.c b/src/recorded_battle.c index 0b385c017c..7c3c850e86 100644 --- a/src/recorded_battle.c +++ b/src/recorded_battle.c @@ -26,7 +26,7 @@ struct PlayerInfo u32 trainerId; u8 name[PLAYER_NAME_LENGTH + 1]; u8 gender; - u16 battlerId; + u16 battler; u16 language; }; @@ -120,7 +120,7 @@ void RecordedBattle_SetTrainerInfo(void) { sPlayers[i].trainerId = gLinkPlayers[i].trainerId; sPlayers[i].gender = gLinkPlayers[i].gender; - sPlayers[i].battlerId = gLinkPlayers[i].id; + sPlayers[i].battler = gLinkPlayers[i].id; sPlayers[i].language = gLinkPlayers[i].language; // Record names @@ -146,7 +146,7 @@ void RecordedBattle_SetTrainerInfo(void) | (gSaveBlock2Ptr->playerTrainerId[3] << 24); sPlayers[0].gender = gSaveBlock2Ptr->playerGender; - sPlayers[0].battlerId = 0; + sPlayers[0].battler = 0; sPlayers[0].language = gGameLanguage; for (i = 0; i < PLAYER_NAME_LENGTH + 1; i++) @@ -154,32 +154,32 @@ void RecordedBattle_SetTrainerInfo(void) } } -void RecordedBattle_SetBattlerAction(u8 battlerId, u8 action) +void RecordedBattle_SetBattlerAction(u8 battler, u8 action) { - if (sBattlerRecordSizes[battlerId] < BATTLER_RECORD_SIZE && sRecordMode != B_RECORD_MODE_PLAYBACK) - sBattleRecords[battlerId][sBattlerRecordSizes[battlerId]++] = action; + if (sBattlerRecordSizes[battler] < BATTLER_RECORD_SIZE && sRecordMode != B_RECORD_MODE_PLAYBACK) + sBattleRecords[battler][sBattlerRecordSizes[battler]++] = action; } -void RecordedBattle_ClearBattlerAction(u8 battlerId, u8 bytesToClear) +void RecordedBattle_ClearBattlerAction(u8 battler, u8 bytesToClear) { s32 i; for (i = 0; i < bytesToClear; i++) { - sBattlerRecordSizes[battlerId]--; - sBattleRecords[battlerId][sBattlerRecordSizes[battlerId]] = 0xFF; - if (sBattlerRecordSizes[battlerId] == 0) + sBattlerRecordSizes[battler]--; + sBattleRecords[battler][sBattlerRecordSizes[battler]] = 0xFF; + if (sBattlerRecordSizes[battler] == 0) break; } } -u8 RecordedBattle_GetBattlerAction(u32 actionType, u8 battlerId) +u8 RecordedBattle_GetBattlerAction(u32 actionType, u8 battler) { if (gTestRunnerEnabled) - TestRunner_Battle_CheckBattleRecordActionType(battlerId, sBattlerRecordSizes[battlerId], actionType); + TestRunner_Battle_CheckBattleRecordActionType(battler, sBattlerRecordSizes[battler], actionType); // Trying to read past array or invalid action byte, battle is over. - if (sBattlerRecordSizes[battlerId] >= BATTLER_RECORD_SIZE || sBattleRecords[battlerId][sBattlerRecordSizes[battlerId]] == 0xFF) + if (sBattlerRecordSizes[battler] >= BATTLER_RECORD_SIZE || sBattleRecords[battler][sBattlerRecordSizes[battler]] == 0xFF) { gSpecialVar_Result = gBattleOutcome = B_OUTCOME_PLAYER_TELEPORTED; // hah ResetPaletteFadeControl(); @@ -189,7 +189,7 @@ u8 RecordedBattle_GetBattlerAction(u32 actionType, u8 battlerId) } else { - return sBattleRecords[battlerId][sBattlerRecordSizes[battlerId]++]; + return sBattleRecords[battler][sBattlerRecordSizes[battler]++]; } } @@ -239,11 +239,11 @@ void RecordedBattle_RecordAllBattlerData(u8 *src) { for (size = *src; size != 0;) { - u8 battlerId = GetNextRecordedDataByte(src, &idx, &size); + u8 battler = GetNextRecordedDataByte(src, &idx, &size); u8 numActions = GetNextRecordedDataByte(src, &idx, &size); for (i = 0; i < numActions; i++) - sBattleRecords[battlerId][sBattlerSavedRecordSizes[battlerId]++] = GetNextRecordedDataByte(src, &idx, &size); + sBattleRecords[battler][sBattlerSavedRecordSizes[battler]++] = GetNextRecordedDataByte(src, &idx, &size); } } } @@ -310,7 +310,7 @@ bool32 MoveRecordedBattleToSaveData(void) battleSave->playersName[i][j] = sPlayers[i].name[j]; battleSave->playersGender[i] = sPlayers[i].gender; battleSave->playersLanguage[i] = sPlayers[i].language; - battleSave->playersBattlers[i] = sPlayers[i].battlerId; + battleSave->playersBattlers[i] = sPlayers[i].battler; battleSave->playersTrainerId[i] = sPlayers[i].trainerId; } @@ -329,16 +329,16 @@ bool32 MoveRecordedBattleToSaveData(void) } else if (sBattleFlags & BATTLE_TYPE_MULTI) { - switch (sPlayers[0].battlerId) + switch (sPlayers[0].battler) { case 0: case 2: - if (!(sPlayers[gRecordedBattleMultiplayerId].battlerId & 1)) + if (!(sPlayers[gRecordedBattleMultiplayerId].battler & 1)) battleSave->battleFlags |= BATTLE_TYPE_RECORDED_IS_MASTER; break; case 1: case 3: - if ((sPlayers[gRecordedBattleMultiplayerId].battlerId & 1)) + if ((sPlayers[gRecordedBattleMultiplayerId].battler & 1)) battleSave->battleFlags |= BATTLE_TYPE_RECORDED_IS_MASTER; break; } @@ -683,35 +683,35 @@ void RecordedBattle_CopyBattlerMoves(u32 battler) void RecordedBattle_CheckMovesetChanges(u8 mode) { - s32 battlerId, j, k; + s32 battler, j, k; if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK)) return; - for (battlerId = 0; battlerId < gBattlersCount; battlerId++) + for (battler = 0; battler < gBattlersCount; battler++) { // Player's side only - if (GetBattlerSide(battlerId) != B_SIDE_OPPONENT) + if (GetBattlerSide(battler) != B_SIDE_OPPONENT) { if (mode == B_RECORD_MODE_RECORDING) { // Check if any of the battler's moves have changed. for (j = 0; j < MAX_MON_MOVES; j++) { - if (gBattleMons[battlerId].moves[j] != sPlayerMonMoves[battlerId / 2][j]) + if (gBattleMons[battler].moves[j] != sPlayerMonMoves[battler / 2][j]) break; } if (j != MAX_MON_MOVES) { // At least one of the moves has been changed - RecordedBattle_SetBattlerAction(battlerId, ACTION_MOVE_CHANGE); + RecordedBattle_SetBattlerAction(battler, ACTION_MOVE_CHANGE); for (j = 0; j < MAX_MON_MOVES; j++) { for (k = 0; k < MAX_MON_MOVES; k++) { - if (gBattleMons[battlerId].moves[j] == sPlayerMonMoves[battlerId / 2][k]) + if (gBattleMons[battler].moves[j] == sPlayerMonMoves[battler / 2][k]) { - RecordedBattle_SetBattlerAction(battlerId, k); + RecordedBattle_SetBattlerAction(battler, k); break; } } @@ -720,7 +720,7 @@ void RecordedBattle_CheckMovesetChanges(u8 mode) } else // B_RECORD_MODE_PLAYBACK { - if (sBattleRecords[battlerId][sBattlerRecordSizes[battlerId]] == ACTION_MOVE_CHANGE) + if (sBattleRecords[battler][sBattlerRecordSizes[battler]] == ACTION_MOVE_CHANGE) { u8 ppBonuses[MAX_MON_MOVES]; u8 moveSlots[MAX_MON_MOVES]; @@ -730,55 +730,55 @@ void RecordedBattle_CheckMovesetChanges(u8 mode) // We know the current action is ACTION_MOVE_CHANGE, retrieve // it without saving it to move on to the next action. - RecordedBattle_GetBattlerAction(RECORDED_BYTE, battlerId); + RecordedBattle_GetBattlerAction(RECORDED_BYTE, battler); for (j = 0; j < MAX_MON_MOVES; j++) - ppBonuses[j] = ((gBattleMons[battlerId].ppBonuses & (3 << (j << 1))) >> (j << 1)); + ppBonuses[j] = ((gBattleMons[battler].ppBonuses & (3 << (j << 1))) >> (j << 1)); for (j = 0; j < MAX_MON_MOVES; j++) { - moveSlots[j] = RecordedBattle_GetBattlerAction(RECORDED_BYTE, battlerId); - movePp.moves[j] = gBattleMons[battlerId].moves[moveSlots[j]]; - movePp.currentPp[j] = gBattleMons[battlerId].pp[moveSlots[j]]; + moveSlots[j] = RecordedBattle_GetBattlerAction(RECORDED_BYTE, battler); + movePp.moves[j] = gBattleMons[battler].moves[moveSlots[j]]; + movePp.currentPp[j] = gBattleMons[battler].pp[moveSlots[j]]; movePp.maxPp[j] = ppBonuses[moveSlots[j]]; - mimickedMoveSlots[j] = (gDisableStructs[battlerId].mimickedMoves & (1u << j)) >> j; + mimickedMoveSlots[j] = (gDisableStructs[battler].mimickedMoves & (1u << j)) >> j; } for (j = 0; j < MAX_MON_MOVES; j++) { - gBattleMons[battlerId].moves[j] = movePp.moves[j]; - gBattleMons[battlerId].pp[j] = movePp.currentPp[j]; + gBattleMons[battler].moves[j] = movePp.moves[j]; + gBattleMons[battler].pp[j] = movePp.currentPp[j]; } - gBattleMons[battlerId].ppBonuses = 0; - gDisableStructs[battlerId].mimickedMoves = 0; + gBattleMons[battler].ppBonuses = 0; + gDisableStructs[battler].mimickedMoves = 0; for (j = 0; j < MAX_MON_MOVES; j++) { - gBattleMons[battlerId].ppBonuses |= movePp.maxPp[j] << (j << 1); - gDisableStructs[battlerId].mimickedMoves |= mimickedMoveSlots[j] << j; + gBattleMons[battler].ppBonuses |= movePp.maxPp[j] << (j << 1); + gDisableStructs[battler].mimickedMoves |= mimickedMoveSlots[j] << j; } - if (!(gBattleMons[battlerId].status2 & STATUS2_TRANSFORMED)) + if (!(gBattleMons[battler].status2 & STATUS2_TRANSFORMED)) { for (j = 0; j < MAX_MON_MOVES; j++) - ppBonuses[j] = (GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_PP_BONUSES, NULL) & ((3 << (j << 1)))) >> (j << 1); + ppBonuses[j] = (GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_PP_BONUSES, NULL) & ((3 << (j << 1)))) >> (j << 1); for (j = 0; j < MAX_MON_MOVES; j++) { - movePp.moves[j] = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_MOVE1 + moveSlots[j], NULL); - movePp.currentPp[j] = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_PP1 + moveSlots[j], NULL); + movePp.moves[j] = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_MOVE1 + moveSlots[j], NULL); + movePp.currentPp[j] = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_PP1 + moveSlots[j], NULL); movePp.maxPp[j] = ppBonuses[moveSlots[j]]; } for (j = 0; j < MAX_MON_MOVES; j++) { - SetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_MOVE1 + j, &movePp.moves[j]); - SetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_PP1 + j, &movePp.currentPp[j]); + SetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_MOVE1 + j, &movePp.moves[j]); + SetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_PP1 + j, &movePp.currentPp[j]); } ppBonusSet = 0; for (j = 0; j < MAX_MON_MOVES; j++) ppBonusSet |= movePp.maxPp[j] << (j << 1); - SetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_PP_BONUSES, &ppBonusSet); + SetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_PP_BONUSES, &ppBonusSet); } - gChosenMoveByBattler[battlerId] = gBattleMons[battlerId].moves[gBattleStruct->chosenMovePositions[battlerId]]; + gChosenMoveByBattler[battler] = gBattleMons[battler].moves[gBattleStruct->chosenMovePositions[battler]]; } } } diff --git a/src/rom_header_gf.c b/src/rom_header_gf.c index c55535003c..af065b5e8b 100644 --- a/src/rom_header_gf.c +++ b/src/rom_header_gf.c @@ -21,16 +21,16 @@ struct GFRomHeader u32 version; u32 language; u8 gameName[32]; - const struct CompressedSpriteSheet * monFrontPics; - const struct CompressedSpriteSheet * monBackPics; - const struct CompressedSpritePalette * monNormalPalettes; - const struct CompressedSpritePalette * monShinyPalettes; - const u8 *const * monIcons; + const struct CompressedSpriteSheet *monFrontPics; + const struct CompressedSpriteSheet *monBackPics; + const struct CompressedSpritePalette *monNormalPalettes; + const struct CompressedSpritePalette *monShinyPalettes; + const u8 *const *monIcons; const u8 *monIconPaletteIds; - const struct SpritePalette * monIconPalettes; - const u8 (* monSpeciesNames)[]; - const u8 (* moveNames)[]; - const struct Decoration * decorations; + const struct SpritePalette *monIconPalettes; + const u8 (*monSpeciesNames)[]; + const u8 (*moveNames)[]; + const struct Decoration *decorations; u32 flagsOffset; u32 varsOffset; u32 pokedexOffset; @@ -70,13 +70,13 @@ struct GFRomHeader u32 externalEventFlagsOffset; u32 externalEventDataOffset; u32 unk18; - const struct SpeciesInfo * speciesInfo; - const u8 (* abilityNames)[]; - const u8 *const * abilityDescriptions; - const struct Item * items; - const struct MoveInfo * moves; - const struct CompressedSpriteSheet * ballGfx; - const struct CompressedSpritePalette * ballPalettes; + const struct SpeciesInfo *speciesInfo; + const u8 (*abilityNames)[]; + const u8 *const *abilityDescriptions; + const struct Item *items; + const struct MoveInfo *moves; + const struct CompressedSpriteSheet *ballGfx; + const struct CompressedSpritePalette *ballPalettes; u32 gcnLinkFlagsOffset; u32 gameClearFlag; u32 ribbonFlag; diff --git a/src/save.c b/src/save.c index 65e496b0d0..4e6c41b6f9 100644 --- a/src/save.c +++ b/src/save.c @@ -836,7 +836,7 @@ bool8 LinkFullSave_SetLastSectorSignature(void) return FALSE; } -u8 WriteSaveBlock2(void) +bool8 WriteSaveBlock2(void) { if (gFlashMemoryPresent != TRUE) return TRUE; @@ -920,7 +920,7 @@ u8 LoadGameSave(u8 saveType) u16 GetSaveBlocksPointersBaseOffset(void) { u16 i, slotOffset; - struct SaveSector* sector; + struct SaveSector *sector; sector = gReadWriteSector = &gSaveDataBuffer; if (gFlashMemoryPresent != TRUE) diff --git a/src/scrcmd.c b/src/scrcmd.c index f988bff6ea..4f047b24ea 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -79,7 +79,7 @@ static void DynamicMultichoiceSortList(struct ListMenuItem *items, u32 count); // This is defined in here so the optimizer can't see its value when compiling // script.c. -void * const gNullScriptPtr = NULL; +void *const gNullScriptPtr = NULL; static const u8 sScriptConditionTable[6][3] = { @@ -2138,11 +2138,11 @@ bool8 ScrCmd_bufferdecorationname(struct ScriptContext *ctx) bool8 ScrCmd_buffermovename(struct ScriptContext *ctx) { u8 stringVarIndex = ScriptReadByte(ctx); - u16 moveId = VarGet(ScriptReadHalfword(ctx)); + u16 move = VarGet(ScriptReadHalfword(ctx)); Script_RequestEffects(SCREFF_V1); - StringCopy(sScriptStringVars[stringVarIndex], GetMoveName(moveId)); + StringCopy(sScriptStringVars[stringVarIndex], GetMoveName(move)); return FALSE; } @@ -2250,7 +2250,7 @@ bool8 ScrCmd_setmonmove(struct ScriptContext *ctx) bool8 ScrCmd_checkpartymove(struct ScriptContext *ctx) { u8 i; - u16 moveId = ScriptReadHalfword(ctx); + u16 move = ScriptReadHalfword(ctx); Script_RequestEffects(SCREFF_V1); @@ -2260,7 +2260,7 @@ bool8 ScrCmd_checkpartymove(struct ScriptContext *ctx) u16 species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL); if (!species) break; - if (!GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG) && MonKnowsMove(&gPlayerParty[i], moveId) == TRUE) + if (!GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG) && MonKnowsMove(&gPlayerParty[i], move) == TRUE) { gSpecialVar_Result = i; gSpecialVar_0x8004 = species; diff --git a/src/script.c b/src/script.c index 96a33acd05..69c35ef6ec 100644 --- a/src/script.c +++ b/src/script.c @@ -35,7 +35,7 @@ EWRAM_DATA u8 gMsgBoxIsCancelable = FALSE; extern ScrCmdFunc gScriptCmdTable[]; extern ScrCmdFunc gScriptCmdTableEnd[]; -extern void * const gNullScriptPtr; +extern void *const gNullScriptPtr; void InitScriptContext(struct ScriptContext *ctx, void *cmdTable, void *cmdTableEnd) { diff --git a/src/secret_base.c b/src/secret_base.c index d4dc43c5bd..7ec41253c4 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -771,7 +771,7 @@ static u8 GetAverageEVs(struct Pokemon *pokemon) void SetPlayerSecretBaseParty(void) { u16 i; - u16 moveIdx; + u16 moveIndex; u16 partyId; struct SecretBaseParty *party; @@ -781,8 +781,8 @@ void SetPlayerSecretBaseParty(void) { for (i = 0; i < PARTY_SIZE; i++) { - for (moveIdx = 0; moveIdx < MAX_MON_MOVES; moveIdx++) - party->moves[i * MAX_MON_MOVES + moveIdx] = MOVE_NONE; + for (moveIndex = 0; moveIndex < MAX_MON_MOVES; moveIndex++) + party->moves[i * MAX_MON_MOVES + moveIndex] = MOVE_NONE; party->species[i] = SPECIES_NONE; party->heldItems[i] = ITEM_NONE; @@ -793,8 +793,8 @@ void SetPlayerSecretBaseParty(void) if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) != SPECIES_NONE && !GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG)) { - for (moveIdx = 0; moveIdx < MAX_MON_MOVES; moveIdx++) - party->moves[partyId * MAX_MON_MOVES + moveIdx] = GetMonData(&gPlayerParty[i], MON_DATA_MOVE1 + moveIdx); + for (moveIndex = 0; moveIndex < MAX_MON_MOVES; moveIndex++) + party->moves[partyId * MAX_MON_MOVES + moveIndex] = GetMonData(&gPlayerParty[i], MON_DATA_MOVE1 + moveIndex); party->species[partyId] = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES); party->heldItems[partyId] = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM); diff --git a/src/shop.c b/src/shop.c index 72d4f1685b..3f47600460 100644 --- a/src/shop.c +++ b/src/shop.c @@ -372,7 +372,7 @@ static u8 CreateShopMenu(u8 martType) return CreateTask(Task_ShopMenu, 8); } -static void SetShopMenuCallback(void (* callback)(void)) +static void SetShopMenuCallback(void (*callback)(void)) { sMartInfo.callback = callback; } @@ -606,7 +606,7 @@ static void BuyMenuPrintItemDescriptionAndShowItemIcon(s32 item, bool8 onInit, s if (item != LIST_CANCEL) { if (sMartInfo.martType == MART_TYPE_NORMAL) - description = ItemId_GetDescription(item); + description = GetItemDescription(item); else description = gDecorations[item].description; } @@ -629,7 +629,7 @@ static void BuyMenuPrintPriceInList(u8 windowId, u32 itemId, u8 y) { ConvertIntToDecimalStringN( gStringVar1, - ItemId_GetPrice(itemId) >> IsPokeNewsActive(POKENEWS_SLATEPORT), + GetItemPrice(itemId) >> IsPokeNewsActive(POKENEWS_SLATEPORT), STR_CONV_MODE_LEFT_ALIGN, 6); } @@ -642,7 +642,7 @@ static void BuyMenuPrintPriceInList(u8 windowId, u32 itemId, u8 y) 6); } - if (ItemId_GetImportance(itemId) && (CheckBagHasItem(itemId, 1) || CheckPCHasItem(itemId, 1))) + if (GetItemImportance(itemId) && (CheckBagHasItem(itemId, 1) || CheckPCHasItem(itemId, 1))) StringCopy(gStringVar4, gText_SoldOut); else StringExpandPlaceholders(gStringVar4, gText_PokedollarVar1); @@ -1000,11 +1000,11 @@ static void Task_BuyMenu(u8 taskId) BuyMenuPrintCursor(tListTaskId, COLORID_GRAY_CURSOR); if (sMartInfo.martType == MART_TYPE_NORMAL) - sShopData->totalCost = (ItemId_GetPrice(itemId) >> IsPokeNewsActive(POKENEWS_SLATEPORT)); + sShopData->totalCost = (GetItemPrice(itemId) >> IsPokeNewsActive(POKENEWS_SLATEPORT)); else sShopData->totalCost = gDecorations[itemId].price; - if (ItemId_GetImportance(itemId) && (CheckBagHasItem(itemId, 1) || CheckPCHasItem(itemId, 1))) + if (GetItemImportance(itemId) && (CheckBagHasItem(itemId, 1) || CheckPCHasItem(itemId, 1))) BuyMenuDisplayMessage(taskId, gText_ThatItemIsSoldOut, BuyMenuReturnToItemList); else if (!IsEnoughMoney(&gSaveBlock1Ptr->money, sShopData->totalCost)) { @@ -1015,15 +1015,15 @@ static void Task_BuyMenu(u8 taskId) if (sMartInfo.martType == MART_TYPE_NORMAL) { CopyItemName(itemId, gStringVar1); - if (ItemId_GetImportance(itemId)) + if (GetItemImportance(itemId)) { ConvertIntToDecimalStringN(gStringVar2, sShopData->totalCost, STR_CONV_MODE_LEFT_ALIGN, 6); StringExpandPlaceholders(gStringVar4, gText_YouWantedVar1ThatllBeVar2); tItemCount = 1; - sShopData->totalCost = (ItemId_GetPrice(tItemId) >> IsPokeNewsActive(POKENEWS_SLATEPORT)) * tItemCount; + sShopData->totalCost = (GetItemPrice(tItemId) >> IsPokeNewsActive(POKENEWS_SLATEPORT)) * tItemCount; BuyMenuDisplayMessage(taskId, gStringVar4, BuyMenuConfirmPurchase); } - else if (ItemId_GetPocket(itemId) == POCKET_TM_HM) + else if (GetItemPocket(itemId) == POCKET_TM_HM) { StringCopy(gStringVar2, GetMoveName(ItemIdToBattleMoveId(itemId))); BuyMenuDisplayMessage(taskId, gText_Var1CertainlyHowMany2, Task_BuyHowManyDialogueInit); @@ -1087,7 +1087,7 @@ static void Task_BuyHowManyDialogueHandleInput(u8 taskId) if (AdjustQuantityAccordingToDPadInput(&tItemCount, sShopData->maxQuantity) == TRUE) { - sShopData->totalCost = (ItemId_GetPrice(tItemId) >> IsPokeNewsActive(POKENEWS_SLATEPORT)) * tItemCount; + sShopData->totalCost = (GetItemPrice(tItemId) >> IsPokeNewsActive(POKENEWS_SLATEPORT)) * tItemCount; BuyMenuPrintItemQuantityAndPrice(taskId); } else @@ -1179,7 +1179,7 @@ static void Task_ReturnToItemListAfterItemPurchase(u8 taskId) u16 premierBallsToAdd = tItemCount / 10; if (premierBallsToAdd >= 1 && ((I_PREMIER_BALL_BONUS <= GEN_7 && tItemId == ITEM_POKE_BALL) - || (I_PREMIER_BALL_BONUS >= GEN_8 && (ItemId_GetPocket(tItemId) == POCKET_POKE_BALLS)))) + || (I_PREMIER_BALL_BONUS >= GEN_8 && (GetItemPocket(tItemId) == POCKET_POKE_BALLS)))) { u32 spaceAvailable = GetFreeSpaceForItemInBag(ITEM_PREMIER_BALL); if (spaceAvailable < premierBallsToAdd) diff --git a/src/sound.c b/src/sound.c index 9a67f2c21b..5b4ae29f71 100644 --- a/src/sound.c +++ b/src/sound.c @@ -16,7 +16,7 @@ struct Fanfare u16 duration; }; -EWRAM_DATA struct MusicPlayerInfo* gMPlay_PokemonCry = NULL; +EWRAM_DATA struct MusicPlayerInfo *gMPlay_PokemonCry = NULL; EWRAM_DATA u8 gPokemonCryBGMDuckingCounter = 0; static u16 sCurrentMapMusic; diff --git a/src/sprays.c b/src/sprays.c index b553d125ac..1a57e3fe26 100644 --- a/src/sprays.c +++ b/src/sprays.c @@ -86,7 +86,7 @@ void DrawSprayMenu(void) if (!CheckBagHasItem(currentSpray, 1)) continue; - menuItems[count].text = ItemId_GetName(currentSpray); + menuItems[count].text = GetItemName(currentSpray); VarSet(LOCAL_VAR_SPRAY_CONST + count, currentSpray); if (VAR_LAST_REPEL_LURE_USED != 0) @@ -109,7 +109,7 @@ void HandleSprayMenuChoice(void) LOCAL_VAR_SPRAY = VarGet(LOCAL_VAR_SPRAY_CONST + gSpecialVar_Result); - VarSet(VAR_REPEL_STEP_COUNT, ItemId_GetHoldEffectParam(LOCAL_VAR_SPRAY) | lureMask); + VarSet(VAR_REPEL_STEP_COUNT, GetItemHoldEffectParam(LOCAL_VAR_SPRAY) | lureMask); if (VAR_LAST_REPEL_LURE_USED != 0) VarSet(VAR_LAST_REPEL_LURE_USED, LOCAL_VAR_SPRAY); diff --git a/src/sprite.c b/src/sprite.c index eb458cb616..4acb4ee943 100644 --- a/src/sprite.c +++ b/src/sprite.c @@ -112,8 +112,8 @@ typedef void (*AffineAnimCmdFunc)(u8 matrixNum, struct Sprite *); #define AFFINE_ANIM_END 0x7FFF // forward declarations -const union AnimCmd * const gDummySpriteAnimTable[]; -const union AffineAnimCmd * const gDummySpriteAffineAnimTable[]; +const union AnimCmd *const gDummySpriteAnimTable[]; +const union AffineAnimCmd *const gDummySpriteAffineAnimTable[]; const struct SpriteTemplate gDummySpriteTemplate; static const u8 sCenterToCornerVecTable[3][4][2] = @@ -154,11 +154,11 @@ const struct OamData gDummyOamData = DUMMY_OAM_DATA; static const union AnimCmd sDummyAnim = { ANIM_END }; -const union AnimCmd * const gDummySpriteAnimTable[] = { &sDummyAnim }; +const union AnimCmd *const gDummySpriteAnimTable[] = { &sDummyAnim }; static const union AffineAnimCmd sDummyAffineAnim = { AFFINE_ANIM_END }; -const union AffineAnimCmd * const gDummySpriteAffineAnimTable[] = { &sDummyAffineAnim }; +const union AffineAnimCmd *const gDummySpriteAffineAnimTable[] = { &sDummyAffineAnim }; const struct SpriteTemplate gDummySpriteTemplate = { diff --git a/src/starter_choose.c b/src/starter_choose.c index 01b6600053..7eaff8254d 100644 --- a/src/starter_choose.c +++ b/src/starter_choose.c @@ -248,18 +248,18 @@ static const union AnimCmd sAnim_StarterCircle[] = ANIMCMD_END, }; -static const union AnimCmd * const sAnims_Hand[] = +static const union AnimCmd *const sAnims_Hand[] = { sAnim_Hand, }; -static const union AnimCmd * const sAnims_Pokeball[] = +static const union AnimCmd *const sAnims_Pokeball[] = { sAnim_Pokeball_Still, sAnim_Pokeball_Moving, }; -static const union AnimCmd * const sAnims_StarterCircle[] = +static const union AnimCmd *const sAnims_StarterCircle[] = { sAnim_StarterCircle, }; @@ -278,8 +278,8 @@ static const union AffineAnimCmd sAffineAnim_StarterCircle[] = AFFINEANIMCMD_END, }; -static const union AffineAnimCmd * const sAffineAnims_StarterPokemon = {sAffineAnim_StarterPokemon}; -static const union AffineAnimCmd * const sAffineAnims_StarterCircle[] = {sAffineAnim_StarterCircle}; +static const union AffineAnimCmd *const sAffineAnims_StarterPokemon = {sAffineAnim_StarterPokemon}; +static const union AffineAnimCmd *const sAffineAnims_StarterCircle[] = {sAffineAnim_StarterCircle}; static const struct CompressedSpriteSheet sSpriteSheet_PokeballSelect[] = { diff --git a/src/trader.c b/src/trader.c index 48ce5d2681..2e427e6f04 100644 --- a/src/trader.c +++ b/src/trader.c @@ -58,7 +58,7 @@ void Trader_ResetFlag(void) void CreateAvailableDecorationsMenu(u8 taskId) { u8 i; - s16 * data = gTasks[taskId].data; + s16 *data = gTasks[taskId].data; struct MauvilleOldManTrader *trader = &gSaveBlock1Ptr->oldMan.trader; struct WindowTemplate windowTemplate = { .bg = 0, @@ -98,7 +98,7 @@ void CreateAvailableDecorationsMenu(u8 taskId) void Task_BufferDecorSelectionAndCloseWindow(u8 taskId, u8 decorationId) { - s16 * data = gTasks[taskId].data; + s16 *data = gTasks[taskId].data; if (decorationId > NUM_DECORATIONS) gSpecialVar_0x8004 = 0xFFFF; else diff --git a/src/trainer_hill.c b/src/trainer_hill.c index ce2b894bf0..0acc8b2168 100644 --- a/src/trainer_hill.c +++ b/src/trainer_hill.c @@ -229,7 +229,7 @@ static const u8 *const sFloorStrings[] = gText_TrainerHill4F, }; -static void (* const sHillFunctions[])(void) = +static void (*const sHillFunctions[])(void) = { [TRAINER_HILL_FUNC_START] = TrainerHillStartChallenge, [TRAINER_HILL_FUNC_GET_OWNER_STATE] = GetOwnerState, diff --git a/src/tv.c b/src/tv.c index 8313ee9bf5..d9dee01d5f 100644 --- a/src/tv.c +++ b/src/tv.c @@ -2169,7 +2169,7 @@ void TryPutLotteryWinnerReportOnAir(void) } } -void TryPutBattleSeminarOnAir(u16 foeSpecies, u16 species, u8 moveIdx, const u16 *movePtr, u16 betterMove) +void TryPutBattleSeminarOnAir(u16 foeSpecies, u16 species, u8 moveIndex, const u16 *movePtr, u16 betterMove) { TVShow *show; u8 i; @@ -2184,10 +2184,10 @@ void TryPutBattleSeminarOnAir(u16 foeSpecies, u16 species, u8 moveIdx, const u16 StringCopy(show->battleSeminar.playerName, gSaveBlock2Ptr->playerName); show->battleSeminar.foeSpecies = foeSpecies; show->battleSeminar.species = species; - show->battleSeminar.move = movePtr[moveIdx]; + show->battleSeminar.move = movePtr[moveIndex]; for (i = 0, j = 0; i < MAX_MON_MOVES; i++) { - if (i != moveIdx && movePtr[i]) + if (i != moveIndex && movePtr[i]) { show->battleSeminar.otherMoves[j] = movePtr[i]; j++; @@ -2777,7 +2777,7 @@ static void SmartShopper_BufferPurchaseTotal(u8 varIdx, TVShow *show) for (i = 0; i < SMARTSHOPPER_NUM_ITEMS; i++) { if (show->smartshopperShow.itemIds[i] != ITEM_NONE) - price += ItemId_GetPrice(show->smartshopperShow.itemIds[i]) * show->smartshopperShow.itemAmounts[i]; + price += GetItemPrice(show->smartshopperShow.itemIds[i]) * show->smartshopperShow.itemAmounts[i]; } if (show->smartshopperShow.priceReduced == TRUE) @@ -4459,7 +4459,7 @@ static void DoTVShowTodaysSmartShopper(void) break; case SMARTSHOPPER_STATE_CLERK_NORMAL: TVShowConvertInternationalString(gStringVar1, show->smartshopperShow.playerName, show->smartshopperShow.language); - StringCopy(gStringVar2, ItemId_GetName(show->smartshopperShow.itemIds[0])); + StringCopy(gStringVar2, GetItemName(show->smartshopperShow.itemIds[0])); ConvertIntToDecimalString(2, show->smartshopperShow.itemAmounts[0]); // Pick a random comment (SMARTSHOPPER_STATE_RAND_COMMENT_#) sTVShowState += SMARTSHOPPER_STATE_CLERK_NORMAL + (Random() % (SMARTSHOPPER_STATE_RAND_COMMENT_4 - SMARTSHOPPER_STATE_RAND_COMMENT_1 + 1)); @@ -4481,7 +4481,7 @@ static void DoTVShowTodaysSmartShopper(void) break; case SMARTSHOPPER_STATE_SECOND_ITEM: // Clerk describes 2nd type of item player purchased - StringCopy(gStringVar2, ItemId_GetName(show->smartshopperShow.itemIds[1])); + StringCopy(gStringVar2, GetItemName(show->smartshopperShow.itemIds[1])); ConvertIntToDecimalString(2, show->smartshopperShow.itemAmounts[1]); if (show->smartshopperShow.itemIds[2] != ITEM_NONE) sTVShowState = SMARTSHOPPER_STATE_THIRD_ITEM; @@ -4492,7 +4492,7 @@ static void DoTVShowTodaysSmartShopper(void) break; case SMARTSHOPPER_STATE_THIRD_ITEM: // Clerk describes 3rd type of item player purchased - StringCopy(gStringVar2, ItemId_GetName(show->smartshopperShow.itemIds[2])); + StringCopy(gStringVar2, GetItemName(show->smartshopperShow.itemIds[2])); ConvertIntToDecimalString(2, show->smartshopperShow.itemAmounts[2]); if (show->smartshopperShow.priceReduced == TRUE) sTVShowState = SMARTSHOPPER_STATE_DURING_SALE; @@ -4520,7 +4520,7 @@ static void DoTVShowTodaysSmartShopper(void) case SMARTSHOPPER_STATE_CLERK_MAX: // Clerk's comments if player purchased maximum number of 1st item TVShowConvertInternationalString(gStringVar1, show->smartshopperShow.playerName, show->smartshopperShow.language); - StringCopy(gStringVar2, ItemId_GetName(show->smartshopperShow.itemIds[0])); + StringCopy(gStringVar2, GetItemName(show->smartshopperShow.itemIds[0])); if (show->smartshopperShow.priceReduced == TRUE) sTVShowState = SMARTSHOPPER_STATE_DURING_SALE; else @@ -4644,7 +4644,7 @@ static void DoTVShowPokemonTodaySuccessfulCapture(void) sTVShowState = 2; break; case 2: - StringCopy(gStringVar2, ItemId_GetName(show->pokemonToday.ball)); + StringCopy(gStringVar2, GetItemName(show->pokemonToday.ball)); ConvertIntToDecimalString(2, show->pokemonToday.nBallsUsed); if (show->pokemonToday.nBallsUsed < 4) sTVShowState = 3; @@ -5684,7 +5684,7 @@ static void DoTVShowHoennTreasureInvestigators(void) switch (state) { case 0: - StringCopy(gStringVar1, ItemId_GetName(show->treasureInvestigators.item)); + StringCopy(gStringVar1, GetItemName(show->treasureInvestigators.item)); if (show->treasureInvestigators.location == MAPSEC_DYNAMIC) { switch (show->treasureInvestigators.mapLayoutId) @@ -5705,13 +5705,13 @@ static void DoTVShowHoennTreasureInvestigators(void) } break; case 1: - StringCopy(gStringVar1, ItemId_GetName(show->treasureInvestigators.item)); + StringCopy(gStringVar1, GetItemName(show->treasureInvestigators.item)); TVShowConvertInternationalString(gStringVar2, show->treasureInvestigators.playerName, show->treasureInvestigators.language); GetMapName(gStringVar3, show->treasureInvestigators.location, 0); TVShowDone(); break; case 2: - StringCopy(gStringVar1, ItemId_GetName(show->treasureInvestigators.item)); + StringCopy(gStringVar1, GetItemName(show->treasureInvestigators.item)); TVShowConvertInternationalString(gStringVar2, show->treasureInvestigators.playerName, show->treasureInvestigators.language); TVShowDone(); break; @@ -5819,7 +5819,7 @@ static void DoTVShowBreakingNewsTV(void) break; case 3: ConvertIntToDecimalString(0, show->breakingNews.balls); - StringCopy(gStringVar2, ItemId_GetName(show->breakingNews.caughtMonBall)); + StringCopy(gStringVar2, GetItemName(show->breakingNews.caughtMonBall)); sTVShowState = 4; break; case 4: @@ -5981,7 +5981,7 @@ static void DoTVShowPokemonLotteryWinnerFlashReport(void) StringCopy(gStringVar2, gText_Second); else StringCopy(gStringVar2, gText_Third); - StringCopy(gStringVar3, ItemId_GetName(show->lottoWinner.item)); + StringCopy(gStringVar3, GetItemName(show->lottoWinner.item)); TVShowDone(); ShowFieldMessage(sTVPokemonLotteryWinnerFlashReportTextGroup[state]); } @@ -6665,7 +6665,7 @@ static void DoTVShowSecretBaseSecrets(void) sTVShowState = show->secretBaseSecrets.savedState; break; case SBSECRETS_STATE_USED_BAG: - StringCopy(gStringVar2, ItemId_GetName(show->secretBaseSecrets.item)); + StringCopy(gStringVar2, GetItemName(show->secretBaseSecrets.item)); sTVShowState = show->secretBaseSecrets.savedState; break; case SBSECRETS_STATE_USED_CUSHION: diff --git a/src/union_room.c b/src/union_room.c index 9fc2126880..69598315b5 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -1629,7 +1629,7 @@ static void CB2_TransitionToCableClub(void) static void CreateTrainerCardInBuffer(void *dest, bool32 setWonderCard) { - struct TrainerCard * card = (struct TrainerCard *)dest; + struct TrainerCard *card = (struct TrainerCard *)dest; TrainerCard_GenerateCardForLinkPlayer(card); // Below field is re-used, to be read by Task_ExchangeCards @@ -3502,10 +3502,10 @@ static void Task_SearchForChildOrParent(u8 taskId) } } -static u8 CreateTask_SearchForChildOrParent(struct RfuIncomingPlayerList * parentList, struct RfuIncomingPlayerList * childList, u32 linkGroup) +static u8 CreateTask_SearchForChildOrParent(struct RfuIncomingPlayerList *parentList, struct RfuIncomingPlayerList *childList, u32 linkGroup) { u8 taskId = CreateTask(Task_SearchForChildOrParent, 0); - struct RfuIncomingPlayerList ** data = (void *)gTasks[taskId].data; + struct RfuIncomingPlayerList **data = (void *)gTasks[taskId].data; data[0] = parentList; data[1] = childList; gTasks[taskId].data[4] = linkGroup; @@ -3569,7 +3569,7 @@ static void Task_ListenForWonderDistributor(u8 taskId) } } -static u8 CreateTask_ListenForCompatiblePartners(struct RfuIncomingPlayerList * list, u32 linkGroup) +static u8 CreateTask_ListenForCompatiblePartners(struct RfuIncomingPlayerList *list, u32 linkGroup) { u8 taskId = CreateTask(Task_ListenForCompatiblePartners, 0); struct RfuIncomingPlayerList **oldList = (void *) gTasks[taskId].data; @@ -3578,7 +3578,7 @@ static u8 CreateTask_ListenForCompatiblePartners(struct RfuIncomingPlayerList * return taskId; } -static u8 CreateTask_ListenForWonderDistributor(struct RfuIncomingPlayerList * list, u32 linkGroup) +static u8 CreateTask_ListenForWonderDistributor(struct RfuIncomingPlayerList *list, u32 linkGroup) { u8 taskId = CreateTask(Task_ListenForWonderDistributor, 0); struct RfuIncomingPlayerList **oldList = (void *) gTasks[taskId].data; @@ -3656,7 +3656,7 @@ static s8 UnionRoomHandleYesNo(u8 *state, bool32 noDraw) return MENU_NOTHING_CHOSEN; } -static u8 CreateTradeBoardWindow(const struct WindowTemplate * template) +static u8 CreateTradeBoardWindow(const struct WindowTemplate *template) { u8 windowId = AddWindow(template); DrawStdWindowFrame(windowId, FALSE); @@ -3886,7 +3886,7 @@ static void ClearIncomingPlayerList(struct RfuIncomingPlayerList *list, u8 count } // Checks player name and trainer id, returns TRUE if they are not the same -static bool8 ArePlayersDifferent(struct RfuPlayerData* player1, const struct RfuPlayerData* player2) +static bool8 ArePlayersDifferent(struct RfuPlayerData *player1, const struct RfuPlayerData *player2) { s32 i; @@ -4050,7 +4050,7 @@ static s32 UnionRoomGetPlayerInteractionResponse(struct RfuPlayerList *list, boo { bool32 metBefore; - struct RfuPlayer * player = &list->players[playerIdx]; + struct RfuPlayer *player = &list->players[playerIdx]; if (!player->rfu.data.startedActivity && !overrideGender) { @@ -4100,7 +4100,7 @@ static void ItemPrintFunc_EmptyList(u8 windowId, u32 itemId, u8 y) { } -static void TradeBoardPrintItemInfo(u8 windowId, u8 y, struct RfuGameData * data, const u8 *playerName, u8 colorIdx) +static void TradeBoardPrintItemInfo(u8 windowId, u8 y, struct RfuGameData *data, const u8 *playerName, u8 colorIdx) { u8 levelStr[4]; u16 species = data->tradeSpecies; @@ -4152,7 +4152,7 @@ static void TradeBoardListMenuItemPrintFunc(u8 windowId, u32 itemId, u8 y) } } -static s32 GetIndexOfNthTradeBoardOffer(struct RfuPlayer * players, s32 n) +static s32 GetIndexOfNthTradeBoardOffer(struct RfuPlayer *players, s32 n) { s32 i; s32 j = 0; diff --git a/src/union_room_battle.c b/src/union_room_battle.c index 2bcbaef19c..af16a0d242 100644 --- a/src/union_room_battle.c +++ b/src/union_room_battle.c @@ -26,7 +26,7 @@ struct UnionRoomBattle s16 textState; }; -static EWRAM_DATA struct UnionRoomBattle * sBattle = NULL; +static EWRAM_DATA struct UnionRoomBattle *sBattle = NULL; static const struct BgTemplate sBgTemplates[] = { { @@ -81,7 +81,7 @@ static void AddTextPrinterForUnionRoomBattle(u8 windowId, const u8 *str, u8 x, u AddTextPrinterParameterized4(windowId, FONT_NORMAL, x, y, letterSpacing, lineSpacing, sTextColors, speed, str); } -static bool32 PrintUnionRoomBattleMessage(s16 * state, const u8 *str, s32 speed) +static bool32 PrintUnionRoomBattleMessage(s16 *state, const u8 *str, s32 speed) { switch (*state) { diff --git a/src/union_room_chat.c b/src/union_room_chat.c index 59dc9efc73..cff034bc79 100644 --- a/src/union_room_chat.c +++ b/src/union_room_chat.c @@ -155,7 +155,7 @@ struct UnionRoomChat struct UnionRoomChatDisplay_Subtask { - bool32 (* callback)(u8 *); + bool32 (*callback)(u8 *); bool8 active; u8 state; }; @@ -189,7 +189,7 @@ struct UnionRoomChatSprites struct SubtaskInfo { u16 idx; - bool32 (* callback)(u8 *); + bool32 (*callback)(u8 *); }; struct MessageWindowInfo diff --git a/src/union_room_player_avatar.c b/src/union_room_player_avatar.c index c99cc0e493..eeed9fe176 100644 --- a/src/union_room_player_avatar.c +++ b/src/union_room_player_avatar.c @@ -16,7 +16,7 @@ // get the sprite index of that player. #define UR_PLAYER_SPRITE_ID(leaderId, memberId) (MAX_RFU_PLAYERS * leaderId + memberId) -static EWRAM_DATA struct UnionRoomObject * sUnionObjWork = NULL; +static EWRAM_DATA struct UnionRoomObject *sUnionObjWork = NULL; static EWRAM_DATA u32 sUnionObjRefreshTimer = 0; static u8 CreateTask_AnimateUnionRoomPlayers(void); @@ -135,7 +135,7 @@ static u16 GetUnionRoomPlayerGraphicsId(u32 gender, u32 id) return sUnionRoomObjGfxIds[gender][id % NUM_UNION_ROOM_CLASSES]; } -static void GetUnionRoomPlayerCoords(u32 leaderId, u32 memberId, s32 * x, s32 * y) +static void GetUnionRoomPlayerCoords(u32 leaderId, u32 memberId, s32 *x, s32 *y) { *x = sUnionRoomPlayerCoords[leaderId][0] + sUnionRoomGroupOffsets[memberId][0] + MAP_OFFSET; *y = sUnionRoomPlayerCoords[leaderId][1] + sUnionRoomGroupOffsets[memberId][1] + MAP_OFFSET; @@ -183,7 +183,7 @@ static void RemoveUnionRoomPlayerObjectEvent(u32 leaderId) static bool32 SetUnionRoomPlayerEnterExitMovement(u32 leaderId, const u8 *movement) { u8 objectId; - struct ObjectEvent * object; + struct ObjectEvent *object; if (TryGetObjectEventIdByLocalIdAndMap(sUnionRoomLocalIds[leaderId], gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &objectId)) return FALSE; object = &gObjectEvents[objectId]; @@ -197,7 +197,7 @@ static bool32 SetUnionRoomPlayerEnterExitMovement(u32 leaderId, const u8 *moveme static bool32 TryReleaseUnionRoomPlayerObjectEvent(u32 leaderId) { u8 objectId; - struct ObjectEvent * object; + struct ObjectEvent *object; if (TryGetObjectEventIdByLocalIdAndMap(sUnionRoomLocalIds[leaderId], gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &objectId)) return TRUE; @@ -212,7 +212,7 @@ static bool32 TryReleaseUnionRoomPlayerObjectEvent(u32 leaderId) return TRUE; } -u8 InitUnionRoomPlayerObjects(struct UnionRoomObject * players) +u8 InitUnionRoomPlayerObjects(struct UnionRoomObject *players) { s32 i; @@ -228,7 +228,7 @@ u8 InitUnionRoomPlayerObjects(struct UnionRoomObject * players) return CreateTask_AnimateUnionRoomPlayers(); } -static bool32 AnimateUnionRoomPlayerDespawn(s8 * state, u32 leaderId, struct UnionRoomObject * object) +static bool32 AnimateUnionRoomPlayerDespawn(s8 *state, u32 leaderId, struct UnionRoomObject *object) { switch (*state) { @@ -252,7 +252,7 @@ static bool32 AnimateUnionRoomPlayerDespawn(s8 * state, u32 leaderId, struct Uni return FALSE; } -static bool32 AnimateUnionRoomPlayerSpawn(s8 * state, u32 leaderId, struct UnionRoomObject * object) +static bool32 AnimateUnionRoomPlayerSpawn(s8 *state, u32 leaderId, struct UnionRoomObject *object) { s16 x, y; @@ -289,7 +289,7 @@ static bool32 AnimateUnionRoomPlayerSpawn(s8 * state, u32 leaderId, struct Union static bool32 SpawnGroupLeader(u32 leaderId, u32 gender, u32 id) { - struct UnionRoomObject * object = &sUnionObjWork[leaderId]; + struct UnionRoomObject *object = &sUnionObjWork[leaderId]; object->schedAnim = UNION_ROOM_SPAWN_IN; object->gfxId = GetUnionRoomPlayerGraphicsId(gender, id); @@ -301,7 +301,7 @@ static bool32 SpawnGroupLeader(u32 leaderId, u32 gender, u32 id) static bool32 DespawnGroupLeader(u32 leaderId) { - struct UnionRoomObject * object = &sUnionObjWork[leaderId]; + struct UnionRoomObject *object = &sUnionObjWork[leaderId]; object->schedAnim = UNION_ROOM_SPAWN_OUT; if (object->state == 1) @@ -310,7 +310,7 @@ static bool32 DespawnGroupLeader(u32 leaderId) return FALSE; } -static void AnimateUnionRoomPlayer(u32 leaderId, struct UnionRoomObject * object) +static void AnimateUnionRoomPlayer(u32 leaderId, struct UnionRoomObject *object) { switch (object->state) { @@ -426,7 +426,7 @@ void SetTilesAroundUnionRoomPlayersPassable(void) } } -static u8 GetNewFacingDirectionForUnionRoomPlayer(u32 memberId, u32 leaderId, struct RfuGameData * gameData) +static u8 GetNewFacingDirectionForUnionRoomPlayer(u32 memberId, u32 leaderId, struct RfuGameData *gameData) { if (memberId) // If not leader return sMemberFacingDirections[memberId]; @@ -441,7 +441,7 @@ static bool32 IsUnionRoomPlayerInvisible(u32 leaderId, u32 memberId) return IsVirtualObjectInvisible(UR_PLAYER_SPRITE_ID(leaderId, memberId) - UR_SPRITE_START_ID); } -static void SpawnGroupMember(u32 leaderId, u32 memberId, u16 graphicsId, struct RfuGameData * gameData) +static void SpawnGroupMember(u32 leaderId, u32 memberId, u16 graphicsId, struct RfuGameData *gameData) { s32 x, y; s32 id = UR_PLAYER_SPRITE_ID(leaderId, memberId); @@ -464,7 +464,7 @@ static void DespawnGroupMember(u32 leaderId, u32 memberId) MapGridSetMetatileImpassabilityAt(x, y, FALSE); } -static void AssembleGroup(u32 leaderId, struct RfuGameData * gameData) +static void AssembleGroup(u32 leaderId, struct RfuGameData *gameData) { s16 x, y, x2, y2; s32 i; @@ -492,7 +492,7 @@ static void AssembleGroup(u32 leaderId, struct RfuGameData * gameData) } } -static void SpawnGroupLeaderAndMembers(u32 leaderId, struct RfuGameData * gameData) +static void SpawnGroupLeaderAndMembers(u32 leaderId, struct RfuGameData *gameData) { u32 i; switch (gameData->activity) @@ -527,7 +527,7 @@ static void DespawnGroupLeaderAndMembers(u32 leaderId, struct RfuGameData *gameD static void UpdateUnionRoomPlayerSprites(struct WirelessLink_URoom *uroom) { s32 i; - struct RfuPlayer * leaders; + struct RfuPlayer *leaders; sUnionObjRefreshTimer = 0; for (i = 0, leaders = uroom->playerList->players; i < MAX_UNION_ROOM_LEADERS; i++) { @@ -553,7 +553,7 @@ bool32 TryInteractWithUnionRoomMember(struct RfuPlayerList *list, s16 *memberIdP { s16 x, y; s32 i, memberId; - struct RfuPlayer * leaders; + struct RfuPlayer *leaders; if (!IsPlayerStandingStill()) return FALSE; diff --git a/src/window.c b/src/window.c index ec998083a0..83b5022005 100644 --- a/src/window.c +++ b/src/window.c @@ -10,7 +10,7 @@ COMMON_DATA void *gWindowBgTilemapBuffers[NUM_BACKGROUNDS] = {0}; extern u32 gWindowTileAutoAllocEnabled; EWRAM_DATA struct Window gWindows[WINDOWS_MAX] = {0}; -EWRAM_DATA static struct Window* sWindowPtr = NULL; +EWRAM_DATA static struct Window *sWindowPtr = NULL; EWRAM_DATA static u16 sWindowSize = 0; static u32 GetNumActiveWindowsOnBg(u32 bgId); diff --git a/src/wireless_communication_status_screen.c b/src/wireless_communication_status_screen.c index 8c89312111..7734c39d24 100644 --- a/src/wireless_communication_status_screen.c +++ b/src/wireless_communication_status_screen.c @@ -54,7 +54,7 @@ struct WirelessCommunicationStatusScreen u8 filler[10]; }; -static struct WirelessCommunicationStatusScreen * sStatusScreen; +static struct WirelessCommunicationStatusScreen *sStatusScreen; static void CB2_InitWirelessCommunicationScreen(void); static void Task_WirelessCommunicationScreen(u8); @@ -247,7 +247,7 @@ static void CB2_ExitWirelessCommunicationStatusScreen(void) } // Cycle through palettes that relocate various shades of blue to create the wave effect at the bottom of the screen. -static void CyclePalette(s16 * counter, s16 * palIdx) +static void CyclePalette(s16 *counter, s16 *palIdx) { s32 idx; if (++(*counter) > 5) @@ -381,7 +381,7 @@ static void WCSS_AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 *s AddTextPrinterParameterized4(windowId, fontId, x, y, 0, 0, color, TEXT_SKIP_DRAW, str); } -static u32 CountPlayersInGroupAndGetActivity(struct RfuPlayer * player, u32 * groupCounts) +static u32 CountPlayersInGroupAndGetActivity(struct RfuPlayer *player, u32 *groupCounts) { int i, j, k; u32 activity = player->rfu.data.activity; @@ -422,7 +422,7 @@ static u32 CountPlayersInGroupAndGetActivity(struct RfuPlayer * player, u32 * gr #undef group_players } -static bool32 HaveCountsChanged(u32 * currCounts, u32 * prevCounts) +static bool32 HaveCountsChanged(u32 *currCounts, u32 *prevCounts) { s32 i; for (i = 0; i < NUM_GROUPTYPES; i++) @@ -433,11 +433,11 @@ static bool32 HaveCountsChanged(u32 * currCounts, u32 * prevCounts) return FALSE; } -static bool32 UpdateCommunicationCounts(u32 * groupCounts, u32 * prevGroupCounts, u32 * activities, u8 taskId) +static bool32 UpdateCommunicationCounts(u32 *groupCounts, u32 *prevGroupCounts, u32 *activities, u8 taskId) { bool32 activitiesChanged = FALSE; u32 groupCountBuffer[NUM_GROUPTYPES] = {0, 0, 0, 0}; - struct RfuPlayer ** players = (void *)gTasks[taskId].data; + struct RfuPlayer **players = (void *)gTasks[taskId].data; s32 i; for (i = 0; i < NUM_TASK_DATA; i++) diff --git a/test/battle/ability/bad_dreams.c b/test/battle/ability/bad_dreams.c index 8a1d3669a2..41cedf8e3e 100644 --- a/test/battle/ability/bad_dreams.c +++ b/test/battle/ability/bad_dreams.c @@ -2,7 +2,7 @@ #include "test/battle.h" // Also checks that non-sleeping enemy is not affected. -SINGLE_BATTLE_TEST("Bad Dreams causes the sleeping enemy Pokemon to lose 1/8 of hp") +SINGLE_BATTLE_TEST("Bad Dreams causes the sleeping enemy Pokemon to lose 1/8 of HP") { u32 status; PARAMETRIZE { status = STATUS1_NONE; } diff --git a/test/battle/ability/ball_fetch.c b/test/battle/ability/ball_fetch.c new file mode 100644 index 0000000000..7411d60a7d --- /dev/null +++ b/test/battle/ability/ball_fetch.c @@ -0,0 +1,7 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("Ball Fetch causes the Pokémon to pick up the last failed Ball at the end of the turn"); +TO_DO_BATTLE_TEST("Ball Fetch doesn't trigger if the Pokémon is already holding an item"); +TO_DO_BATTLE_TEST("Ball Fetch only picks up the first failed ball, once per battle"); // Bestow can help test this +TO_DO_BATTLE_TEST("Ball Fetch doesn't trigger in Max Raid Battles"); diff --git a/test/battle/ability/battery.c b/test/battle/ability/battery.c new file mode 100644 index 0000000000..cecfa81d0c --- /dev/null +++ b/test/battle/ability/battery.c @@ -0,0 +1,5 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("Battery increases Sp. Attack damage of allies by ~30%"); // 5325/4096 +TO_DO_BATTLE_TEST("Battery does not increase its own Sp. Attack damage"); diff --git a/test/battle/ability/beads_of_ruin.c b/test/battle/ability/beads_of_ruin.c index cfcfb17467..37240d2d68 100644 --- a/test/battle/ability/beads_of_ruin.c +++ b/test/battle/ability/beads_of_ruin.c @@ -73,3 +73,5 @@ SINGLE_BATTLE_TEST("Beads of Ruin's message displays correctly after all battler MESSAGE("The opposing Chi-Yu's Beads of Ruin weakened the Sp. Def of all surrounding Pokémon!"); } } + +TO_DO_BATTLE_TEST("Beads of Ruin reduce Defense if Wonder Room is active"); diff --git a/test/battle/ability/beast_boost.c b/test/battle/ability/beast_boost.c index 9b07c51f1d..3adb4eb9cd 100644 --- a/test/battle/ability/beast_boost.c +++ b/test/battle/ability/beast_boost.c @@ -56,3 +56,45 @@ SINGLE_BATTLE_TEST("Beast Boost doesn't trigger if user is fainted") MESSAGE("2 sent out Wobbuffet!"); } } + +SINGLE_BATTLE_TEST("Beast Boost prioritizes stats in the case of a tie in the following order: Atk, Def, Sp.Atk, Sp.Def, Speed") +{ + u8 stats[] = {1, 1, 1, 1, 1}; + + PARAMETRIZE { stats[4] = 255; stats[3] = 255; stats[2] = 255; stats[1] = 255; stats[0] = 255; } + PARAMETRIZE { stats[4] = 255; stats[3] = 255; stats[2] = 255; stats[1] = 255; } + PARAMETRIZE { stats[4] = 255; stats[3] = 255; stats[2] = 255; } + PARAMETRIZE { stats[4] = 255; stats[3] = 255; } + GIVEN { + PLAYER(SPECIES_NIHILEGO) { Ability(ABILITY_BEAST_BOOST); Attack(stats[0]); Defense(stats[1]); SpAttack(stats[2]); SpDefense(stats[3]); Speed(stats[4]); } + OPPONENT(SPECIES_WOBBUFFET) { HP(1); Speed(1); } + OPPONENT(SPECIES_WOBBUFFET) { Speed(1); } + } WHEN { + TURN { MOVE(player, MOVE_SCRATCH); SEND_OUT(opponent, 1); } + } SCENE { + ABILITY_POPUP(player, ABILITY_BEAST_BOOST); + switch(i) { + case 0: + MESSAGE("Nihilego's Beast Boost raised its Attack!"); + break; + case 1: + MESSAGE("Nihilego's Beast Boost raised its Defense!"); + break; + case 2: + MESSAGE("Nihilego's Beast Boost raised its Sp. Atk!"); + break; + case 3: + MESSAGE("Nihilego's Beast Boost raised its Sp. Def!"); + break; + } + } +} + +TO_DO_BATTLE_TEST("Beast Boost considers Power Split"); +TO_DO_BATTLE_TEST("Beast Boost considers Guard Split"); +TO_DO_BATTLE_TEST("Beast Boost considers Power Trick"); +TO_DO_BATTLE_TEST("Beast Boost considers Wonder Room"); +TO_DO_BATTLE_TEST("Beast Boost considers Speed Swap"); +TO_DO_BATTLE_TEST("Beast Boost doesn't consider stat stages"); +TO_DO_BATTLE_TEST("Beast Boost doesn't consider held items"); +TO_DO_BATTLE_TEST("Beast Boost doesn't consider status condition reductions"); diff --git a/test/battle/ability/berserk.c b/test/battle/ability/berserk.c index e4d625ebc5..80e418e3c5 100644 --- a/test/battle/ability/berserk.c +++ b/test/battle/ability/berserk.c @@ -1,7 +1,7 @@ #include "global.h" #include "test/battle.h" -SINGLE_BATTLE_TEST("Berserk activates only if the target had more than 50% of its hp") +SINGLE_BATTLE_TEST("Berserk activates only if the target had more than 50% of its HP") { bool32 activates = FALSE; u16 maxHp = 500, hp = 0; diff --git a/test/battle/ability/bulletproof.c b/test/battle/ability/bulletproof.c new file mode 100644 index 0000000000..733eb63a11 --- /dev/null +++ b/test/battle/ability/bulletproof.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("Bulletproof makes ballistic moves fail against the ability user"); diff --git a/test/battle/ability/cheeck_pouch.c b/test/battle/ability/cheek_pouch.c similarity index 100% rename from test/battle/ability/cheeck_pouch.c rename to test/battle/ability/cheek_pouch.c diff --git a/test/battle/ability/competitive.c b/test/battle/ability/competitive.c new file mode 100644 index 0000000000..cc3e582eab --- /dev/null +++ b/test/battle/ability/competitive.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Competitive (Ability) test titles") diff --git a/test/battle/ability/dark_aura.c b/test/battle/ability/dark_aura.c new file mode 100644 index 0000000000..eb1bf05246 --- /dev/null +++ b/test/battle/ability/dark_aura.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Dark Aura (Ability) test titles") diff --git a/test/battle/ability/dazzling.c b/test/battle/ability/dazzling.c index e248c9ce0b..7541b8a566 100644 --- a/test/battle/ability/dazzling.c +++ b/test/battle/ability/dazzling.c @@ -72,3 +72,27 @@ DOUBLE_BATTLE_TEST("Dazzling, Queenly Majesty and Armor Tail don't protect the u } } +SINGLE_BATTLE_TEST("Dazzling, Queenly Majesty and Armor Tail protect from all multi hit hits with one activation") +{ + u32 species, ability; + + PARAMETRIZE { species = SPECIES_BRUXISH; ability = ABILITY_DAZZLING; } + PARAMETRIZE { species = SPECIES_FARIGIRAF; ability = ABILITY_ARMOR_TAIL; } + PARAMETRIZE { species = SPECIES_TSAREENA; ability = ABILITY_QUEENLY_MAJESTY; } + + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(species) { Ability(ability); } + } WHEN { + TURN { MOVE(player, MOVE_WATER_SHURIKEN); } + } SCENE { + NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_WATER_SHURIKEN, opponent); + ABILITY_POPUP(opponent, ability); + NONE_OF { + ABILITY_POPUP(opponent, ability); + ABILITY_POPUP(opponent, ability); + ABILITY_POPUP(opponent, ability); + ABILITY_POPUP(opponent, ability); + } + } +} diff --git a/test/battle/ability/delta_stream.c b/test/battle/ability/delta_stream.c new file mode 100644 index 0000000000..5b4081cb1e --- /dev/null +++ b/test/battle/ability/delta_stream.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Delta Stream (Ability) test titles") diff --git a/test/battle/ability/early_bird.c b/test/battle/ability/early_bird.c new file mode 100644 index 0000000000..9b368970f6 --- /dev/null +++ b/test/battle/ability/early_bird.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Early Bird (Ability) test titles") diff --git a/test/battle/ability/fairy_aura.c b/test/battle/ability/fairy_aura.c new file mode 100644 index 0000000000..3b8d400b02 --- /dev/null +++ b/test/battle/ability/fairy_aura.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Fairy Aura (Ability) test titles") diff --git a/test/battle/ability/filter.c b/test/battle/ability/filter.c new file mode 100644 index 0000000000..ca323b1be2 --- /dev/null +++ b/test/battle/ability/filter.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Filter (Ability) test titles") diff --git a/test/battle/ability/flare_boost.c b/test/battle/ability/flare_boost.c new file mode 100644 index 0000000000..a4ff14382a --- /dev/null +++ b/test/battle/ability/flare_boost.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Flare Boost (Ability) test titles") diff --git a/test/battle/ability/flower_veil.c b/test/battle/ability/flower_veil.c new file mode 100644 index 0000000000..c1952360d1 --- /dev/null +++ b/test/battle/ability/flower_veil.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Flower Veil (Ability) test titles") diff --git a/test/battle/ability/forewarn.c b/test/battle/ability/forewarn.c new file mode 100644 index 0000000000..810fcd975f --- /dev/null +++ b/test/battle/ability/forewarn.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Forewarn (Ability) test titles") diff --git a/test/battle/ability/friend_guard.c b/test/battle/ability/friend_guard.c new file mode 100644 index 0000000000..5e4776731e --- /dev/null +++ b/test/battle/ability/friend_guard.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Friend Guard (Ability) test titles") diff --git a/test/battle/ability/fur_coat.c b/test/battle/ability/fur_coat.c new file mode 100644 index 0000000000..56fb197114 --- /dev/null +++ b/test/battle/ability/fur_coat.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Fur Coat (Ability) test titles") diff --git a/test/battle/ability/gluttony.c b/test/battle/ability/gluttony.c new file mode 100644 index 0000000000..4ceda945f6 --- /dev/null +++ b/test/battle/ability/gluttony.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Gluttony (Ability) test titles") diff --git a/test/battle/ability/gooey.c b/test/battle/ability/gooey.c new file mode 100644 index 0000000000..ad78e30c39 --- /dev/null +++ b/test/battle/ability/gooey.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Gooey (Ability) test titles") diff --git a/test/battle/ability/gorilla_tactics.c b/test/battle/ability/gorilla_tactics.c new file mode 100644 index 0000000000..2bafd88165 --- /dev/null +++ b/test/battle/ability/gorilla_tactics.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Gorilla Tactics (Ability) test titles") diff --git a/test/battle/ability/grass_pelt.c b/test/battle/ability/grass_pelt.c new file mode 100644 index 0000000000..1696b71e10 --- /dev/null +++ b/test/battle/ability/grass_pelt.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Grass Pelt (Ability) test titles") diff --git a/test/battle/ability/guts.c b/test/battle/ability/guts.c new file mode 100644 index 0000000000..459adc0e69 --- /dev/null +++ b/test/battle/ability/guts.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Guts (Ability) test titles") diff --git a/test/battle/ability/hadron_engine.c b/test/battle/ability/hadron_engine.c new file mode 100644 index 0000000000..e6324c0c51 --- /dev/null +++ b/test/battle/ability/hadron_engine.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Hadron Engine (Ability) test titles") diff --git a/test/battle/ability/heatproof.c b/test/battle/ability/heatproof.c new file mode 100644 index 0000000000..7f1d772bb7 --- /dev/null +++ b/test/battle/ability/heatproof.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Heatproof (Ability) test titles") diff --git a/test/battle/ability/heavy_metal.c b/test/battle/ability/heavy_metal.c new file mode 100644 index 0000000000..baaa039b19 --- /dev/null +++ b/test/battle/ability/heavy_metal.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Heavy Metal (Ability) test titles") diff --git a/test/battle/ability/honey_gather.c b/test/battle/ability/honey_gather.c new file mode 100644 index 0000000000..56dbb22f2e --- /dev/null +++ b/test/battle/ability/honey_gather.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Honey Gather (Ability) test titles") diff --git a/test/battle/ability/huge_power.c b/test/battle/ability/huge_power.c new file mode 100644 index 0000000000..9362bf8ce3 --- /dev/null +++ b/test/battle/ability/huge_power.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Huge Power (Ability) test titles") diff --git a/test/battle/ability/hustle.c b/test/battle/ability/hustle.c new file mode 100644 index 0000000000..c399bfa501 --- /dev/null +++ b/test/battle/ability/hustle.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Hustle (Ability) test titles") diff --git a/test/battle/ability/illuminate.c b/test/battle/ability/illuminate.c new file mode 100644 index 0000000000..72bf1f6f81 --- /dev/null +++ b/test/battle/ability/illuminate.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Illuminate (Ability) test titles") diff --git a/test/battle/ability/imposter.c b/test/battle/ability/imposter.c new file mode 100644 index 0000000000..98f6cc29fc --- /dev/null +++ b/test/battle/ability/imposter.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Imposter (Ability) test titles") diff --git a/test/battle/ability/infiltrator.c b/test/battle/ability/infiltrator.c new file mode 100644 index 0000000000..faf00ee113 --- /dev/null +++ b/test/battle/ability/infiltrator.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Infiltrator (Ability) test titles") diff --git a/test/battle/ability/iron_barbs.c b/test/battle/ability/iron_barbs.c new file mode 100644 index 0000000000..8b1525a9f6 --- /dev/null +++ b/test/battle/ability/iron_barbs.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Iron Barbs (Ability) test titles") diff --git a/test/battle/ability/iron_fist.c b/test/battle/ability/iron_fist.c new file mode 100644 index 0000000000..ae26f9cdd0 --- /dev/null +++ b/test/battle/ability/iron_fist.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Iron Fist (Ability) test titles") diff --git a/test/battle/ability/justified.c b/test/battle/ability/justified.c new file mode 100644 index 0000000000..3416d77415 --- /dev/null +++ b/test/battle/ability/justified.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Justified (Ability) test titles") diff --git a/test/battle/ability/klutz.c b/test/battle/ability/klutz.c new file mode 100644 index 0000000000..76216edd17 --- /dev/null +++ b/test/battle/ability/klutz.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Klutz (Ability) test titles") diff --git a/test/battle/ability/levitate.c b/test/battle/ability/levitate.c new file mode 100644 index 0000000000..a1c1dc927d --- /dev/null +++ b/test/battle/ability/levitate.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Levitate (Ability) test titles") diff --git a/test/battle/ability/libero.c b/test/battle/ability/libero.c new file mode 100644 index 0000000000..8ea93df3c0 --- /dev/null +++ b/test/battle/ability/libero.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Libero (Ability) test titles") diff --git a/test/battle/ability/light_metal.c b/test/battle/ability/light_metal.c new file mode 100644 index 0000000000..8ad4a6a4b5 --- /dev/null +++ b/test/battle/ability/light_metal.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Light Metal (Ability) test titles") diff --git a/test/battle/ability/long_reach.c b/test/battle/ability/long_reach.c new file mode 100644 index 0000000000..3558ea92b2 --- /dev/null +++ b/test/battle/ability/long_reach.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Long Reach (Ability) test titles") diff --git a/test/battle/ability/magma_armor.c b/test/battle/ability/magma_armor.c new file mode 100644 index 0000000000..e61444baee --- /dev/null +++ b/test/battle/ability/magma_armor.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Magma Armor (Ability) test titles") diff --git a/test/battle/ability/magnet_pull.c b/test/battle/ability/magnet_pull.c new file mode 100644 index 0000000000..538b15f824 --- /dev/null +++ b/test/battle/ability/magnet_pull.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Magnet Pull (Ability) test titles") diff --git a/test/battle/ability/marvel_scale.c b/test/battle/ability/marvel_scale.c new file mode 100644 index 0000000000..4fc7ee3c62 --- /dev/null +++ b/test/battle/ability/marvel_scale.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Marvel Scale (Ability) test titles") diff --git a/test/battle/ability/mega_launcher.c b/test/battle/ability/mega_launcher.c new file mode 100644 index 0000000000..dae3799f81 --- /dev/null +++ b/test/battle/ability/mega_launcher.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Mega Launcher (Ability) test titles") diff --git a/test/battle/ability/minus.c b/test/battle/ability/minus.c new file mode 100644 index 0000000000..bf841465a6 --- /dev/null +++ b/test/battle/ability/minus.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Minus (Ability) test titles") diff --git a/test/battle/ability/mold_breaker.c b/test/battle/ability/mold_breaker.c new file mode 100644 index 0000000000..2c04deeeef --- /dev/null +++ b/test/battle/ability/mold_breaker.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Mold Breaker (Ability) test titles") diff --git a/test/battle/ability/multiscale.c b/test/battle/ability/multiscale.c new file mode 100644 index 0000000000..f2a808d69a --- /dev/null +++ b/test/battle/ability/multiscale.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Multiscale (Ability) test titles") diff --git a/test/battle/ability/multitype.c b/test/battle/ability/multitype.c new file mode 100644 index 0000000000..a8b384180f --- /dev/null +++ b/test/battle/ability/multitype.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Multitype (Ability) test titles") diff --git a/test/battle/ability/natural_cure.c b/test/battle/ability/natural_cure.c new file mode 100644 index 0000000000..760c341e12 --- /dev/null +++ b/test/battle/ability/natural_cure.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Natural Cure (Ability) test titles") diff --git a/test/battle/ability/no_guard.c b/test/battle/ability/no_guard.c new file mode 100644 index 0000000000..e365968d45 --- /dev/null +++ b/test/battle/ability/no_guard.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write No Guard (Ability) test titles") diff --git a/test/battle/ability/perish_body.c b/test/battle/ability/perish_body.c new file mode 100644 index 0000000000..92562ef885 --- /dev/null +++ b/test/battle/ability/perish_body.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Perish Body (Ability) test titles") diff --git a/test/battle/ability/pickpocket.c b/test/battle/ability/pickpocket.c new file mode 100644 index 0000000000..1e8ec6a526 --- /dev/null +++ b/test/battle/ability/pickpocket.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Pickpocket (Ability) test titles") diff --git a/test/battle/ability/plus.c b/test/battle/ability/plus.c new file mode 100644 index 0000000000..5b56018bf6 --- /dev/null +++ b/test/battle/ability/plus.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Plus (Ability) test titles") diff --git a/test/battle/ability/poison_puppeteer.c b/test/battle/ability/poison_puppeteer.c index d5c470ad37..db27691415 100644 --- a/test/battle/ability/poison_puppeteer.c +++ b/test/battle/ability/poison_puppeteer.c @@ -1,10 +1,6 @@ #include "global.h" #include "test/battle.h" -ASSUMPTIONS -{ -} - SINGLE_BATTLE_TEST("Poison Puppeteer confuses target if it was poisoned by a damaging move") { GIVEN { diff --git a/test/battle/ability/power_construct.c b/test/battle/ability/power_construct.c new file mode 100644 index 0000000000..6a8ca9db5f --- /dev/null +++ b/test/battle/ability/power_construct.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Power Construct (Ability) test titles") diff --git a/test/battle/ability/power_of_alchemy.c b/test/battle/ability/power_of_alchemy.c new file mode 100644 index 0000000000..137a20a43d --- /dev/null +++ b/test/battle/ability/power_of_alchemy.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Power of Alchemy (Ability) test titles") diff --git a/test/battle/ability/power_spot.c b/test/battle/ability/power_spot.c new file mode 100644 index 0000000000..c44eb9a924 --- /dev/null +++ b/test/battle/ability/power_spot.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Power Spot (Ability) test titles") diff --git a/test/battle/ability/prism_armor.c b/test/battle/ability/prism_armor.c new file mode 100644 index 0000000000..532642d3a2 --- /dev/null +++ b/test/battle/ability/prism_armor.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Prism Armor (Ability) test titles") diff --git a/test/battle/ability/propeller_tail.c b/test/battle/ability/propeller_tail.c new file mode 100644 index 0000000000..eb8df38c8f --- /dev/null +++ b/test/battle/ability/propeller_tail.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Propeller Tail (Ability) test titles") diff --git a/test/battle/ability/protosynthesis.c b/test/battle/ability/protosynthesis.c index d895879c60..6fd271acb2 100644 --- a/test/battle/ability/protosynthesis.c +++ b/test/battle/ability/protosynthesis.c @@ -100,59 +100,36 @@ SINGLE_BATTLE_TEST("Protosynthesis activates on switch-in") } } -SINGLE_BATTLE_TEST("Protosynthesis boosts Attack 1st in case of a stat tie") +SINGLE_BATTLE_TEST("Protosynthesis prioritizes stats in the case of a tie in the following order: Atk, Def, Sp.Atk, Sp.Def, Speed") { - GIVEN { - PLAYER(SPECIES_GREAT_TUSK) { Ability(ABILITY_PROTOSYNTHESIS); Attack(5); Defense(5); SpAttack(5); SpDefense(5); Speed(5); } - OPPONENT(SPECIES_GROUDON) { Ability(ABILITY_DROUGHT); Speed(5); } - } WHEN { - TURN { } - } SCENE { - ABILITY_POPUP(opponent, ABILITY_DROUGHT); - ABILITY_POPUP(player, ABILITY_PROTOSYNTHESIS); - MESSAGE("Great Tusk's Attack was heightened!"); - } -} + u8 stats[] = {1, 1, 1, 1, 1}; -SINGLE_BATTLE_TEST("Protosynthesis boosts Defense 2nd in case of a stat tie") -{ + PARAMETRIZE { stats[4] = 255; stats[3] = 255; stats[2] = 255; stats[1] = 255; stats[0] = 255; } + PARAMETRIZE { stats[4] = 255; stats[3] = 255; stats[2] = 255; stats[1] = 255; } + PARAMETRIZE { stats[4] = 255; stats[3] = 255; stats[2] = 255; } + PARAMETRIZE { stats[4] = 255; stats[3] = 255; } GIVEN { - PLAYER(SPECIES_GREAT_TUSK) { Ability(ABILITY_PROTOSYNTHESIS); Attack(4); Defense(5); SpAttack(5); SpDefense(5); Speed(5); } + PLAYER(SPECIES_GREAT_TUSK) { Ability(ABILITY_PROTOSYNTHESIS); Attack(stats[0]); Defense(stats[1]); SpAttack(stats[2]); SpDefense(stats[3]); Speed(stats[4]); } OPPONENT(SPECIES_GROUDON) { Ability(ABILITY_DROUGHT); Speed(5); } } WHEN { TURN { } } SCENE { ABILITY_POPUP(opponent, ABILITY_DROUGHT); ABILITY_POPUP(player, ABILITY_PROTOSYNTHESIS); - MESSAGE("Great Tusk's Defense was heightened!"); - } -} - -SINGLE_BATTLE_TEST("Protosynthesis boosts Special Attack 3rd in case of a stat tie") -{ - GIVEN { - PLAYER(SPECIES_GREAT_TUSK) { Ability(ABILITY_PROTOSYNTHESIS); Attack(4); Defense(4); SpAttack(5); SpDefense(5); Speed(5); } - OPPONENT(SPECIES_GROUDON) { Ability(ABILITY_DROUGHT); Speed(5); } - } WHEN { - TURN { } - } SCENE { - ABILITY_POPUP(opponent, ABILITY_DROUGHT); - ABILITY_POPUP(player, ABILITY_PROTOSYNTHESIS); - MESSAGE("Great Tusk's Sp. Atk was heightened!"); - } -} - -SINGLE_BATTLE_TEST("Protosynthesis boosts Special Defense 4th in case of a stat tie") -{ - GIVEN { - PLAYER(SPECIES_GREAT_TUSK) { Ability(ABILITY_PROTOSYNTHESIS); Attack(4); Defense(4); SpAttack(4); SpDefense(5); Speed(5); } - OPPONENT(SPECIES_GROUDON) { Ability(ABILITY_DROUGHT); Speed(5); } - } WHEN { - TURN { } - } SCENE { - ABILITY_POPUP(opponent, ABILITY_DROUGHT); - ABILITY_POPUP(player, ABILITY_PROTOSYNTHESIS); - MESSAGE("Great Tusk's Sp. Def was heightened!"); + switch(i) { + case 0: + MESSAGE("Great Tusk's Attack was heightened!"); + break; + case 1: + MESSAGE("Great Tusk's Defense was heightened!"); + break; + case 2: + MESSAGE("Great Tusk's Sp. Atk was heightened!"); + break; + case 3: + MESSAGE("Great Tusk's Sp. Def was heightened!"); + break; + } } } diff --git a/test/battle/ability/punk_rock.c b/test/battle/ability/punk_rock.c new file mode 100644 index 0000000000..01a5459a0d --- /dev/null +++ b/test/battle/ability/punk_rock.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Punk Rock (Ability) test titles") diff --git a/test/battle/ability/pure_power.c b/test/battle/ability/pure_power.c new file mode 100644 index 0000000000..e33479252c --- /dev/null +++ b/test/battle/ability/pure_power.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Pure Power (Ability) test titles") diff --git a/test/battle/ability/quark_drive.c b/test/battle/ability/quark_drive.c index e4850e7001..61a51d3d35 100644 --- a/test/battle/ability/quark_drive.c +++ b/test/battle/ability/quark_drive.c @@ -115,59 +115,36 @@ SINGLE_BATTLE_TEST("Quark Drive activates on Electric Terrain even if not ground } } -SINGLE_BATTLE_TEST("Quark Drive boosts Attack 1st in case of a stat tie") +SINGLE_BATTLE_TEST("Quark Drive prioritizes stats in the case of a tie in the following order: Atk, Def, Sp.Atk, Sp.Def, Speed") { - GIVEN { - PLAYER(SPECIES_IRON_TREADS) { Ability(ABILITY_QUARK_DRIVE); Attack(5); Defense(5); SpAttack(5); SpDefense(5); Speed(5); } - OPPONENT(SPECIES_TAPU_KOKO) { Ability(ABILITY_ELECTRIC_SURGE); Speed(5); } - } WHEN { - TURN { } - } SCENE { - ABILITY_POPUP(opponent, ABILITY_ELECTRIC_SURGE); - ABILITY_POPUP(player, ABILITY_QUARK_DRIVE); - MESSAGE("Iron Treads's Attack was heightened!"); - } -} + u8 stats[] = {1, 1, 1, 1, 1}; -SINGLE_BATTLE_TEST("Quark Drive boosts Defense 2nd in case of a stat tie") -{ + PARAMETRIZE { stats[4] = 255; stats[3] = 255; stats[2] = 255; stats[1] = 255; stats[0] = 255; } + PARAMETRIZE { stats[4] = 255; stats[3] = 255; stats[2] = 255; stats[1] = 255; } + PARAMETRIZE { stats[4] = 255; stats[3] = 255; stats[2] = 255; } + PARAMETRIZE { stats[4] = 255; stats[3] = 255; } GIVEN { - PLAYER(SPECIES_IRON_TREADS) { Ability(ABILITY_QUARK_DRIVE); Attack(4); Defense(5); SpAttack(5); SpDefense(5); Speed(5); } + PLAYER(SPECIES_IRON_TREADS) { Ability(ABILITY_QUARK_DRIVE); Attack(stats[0]); Defense(stats[1]); SpAttack(stats[2]); SpDefense(stats[3]); Speed(stats[4]); } OPPONENT(SPECIES_TAPU_KOKO) { Ability(ABILITY_ELECTRIC_SURGE); Speed(5); } } WHEN { TURN { } } SCENE { ABILITY_POPUP(opponent, ABILITY_ELECTRIC_SURGE); ABILITY_POPUP(player, ABILITY_QUARK_DRIVE); - MESSAGE("Iron Treads's Defense was heightened!"); - } -} - -SINGLE_BATTLE_TEST("Quark Drive boosts Special Attack 3rd in case of a stat tie") -{ - GIVEN { - PLAYER(SPECIES_IRON_TREADS) { Ability(ABILITY_QUARK_DRIVE); Attack(4); Defense(4); SpAttack(5); SpDefense(5); Speed(5); } - OPPONENT(SPECIES_TAPU_KOKO) { Ability(ABILITY_ELECTRIC_SURGE); Speed(5); } - } WHEN { - TURN { } - } SCENE { - ABILITY_POPUP(opponent, ABILITY_ELECTRIC_SURGE); - ABILITY_POPUP(player, ABILITY_QUARK_DRIVE); - MESSAGE("Iron Treads's Sp. Atk was heightened!"); - } -} - -SINGLE_BATTLE_TEST("Quark Drive boosts Special Defense 4th in case of a stat tie") -{ - GIVEN { - PLAYER(SPECIES_IRON_TREADS) { Ability(ABILITY_QUARK_DRIVE); Attack(4); Defense(4); SpAttack(4); SpDefense(5); Speed(5); } - OPPONENT(SPECIES_TAPU_KOKO) { Ability(ABILITY_ELECTRIC_SURGE); Speed(5); } - } WHEN { - TURN { } - } SCENE { - ABILITY_POPUP(opponent, ABILITY_ELECTRIC_SURGE); - ABILITY_POPUP(player, ABILITY_QUARK_DRIVE); - MESSAGE("Iron Treads's Sp. Def was heightened!"); + switch(i) { + case 0: + MESSAGE("Iron Treads's Attack was heightened!"); + break; + case 1: + MESSAGE("Iron Treads's Defense was heightened!"); + break; + case 2: + MESSAGE("Iron Treads's Sp. Atk was heightened!"); + break; + case 3: + MESSAGE("Iron Treads's Sp. Def was heightened!"); + break; + } } } diff --git a/test/battle/ability/quick_feet.c b/test/battle/ability/quick_feet.c new file mode 100644 index 0000000000..fde10a7593 --- /dev/null +++ b/test/battle/ability/quick_feet.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Quick Feet (Ability) test titles") diff --git a/test/battle/ability/receiver.c b/test/battle/ability/receiver.c new file mode 100644 index 0000000000..a9155b7244 --- /dev/null +++ b/test/battle/ability/receiver.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Receiver (Ability) test titles") diff --git a/test/battle/ability/reckless.c b/test/battle/ability/reckless.c new file mode 100644 index 0000000000..49d5c59262 --- /dev/null +++ b/test/battle/ability/reckless.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Reckless (Ability) test titles") diff --git a/test/battle/ability/rks_system.c b/test/battle/ability/rks_system.c new file mode 100644 index 0000000000..17c4d2d4a7 --- /dev/null +++ b/test/battle/ability/rks_system.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write RKS System (Ability) test titles") diff --git a/test/battle/ability/rock_head.c b/test/battle/ability/rock_head.c new file mode 100644 index 0000000000..56db705778 --- /dev/null +++ b/test/battle/ability/rock_head.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Rock Head (Ability) test titles") diff --git a/test/battle/ability/run_away.c b/test/battle/ability/run_away.c new file mode 100644 index 0000000000..c49eef7213 --- /dev/null +++ b/test/battle/ability/run_away.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Run Away (Ability) test titles") diff --git a/test/battle/ability/sand_spit.c b/test/battle/ability/sand_spit.c new file mode 100644 index 0000000000..c2128f65de --- /dev/null +++ b/test/battle/ability/sand_spit.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Sand Spit (Ability) test titles") diff --git a/test/battle/ability/sand_stream.c b/test/battle/ability/sand_stream.c new file mode 100644 index 0000000000..6cd1b06eb4 --- /dev/null +++ b/test/battle/ability/sand_stream.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Sand Stream (Ability) test titles") diff --git a/test/battle/ability/screen_cleaner.c b/test/battle/ability/screen_cleaner.c new file mode 100644 index 0000000000..dd4ad761d1 --- /dev/null +++ b/test/battle/ability/screen_cleaner.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Screen Cleaner (Ability) test titles") diff --git a/test/battle/ability/serene_grace.c b/test/battle/ability/serene_grace.c new file mode 100644 index 0000000000..75dad60618 --- /dev/null +++ b/test/battle/ability/serene_grace.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Serene Grace (Ability) test titles") diff --git a/test/battle/ability/shadow_shield.c b/test/battle/ability/shadow_shield.c new file mode 100644 index 0000000000..7a28500761 --- /dev/null +++ b/test/battle/ability/shadow_shield.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Shadow Shield (Ability) test titles") diff --git a/test/battle/ability/shadow_tag.c b/test/battle/ability/shadow_tag.c new file mode 100644 index 0000000000..f00696d8b7 --- /dev/null +++ b/test/battle/ability/shadow_tag.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Shadow Tag (Ability) test titles") diff --git a/test/battle/ability/simple.c b/test/battle/ability/simple.c new file mode 100644 index 0000000000..cfdbf407ea --- /dev/null +++ b/test/battle/ability/simple.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Simple (Ability) test titles") diff --git a/test/battle/ability/skill_link.c b/test/battle/ability/skill_link.c new file mode 100644 index 0000000000..2da8ee2c58 --- /dev/null +++ b/test/battle/ability/skill_link.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Skill Link (Ability) test titles") diff --git a/test/battle/ability/slow_start.c b/test/battle/ability/slow_start.c new file mode 100644 index 0000000000..d5b3f5bcb5 --- /dev/null +++ b/test/battle/ability/slow_start.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Slow Start (Ability) test titles") diff --git a/test/battle/ability/soul_heart.c b/test/battle/ability/soul_heart.c new file mode 100644 index 0000000000..393fbb6c20 --- /dev/null +++ b/test/battle/ability/soul_heart.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Soul Heart (Ability) test titles") diff --git a/test/battle/ability/soundproof.c b/test/battle/ability/soundproof.c new file mode 100644 index 0000000000..a7135942d1 --- /dev/null +++ b/test/battle/ability/soundproof.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Soundproof (Ability) test titles") diff --git a/test/battle/ability/stakeout.c b/test/battle/ability/stakeout.c new file mode 100644 index 0000000000..2bbea394fd --- /dev/null +++ b/test/battle/ability/stakeout.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Stakeout (Ability) test titles") diff --git a/test/battle/ability/stall.c b/test/battle/ability/stall.c new file mode 100644 index 0000000000..f93eac14c4 --- /dev/null +++ b/test/battle/ability/stall.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Stall (Ability) test titles") diff --git a/test/battle/ability/steadfast.c b/test/battle/ability/steadfast.c new file mode 100644 index 0000000000..fc35e94278 --- /dev/null +++ b/test/battle/ability/steadfast.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Steadfast (Ability) test titles") diff --git a/test/battle/ability/steely_spirit.c b/test/battle/ability/steely_spirit.c new file mode 100644 index 0000000000..e84893ad8c --- /dev/null +++ b/test/battle/ability/steely_spirit.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Steely Spirit (Ability) test titles") diff --git a/test/battle/ability/strong_jaw.c b/test/battle/ability/strong_jaw.c new file mode 100644 index 0000000000..1b9ce7fba7 --- /dev/null +++ b/test/battle/ability/strong_jaw.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Strong Jaw (Ability) test titles") diff --git a/test/battle/ability/suction_cups.c b/test/battle/ability/suction_cups.c new file mode 100644 index 0000000000..bcf23c5e18 --- /dev/null +++ b/test/battle/ability/suction_cups.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Suction Cups (Ability) test titles") diff --git a/test/battle/ability/surge_surfer.c b/test/battle/ability/surge_surfer.c new file mode 100644 index 0000000000..c0b1056a2d --- /dev/null +++ b/test/battle/ability/surge_surfer.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Surge Surfer (Ability) test titles") diff --git a/test/battle/ability/sweet_veil.c b/test/battle/ability/sweet_veil.c new file mode 100644 index 0000000000..2cedae3c14 --- /dev/null +++ b/test/battle/ability/sweet_veil.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Sweet Veil (Ability) test titles") diff --git a/test/battle/ability/synchronize.c b/test/battle/ability/synchronize.c new file mode 100644 index 0000000000..43cf87d5fe --- /dev/null +++ b/test/battle/ability/synchronize.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Synchronize (Ability) test titles") diff --git a/test/battle/ability/tangled_feet.c b/test/battle/ability/tangled_feet.c new file mode 100644 index 0000000000..fb50ba191d --- /dev/null +++ b/test/battle/ability/tangled_feet.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Tangled Feet (Ability) test titles") diff --git a/test/battle/ability/technician.c b/test/battle/ability/technician.c new file mode 100644 index 0000000000..bd529a5a01 --- /dev/null +++ b/test/battle/ability/technician.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Technician (Ability) test titles") diff --git a/test/battle/ability/telepathy.c b/test/battle/ability/telepathy.c new file mode 100644 index 0000000000..220b2e7180 --- /dev/null +++ b/test/battle/ability/telepathy.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Telepathy (Ability) test titles") diff --git a/test/battle/ability/teravolt.c b/test/battle/ability/teravolt.c new file mode 100644 index 0000000000..e9739a720d --- /dev/null +++ b/test/battle/ability/teravolt.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Teravolt (Ability) test titles") diff --git a/test/battle/ability/thick_fat.c b/test/battle/ability/thick_fat.c new file mode 100644 index 0000000000..bcc4c9487c --- /dev/null +++ b/test/battle/ability/thick_fat.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Thick Fat (Ability) test titles") diff --git a/test/battle/ability/tinted_lens.c b/test/battle/ability/tinted_lens.c new file mode 100644 index 0000000000..9ddb69ec17 --- /dev/null +++ b/test/battle/ability/tinted_lens.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Tinted Lens (Ability) test titles") diff --git a/test/battle/ability/tough_claws.c b/test/battle/ability/tough_claws.c new file mode 100644 index 0000000000..4e6f4ecf8b --- /dev/null +++ b/test/battle/ability/tough_claws.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Tough Claws (Ability) test titles") diff --git a/test/battle/ability/toxic_boost.c b/test/battle/ability/toxic_boost.c new file mode 100644 index 0000000000..85960c5b02 --- /dev/null +++ b/test/battle/ability/toxic_boost.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Toxic Boost (Ability) test titles") diff --git a/test/battle/ability/triage.c b/test/battle/ability/triage.c new file mode 100644 index 0000000000..753d32b717 --- /dev/null +++ b/test/battle/ability/triage.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Triage (Ability) test titles") diff --git a/test/battle/ability/truant.c b/test/battle/ability/truant.c new file mode 100644 index 0000000000..85c0fe7749 --- /dev/null +++ b/test/battle/ability/truant.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Truant (Ability) test titles") diff --git a/test/battle/ability/turboblaze.c b/test/battle/ability/turboblaze.c new file mode 100644 index 0000000000..a715c23111 --- /dev/null +++ b/test/battle/ability/turboblaze.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Turboblaze (Ability) test titles") diff --git a/test/battle/ability/unaware.c b/test/battle/ability/unaware.c new file mode 100644 index 0000000000..5eb83cb9df --- /dev/null +++ b/test/battle/ability/unaware.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Unaware (Ability) test titles") diff --git a/test/battle/ability/unburden.c b/test/battle/ability/unburden.c index 63a72e2ace..28f867622e 100644 --- a/test/battle/ability/unburden.c +++ b/test/battle/ability/unburden.c @@ -4,7 +4,7 @@ SINGLE_BATTLE_TEST("Unburden doubles speed once user uses item") { GIVEN { - ASSUME(ItemId_GetHoldEffect(ITEM_GRASSY_SEED) == HOLD_EFFECT_SEEDS); + ASSUME(GetItemHoldEffect(ITEM_GRASSY_SEED) == HOLD_EFFECT_SEEDS); ASSUME(GetMoveEffect(MOVE_U_TURN) == EFFECT_HIT_ESCAPE); PLAYER(SPECIES_DRIFBLIM) { Ability(ABILITY_UNBURDEN); Item(ITEM_GRASSY_SEED); Speed(5); } OPPONENT(SPECIES_WOBBUFFET) { Speed(7); } diff --git a/test/battle/ability/unnerve.c b/test/battle/ability/unnerve.c index 4547854231..9a8972eb5c 100644 --- a/test/battle/ability/unnerve.c +++ b/test/battle/ability/unnerve.c @@ -72,3 +72,30 @@ SINGLE_BATTLE_TEST("Unnerve prints the correct string (opponent)") MESSAGE("Your team is too nervous to eat Berries!"); } } + +SINGLE_BATTLE_TEST("Unnerve activates only once per switch-in") +{ + u16 mon; + u16 ability; + PARAMETRIZE { mon = SPECIES_JOLTIK, ability = ABILITY_UNNERVE; } + PARAMETRIZE { mon = SPECIES_CALYREX_ICE, ability = ABILITY_AS_ONE_ICE_RIDER; } + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_WEEZING) { Ability(ABILITY_NEUTRALIZING_GAS); } + OPPONENT(mon) { Ability(ability); } + OPPONENT(mon) { Ability(ability); } + } WHEN { + TURN { SWITCH(player, 1); } + TURN { SWITCH(player, 0); } + TURN { SWITCH(player, 1); } + TURN { SWITCH(player, 0); } + TURN { SWITCH(opponent, 1); } + } SCENE { + ABILITY_POPUP(opponent, ability); + ABILITY_POPUP(player, ABILITY_NEUTRALIZING_GAS); + NOT ABILITY_POPUP(opponent, ability); + ABILITY_POPUP(player, ABILITY_NEUTRALIZING_GAS); + ABILITY_POPUP(opponent, ability); + + } +} diff --git a/test/battle/ability/unseen_fist.c b/test/battle/ability/unseen_fist.c new file mode 100644 index 0000000000..046ef7d2fb --- /dev/null +++ b/test/battle/ability/unseen_fist.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Unseen Fist (Ability) test titles") diff --git a/test/battle/ability/victory_star.c b/test/battle/ability/victory_star.c new file mode 100644 index 0000000000..46c3aca825 --- /dev/null +++ b/test/battle/ability/victory_star.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Victory Star (Ability) test titles") diff --git a/test/battle/ability/vital_spirit.c b/test/battle/ability/vital_spirit.c new file mode 100644 index 0000000000..2539df2334 --- /dev/null +++ b/test/battle/ability/vital_spirit.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Vital Spirit (Ability) test titles") diff --git a/test/battle/ability/wandering_spirit.c b/test/battle/ability/wandering_spirit.c new file mode 100644 index 0000000000..d32fb7c7b2 --- /dev/null +++ b/test/battle/ability/wandering_spirit.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Wandering Spirit (Ability) test titles") diff --git a/test/battle/ability/water_bubble.c b/test/battle/ability/water_bubble.c new file mode 100644 index 0000000000..2f04b18096 --- /dev/null +++ b/test/battle/ability/water_bubble.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Water Bubble (Ability) test titles") diff --git a/test/battle/ability/water_veil.c b/test/battle/ability/water_veil.c new file mode 100644 index 0000000000..428243fc10 --- /dev/null +++ b/test/battle/ability/water_veil.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Water Veil (Ability) test titles") diff --git a/test/battle/ability/well_baked_body.c b/test/battle/ability/well_baked_body.c new file mode 100644 index 0000000000..ae555b47cf --- /dev/null +++ b/test/battle/ability/well_baked_body.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Well-Baked Body (Ability) test titles") diff --git a/test/battle/ability/wimp_out.c b/test/battle/ability/wimp_out.c new file mode 100644 index 0000000000..3ceea91788 --- /dev/null +++ b/test/battle/ability/wimp_out.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Wimp Out (Ability) test titles") diff --git a/test/battle/ability/wonder_guard.c b/test/battle/ability/wonder_guard.c new file mode 100644 index 0000000000..673b6c113a --- /dev/null +++ b/test/battle/ability/wonder_guard.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Wonder Guard (Ability) test titles") diff --git a/test/battle/ability/wonder_skin.c b/test/battle/ability/wonder_skin.c new file mode 100644 index 0000000000..6501894f1c --- /dev/null +++ b/test/battle/ability/wonder_skin.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Wonder Skin (Ability) test titles") diff --git a/test/battle/ai/ai.c b/test/battle/ai/ai.c index a23052b25c..dfd0e2eeda 100644 --- a/test/battle/ai/ai.c +++ b/test/battle/ai/ai.c @@ -864,7 +864,7 @@ AI_SINGLE_BATTLE_TEST("AI_FLAG_SMART_SWITCHING: AI considers Focus Sash when det AI_SINGLE_BATTLE_TEST("AI sees popped Air Balloon") { GIVEN { - ASSUME(ItemId_GetHoldEffect(ITEM_AIR_BALLOON) == HOLD_EFFECT_AIR_BALLOON); + ASSUME(GetItemHoldEffect(ITEM_AIR_BALLOON) == HOLD_EFFECT_AIR_BALLOON); ASSUME(GetMoveType(MOVE_EARTHQUAKE) == TYPE_GROUND); AI_FLAGS(AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY | AI_FLAG_OMNISCIENT); PLAYER(SPECIES_TORCHIC) { Item(ITEM_AIR_BALLOON); Moves(MOVE_SCRATCH); } @@ -878,7 +878,7 @@ AI_SINGLE_BATTLE_TEST("AI sees popped Air Balloon") AI_SINGLE_BATTLE_TEST("AI sees popped Air Balloon after Air Balloon mon switches out and back in") { GIVEN { - ASSUME(ItemId_GetHoldEffect(ITEM_AIR_BALLOON) == HOLD_EFFECT_AIR_BALLOON); + ASSUME(GetItemHoldEffect(ITEM_AIR_BALLOON) == HOLD_EFFECT_AIR_BALLOON); ASSUME(GetMoveType(MOVE_EARTHQUAKE) == TYPE_GROUND); AI_FLAGS(AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY | AI_FLAG_OMNISCIENT); PLAYER(SPECIES_TORCHIC) { Item(ITEM_AIR_BALLOON); Moves(MOVE_SCRATCH); } @@ -891,3 +891,76 @@ AI_SINGLE_BATTLE_TEST("AI sees popped Air Balloon after Air Balloon mon switches TURN { MOVE(player, MOVE_SCRATCH); EXPECT_MOVE(opponent, MOVE_EARTHQUAKE); SEND_OUT(player, 1); } } } + +SINGLE_BATTLE_TEST("AI correctly records used moves") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { Moves(MOVE_TACKLE, MOVE_GROWL, MOVE_FLOWER_TRICK, MOVE_TORCH_SONG); } + OPPONENT(SPECIES_WOBBUFFET) { Moves(MOVE_RAGE_FIST, MOVE_PSYCHIC, MOVE_SCRATCH, MOVE_EARTHQUAKE); } + } WHEN { + TURN { MOVE(player, MOVE_TACKLE); MOVE(opponent, MOVE_EARTHQUAKE); } + TURN { MOVE(player, MOVE_FLOWER_TRICK); MOVE(opponent, MOVE_SCRATCH); } + TURN { MOVE(player, MOVE_TORCH_SONG); MOVE(opponent, MOVE_PSYCHIC); } + TURN { MOVE(player, MOVE_GROWL); MOVE(opponent, MOVE_RAGE_FIST); } + } THEN { + EXPECT_EQ(BATTLE_HISTORY->usedMoves[B_POSITION_PLAYER_LEFT][0], MOVE_TACKLE); + EXPECT_EQ(BATTLE_HISTORY->usedMoves[B_POSITION_PLAYER_LEFT][1], MOVE_GROWL); + EXPECT_EQ(BATTLE_HISTORY->usedMoves[B_POSITION_PLAYER_LEFT][2], MOVE_FLOWER_TRICK); + EXPECT_EQ(BATTLE_HISTORY->usedMoves[B_POSITION_PLAYER_LEFT][3], MOVE_TORCH_SONG); + + EXPECT_EQ(BATTLE_HISTORY->usedMoves[B_POSITION_OPPONENT_LEFT][0], MOVE_RAGE_FIST); + EXPECT_EQ(BATTLE_HISTORY->usedMoves[B_POSITION_OPPONENT_LEFT][1], MOVE_PSYCHIC); + EXPECT_EQ(BATTLE_HISTORY->usedMoves[B_POSITION_OPPONENT_LEFT][2], MOVE_SCRATCH); + EXPECT_EQ(BATTLE_HISTORY->usedMoves[B_POSITION_OPPONENT_LEFT][3], MOVE_EARTHQUAKE); + } +} + +AI_SINGLE_BATTLE_TEST("AI sees that Primal weather can block a move by type") +{ + GIVEN { + ASSUME(GetMoveType(MOVE_HYDRO_PUMP) == TYPE_WATER); + AI_FLAGS(AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY | AI_FLAG_OMNISCIENT); + PLAYER(SPECIES_GROUDON) { Item(ITEM_RED_ORB); Moves(MOVE_SCRATCH); } + OPPONENT(SPECIES_BLASTOISE) { Moves(MOVE_HYDRO_PUMP, MOVE_POUND); } + } WHEN { + TURN { MOVE(player, MOVE_SCRATCH); EXPECT_MOVE(opponent, MOVE_POUND); } + } +} + +AI_DOUBLE_BATTLE_TEST("AI sees opposing drain ability") +{ + GIVEN { + ASSUME(GetMoveType(MOVE_THUNDERBOLT) == TYPE_ELECTRIC); + ASSUME(GetMoveType(MOVE_RAZOR_LEAF) != TYPE_ELECTRIC); + ASSUME(GetMoveType(MOVE_METAL_CLAW) != TYPE_ELECTRIC); + AI_FLAGS(AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_CHECK_VIABILITY | AI_FLAG_TRY_TO_FAINT | AI_FLAG_OMNISCIENT); + PLAYER(SPECIES_RAICHU) { Ability(ABILITY_LIGHTNING_ROD); Moves(MOVE_CELEBRATE); } + PLAYER(SPECIES_KRABBY) { Ability(ABILITY_VOLT_ABSORB); Moves(MOVE_CELEBRATE); } + OPPONENT(SPECIES_MAGNETON) { Moves(MOVE_THUNDERBOLT, MOVE_RAZOR_LEAF); } + OPPONENT(SPECIES_WOBBUFFET) { Moves(MOVE_THUNDERBOLT, MOVE_METAL_CLAW); } + } WHEN { + TURN { + NOT_EXPECT_MOVE(opponentLeft, MOVE_THUNDERBOLT); + NOT_EXPECT_MOVE(opponentRight, MOVE_THUNDERBOLT); } + } +} + +AI_SINGLE_BATTLE_TEST("AI will not set up Weather if it wont have any affect") +{ + u32 ability; + + PARAMETRIZE { ability = ABILITY_CLOUD_NINE; } + PARAMETRIZE { ability = ABILITY_DAMP; } + + GIVEN { + ASSUME(GetMoveEffect(MOVE_RAIN_DANCE) == EFFECT_RAIN_DANCE); + AI_FLAGS(AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY); + PLAYER(SPECIES_GOLDUCK) { Ability(ability); Moves(MOVE_SCRATCH); } + OPPONENT(SPECIES_KABUTOPS) { Ability(ABILITY_SWIFT_SWIM); Moves(MOVE_RAIN_DANCE, MOVE_POUND); } + } WHEN { + if (ability == ABILITY_CLOUD_NINE) + TURN { MOVE(player, MOVE_SCRATCH); EXPECT_MOVE(opponent, MOVE_POUND); } + else + TURN { MOVE(player, MOVE_SCRATCH); EXPECT_MOVE(opponent, MOVE_RAIN_DANCE); } + } +} diff --git a/test/battle/ai/ai_calc_best_move_score.c b/test/battle/ai/ai_calc_best_move_score.c index f3b339deba..a4a13c283f 100644 --- a/test/battle/ai/ai_calc_best_move_score.c +++ b/test/battle/ai/ai_calc_best_move_score.c @@ -54,7 +54,7 @@ AI_SINGLE_BATTLE_TEST("AI will increase speed if it is slower") } } -AI_SINGLE_BATTLE_TEST("AI will correctly predict what move the opposing mon going to use") +AI_SINGLE_BATTLE_TEST("AI will not waste a turn setting up if it knows target can faint it") { u16 move; diff --git a/test/battle/ai/ai_switching.c b/test/battle/ai/ai_switching.c index 6f0fb7920c..a4ddef6735 100644 --- a/test/battle/ai/ai_switching.c +++ b/test/battle/ai/ai_switching.c @@ -97,11 +97,11 @@ AI_DOUBLE_BATTLE_TEST("AI will not try to switch for the same pokemon for 2 spot } WHEN { TURN { EXPECT_SWITCH(opponentLeft, 3); }; } SCENE { - MESSAGE("{PKMN} TRAINER LEAF withdrew Linoone!"); - MESSAGE("{PKMN} TRAINER LEAF sent out Gengar!"); + MESSAGE(AI_TRAINER_NAME " withdrew Linoone!"); + MESSAGE(AI_TRAINER_NAME " sent out Gengar!"); NONE_OF { - MESSAGE("{PKMN} TRAINER LEAF withdrew Zigzagoon!"); - MESSAGE("{PKMN} TRAINER LEAF sent out Gengar!"); + MESSAGE(AI_TRAINER_NAME " withdrew Zigzagoon!"); + MESSAGE(AI_TRAINER_NAME " sent out Gengar!"); } } } @@ -540,7 +540,7 @@ AI_SINGLE_BATTLE_TEST("AI_FLAG_SMART_SWITCHING: AI will switch out if mon would ASSUME(GetMoveType(MOVE_THUNDERBOLT) == TYPE_ELECTRIC); ASSUME(GetMoveType(MOVE_EARTHQUAKE) == TYPE_GROUND); - AI_FLAGS(AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_CHECK_VIABILITY | AI_FLAG_TRY_TO_FAINT | AI_FLAG_SMART_SWITCHING | AI_FLAG_SMART_MON_CHOICES); + AI_FLAGS(AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_CHECK_VIABILITY | AI_FLAG_TRY_TO_FAINT | AI_FLAG_SMART_SWITCHING | AI_FLAG_SMART_MON_CHOICES | AI_FLAG_OMNISCIENT); PLAYER(SPECIES_ELECTRODE) { Moves(MOVE_THUNDERBOLT, MOVE_THUNDER_WAVE, MOVE_THUNDER_SHOCK); } OPPONENT(SPECIES_PELIPPER) { Moves(MOVE_EARTHQUAKE); }; OPPONENT(SPECIES_RHYDON) { Moves(MOVE_EARTHQUAKE); Ability(ABILITY_ROCK_HEAD); } diff --git a/test/battle/hold_effect/berserk_gene.c b/test/battle/hold_effect/berserk_gene.c index 164830ad52..640198c992 100644 --- a/test/battle/hold_effect/berserk_gene.c +++ b/test/battle/hold_effect/berserk_gene.c @@ -236,3 +236,19 @@ SINGLE_BATTLE_TEST("Berserk Gene causes confusion timer to not tick down", u32 s EXPECT_EQ(results[0].status2, results[1].status2); } } + +SINGLE_BATTLE_TEST("Berserk Gene does not cause an infinite loop") +{ + GIVEN { + ASSUME(GetMoveEffect(MOVE_BESTOW) == EFFECT_BESTOW); + PLAYER(SPECIES_TOXEL) { Item(ITEM_BERSERK_GENE); Ability(ABILITY_KLUTZ); } + PLAYER(SPECIES_WYNAUT); + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_BESTOW); } + } SCENE { + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent); + MESSAGE("Using Berserk Gene, the Attack of the opposing Wobbuffet sharply rose!"); + } +} diff --git a/test/battle/hold_effect/gems.c b/test/battle/hold_effect/gems.c index 5486443808..52c85d7fb5 100644 --- a/test/battle/hold_effect/gems.c +++ b/test/battle/hold_effect/gems.c @@ -87,19 +87,3 @@ SINGLE_BATTLE_TEST("Gem is consumed if the move type is changed") ANIMATION(ANIM_TYPE_MOVE, MOVE_FEINT_ATTACK, player); } } - -SINGLE_BATTLE_TEST("Gem is not consumed if a no type damage move is used") //ie. Counter, Psywave, Super Fang. All these moves have 1 base power. -{ - ASSUME(GetMovePower(MOVE_PSYWAVE) == 1); - GIVEN { - PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_PSYCHIC_GEM); }; - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { MOVE(player, MOVE_PSYWAVE); } - } SCENE { - NONE_OF { - ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, player); - MESSAGE("The Psychic Gem strengthened Wobbuffet's power!"); - } - } -} diff --git a/test/battle/hold_effect/life_orb.c b/test/battle/hold_effect/life_orb.c index f27ce29d03..7f4fcc2ccf 100644 --- a/test/battle/hold_effect/life_orb.c +++ b/test/battle/hold_effect/life_orb.c @@ -1,6 +1,21 @@ #include "global.h" #include "test/battle.h" +SINGLE_BATTLE_TEST("Life Orb activates when users attack is succesful") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_LIFE_ORB); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_POUND); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_POUND, player); + HP_BAR(opponent); + HP_BAR(player); + MESSAGE("Wobbuffet was hurt by the Life Orb!"); + } +} + SINGLE_BATTLE_TEST("Life Orb activates if it hits a Substitute") { GIVEN { @@ -31,3 +46,21 @@ SINGLE_BATTLE_TEST("Life Orb does not activate if using a status move") } } } + +SINGLE_BATTLE_TEST("Life Orb doesn't cause any HP loss if user is unable to attack") +{ + PASSES_RANDOMLY(25, 100, RNG_PARALYSIS); + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_LIFE_ORB); Status1(STATUS1_PARALYSIS); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_POUND); } + } SCENE { + NONE_OF { + ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, player); + HP_BAR(opponent); + HP_BAR(player); + MESSAGE("Wobbuffet was hurt by the Life Orb!"); + } + } +} diff --git a/test/battle/move_effect/bestow.c b/test/battle/move_effect/bestow.c index 24abdb3bea..4ca86119b6 100644 --- a/test/battle/move_effect/bestow.c +++ b/test/battle/move_effect/bestow.c @@ -47,8 +47,6 @@ SINGLE_BATTLE_TEST("Bestow fails if the target already has a held item") #include "mail.h" SINGLE_BATTLE_TEST("Bestow fails if the user is holding Mail") { - KNOWN_FAILING; - GIVEN { ASSUME(ItemIsMail(ITEM_ORANGE_MAIL)); PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_ORANGE_MAIL); } @@ -81,7 +79,7 @@ SINGLE_BATTLE_TEST("Bestow fails if the user's held item is a Mega Stone") SINGLE_BATTLE_TEST("Bestow fails if the user's held item is a Z-Crystal") { GIVEN { - ASSUME(ItemId_GetHoldEffect(ITEM_FIGHTINIUM_Z) == HOLD_EFFECT_Z_CRYSTAL); + ASSUME(GetItemHoldEffect(ITEM_FIGHTINIUM_Z) == HOLD_EFFECT_Z_CRYSTAL); PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_FIGHTINIUM_Z); } OPPONENT(SPECIES_WOBBUFFET); } WHEN { @@ -94,36 +92,41 @@ SINGLE_BATTLE_TEST("Bestow fails if the user's held item is a Z-Crystal") } } -SINGLE_BATTLE_TEST("Bestow fails if the target is behind a Substitute") +SINGLE_BATTLE_TEST("Bestow fails if the target is behind a Substitute (Gen 6+)") { - KNOWN_FAILING; - GIVEN { PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_SITRUS_BERRY); Speed(50); } OPPONENT(SPECIES_WOBBUFFET) { Speed(100); } } WHEN { TURN { MOVE(opponent, MOVE_SUBSTITUTE); MOVE(player, MOVE_BESTOW); } } SCENE { - MESSAGE("But it failed!"); + if (B_UPDATED_MOVE_FLAGS >= GEN_6) { + NOT MESSAGE("But it failed!"); + } else { + MESSAGE("But it failed!"); + } } THEN { - EXPECT(player->item == ITEM_SITRUS_BERRY); - EXPECT(opponent->item == ITEM_NONE); + if (B_UPDATED_MOVE_FLAGS >= GEN_6) { + EXPECT(player->item == ITEM_NONE); + EXPECT(opponent->item == ITEM_SITRUS_BERRY); + } else { + EXPECT(player->item == ITEM_SITRUS_BERRY); + EXPECT(opponent->item == ITEM_NONE); + } } } SINGLE_BATTLE_TEST("Bestow fails if the user's held item changes its form") { - KNOWN_FAILING; - GIVEN { - PLAYER(SPECIES_GIRATINA_ORIGIN) { Item(ITEM_GRISEOUS_ORB); } + PLAYER(SPECIES_GIRATINA_ORIGIN) { Item(ITEM_GRISEOUS_CORE); } OPPONENT(SPECIES_WOBBUFFET); } WHEN { TURN { MOVE(player, MOVE_BESTOW); } } SCENE { MESSAGE("But it failed!"); } THEN { - EXPECT(player->item == ITEM_GRISEOUS_ORB); + EXPECT(player->item == ITEM_GRISEOUS_CORE); EXPECT(opponent->item == ITEM_NONE); } } diff --git a/test/battle/move_effect/facade.c b/test/battle/move_effect/facade.c new file mode 100644 index 0000000000..cc1e21e34f --- /dev/null +++ b/test/battle/move_effect/facade.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Facade (Move Effect) test titles") diff --git a/test/battle/move_effect/fairy_lock.c b/test/battle/move_effect/fairy_lock.c new file mode 100644 index 0000000000..a42aa6aa48 --- /dev/null +++ b/test/battle/move_effect/fairy_lock.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Fairy Lock (Move Effect) test titles") diff --git a/test/battle/move_effect/false_swipe.c b/test/battle/move_effect/false_swipe.c new file mode 100644 index 0000000000..da2cbf6a21 --- /dev/null +++ b/test/battle/move_effect/false_swipe.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write False Swipe (Move Effect) test titles") diff --git a/test/battle/move_effect/fell_stinger.c b/test/battle/move_effect/fell_stinger.c new file mode 100644 index 0000000000..2613dc2d9d --- /dev/null +++ b/test/battle/move_effect/fell_stinger.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Fell Stinger (Move Effect) test titles") diff --git a/test/battle/move_effect/final_gambit.c b/test/battle/move_effect/final_gambit.c new file mode 100644 index 0000000000..be815abf5a --- /dev/null +++ b/test/battle/move_effect/final_gambit.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Final Gambit (Move Effect) test titles") diff --git a/test/battle/move_effect/first_turn_only.c b/test/battle/move_effect/first_turn_only.c new file mode 100644 index 0000000000..b26245a3d9 --- /dev/null +++ b/test/battle/move_effect/first_turn_only.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Fake Out/First Impression (Move Effect) test titles") diff --git a/test/battle/move_effect/flail.c b/test/battle/move_effect/flail.c new file mode 100644 index 0000000000..af5544d9b4 --- /dev/null +++ b/test/battle/move_effect/flail.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Flail (Move Effect) test titles") diff --git a/test/battle/move_effect/flatter.c b/test/battle/move_effect/flatter.c new file mode 100644 index 0000000000..7effb09329 --- /dev/null +++ b/test/battle/move_effect/flatter.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Flatter (Move Effect) test titles") diff --git a/test/battle/move_effect/foresight.c b/test/battle/move_effect/foresight.c new file mode 100644 index 0000000000..082e2d6fa4 --- /dev/null +++ b/test/battle/move_effect/foresight.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Foresight (Move Effect) test titles") diff --git a/test/battle/move_effect/frustration.c b/test/battle/move_effect/frustration.c new file mode 100644 index 0000000000..eb994c5076 --- /dev/null +++ b/test/battle/move_effect/frustration.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Frustration (Move Effect) test titles") diff --git a/test/battle/move_effect/fusion_combo.c b/test/battle/move_effect/fusion_combo.c new file mode 100644 index 0000000000..7561536b11 --- /dev/null +++ b/test/battle/move_effect/fusion_combo.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Fusion Flare/Bolt (Move Effect) test titles") diff --git a/test/battle/move_effect/gear_up.c b/test/battle/move_effect/gear_up.c new file mode 100644 index 0000000000..03aba9a395 --- /dev/null +++ b/test/battle/move_effect/gear_up.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Gear Up (Move Effect) test titles") diff --git a/test/battle/move_effect/geomancy.c b/test/battle/move_effect/geomancy.c new file mode 100644 index 0000000000..f5b113a452 --- /dev/null +++ b/test/battle/move_effect/geomancy.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Geomancy (Move Effect) test titles") diff --git a/test/battle/move_effect/grassy_glide.c b/test/battle/move_effect/grassy_glide.c new file mode 100644 index 0000000000..00219fb1dd --- /dev/null +++ b/test/battle/move_effect/grassy_glide.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Grassy Glide (Move Effect) test titles") diff --git a/test/battle/move_effect/grav_apple.c b/test/battle/move_effect/grav_apple.c new file mode 100644 index 0000000000..7ce2dd26c7 --- /dev/null +++ b/test/battle/move_effect/grav_apple.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Grav Apple (Move Effect) test titles") diff --git a/test/battle/move_effect/growth.c b/test/battle/move_effect/growth.c new file mode 100644 index 0000000000..7b53f56cfc --- /dev/null +++ b/test/battle/move_effect/growth.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Growth (Move Effect) test titles") diff --git a/test/battle/move_effect/grudge.c b/test/battle/move_effect/grudge.c new file mode 100644 index 0000000000..f0e0e53b6a --- /dev/null +++ b/test/battle/move_effect/grudge.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Grudge (Move Effect) test titles") diff --git a/test/battle/move_effect/guard_swap.c b/test/battle/move_effect/guard_swap.c new file mode 100644 index 0000000000..f0e0e53b6a --- /dev/null +++ b/test/battle/move_effect/guard_swap.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Grudge (Move Effect) test titles") diff --git a/test/battle/move_effect/guardian_of_alola.c b/test/battle/move_effect/guardian_of_alola.c new file mode 100644 index 0000000000..fe33236363 --- /dev/null +++ b/test/battle/move_effect/guardian_of_alola.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Guardian of Alola (Move Effect) test titles") diff --git a/test/battle/move_effect/gyro_ball.c b/test/battle/move_effect/gyro_ball.c new file mode 100644 index 0000000000..e6cbfa46c9 --- /dev/null +++ b/test/battle/move_effect/gyro_ball.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Gyro Ball (Move Effect) test titles") diff --git a/test/battle/move_effect/hail.c b/test/battle/move_effect/hail.c new file mode 100644 index 0000000000..9fdbe0ab37 --- /dev/null +++ b/test/battle/move_effect/hail.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Hail (Move Effect) test titles") diff --git a/test/battle/move_effect/happy_hour.c b/test/battle/move_effect/happy_hour.c new file mode 100644 index 0000000000..4e271068e2 --- /dev/null +++ b/test/battle/move_effect/happy_hour.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Happy Hour (Move Effect) test titles") diff --git a/test/battle/move_effect/heal_bell.c b/test/battle/move_effect/heal_bell.c index 7730879d45..6a8e5d5ed4 100644 --- a/test/battle/move_effect/heal_bell.c +++ b/test/battle/move_effect/heal_bell.c @@ -3,7 +3,35 @@ ASSUMPTIONS { - ASSUME(GetMoveEffect(MOVE_HEAL_BELL) == EFFECT_HEAL_BELL); + ASSUME(gMovesInfo[MOVE_HEAL_BELL].effect == EFFECT_HEAL_BELL); + ASSUME(gMovesInfo[MOVE_AROMATHERAPY].effect == EFFECT_HEAL_BELL); + ASSUME(MoveHasAdditionalEffect(MOVE_SPARKLY_SWIRL, MOVE_EFFECT_AROMATHERAPY)); +} + +DOUBLE_BATTLE_TEST("Sparkly Swirl cures the entire party") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { Status1(STATUS1_POISON); } + PLAYER(SPECIES_WOBBUFFET) { Status1(STATUS1_POISON); } + PLAYER(SPECIES_WOBBUFFET) { Status1(STATUS1_POISON); } + PLAYER(SPECIES_WOBBUFFET) { Status1(STATUS1_POISON); } + PLAYER(SPECIES_WOBBUFFET) { Status1(STATUS1_POISON); } + PLAYER(SPECIES_WOBBUFFET) { Status1(STATUS1_POISON); } + OPPONENT(SPECIES_WYNAUT); + OPPONENT(SPECIES_WYNAUT); + } WHEN { + TURN { MOVE(playerLeft, MOVE_SPARKLY_SWIRL, target: opponentLeft); } + TURN { SWITCH(playerLeft, 2); SWITCH(playerRight, 3); } + } SCENE { + int i; + + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPARKLY_SWIRL, playerLeft); + STATUS_ICON(playerLeft, none: TRUE); + STATUS_ICON(playerRight, none: TRUE); + NOT MESSAGE("Wobbuffet was hurt by its poisoning!"); + for (i = 0; i < PARTY_SIZE; i++) + EXPECT_EQ(GetMonData(&gPlayerParty[i], MON_DATA_STATUS), STATUS1_NONE); + } } DOUBLE_BATTLE_TEST("Heal Bell/Aromatherapy cures the entire party of the user from primary status effects") @@ -52,7 +80,7 @@ DOUBLE_BATTLE_TEST("Heal Bell/Aromatherapy cures the entire party of the user fr case STATUS1_FROSTBITE: STATUS_ICON(playerLeft, frostbite: FALSE); STATUS_ICON(playerRight, frostbite: FALSE); break; } for (j = 0; j < PARTY_SIZE; j++) - EXPECT_EQ(GetMonData(&gPlayerParty[0], MON_DATA_STATUS), STATUS1_NONE); + EXPECT_EQ(GetMonData(&gPlayerParty[i], MON_DATA_STATUS), STATUS1_NONE); } } diff --git a/test/battle/move_effect/heal_block.c b/test/battle/move_effect/heal_block.c new file mode 100644 index 0000000000..2bb4367dd4 --- /dev/null +++ b/test/battle/move_effect/heal_block.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Heal Block (Move Effect) test titles") diff --git a/test/battle/move_effect/heart_swap.c b/test/battle/move_effect/heart_swap.c new file mode 100644 index 0000000000..1c4d22e204 --- /dev/null +++ b/test/battle/move_effect/heart_swap.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Heart Swap (Move Effect) test titles") diff --git a/test/battle/move_effect/heat_crash.c b/test/battle/move_effect/heat_crash.c new file mode 100644 index 0000000000..8b2d0a0433 --- /dev/null +++ b/test/battle/move_effect/heat_crash.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Heat Crash (Move Effect) test titles") diff --git a/test/battle/move_effect/helping_hand.c b/test/battle/move_effect/helping_hand.c new file mode 100644 index 0000000000..81d64e113d --- /dev/null +++ b/test/battle/move_effect/helping_hand.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Helping Hand (Move Effect) test titles") diff --git a/test/battle/move_effect/hidden_power.c b/test/battle/move_effect/hidden_power.c index 7f2bb5f2b9..124d78c96a 100644 --- a/test/battle/move_effect/hidden_power.c +++ b/test/battle/move_effect/hidden_power.c @@ -113,8 +113,8 @@ SINGLE_BATTLE_TEST("Hidden Power's type is determined by IVs") ASSUME(gTypeEffectivenessTable[type][foeType] == UQ_4_12(2.0)); // Foe's Type resists ASSUME(gSpeciesInfo[foeSpecies].types[0] == gSpeciesInfo[foeSpecies].types[1]); // Foe's pure type ASSUME(gSpeciesInfo[foeSpecies].types[0] == foeType); // Foe is the super-effective type - ASSUME(ItemId_GetHoldEffect(foeItem) == HOLD_EFFECT_RESIST_BERRY); // Item is resist berry - ASSUME(ItemId_GetHoldEffectParam(foeItem) == type); // Resist berry of type + ASSUME(GetItemHoldEffect(foeItem) == HOLD_EFFECT_RESIST_BERRY); // Item is resist berry + ASSUME(GetItemHoldEffectParam(foeItem) == type); // Resist berry of type PLAYER(SPECIES_DUNSPARCE) { HPIV(hp); AttackIV(atk); DefenseIV(def); SpAttackIV(spAtk); SpDefenseIV(spDef); SpeedIV(speed); } } else { PLAYER(SPECIES_DUNSPARCE); diff --git a/test/battle/move_effect/hit_enemy_heal_ally.c b/test/battle/move_effect/hit_enemy_heal_ally.c new file mode 100644 index 0000000000..018672cd6c --- /dev/null +++ b/test/battle/move_effect/hit_enemy_heal_ally.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Pollen Puff (Move Effect) test titles") diff --git a/test/battle/move_effect/hyperspace_fury.c b/test/battle/move_effect/hyperspace_fury.c new file mode 100644 index 0000000000..080758c94b --- /dev/null +++ b/test/battle/move_effect/hyperspace_fury.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Hyperspace Fury (Move Effect) test titles") diff --git a/test/battle/move_effect/imprison.c b/test/battle/move_effect/imprison.c new file mode 100644 index 0000000000..dd4e496692 --- /dev/null +++ b/test/battle/move_effect/imprison.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Imprison (Move Effect) test titles") diff --git a/test/battle/move_effect/ingrain.c b/test/battle/move_effect/ingrain.c new file mode 100644 index 0000000000..19213f10d9 --- /dev/null +++ b/test/battle/move_effect/ingrain.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Ingrain (Move Effect) test titles") diff --git a/test/battle/move_effect/jungle_healing.c b/test/battle/move_effect/jungle_healing.c new file mode 100644 index 0000000000..12b964a049 --- /dev/null +++ b/test/battle/move_effect/jungle_healing.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Jungle Healing (Move Effect) test titles") diff --git a/test/battle/move_effect/lash_out.c b/test/battle/move_effect/lash_out.c new file mode 100644 index 0000000000..dd8e9eb0e9 --- /dev/null +++ b/test/battle/move_effect/lash_out.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Lash Out (Move Effect) test titles") diff --git a/test/battle/move_effect/level_damage.c b/test/battle/move_effect/level_damage.c new file mode 100644 index 0000000000..63bd121577 --- /dev/null +++ b/test/battle/move_effect/level_damage.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Seismic Toss/Night Shade (Move Effect) test titles") diff --git a/test/battle/move_effect/light_screen.c b/test/battle/move_effect/light_screen.c new file mode 100644 index 0000000000..56eedebbd4 --- /dev/null +++ b/test/battle/move_effect/light_screen.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Light Screen (Move Effect) test titles") diff --git a/test/battle/move_effect/lock_on.c b/test/battle/move_effect/lock_on.c new file mode 100644 index 0000000000..9e7b93cff4 --- /dev/null +++ b/test/battle/move_effect/lock_on.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Lock-On/Mind Reader (Move Effect) test titles") diff --git a/test/battle/move_effect/low_kick.c b/test/battle/move_effect/low_kick.c new file mode 100644 index 0000000000..c68b152e2d --- /dev/null +++ b/test/battle/move_effect/low_kick.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Low Kick (Move Effect) test titles") diff --git a/test/battle/move_effect/magic_room.c b/test/battle/move_effect/magic_room.c new file mode 100644 index 0000000000..9fde0046fd --- /dev/null +++ b/test/battle/move_effect/magic_room.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Magic Room (Move Effect) test titles") diff --git a/test/battle/move_effect/magnet_rise.c b/test/battle/move_effect/magnet_rise.c new file mode 100644 index 0000000000..9fde0046fd --- /dev/null +++ b/test/battle/move_effect/magnet_rise.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Magic Room (Move Effect) test titles") diff --git a/test/battle/move_effect/magnetic_flux.c b/test/battle/move_effect/magnetic_flux.c new file mode 100644 index 0000000000..f574db0089 --- /dev/null +++ b/test/battle/move_effect/magnetic_flux.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Magnetic Flux (Move Effect) test titles") diff --git a/test/battle/move_effect/magnitude.c b/test/battle/move_effect/magnitude.c new file mode 100644 index 0000000000..75799a4dcb --- /dev/null +++ b/test/battle/move_effect/magnitude.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Magnitude (Move Effect) test titles") diff --git a/test/battle/move_effect/mat_block.c b/test/battle/move_effect/mat_block.c new file mode 100644 index 0000000000..78921a7329 --- /dev/null +++ b/test/battle/move_effect/mat_block.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Mat Block (Move Effect) test titles") diff --git a/test/battle/move_effect/max_move.c b/test/battle/move_effect/max_move.c new file mode 100644 index 0000000000..41c2a4e32c --- /dev/null +++ b/test/battle/move_effect/max_move.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Max Moves (Move Effect) test titles") diff --git a/test/battle/move_effect/me_first.c b/test/battle/move_effect/me_first.c new file mode 100644 index 0000000000..e5fbd2a7fb --- /dev/null +++ b/test/battle/move_effect/me_first.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Me First (Move Effect) test titles") diff --git a/test/battle/move_effect/mean_look.c b/test/battle/move_effect/mean_look.c new file mode 100644 index 0000000000..a5fa8ff0c1 --- /dev/null +++ b/test/battle/move_effect/mean_look.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Mean Look (Move Effect) test titles") diff --git a/test/battle/move_effect/memento.c b/test/battle/move_effect/memento.c new file mode 100644 index 0000000000..c83ffc1ab1 --- /dev/null +++ b/test/battle/move_effect/memento.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Memento (Move Effect) test titles") diff --git a/test/battle/move_effect/metal_burst.c b/test/battle/move_effect/metal_burst.c new file mode 100644 index 0000000000..4fec370e85 --- /dev/null +++ b/test/battle/move_effect/metal_burst.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Metal Burst (Move Effect) test titles") diff --git a/test/battle/move_effect/mimic.c b/test/battle/move_effect/mimic.c new file mode 100644 index 0000000000..4a51a4b79e --- /dev/null +++ b/test/battle/move_effect/mimic.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Mimic (Move Effect) test titles") diff --git a/test/battle/move_effect/minimize.c b/test/battle/move_effect/minimize.c new file mode 100644 index 0000000000..f0196936a5 --- /dev/null +++ b/test/battle/move_effect/minimize.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Minimize (Move Effect) test titles") diff --git a/test/battle/move_effect/miracle_eye.c b/test/battle/move_effect/miracle_eye.c new file mode 100644 index 0000000000..784323f1cc --- /dev/null +++ b/test/battle/move_effect/miracle_eye.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Miracle Eye (Move Effect) test titles") diff --git a/test/battle/move_effect/mirror_coat.c b/test/battle/move_effect/mirror_coat.c new file mode 100644 index 0000000000..2a3d6ef250 --- /dev/null +++ b/test/battle/move_effect/mirror_coat.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Mirror Coat (Move Effect) test titles") diff --git a/test/battle/move_effect/mist.c b/test/battle/move_effect/mist.c new file mode 100644 index 0000000000..332d82a6f9 --- /dev/null +++ b/test/battle/move_effect/mist.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Mist (Move Effect) test titles") diff --git a/test/battle/move_effect/mud_sport.c b/test/battle/move_effect/mud_sport.c new file mode 100644 index 0000000000..143bbe1447 --- /dev/null +++ b/test/battle/move_effect/mud_sport.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Mud Sport (Move Effect) test titles") diff --git a/test/battle/move_effect/natural_gift.c b/test/battle/move_effect/natural_gift.c new file mode 100644 index 0000000000..dd9b0bd466 --- /dev/null +++ b/test/battle/move_effect/natural_gift.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Natural Gift (Move Effect) test titles") diff --git a/test/battle/move_effect/nature_power.c b/test/battle/move_effect/nature_power.c new file mode 100644 index 0000000000..1e9692f88d --- /dev/null +++ b/test/battle/move_effect/nature_power.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Nature Power (Move Effect) test titles") diff --git a/test/battle/move_effect/nightmare.c b/test/battle/move_effect/nightmare.c new file mode 100644 index 0000000000..c243664f2d --- /dev/null +++ b/test/battle/move_effect/nightmare.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Nightmare (Move Effect) test titles") diff --git a/test/battle/move_effect/no_retreat.c b/test/battle/move_effect/no_retreat.c new file mode 100644 index 0000000000..bf2a15dfbf --- /dev/null +++ b/test/battle/move_effect/no_retreat.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write No Retreat (Move Effect) test titles") diff --git a/test/battle/move_effect/noble_roar.c b/test/battle/move_effect/noble_roar.c new file mode 100644 index 0000000000..4fd182b84d --- /dev/null +++ b/test/battle/move_effect/noble_roar.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Noble Roar (Move Effect) test titles") diff --git a/test/battle/move_effect/order_up.c b/test/battle/move_effect/order_up.c new file mode 100644 index 0000000000..fffd773403 --- /dev/null +++ b/test/battle/move_effect/order_up.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Order Up (Move Effect) test titles") diff --git a/test/battle/move_effect/pain_split.c b/test/battle/move_effect/pain_split.c new file mode 100644 index 0000000000..be92aecc7d --- /dev/null +++ b/test/battle/move_effect/pain_split.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Pain Split (Move Effect) test titles") diff --git a/test/battle/move_effect/paralyze.c b/test/battle/move_effect/paralyze.c new file mode 100644 index 0000000000..a3f1a5574a --- /dev/null +++ b/test/battle/move_effect/paralyze.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Paralyze (Move Effect) test titles") diff --git a/test/battle/move_effect/parting_shot.c b/test/battle/move_effect/parting_shot.c new file mode 100644 index 0000000000..4d55d09315 --- /dev/null +++ b/test/battle/move_effect/parting_shot.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Parting Shot (Move Effect) test titles") diff --git a/test/battle/move_effect/payback.c b/test/battle/move_effect/payback.c new file mode 100644 index 0000000000..1f078987a1 --- /dev/null +++ b/test/battle/move_effect/payback.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Payback (Move Effect) test titles") diff --git a/test/battle/move_effect/perish_song.c b/test/battle/move_effect/perish_song.c new file mode 100644 index 0000000000..bfbe7eedc8 --- /dev/null +++ b/test/battle/move_effect/perish_song.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Perish Song (Move Effect) test titles") diff --git a/test/battle/move_effect/placeholder.c b/test/battle/move_effect/placeholder.c new file mode 100644 index 0000000000..1b06392b9a --- /dev/null +++ b/test/battle/move_effect/placeholder.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Placeholder (Move Effect) test titles") diff --git a/test/battle/move_effect/poison.c b/test/battle/move_effect/poison.c new file mode 100644 index 0000000000..5b26ccf62d --- /dev/null +++ b/test/battle/move_effect/poison.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Poison (Move Effect) test titles") diff --git a/test/battle/move_effect/poltergeist.c b/test/battle/move_effect/poltergeist.c new file mode 100644 index 0000000000..f90031d8a8 --- /dev/null +++ b/test/battle/move_effect/poltergeist.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Poltergeist (Move Effect) test titles") diff --git a/test/battle/move_effect/power_swap.c b/test/battle/move_effect/power_swap.c new file mode 100644 index 0000000000..214a8488cc --- /dev/null +++ b/test/battle/move_effect/power_swap.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Power Swap (Move Effect) test titles") diff --git a/test/battle/move_effect/power_trick.c b/test/battle/move_effect/power_trick.c new file mode 100644 index 0000000000..a8f89051e7 --- /dev/null +++ b/test/battle/move_effect/power_trick.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Power Trick (Move Effect) test titles") diff --git a/test/battle/move_effect/present.c b/test/battle/move_effect/present.c new file mode 100644 index 0000000000..bd21f13de4 --- /dev/null +++ b/test/battle/move_effect/present.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Present (Move Effect) test titles") diff --git a/test/battle/move_effect/psyblade.c b/test/battle/move_effect/psyblade.c new file mode 100644 index 0000000000..3a5778d1f4 --- /dev/null +++ b/test/battle/move_effect/psyblade.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Psyblade (Move Effect) test titles") diff --git a/test/battle/move_effect/psych_up.c b/test/battle/move_effect/psych_up.c new file mode 100644 index 0000000000..36241a4ed7 --- /dev/null +++ b/test/battle/move_effect/psych_up.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Psych Up (Move Effect) test titles") diff --git a/test/battle/move_effect/psycho_shift.c b/test/battle/move_effect/psycho_shift.c new file mode 100644 index 0000000000..4382ca4575 --- /dev/null +++ b/test/battle/move_effect/psycho_shift.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Psycho Shift (Move Effect) test titles") diff --git a/test/battle/move_effect/psyshock.c b/test/battle/move_effect/psyshock.c new file mode 100644 index 0000000000..6b3ee54c5c --- /dev/null +++ b/test/battle/move_effect/psyshock.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Psyshock (Move Effect) test titles") diff --git a/test/battle/move_effect/psywave.c b/test/battle/move_effect/psywave.c new file mode 100644 index 0000000000..627e45ea3e --- /dev/null +++ b/test/battle/move_effect/psywave.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Psywave (Move Effect) test titles") diff --git a/test/battle/move_effect/punishment.c b/test/battle/move_effect/punishment.c new file mode 100644 index 0000000000..45f0b899af --- /dev/null +++ b/test/battle/move_effect/punishment.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Punishment (Move Effect) test titles") diff --git a/test/battle/move_effect/purify.c b/test/battle/move_effect/purify.c new file mode 100644 index 0000000000..134c96119f --- /dev/null +++ b/test/battle/move_effect/purify.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Purify (Move Effect) test titles") diff --git a/test/battle/move_effect/quiver_dance.c b/test/battle/move_effect/quiver_dance.c new file mode 100644 index 0000000000..5a7ff5b944 --- /dev/null +++ b/test/battle/move_effect/quiver_dance.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Quiver Dance (Move Effect) test titles") diff --git a/test/battle/move_effect/rage.c b/test/battle/move_effect/rage.c new file mode 100644 index 0000000000..33025a6b0e --- /dev/null +++ b/test/battle/move_effect/rage.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Rage (Move Effect) test titles") diff --git a/test/battle/move_effect/rain_always_hit.c b/test/battle/move_effect/rain_always_hit.c new file mode 100644 index 0000000000..3bed952a37 --- /dev/null +++ b/test/battle/move_effect/rain_always_hit.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Bleakwind/Wildbolt/Sandsear Storm (Move Effect) test titles") diff --git a/test/battle/move_effect/rain_dance.c b/test/battle/move_effect/rain_dance.c new file mode 100644 index 0000000000..f9c3786b71 --- /dev/null +++ b/test/battle/move_effect/rain_dance.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Rain Dance (Move Effect) test titles") diff --git a/test/battle/move_effect/recoil_hp_25.c b/test/battle/move_effect/recoil_hp_25.c new file mode 100644 index 0000000000..9abb1bcfd0 --- /dev/null +++ b/test/battle/move_effect/recoil_hp_25.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Struggle (Move Effect) test titles") diff --git a/test/battle/move_effect/recycle.c b/test/battle/move_effect/recycle.c new file mode 100644 index 0000000000..53f2e5c2ff --- /dev/null +++ b/test/battle/move_effect/recycle.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Recycle (Move Effect) test titles") diff --git a/test/battle/move_effect/rest.c b/test/battle/move_effect/rest.c new file mode 100644 index 0000000000..4d0d85b560 --- /dev/null +++ b/test/battle/move_effect/rest.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Rest (Move Effect) test titles") diff --git a/test/battle/move_effect/restore_hp.c b/test/battle/move_effect/restore_hp.c new file mode 100644 index 0000000000..57f756115e --- /dev/null +++ b/test/battle/move_effect/restore_hp.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Recover/Slack Off/Heal Order (Move Effect) test titles") diff --git a/test/battle/move_effect/return.c b/test/battle/move_effect/return.c new file mode 100644 index 0000000000..50945ca556 --- /dev/null +++ b/test/battle/move_effect/return.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Return (Move Effect) test titles") diff --git a/test/battle/move_effect/revenge.c b/test/battle/move_effect/revenge.c new file mode 100644 index 0000000000..980bca9e33 --- /dev/null +++ b/test/battle/move_effect/revenge.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Revenge (Move Effect) test titles") diff --git a/test/battle/move_effect/rising_voltage.c b/test/battle/move_effect/rising_voltage.c new file mode 100644 index 0000000000..de6ca67c04 --- /dev/null +++ b/test/battle/move_effect/rising_voltage.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Rising Voltage (Move Effect) test titles") diff --git a/test/battle/move_effect/rollout.c b/test/battle/move_effect/rollout.c new file mode 100644 index 0000000000..c137ca4fc8 --- /dev/null +++ b/test/battle/move_effect/rollout.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Rollout (Move Effect) test titles") diff --git a/test/battle/move_effect/safeguard.c b/test/battle/move_effect/safeguard.c new file mode 100644 index 0000000000..44dee766ee --- /dev/null +++ b/test/battle/move_effect/safeguard.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Safeguard (Move Effect) test titles") diff --git a/test/battle/move_effect/sandstorm.c b/test/battle/move_effect/sandstorm.c new file mode 100644 index 0000000000..7a70a2f3ff --- /dev/null +++ b/test/battle/move_effect/sandstorm.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Sandstorm (Move Effect) test titles") diff --git a/test/battle/move_effect/shell_smash.c b/test/battle/move_effect/shell_smash.c new file mode 100644 index 0000000000..af31e771ad --- /dev/null +++ b/test/battle/move_effect/shell_smash.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Shell Smash (Move Effect) test titles") diff --git a/test/battle/move_effect/shift_gear.c b/test/battle/move_effect/shift_gear.c new file mode 100644 index 0000000000..990e815cb3 --- /dev/null +++ b/test/battle/move_effect/shift_gear.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Shift Gear (Move Effect) test titles") diff --git a/test/battle/move_effect/shore_up.c b/test/battle/move_effect/shore_up.c new file mode 100644 index 0000000000..91ee4f05b6 --- /dev/null +++ b/test/battle/move_effect/shore_up.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Shore Up (Move Effect) test titles") diff --git a/test/battle/move_effect/sky_drop.c b/test/battle/move_effect/sky_drop.c new file mode 100644 index 0000000000..f0482788dd --- /dev/null +++ b/test/battle/move_effect/sky_drop.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Sky Drop (Move Effect) test titles") diff --git a/test/battle/move_effect/smack_down.c b/test/battle/move_effect/smack_down.c deleted file mode 100644 index eb924ea1ac..0000000000 --- a/test/battle/move_effect/smack_down.c +++ /dev/null @@ -1,19 +0,0 @@ -#include "global.h" -#include "test/battle.h" - -ASSUMPTIONS -{ - ASSUME(MoveHasAdditionalEffect(MOVE_SMACK_DOWN, MOVE_EFFECT_SMACK_DOWN) == TRUE); -} - -SINGLE_BATTLE_TEST("Smack Down does not ground mons behind substitutes") -{ - GIVEN { - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_SKARMORY); - } WHEN { - TURN { MOVE(opponent, MOVE_SUBSTITUTE); MOVE(player, MOVE_SMACK_DOWN); } - } SCENE { - NOT MESSAGE("The opposing Skarmory fell straight down!"); - } -} diff --git a/test/battle/move_effect/smelling_salts.c b/test/battle/move_effect/smelling_salts.c deleted file mode 100644 index 6b1d0b2d7e..0000000000 --- a/test/battle/move_effect/smelling_salts.c +++ /dev/null @@ -1,63 +0,0 @@ -#include "global.h" -#include "test/battle.h" - -ASSUMPTIONS -{ - ASSUME(MoveHasAdditionalEffect(MOVE_SMELLING_SALTS, MOVE_EFFECT_REMOVE_STATUS) == TRUE); - ASSUME(GetMoveEffectArg_Status(MOVE_SMELLING_SALTS) == STATUS1_PARALYSIS); -} - -SINGLE_BATTLE_TEST("Smelling Salts does not cure paralyzed pokemons behind substitutes or get increased power") -{ - u32 ability; - PARAMETRIZE { ability = ABILITY_INNER_FOCUS; } - PARAMETRIZE { ability = ABILITY_INFILTRATOR; } - GIVEN { - PLAYER(SPECIES_CROBAT) { Ability(ability); } - OPPONENT(SPECIES_SEISMITOAD) { Status1(STATUS1_PARALYSIS); } - } WHEN { - TURN { MOVE(opponent, MOVE_SUBSTITUTE); MOVE(player, MOVE_CELEBRATE); } - TURN { MOVE(opponent, MOVE_CELEBRATE); MOVE(player, MOVE_SMELLING_SALTS); } - } SCENE { - ANIMATION(ANIM_TYPE_MOVE, MOVE_SMELLING_SALTS, player); - if (ability == ABILITY_INNER_FOCUS) - { - MESSAGE("The substitute took damage for the opposing Seismitoad!"); - NONE_OF - { - MESSAGE("The opposing Seismitoad's substitute faded!"); // Smelling Salts does 86 damage, the sub has 122 HP, if hitting a sub it shouldn't get boosted damage. - MESSAGE("The opposing Seismitoad was cured of paralysis!"); - STATUS_ICON(opponent, none: TRUE); - } - } - else - { - MESSAGE("The opposing Seismitoad was cured of paralysis!"); - STATUS_ICON(opponent, none: TRUE); - } - } -} - -SINGLE_BATTLE_TEST("Smelling Salts get incread power vs. paralyzed targets") -{ - u32 status1; - PARAMETRIZE { status1 = STATUS1_PARALYSIS; } - PARAMETRIZE { status1 = STATUS1_NONE; } - GIVEN { - PLAYER(SPECIES_CROBAT); - OPPONENT(SPECIES_LOTAD) { Status1(status1); } - } WHEN { - TURN { MOVE(player, MOVE_SMELLING_SALTS); } - } SCENE { - ANIMATION(ANIM_TYPE_MOVE, MOVE_SMELLING_SALTS, player); - if (status1 == STATUS1_PARALYSIS) - { - MESSAGE("The opposing Lotad fainted!"); - } - else - { - NOT MESSAGE("The opposing Lotad fainted!"); - MESSAGE("The opposing Lotad used Celebrate!"); - } - } -} diff --git a/test/battle/move_effect/snatch.c b/test/battle/move_effect/snatch.c new file mode 100644 index 0000000000..f8e2891837 --- /dev/null +++ b/test/battle/move_effect/snatch.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Snatch (Move Effect) test titles") diff --git a/test/battle/move_effect/snipe_shot.c b/test/battle/move_effect/snipe_shot.c new file mode 100644 index 0000000000..7ef7cbeb28 --- /dev/null +++ b/test/battle/move_effect/snipe_shot.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Snipe Shot (Move Effect) test titles") diff --git a/test/battle/move_effect/snowscape.c b/test/battle/move_effect/snowscape.c new file mode 100644 index 0000000000..a0d1275f66 --- /dev/null +++ b/test/battle/move_effect/snowscape.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Snowscape (Move Effect) test titles") diff --git a/test/battle/move_effect/soak.c b/test/battle/move_effect/soak.c new file mode 100644 index 0000000000..156e1f9558 --- /dev/null +++ b/test/battle/move_effect/soak.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Soak (Move Effect) test titles") diff --git a/test/battle/move_effect/softboiled.c b/test/battle/move_effect/softboiled.c new file mode 100644 index 0000000000..a4cbce5b93 --- /dev/null +++ b/test/battle/move_effect/softboiled.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Softboiled (Move Effect) test titles") diff --git a/test/battle/move_effect/sparkling_aria.c b/test/battle/move_effect/sparkling_aria.c deleted file mode 100644 index 86b906228b..0000000000 --- a/test/battle/move_effect/sparkling_aria.c +++ /dev/null @@ -1,25 +0,0 @@ -#include "global.h" -#include "test/battle.h" - -ASSUMPTIONS -{ - ASSUME(MoveHasAdditionalEffect(MOVE_SPARKLING_ARIA, MOVE_EFFECT_REMOVE_STATUS) == TRUE); - ASSUME(GetMoveEffectArg_Status(MOVE_SPARKLING_ARIA) == STATUS1_BURN); - ASSUME(IsSoundMove(MOVE_SPARKLING_ARIA)); -} - -DOUBLE_BATTLE_TEST("Sparkling Aria cures burns from all Pokemon on the field and behind substitutes") -{ - GIVEN { - PLAYER(SPECIES_PRIMARINA); - PLAYER(SPECIES_WOBBUFFET) { Status1(STATUS1_BURN); } - OPPONENT(SPECIES_WOBBUFFET) { Status1(STATUS1_BURN); } - OPPONENT(SPECIES_WYNAUT) { Status1(STATUS1_BURN); } - } WHEN { - TURN { MOVE(opponentLeft, MOVE_SUBSTITUTE); MOVE(opponentRight, MOVE_CELEBRATE); MOVE(playerRight, MOVE_CELEBRATE); MOVE(playerLeft, MOVE_SPARKLING_ARIA); } - } SCENE { - MESSAGE("The opposing Wobbuffet's burn was cured!"); - MESSAGE("Wobbuffet's burn was cured!"); - MESSAGE("The opposing Wynaut's burn was cured!"); - } -} diff --git a/test/battle/move_effect/special_attack_down_2.c b/test/battle/move_effect/special_attack_down_2.c new file mode 100644 index 0000000000..b62d4b52ac --- /dev/null +++ b/test/battle/move_effect/special_attack_down_2.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Eerie Impulse (Move Effect) test titles") diff --git a/test/battle/move_effect/special_attack_up.c b/test/battle/move_effect/special_attack_up.c new file mode 100644 index 0000000000..964566a8db --- /dev/null +++ b/test/battle/move_effect/special_attack_up.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Sp.Atk +1 (Move Effect) test titles") // Pre-gen5 Growth diff --git a/test/battle/move_effect/special_attack_up_2.c b/test/battle/move_effect/special_attack_up_2.c new file mode 100644 index 0000000000..c4bf38d6aa --- /dev/null +++ b/test/battle/move_effect/special_attack_up_2.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Nasty Plot (Move Effect) test titles") diff --git a/test/battle/move_effect/special_defense_down.c b/test/battle/move_effect/special_defense_down.c new file mode 100644 index 0000000000..1769ff6975 --- /dev/null +++ b/test/battle/move_effect/special_defense_down.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Sp.Def -1 (Move Effect) test titles") // No move has this effect diff --git a/test/battle/move_effect/special_defense_down_2.c b/test/battle/move_effect/special_defense_down_2.c new file mode 100644 index 0000000000..5fff5bdd7b --- /dev/null +++ b/test/battle/move_effect/special_defense_down_2.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Fake Tears/Metal Sound (Move Effect) test titles") diff --git a/test/battle/move_effect/special_defense_up.c b/test/battle/move_effect/special_defense_up.c new file mode 100644 index 0000000000..66bbfa4dc5 --- /dev/null +++ b/test/battle/move_effect/special_defense_up.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Sp.Def +1 (Move Effect) test titles") // No move has this effect diff --git a/test/battle/move_effect/special_defense_up_2.c b/test/battle/move_effect/special_defense_up_2.c new file mode 100644 index 0000000000..1685663452 --- /dev/null +++ b/test/battle/move_effect/special_defense_up_2.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Amnesia (Move Effect) test titles") diff --git a/test/battle/move_effect/speed_down_2.c b/test/battle/move_effect/speed_down_2.c new file mode 100644 index 0000000000..e3b95e3fe9 --- /dev/null +++ b/test/battle/move_effect/speed_down_2.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Scary Face/Cotton Spore (Move Effect) test titles") diff --git a/test/battle/move_effect/speed_up.c b/test/battle/move_effect/speed_up.c new file mode 100644 index 0000000000..1b0d417ef6 --- /dev/null +++ b/test/battle/move_effect/speed_up.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Speed +1 (Move Effect) test titles") // No move has this effect diff --git a/test/battle/move_effect/speed_up_2.c b/test/battle/move_effect/speed_up_2.c new file mode 100644 index 0000000000..7202555498 --- /dev/null +++ b/test/battle/move_effect/speed_up_2.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Agility/Rock Polish (Move Effect) test titles") diff --git a/test/battle/move_effect/spite.c b/test/battle/move_effect/spite.c new file mode 100644 index 0000000000..6a23e16dd2 --- /dev/null +++ b/test/battle/move_effect/spite.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Spite (Move Effect) test titles") diff --git a/test/battle/move_effect/stored_power.c b/test/battle/move_effect/stored_power.c new file mode 100644 index 0000000000..55788a1ff0 --- /dev/null +++ b/test/battle/move_effect/stored_power.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Stored Power (Move Effect) test titles") diff --git a/test/battle/move_effect/sunny_day.c b/test/battle/move_effect/sunny_day.c new file mode 100644 index 0000000000..d7fed979d9 --- /dev/null +++ b/test/battle/move_effect/sunny_day.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Sunny Day (Move Effect) test titles") diff --git a/test/battle/move_effect/super_fang.c b/test/battle/move_effect/super_fang.c new file mode 100644 index 0000000000..33e162395d --- /dev/null +++ b/test/battle/move_effect/super_fang.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Super Fang (Move Effect) test titles") diff --git a/test/battle/move_effect/swagger.c b/test/battle/move_effect/swagger.c new file mode 100644 index 0000000000..5845d4292f --- /dev/null +++ b/test/battle/move_effect/swagger.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Swagger (Move Effect) test titles") diff --git a/test/battle/move_effect/synchronoise.c b/test/battle/move_effect/synchronoise.c new file mode 100644 index 0000000000..9b68ccc63a --- /dev/null +++ b/test/battle/move_effect/synchronoise.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Synchronoise (Move Effect) test titles") diff --git a/test/battle/move_effect/taunt.c b/test/battle/move_effect/taunt.c new file mode 100644 index 0000000000..91fe13364d --- /dev/null +++ b/test/battle/move_effect/taunt.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Taunt (Move Effect) test titles") diff --git a/test/battle/move_effect/terrain_pulse.c b/test/battle/move_effect/terrain_pulse.c new file mode 100644 index 0000000000..75b6802451 --- /dev/null +++ b/test/battle/move_effect/terrain_pulse.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Terrain Pulse (Move Effect) test titles") diff --git a/test/battle/move_effect/third_type.c b/test/battle/move_effect/third_type.c new file mode 100644 index 0000000000..c3bcab38d2 --- /dev/null +++ b/test/battle/move_effect/third_type.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Trick-or-Treat/Forest's Curse (Move Effect) test titles") diff --git a/test/battle/move_effect/tickle.c b/test/battle/move_effect/tickle.c new file mode 100644 index 0000000000..b5f5a56d69 --- /dev/null +++ b/test/battle/move_effect/tickle.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Tickle (Move Effect) test titles") diff --git a/test/battle/move_effect/topsy_turvy.c b/test/battle/move_effect/topsy_turvy.c new file mode 100644 index 0000000000..6e5ce38097 --- /dev/null +++ b/test/battle/move_effect/topsy_turvy.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Topsy Turvy (Move Effect) test titles") diff --git a/test/battle/move_effect/toxic_spikes.c b/test/battle/move_effect/toxic_spikes.c index 641fc0520c..5452f66a8b 100644 --- a/test/battle/move_effect/toxic_spikes.c +++ b/test/battle/move_effect/toxic_spikes.c @@ -235,3 +235,34 @@ SINGLE_BATTLE_TEST("Toxic Spikes inflicts poison on switch in after Primal Rever STATUS_ICON(player, poison: TRUE); } } + +SINGLE_BATTLE_TEST("Toxic Spikes print normal poison for 1 layer") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WYNAUT); + } WHEN { + TURN { MOVE(player, MOVE_TOXIC_SPIKES); } + TURN { SWITCH(opponent, 1); } + TURN {} + } SCENE { + MESSAGE("The opposing Wynaut was poisoned!"); + } +} + +SINGLE_BATTLE_TEST("Toxic Spikes print bad poison for 2 layers") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WYNAUT); + } WHEN { + TURN { MOVE(player, MOVE_TOXIC_SPIKES); } + TURN { MOVE(player, MOVE_TOXIC_SPIKES); } + TURN { SWITCH(opponent, 1); } + TURN {} + } SCENE { + MESSAGE("The opposing Wynaut was badly poisoned!"); + } +} diff --git a/test/battle/move_effect/toxic_thread.c b/test/battle/move_effect/toxic_thread.c new file mode 100644 index 0000000000..9471b24bd6 --- /dev/null +++ b/test/battle/move_effect/toxic_thread.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Toxic Thread (Move Effect) test titles") diff --git a/test/battle/move_effect/transform.c b/test/battle/move_effect/transform.c new file mode 100644 index 0000000000..fd6e5f5a94 --- /dev/null +++ b/test/battle/move_effect/transform.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Transform (Move Effect) test titles") diff --git a/test/battle/move_effect/trick.c b/test/battle/move_effect/trick.c new file mode 100644 index 0000000000..3aa26af67a --- /dev/null +++ b/test/battle/move_effect/trick.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Trick (Move Effect) test titles") diff --git a/test/battle/move_effect/trick_room.c b/test/battle/move_effect/trick_room.c new file mode 100644 index 0000000000..615931ef15 --- /dev/null +++ b/test/battle/move_effect/trick_room.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Trick Room (Move Effect) test titles") diff --git a/test/battle/move_effect/trump_card.c b/test/battle/move_effect/trump_card.c new file mode 100644 index 0000000000..21b5c48ca3 --- /dev/null +++ b/test/battle/move_effect/trump_card.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Trump Card (Move Effect) test titles") diff --git a/test/battle/move_effect/two_typed_move.c b/test/battle/move_effect/two_typed_move.c new file mode 100644 index 0000000000..43c3515739 --- /dev/null +++ b/test/battle/move_effect/two_typed_move.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Flying Press (Move Effect) test titles") diff --git a/test/battle/move_effect/venom_drench.c b/test/battle/move_effect/venom_drench.c new file mode 100644 index 0000000000..00dac65858 --- /dev/null +++ b/test/battle/move_effect/venom_drench.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Venom Drench (Move Effect) test titles") diff --git a/test/battle/move_effect/victory_dance.c b/test/battle/move_effect/victory_dance.c new file mode 100644 index 0000000000..cd1d892428 --- /dev/null +++ b/test/battle/move_effect/victory_dance.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Victory Dance (Move Effect) test titles") diff --git a/test/battle/move_effect/wake_up_slap.c b/test/battle/move_effect/wake_up_slap.c deleted file mode 100644 index 0e172bf053..0000000000 --- a/test/battle/move_effect/wake_up_slap.c +++ /dev/null @@ -1,57 +0,0 @@ -#include "global.h" -#include "test/battle.h" - -ASSUMPTIONS -{ - ASSUME(MoveHasAdditionalEffect(MOVE_WAKE_UP_SLAP, MOVE_EFFECT_REMOVE_STATUS) == TRUE); - ASSUME(GetMoveEffectArg_Status(MOVE_WAKE_UP_SLAP) == STATUS1_SLEEP); -} - -SINGLE_BATTLE_TEST("Wake-Up Slap does not cure paralyzed pokemons behind substitutes or get increased power") -{ - u32 ability; - PARAMETRIZE { ability = ABILITY_INNER_FOCUS; } - PARAMETRIZE { ability = ABILITY_INFILTRATOR; } - GIVEN { - PLAYER(SPECIES_CROBAT) { Ability(ability); } - OPPONENT(SPECIES_SEISMITOAD); - } WHEN { - TURN { MOVE(opponent, MOVE_SUBSTITUTE); MOVE(player, MOVE_SING); } - TURN { MOVE(opponent, MOVE_CELEBRATE); MOVE(player, MOVE_WAKE_UP_SLAP); } - } SCENE { - ANIMATION(ANIM_TYPE_MOVE, MOVE_WAKE_UP_SLAP, player); - if (ability == ABILITY_INNER_FOCUS) { - MESSAGE("The substitute took damage for the opposing Seismitoad!"); - NONE_OF - { - MESSAGE("The opposing Seismitoad's substitute faded!"); // Smelling Salts does 86 damage, the sub has 122 HP, if hitting a sub it shouldn't get boosted damage. - MESSAGE("The opposing Seismitoad woke up!"); - STATUS_ICON(opponent, none: TRUE); - } - } else { - MESSAGE("The opposing Seismitoad woke up!"); - STATUS_ICON(opponent, none: TRUE); - } - } -} - -SINGLE_BATTLE_TEST("Wake-Up Slap gets increased power against sleeping targets") -{ - u32 status1; - PARAMETRIZE { status1 = STATUS1_SLEEP; } - PARAMETRIZE { status1 = STATUS1_NONE; } - GIVEN { - PLAYER(SPECIES_CROBAT); - OPPONENT(SPECIES_LOTAD) { Status1(status1); } - } WHEN { - TURN { MOVE(player, MOVE_WAKE_UP_SLAP); } - } SCENE { - ANIMATION(ANIM_TYPE_MOVE, MOVE_WAKE_UP_SLAP, player); - if (status1 == STATUS1_SLEEP) { - MESSAGE("The opposing Lotad fainted!"); - } else { - NOT MESSAGE("The opposing Lotad fainted!"); - MESSAGE("The opposing Lotad used Celebrate!"); - } - } -} diff --git a/test/battle/move_effect/water_sport.c b/test/battle/move_effect/water_sport.c new file mode 100644 index 0000000000..f7521c1fcc --- /dev/null +++ b/test/battle/move_effect/water_sport.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Water Sport (Move Effect) test titles") diff --git a/test/battle/move_effect/will_o_wisp.c b/test/battle/move_effect/will_o_wisp.c new file mode 100644 index 0000000000..08b1bd6c69 --- /dev/null +++ b/test/battle/move_effect/will_o_wisp.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Will-O-Wisp (Move Effect) test titles") diff --git a/test/battle/move_effect/wish.c b/test/battle/move_effect/wish.c new file mode 100644 index 0000000000..a38529d792 --- /dev/null +++ b/test/battle/move_effect/wish.c @@ -0,0 +1,41 @@ +#include "global.h" +#include "test/battle.h" + +SINGLE_BATTLE_TEST("Wish heals the user at the end of the next turn") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_WISH); MOVE(opponent, MOVE_POUND); } + TURN { } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_WISH, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_POUND, opponent); + HP_BAR(player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, opponent); + MESSAGE("Wobbuffet's wish came true!"); + HP_BAR(player); + } +} + +SINGLE_BATTLE_TEST("Wish is blocked by Heal Block") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_WISH); MOVE(opponent, MOVE_POUND); } + TURN { MOVE(opponent, MOVE_HEAL_BLOCK); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_WISH, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_POUND, opponent); + HP_BAR(player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_HEAL_BLOCK, opponent); + MESSAGE("Wobbuffet was prevented from healing!"); + NOT HP_BAR(player); + } +} +TO_DO_BATTLE_TEST("TODO: Write Wish (Move Effect) test titles") diff --git a/test/battle/move_effect/wonder_room.c b/test/battle/move_effect/wonder_room.c new file mode 100644 index 0000000000..113b7c55eb --- /dev/null +++ b/test/battle/move_effect/wonder_room.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Wonder Room (Move Effect) test titles") diff --git a/test/battle/move_effect/yawn.c b/test/battle/move_effect/yawn.c new file mode 100644 index 0000000000..ec150cc9bb --- /dev/null +++ b/test/battle/move_effect/yawn.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Yawn (Move Effect) test titles") diff --git a/test/battle/move_effect/flame_burst.c b/test/battle/move_effect_secondary/flame_burst.c similarity index 100% rename from test/battle/move_effect/flame_burst.c rename to test/battle/move_effect_secondary/flame_burst.c diff --git a/test/battle/move_effect_secondary/remove_status.c b/test/battle/move_effect_secondary/remove_status.c new file mode 100644 index 0000000000..0ff3d0f78c --- /dev/null +++ b/test/battle/move_effect_secondary/remove_status.c @@ -0,0 +1,132 @@ +#include "global.h" +#include "test/battle.h" + +SINGLE_BATTLE_TEST("Smelling Salts does not cure paralyzed pokemons behind substitutes or get increased power") +{ + u32 ability; + PARAMETRIZE { ability = ABILITY_INNER_FOCUS; } + PARAMETRIZE { ability = ABILITY_INFILTRATOR; } + GIVEN { + ASSUME(MoveHasAdditionalEffect(MOVE_SMELLING_SALTS, MOVE_EFFECT_REMOVE_STATUS) == TRUE); + ASSUME(GetMoveEffectArg_Status(MOVE_SMELLING_SALTS) == STATUS1_PARALYSIS); + PLAYER(SPECIES_CROBAT) { Ability(ability); } + OPPONENT(SPECIES_SEISMITOAD) { Status1(STATUS1_PARALYSIS); } + } WHEN { + TURN { MOVE(opponent, MOVE_SUBSTITUTE); MOVE(player, MOVE_CELEBRATE); } + TURN { MOVE(opponent, MOVE_CELEBRATE); MOVE(player, MOVE_SMELLING_SALTS); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SMELLING_SALTS, player); + if (ability == ABILITY_INNER_FOCUS) + { + MESSAGE("The substitute took damage for the opposing Seismitoad!"); + NONE_OF + { + MESSAGE("The opposing Seismitoad's substitute faded!"); // Smelling Salts does 86 damage, the sub has 122 HP, if hitting a sub it shouldn't get boosted damage. + MESSAGE("The opposing Seismitoad was cured of paralysis!"); + STATUS_ICON(opponent, none: TRUE); + } + } + else + { + MESSAGE("The opposing Seismitoad was cured of paralysis!"); + STATUS_ICON(opponent, none: TRUE); + } + } +} + +SINGLE_BATTLE_TEST("Smelling Salts get incread power vs. paralyzed targets") +{ + u32 status1; + PARAMETRIZE { status1 = STATUS1_PARALYSIS; } + PARAMETRIZE { status1 = STATUS1_NONE; } + GIVEN { + ASSUME(MoveHasAdditionalEffect(MOVE_SMELLING_SALTS, MOVE_EFFECT_REMOVE_STATUS) == TRUE); + ASSUME(GetMoveEffectArg_Status(MOVE_SMELLING_SALTS) == STATUS1_PARALYSIS); + PLAYER(SPECIES_CROBAT); + OPPONENT(SPECIES_LOTAD) { Status1(status1); } + } WHEN { + TURN { MOVE(player, MOVE_SMELLING_SALTS); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SMELLING_SALTS, player); + if (status1 == STATUS1_PARALYSIS) + { + MESSAGE("The opposing Lotad fainted!"); + } + else + { + NOT MESSAGE("The opposing Lotad fainted!"); + MESSAGE("The opposing Lotad used Celebrate!"); + } + } +} + +SINGLE_BATTLE_TEST("Wake-Up Slap does not cure paralyzed pokemons behind substitutes or get increased power") +{ + u32 ability; + PARAMETRIZE { ability = ABILITY_INNER_FOCUS; } + PARAMETRIZE { ability = ABILITY_INFILTRATOR; } + GIVEN { + ASSUME(MoveHasAdditionalEffect(MOVE_WAKE_UP_SLAP, MOVE_EFFECT_REMOVE_STATUS) == TRUE); + ASSUME(GetMoveEffectArg_Status(MOVE_WAKE_UP_SLAP) == STATUS1_SLEEP); + PLAYER(SPECIES_CROBAT) { Ability(ability); } + OPPONENT(SPECIES_SEISMITOAD); + } WHEN { + TURN { MOVE(opponent, MOVE_SUBSTITUTE); MOVE(player, MOVE_SING); } + TURN { MOVE(opponent, MOVE_CELEBRATE); MOVE(player, MOVE_WAKE_UP_SLAP); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_WAKE_UP_SLAP, player); + if (ability == ABILITY_INNER_FOCUS) { + MESSAGE("The substitute took damage for the opposing Seismitoad!"); + NONE_OF + { + MESSAGE("The opposing Seismitoad's substitute faded!"); // Smelling Salts does 86 damage, the sub has 122 HP, if hitting a sub it shouldn't get boosted damage. + MESSAGE("The opposing Seismitoad woke up!"); + STATUS_ICON(opponent, none: TRUE); + } + } else { + MESSAGE("The opposing Seismitoad woke up!"); + STATUS_ICON(opponent, none: TRUE); + } + } +} + +SINGLE_BATTLE_TEST("Wake-Up Slap gets increased power against sleeping targets") +{ + u32 status1; + PARAMETRIZE { status1 = STATUS1_SLEEP; } + PARAMETRIZE { status1 = STATUS1_NONE; } + GIVEN { + ASSUME(MoveHasAdditionalEffect(MOVE_WAKE_UP_SLAP, MOVE_EFFECT_REMOVE_STATUS) == TRUE); + ASSUME(GetMoveEffectArg_Status(MOVE_WAKE_UP_SLAP) == STATUS1_SLEEP); + PLAYER(SPECIES_CROBAT); + OPPONENT(SPECIES_LOTAD) { Status1(status1); } + } WHEN { + TURN { MOVE(player, MOVE_WAKE_UP_SLAP); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_WAKE_UP_SLAP, player); + if (status1 == STATUS1_SLEEP) { + MESSAGE("The opposing Lotad fainted!"); + } else { + NOT MESSAGE("The opposing Lotad fainted!"); + MESSAGE("The opposing Lotad used Celebrate!"); + } + } +} + +DOUBLE_BATTLE_TEST("Sparkling Aria cures burns from all Pokemon on the field and behind substitutes") +{ + GIVEN { + ASSUME(MoveHasAdditionalEffect(MOVE_SPARKLING_ARIA, MOVE_EFFECT_REMOVE_STATUS) == TRUE); + ASSUME(GetMoveEffectArg_Status(MOVE_SPARKLING_ARIA) == STATUS1_BURN); + PLAYER(SPECIES_PRIMARINA); + PLAYER(SPECIES_WOBBUFFET) { Status1(STATUS1_BURN); } + OPPONENT(SPECIES_WOBBUFFET) { Status1(STATUS1_BURN); } + OPPONENT(SPECIES_WYNAUT) { Status1(STATUS1_BURN); } + } WHEN { + TURN { MOVE(opponentLeft, MOVE_SUBSTITUTE); MOVE(opponentRight, MOVE_CELEBRATE); MOVE(playerRight, MOVE_CELEBRATE); MOVE(playerLeft, MOVE_SPARKLING_ARIA); } + } SCENE { + MESSAGE("The opposing Wobbuffet's burn was cured!"); + MESSAGE("Wobbuffet's burn was cured!"); + MESSAGE("The opposing Wynaut's burn was cured!"); + } +} diff --git a/test/battle/move_effect/salt_cure.c b/test/battle/move_effect_secondary/salt_cure.c similarity index 100% rename from test/battle/move_effect/salt_cure.c rename to test/battle/move_effect_secondary/salt_cure.c diff --git a/test/battle/move_effect_secondary/smack_down.c b/test/battle/move_effect_secondary/smack_down.c new file mode 100644 index 0000000000..64eba3889c --- /dev/null +++ b/test/battle/move_effect_secondary/smack_down.c @@ -0,0 +1,28 @@ +#include "global.h" +#include "test/battle.h" + +SINGLE_BATTLE_TEST("Smack Down does not ground mons behind substitutes") +{ + GIVEN { + ASSUME(MoveHasAdditionalEffect(MOVE_SMACK_DOWN, MOVE_EFFECT_SMACK_DOWN) == TRUE); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_SKARMORY); + } WHEN { + TURN { MOVE(opponent, MOVE_SUBSTITUTE); MOVE(player, MOVE_SMACK_DOWN); } + } SCENE { + NOT MESSAGE("The opposing Skarmory fell straight down!"); + } +} + +SINGLE_BATTLE_TEST("Thousand Arrows does not ground mons behind substitutes") +{ + GIVEN { + ASSUME(MoveHasAdditionalEffect(MOVE_THOUSAND_ARROWS, MOVE_EFFECT_SMACK_DOWN)); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_SKARMORY); + } WHEN { + TURN { MOVE(opponent, MOVE_SUBSTITUTE); MOVE(player, MOVE_THOUSAND_ARROWS); } + } SCENE { + NOT MESSAGE("The opposing Skarmory fell straight down!"); + } +} diff --git a/test/battle/move_effect_secondary/will_o_wisp.c b/test/battle/move_effect_secondary/will_o_wisp.c new file mode 100644 index 0000000000..08b1bd6c69 --- /dev/null +++ b/test/battle/move_effect_secondary/will_o_wisp.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("TODO: Write Will-O-Wisp (Move Effect) test titles") diff --git a/test/battle/move_effect/thousand_arrows.c b/test/battle/move_flags/ignore_type_if_flying_and_ungrounded.c similarity index 70% rename from test/battle/move_effect/thousand_arrows.c rename to test/battle/move_flags/ignore_type_if_flying_and_ungrounded.c index c62e71001d..8536986c6c 100644 --- a/test/battle/move_effect/thousand_arrows.c +++ b/test/battle/move_flags/ignore_type_if_flying_and_ungrounded.c @@ -1,30 +1,13 @@ #include "global.h" #include "test/battle.h" -ASSUMPTIONS -{ - ASSUME(MoveHasAdditionalEffect(MOVE_THOUSAND_ARROWS, MOVE_EFFECT_SMACK_DOWN)); - ASSUME(MoveIgnoresTypeIfFlyingAndUngrounded(MOVE_THOUSAND_ARROWS) == TRUE); -} - -SINGLE_BATTLE_TEST("Thousand Arrows does not ground mons behind substitutes") -{ - GIVEN { - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_SKARMORY); - } WHEN { - TURN { MOVE(opponent, MOVE_SUBSTITUTE); MOVE(player, MOVE_THOUSAND_ARROWS); } - } SCENE { - NOT MESSAGE("The opposing Skarmory fell straight down!"); - } -} - SINGLE_BATTLE_TEST("Thousand Arrows does neutral damage to non-grounded Flying types regardless of other typings") { u32 pokemon; PARAMETRIZE { pokemon = SPECIES_SKARMORY; } PARAMETRIZE { pokemon = SPECIES_SCYTHER; } GIVEN { + ASSUME(MoveIgnoresTypeIfFlyingAndUngrounded(MOVE_THOUSAND_ARROWS) == TRUE); PLAYER(SPECIES_WOBBUFFET); OPPONENT(pokemon); } WHEN { diff --git a/test/battle/ability/switch_in_abilities.c b/test/battle/switch_in_abilities.c similarity index 100% rename from test/battle/ability/switch_in_abilities.c rename to test/battle/switch_in_abilities.c diff --git a/test/test_runner.c b/test/test_runner.c index f279835c4b..8ca5b488e3 100644 --- a/test/test_runner.c +++ b/test/test_runner.c @@ -684,12 +684,22 @@ static s32 MgbaVPrintf_(const char *fmt, va_list va) break; case 'S': pokeS = va_arg(va, const u8 *); - while ((c = *pokeS++) != EOS) + if (pokeS == NULL) { - if ((c = gWireless_RSEtoASCIITable[c]) != '\0') - i = MgbaPutchar_(i, c); - else - i = MgbaPutchar_(i, '?'); + i = MgbaPutchar_(i, 'N'); + i = MgbaPutchar_(i, 'U'); + i = MgbaPutchar_(i, 'L'); + i = MgbaPutchar_(i, 'L'); + } + else + { + while ((c = *pokeS++) != EOS) + { + if ((c = gWireless_RSEtoASCIITable[c]) != '\0') + i = MgbaPutchar_(i, c); + else + i = MgbaPutchar_(i, '?'); + } } break; } diff --git a/test/test_runner_battle.c b/test/test_runner_battle.c index 098c4f4a29..cba0d95e59 100644 --- a/test/test_runner_battle.c +++ b/test/test_runner_battle.c @@ -2116,17 +2116,17 @@ void MoveGetIdAndSlot(s32 battlerId, struct MoveContext *ctx, u32 *moveId, u32 * if (ctx->explicitGimmick && ctx->gimmick != GIMMICK_NONE) { u32 item = GetMonData(mon, MON_DATA_HELD_ITEM); - u32 holdEffect = ItemId_GetHoldEffect(item); + u32 holdEffect = GetItemHoldEffect(item); u32 species = GetMonData(mon, MON_DATA_SPECIES); u32 side = battlerId & BIT_SIDE; // Check invalid item usage. INVALID_IF(ctx->gimmick == GIMMICK_MEGA && holdEffect != HOLD_EFFECT_MEGA_STONE && species != SPECIES_RAYQUAZA, "Cannot Mega Evolve without a Mega Stone"); INVALID_IF(ctx->gimmick == GIMMICK_Z_MOVE && holdEffect != HOLD_EFFECT_Z_CRYSTAL, "Cannot use a Z-Move without a Z-Crystal"); - INVALID_IF(ctx->gimmick == GIMMICK_Z_MOVE && ItemId_GetSecondaryId(item) != GetMoveType(*moveId) + INVALID_IF(ctx->gimmick == GIMMICK_Z_MOVE && GetItemSecondaryId(item) != GetMoveType(*moveId) && GetSignatureZMove(*moveId, species, item) == MOVE_NONE && *moveId != MOVE_PHOTON_GEYSER, // exception because test won't recognize Ultra Necrozma pre-Burst - "Cannot turn %S into a Z-Move with %S", GetMoveName(ctx->move), ItemId_GetName(item)); + "Cannot turn %S into a Z-Move with %S", GetMoveName(ctx->move), GetItemName(item)); INVALID_IF(ctx->gimmick != GIMMICK_MEGA && holdEffect == HOLD_EFFECT_MEGA_STONE, "Cannot use another gimmick while holding a Mega Stone"); INVALID_IF(ctx->gimmick != GIMMICK_Z_MOVE && ctx->gimmick != GIMMICK_ULTRA_BURST && holdEffect == HOLD_EFFECT_Z_CRYSTAL, "Cannot use another gimmick while holding a Z-Crystal"); @@ -2464,19 +2464,19 @@ void UseItem(u32 sourceLine, struct BattlePokemon *battler, struct ItemContext c { s32 i; s32 battlerId = battler - gBattleMons; - bool32 requirePartyIndex = ItemId_GetType(ctx.itemId) == ITEM_USE_PARTY_MENU || ItemId_GetType(ctx.itemId) == ITEM_USE_PARTY_MENU_MOVES; + bool32 requirePartyIndex = GetItemType(ctx.itemId) == ITEM_USE_PARTY_MENU || GetItemType(ctx.itemId) == ITEM_USE_PARTY_MENU_MOVES; // Check general bad use. INVALID_IF(DATA.turnState == TURN_CLOSED, "USE_ITEM outside TURN"); INVALID_IF(DATA.actionBattlers & (1 << battlerId), "Multiple battler actions"); INVALID_IF(ctx.itemId >= ITEMS_COUNT, "Illegal item: %d", ctx.itemId); // Check party menu items. - INVALID_IF(requirePartyIndex && !ctx.explicitPartyIndex, "%S requires explicit party index", ItemId_GetName(ctx.itemId)); + INVALID_IF(requirePartyIndex && !ctx.explicitPartyIndex, "%S requires explicit party index", GetItemName(ctx.itemId)); INVALID_IF(requirePartyIndex && ctx.partyIndex >= ((battlerId & BIT_SIDE) == B_SIDE_PLAYER ? DATA.playerPartySize : DATA.opponentPartySize), \ "USE_ITEM to invalid party index"); // Check move slot items. - if (ItemId_GetType(ctx.itemId) == ITEM_USE_PARTY_MENU_MOVES) + if (GetItemType(ctx.itemId) == ITEM_USE_PARTY_MENU_MOVES) { - INVALID_IF(!ctx.explicitMove, "%S requires an explicit move", ItemId_GetName(ctx.itemId)); + INVALID_IF(!ctx.explicitMove, "%S requires an explicit move", GetItemName(ctx.itemId)); for (i = 0; i < MAX_MON_MOVES; i++) { if (GetMonData(CurrentMon(battlerId), MON_DATA_MOVE1 + i, NULL) == ctx.move) diff --git a/test/text.c b/test/text.c index 7650c2dd59..981d03fdc0 100644 --- a/test/text.c +++ b/test/text.c @@ -93,7 +93,7 @@ TEST("Move descriptions fit on Pokemon Summary Screen") u32 i; const u32 fontId = FONT_NORMAL, widthPx = 152; u32 move = MOVE_NONE; - for (i = 1; i < MOVES_COUNT; i++) + for (i = 1; i < MOVES_COUNT_ALL; i++) { PARAMETRIZE_LABEL("%S", GetMoveDescription(i)) { move = i; } } @@ -811,6 +811,7 @@ TEST("Battle strings fit on the battle message window") default: break; } + EXPECT(gBattleStringsTable[battleStringId] != NULL); BattleStringExpandPlaceholders(gBattleStringsTable[battleStringId], battleString, BATTLE_STRING_BUFFER_SIZE); DebugPrintf("Battle String ID %d: %S", battleStringId, battleString); for (j = 1;; j++) diff --git a/tools/trainerproc/main.c b/tools/trainerproc/main.c index b301ddf552..5823facaca 100644 --- a/tools/trainerproc/main.c +++ b/tools/trainerproc/main.c @@ -459,7 +459,7 @@ static bool match_identifier(struct Parser *p, struct Token *t) if (!peek_char(&p_, &c)) break; - if (('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z') || ('0' <= c && c <= '9') || c == '_') + if (('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z') || ('0' <= c && c <= '9') || c == '_'|| c == '\'') ; else break; @@ -493,7 +493,7 @@ static bool match_human_identifier(struct Parser *p, struct Token *t) if (!peek_char(&p_, &c)) break; - if (('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z') || c == '_' || c == '-' || c == ' ') + if (('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z') || c == '_' || c == '-' || c == ' ' || c == '\'') ; else if (p_.offset > t->begin && ('0' <= c && c <= '9')) ; @@ -573,7 +573,7 @@ static bool match_move_identifier(struct Parser *p, struct Token *t) if (!peek_char(&p_, &c)) break; - if (('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z') || ('0' <= c && c <= '9') || c == '_' || c == '-' || c == ' ' || c == ',') + if (('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z') || ('0' <= c && c <= '9') || c == '_' || c == '-' || c == ' ' || c == ',' || c == '\'') ; else break; @@ -1581,6 +1581,8 @@ static void fprint_constant(FILE *f, const char *prefix, struct String s) fputc(c, f); else if ('a' <= c && c <= 'z') fputc(c - 'a' + 'A', f); + else if (c == '\'') + ; else fputc('_', f); }