Mater to upcoming merge 31/07/25 (#7457)

This commit is contained in:
Martin Griffin 2025-08-01 12:16:59 +01:00 committed by GitHub
commit d060d547b6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
69 changed files with 733 additions and 813 deletions

View File

@ -338,6 +338,16 @@
"contributions": [ "contributions": [
"code" "code"
] ]
},
{
"login": "tustin2121",
"name": "tustin2121",
"avatar_url": "https://avatars.githubusercontent.com/u/794812?v=4",
"profile": "https://tustin2121.github.io/",
"contributions": [
"doc",
"code"
]
} }
], ],
"contributorsPerLine": 7, "contributorsPerLine": 7,

View File

@ -43,9 +43,10 @@ body:
label: Version label: Version
description: What version of pokeemerald-expansion are you using? description: What version of pokeemerald-expansion are you using?
options: options:
- 1.12.1 (Latest release) - 1.12.2 (Latest release)
- master (default, unreleased bugfixes) - master (default, unreleased bugfixes)
- upcoming (Edge) - upcoming (Edge)
- 1.12.1
- 1.12.0 - 1.12.0
- 1.11.4 - 1.11.4
- 1.11.3 - 1.11.3

View File

@ -43,9 +43,10 @@ body:
label: Version label: Version
description: What version of pokeemerald-expansion are you using? description: What version of pokeemerald-expansion are you using?
options: options:
- 1.12.1 (Latest release) - 1.12.2 (Latest release)
- master (default, unreleased bugfixes) - master (default, unreleased bugfixes)
- upcoming (Edge) - upcoming (Edge)
- 1.12.1
- 1.12.0 - 1.12.0
- 1.11.4 - 1.11.4
- 1.11.3 - 1.11.3

View File

@ -43,9 +43,10 @@ body:
label: Version label: Version
description: What version of pokeemerald-expansion are you using? description: What version of pokeemerald-expansion are you using?
options: options:
- 1.12.1 (Latest release) - 1.12.2 (Latest release)
- master (default, unreleased bugfixes) - master (default, unreleased bugfixes)
- upcoming (Edge) - upcoming (Edge)
- 1.12.1
- 1.12.0 - 1.12.0
- 1.11.4 - 1.11.4
- 1.11.3 - 1.11.3

View File

@ -58,7 +58,8 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<td align="center" valign="top" width="14.28%"><a href="https://github.com/fakuzatsu"><img src="https://avatars.githubusercontent.com/u/118256341?v=4?s=100" width="100px;" alt="Zatsu"/><br /><sub><b>Zatsu</b></sub></a><br /><a href="https://github.com/rh-hideout/pokeemerald-expansion/commits?author=fakuzatsu" title="Code">💻</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/fakuzatsu"><img src="https://avatars.githubusercontent.com/u/118256341?v=4?s=100" width="100px;" alt="Zatsu"/><br /><sub><b>Zatsu</b></sub></a><br /><a href="https://github.com/rh-hideout/pokeemerald-expansion/commits?author=fakuzatsu" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/poetahto"><img src="https://avatars.githubusercontent.com/u/11669335?v=4?s=100" width="100px;" alt="poetahto"/><br /><sub><b>poetahto</b></sub></a><br /><a href="https://github.com/rh-hideout/pokeemerald-expansion/commits?author=poetahto" title="Code">💻</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/poetahto"><img src="https://avatars.githubusercontent.com/u/11669335?v=4?s=100" width="100px;" alt="poetahto"/><br /><sub><b>poetahto</b></sub></a><br /><a href="https://github.com/rh-hideout/pokeemerald-expansion/commits?author=poetahto" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/lordraindance2"><img src="https://avatars.githubusercontent.com/u/47706100?v=4?s=100" width="100px;" alt="lordraindance2"/><br /><sub><b>lordraindance2</b></sub></a><br /><a href="https://github.com/rh-hideout/pokeemerald-expansion/commits?author=lordraindance2" title="Code">💻</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/lordraindance2"><img src="https://avatars.githubusercontent.com/u/47706100?v=4?s=100" width="100px;" alt="lordraindance2"/><br /><sub><b>lordraindance2</b></sub></a><br /><a href="https://github.com/rh-hideout/pokeemerald-expansion/commits?author=lordraindance2" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/pablopenna"><img src="https://avatars.githubusercontent.com/u/11214682?v=4?s=100" width="100px;" alt="Pablo Pena"/><br /><sub><b>Pablo Pena</b></sub></a><br /><a href="https://github.com/rh-hideout/pokeemerald-expansion/commits?author=pablopenna" title="Code">💻</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/pablopenna"><img src="https://avatars.githubusercontent.com/u/11214682?v=4?s=100" width="100px;" alt="Pablo Pena"/><br /><sub><b>Pablo Pena</b></sub></a><br /><a href="https://github.com/rh-hideout/pokeemerald-expansion/commits?author=pablopenna" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://tustin2121.github.io/"><img src="https://avatars.githubusercontent.com/u/794812?v=4?s=100" width="100px;" alt="tustin2121"/><br /><sub><b>tustin2121</b></sub></a><br /><a href="https://github.com/rh-hideout/pokeemerald-expansion/commits?author=tustin2121" title="Documentation">📖</a> <a href="https://github.com/rh-hideout/pokeemerald-expansion/commits?author=tustin2121" title="Code">💻</a></td>
</tr> </tr>
</tbody> </tbody>
<tfoot> <tfoot>

View File

@ -17,7 +17,7 @@
If you use **`pokeemerald-expansion`**, please credit **RHH (Rom Hacking Hideout)**. Optionally, include the version number for clarity. If you use **`pokeemerald-expansion`**, please credit **RHH (Rom Hacking Hideout)**. Optionally, include the version number for clarity.
``` ```
Based off RHH's pokeemerald-expansion 1.12.1 https://github.com/rh-hideout/pokeemerald-expansion/ Based off RHH's pokeemerald-expansion 1.12.2 https://github.com/rh-hideout/pokeemerald-expansion/
``` ```
Please consider [crediting all contributors](CREDITS.md) involved in the project! Please consider [crediting all contributors](CREDITS.md) involved in the project!

View File

@ -69,8 +69,8 @@
.endm .endm
@ VAR_RESULT is 1 if player is on a Pyramid floor, 2 if on the Pyramid peak, 0 otherwise @ VAR_RESULT is 1 if player is on a Pyramid floor, 2 if on the Pyramid peak, 0 otherwise
.macro pyramid_inchallenge .macro pyramid_getlocation
setvar VAR_0x8004, BATTLE_PYRAMID_FUNC_IS_IN setvar VAR_0x8004, BATTLE_PYRAMID_FUNC_CURRENT_LOCATION
special CallBattlePyramidFunction special CallBattlePyramidFunction
.endm .endm

View File

@ -2485,6 +2485,8 @@ BattleScript_EffectMagnetRise::
attackcanceler attackcanceler
attackstring attackstring
ppreduce ppreduce
jumpifstatus3 BS_ATTACKER, STATUS3_ROOTED, BattleScript_ButItFailed
jumpifstatus3 BS_ATTACKER, STATUS3_SMACKED_DOWN, BattleScript_ButItFailed
setuserstatus3 STATUS3_MAGNET_RISE, BattleScript_ButItFailed setuserstatus3 STATUS3_MAGNET_RISE, BattleScript_ButItFailed
attackanimation attackanimation
waitanimation waitanimation
@ -3405,6 +3407,7 @@ BattleScript_PowerHerbActivation:
BattleScript_EffectTwoTurnsAttack:: BattleScript_EffectTwoTurnsAttack::
jumpifvolatile BS_ATTACKER, VOLATILE_MULTIPLETURNS, BattleScript_TwoTurnMovesSecondTurn jumpifvolatile BS_ATTACKER, VOLATILE_MULTIPLETURNS, BattleScript_TwoTurnMovesSecondTurn
jumpifword CMP_COMMON_BITS, gHitMarker, HITMARKER_NO_ATTACKSTRING, BattleScript_TwoTurnMovesSecondTurn jumpifword CMP_COMMON_BITS, gHitMarker, HITMARKER_NO_ATTACKSTRING, BattleScript_TwoTurnMovesSecondTurn
jumpifword CMP_COMMON_BITS, gHitMarker, HITMARKER_ATTACKSTRING_PRINTED, BattleScript_EffectHit @ if it's not the first hit
tryfiretwoturnmovewithoutcharging BS_ATTACKER, BattleScript_EffectHit @ e.g. Solar Beam tryfiretwoturnmovewithoutcharging BS_ATTACKER, BattleScript_EffectHit @ e.g. Solar Beam
call BattleScript_FirstChargingTurn call BattleScript_FirstChargingTurn
tryfiretwoturnmoveaftercharging BS_ATTACKER, BattleScript_TwoTurnMovesSecondTurn @ e.g. Electro Shot tryfiretwoturnmoveaftercharging BS_ATTACKER, BattleScript_TwoTurnMovesSecondTurn @ e.g. Electro Shot
@ -7955,6 +7958,8 @@ BattleScript_MummyActivates::
return return
BattleScript_WanderingSpiritActivates:: BattleScript_WanderingSpiritActivates::
saveattacker
savetarget
.if B_ABILITY_POP_UP == TRUE .if B_ABILITY_POP_UP == TRUE
copybyte gBattlerAbility, gBattlerTarget copybyte gBattlerAbility, gBattlerTarget
sethword sABILITY_OVERWRITE, ABILITY_WANDERING_SPIRIT sethword sABILITY_OVERWRITE, ABILITY_WANDERING_SPIRIT
@ -7971,6 +7976,8 @@ BattleScript_WanderingSpiritActivates::
jumpiffainted BS_TARGET, TRUE, BattleScript_WanderingSpiritActivatesRet jumpiffainted BS_TARGET, TRUE, BattleScript_WanderingSpiritActivatesRet
switchinabilities BS_TARGET switchinabilities BS_TARGET
BattleScript_WanderingSpiritActivatesRet: BattleScript_WanderingSpiritActivatesRet:
restoreattacker
restoretarget
return return
BattleScript_TargetsStatWasMaxedOut:: BattleScript_TargetsStatWasMaxedOut::

View File

@ -29,9 +29,9 @@ EventScript_FrontierFieldWhiteOut::
waitbuttonpress waitbuttonpress
pike_inchallenge pike_inchallenge
goto_if_eq VAR_RESULT, TRUE, BattleFrontier_BattlePike_EventScript_Retire goto_if_eq VAR_RESULT, TRUE, BattleFrontier_BattlePike_EventScript_Retire
pyramid_inchallenge pyramid_getlocation
goto_if_eq VAR_RESULT, 1, BattleFrontier_BattlePyramid_EventScript_WarpToLobbyLost @ On Pyramid floor goto_if_eq VAR_RESULT, PYRAMID_LOCATION_FLOOR, BattleFrontier_BattlePyramid_EventScript_WarpToLobbyLost
goto_if_eq VAR_RESULT, 2, BattleFrontier_BattlePyramid_EventScript_WarpToLobbyLost @ On Pyramid peak goto_if_eq VAR_RESULT, PYRAMID_LOCATION_TOP, BattleFrontier_BattlePyramid_EventScript_WarpToLobbyLost
trainerhill_inchallenge trainerhill_inchallenge
goto_if_eq VAR_RESULT, TRUE, TrainerHill_1F_EventScript_Lost goto_if_eq VAR_RESULT, TRUE, TrainerHill_1F_EventScript_Lost
special Script_FadeOutMapMusic special Script_FadeOutMapMusic

View File

@ -133,8 +133,8 @@ EventScript_PickUpItem::
waitfanfare waitfanfare
waitmessage waitmessage
bufferitemnameplural STR_VAR_2, VAR_0x8004, VAR_0x8005 bufferitemnameplural STR_VAR_2, VAR_0x8004, VAR_0x8005
pyramid_inchallenge pyramid_getlocation
goto_if_eq VAR_RESULT, TRUE, EventScript_PutBattlePyramidItemInBag goto_if_eq VAR_RESULT, PYRAMID_LOCATION_FLOOR, EventScript_PutBattlePyramidItemInBag
msgbox gText_PutItemInPocket, MSGBOX_DEFAULT msgbox gText_PutItemInPocket, MSGBOX_DEFAULT
hideitemdescription hideitemdescription
return return

View File

@ -20,6 +20,7 @@
- [Day/Night System FAQ](tutorials/dns.md) - [Day/Night System FAQ](tutorials/dns.md)
- [Changelog](./CHANGELOG.md) - [Changelog](./CHANGELOG.md)
- [1.12.x]() - [1.12.x]()
- [Version 1.12.2](changelogs/1.12.x/1.12.2.md)
- [Version 1.12.1](changelogs/1.12.x/1.12.1.md) - [Version 1.12.1](changelogs/1.12.x/1.12.1.md)
- [Version 1.12.0](changelogs/1.12.x/1.12.0.md) - [Version 1.12.0](changelogs/1.12.x/1.12.0.md)
- [1.11.x]() - [1.11.x]()

View File

@ -0,0 +1,164 @@
```md
## How to update
- 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 expansion/1.12.1
`.
```
## 🧬 General 🧬
### Changed
* Changed trainer tutorial to take into account removed palette compression by @hedara90 in [#7044](https://github.com/rh-hideout/pokeemerald-expansion/pull/7044)
* Update CI to ignore allcontributors commits by @pkmnsnfrn in [#7046](https://github.com/rh-hideout/pokeemerald-expansion/pull/7046)
* add bassforte123 as a contributor for code by @allcontributors[bot] in [#7003](https://github.com/rh-hideout/pokeemerald-expansion/pull/7003)
* add iriv24 as a contributor for code by @allcontributors[bot] in [#7059](https://github.com/rh-hideout/pokeemerald-expansion/pull/7059)
* add Bivurnum as a contributor for code by @allcontributors[bot] in [#7067](https://github.com/rh-hideout/pokeemerald-expansion/pull/7067)
* Fixed CI issue introduced 7046 by @pkmnsnfrn in [#7072](https://github.com/rh-hideout/pokeemerald-expansion/pull/7072)
* Added loop iterator style by @hedara90 in [#7092](https://github.com/rh-hideout/pokeemerald-expansion/pull/7092)
* add Emiliasky as a contributor for test by @allcontributors[bot] in [#7082](https://github.com/rh-hideout/pokeemerald-expansion/pull/7082)
* Update CREDITS.md with correct line placement by @pkmnsnfrn in [#7096](https://github.com/rh-hideout/pokeemerald-expansion/pull/7096)
* Fix typo in INSTALL.md by @hedara90 in [#7116](https://github.com/rh-hideout/pokeemerald-expansion/pull/7116)
* Use RGB values for DEFAULT_LIGHT_COLOR by @hedara90 in [#7133](https://github.com/rh-hideout/pokeemerald-expansion/pull/7133)
* Applied Kasen's documentation improvements by @hedara90 in [#7104](https://github.com/rh-hideout/pokeemerald-expansion/pull/7104)
* add fakuzatsu as a contributor for code by @allcontributors[bot] in [#7136](https://github.com/rh-hideout/pokeemerald-expansion/pull/7136)
* Fixed description of `FORM_CHANGE_WITHDRAW` by @AsparagusEduardo in [#7152](https://github.com/rh-hideout/pokeemerald-expansion/pull/7152)
* add poetahto as a contributor for code by @allcontributors[bot] in [#7162](https://github.com/rh-hideout/pokeemerald-expansion/pull/7162)
* Pret merge (19th of June, 2025) by @Bassoonian in [#7163](https://github.com/rh-hideout/pokeemerald-expansion/pull/7163)
* Update the description of OW_OBJECT_VANILLA_SHADOWS by @pkmnsnfrn in [#7184](https://github.com/rh-hideout/pokeemerald-expansion/pull/7184)
* fix: use BackPickId to calculate player intro ball throw animation palette by @pablopenna in [#7193](https://github.com/rh-hideout/pokeemerald-expansion/pull/7193)
* add pablopenna as a contributor for code by @allcontributors[bot] in [#7202](https://github.com/rh-hideout/pokeemerald-expansion/pull/7202)
### Fixed
* Added line break between Trainer 1 name and Trainer 2 name in sText_TwoTrainersWantToBattle by @grintoul1 in [#7028](https://github.com/rh-hideout/pokeemerald-expansion/pull/7028)
* Fixed Battle Pyramid mon generation by @hedara90 in [#7146](https://github.com/rh-hideout/pokeemerald-expansion/pull/7146)
* force sGFRomHeader to always be present by @DizzyEggg in [#7186](https://github.com/rh-hideout/pokeemerald-expansion/pull/7186)
* force RHH Rom Header to always be present by @DizzyEggg in [#7187](https://github.com/rh-hideout/pokeemerald-expansion/pull/7187)
* Fixed debug flag menu sound by @AsparagusEduardo in [#7190](https://github.com/rh-hideout/pokeemerald-expansion/pull/7190)
* Fix BtlController_EmitChosenMonReturnValue UB by @DizzyEggg in [#7197](https://github.com/rh-hideout/pokeemerald-expansion/pull/7197)
* Backported Safari catch and add to party fix by @hedara90 in [#7192](https://github.com/rh-hideout/pokeemerald-expansion/pull/7192)
* Fix 01_battle_engine_bugs.yaml by @hedara90 in [#7242](https://github.com/rh-hideout/pokeemerald-expansion/pull/7242)
## 🗺️ Overworld 🗺️
### Fixed
* Bug fix: clear saved follower NPC door warp when doing dive warp by @Bivurnum in [#7065](https://github.com/rh-hideout/pokeemerald-expansion/pull/7065)
* Fix Contest Painting load palette error by @ExMingYan in [#7077](https://github.com/rh-hideout/pokeemerald-expansion/pull/7077)
* Bug fix: Follower NPC no longer retains bike sprite after white out by @Bivurnum in [#7120](https://github.com/rh-hideout/pokeemerald-expansion/pull/7120)
* Bug fix: clear follower npc surf blob on white out by @Bivurnum in [#7153](https://github.com/rh-hideout/pokeemerald-expansion/pull/7153)
## 🐉 Pokémon 🐉
### Changed
* Fixes Rapid Spin description (#7178) by @grintoul1 in [#7181](https://github.com/rh-hideout/pokeemerald-expansion/pull/7181)
### Fixed
* Fixed text width for a lot of forms in HGSS Dex by @AsparagusEduardo in [#7035](https://github.com/rh-hideout/pokeemerald-expansion/pull/7035)
* Fixes Roamers not saving shininess by @i0brendan0 in [#7185](https://github.com/rh-hideout/pokeemerald-expansion/pull/7185)
* [FIX] Prevent caught Pokémon loss in NPC partner battles by @J2M2 in [#7177](https://github.com/rh-hideout/pokeemerald-expansion/pull/7177)
## ⚔️ Battle General ⚔️
### Changed
* Fixes large battle messages being cut off instead of being prompted to advance 2 by @PhallenTree in [#7036](https://github.com/rh-hideout/pokeemerald-expansion/pull/7036)
* Battle controller pret documentation by @AlexOn1ine in [#7029](https://github.com/rh-hideout/pokeemerald-expansion/pull/7029)
* Fix typos and some cleanup (mainly in battle files) by @PhallenTree in [#7107](https://github.com/rh-hideout/pokeemerald-expansion/pull/7107)
### Fixed
* Fixes multi battle party re-order by @AlexOn1ine in [#7042](https://github.com/rh-hideout/pokeemerald-expansion/pull/7042)
* Fixes Aura Wheel + Normalize and Hunger Switch while Transformed/Terastallized by @PhallenTree in [#7061](https://github.com/rh-hideout/pokeemerald-expansion/pull/7061)
* Fixes speed calculation order by @AlexOn1ine in [#7064](https://github.com/rh-hideout/pokeemerald-expansion/pull/7064)
* Bug fix for Grassy Terrain incorrectly healing non-grounded Pokemon by @LinathanZel in [#7058](https://github.com/rh-hideout/pokeemerald-expansion/pull/7058)
* Fixes Wandering Spirit copied ability activation on fainted mon by @AlexOn1ine in [#7066](https://github.com/rh-hideout/pokeemerald-expansion/pull/7066)
* Chloroblast fix by @LinathanZel in [#7008](https://github.com/rh-hideout/pokeemerald-expansion/pull/7008)
<!-- Add any important details for the release changelog. Must be structed as bullet points. --->
<!--- Remove this section if not applicable. --->
* Chloroblast causing recoil damage even if the move fails to connect by @LinathanZel in #7007
* [DRAFT] Fix Normalize not boosting Normal type moves if they were already Normal type by @i0brendan0 in [#7060](https://github.com/rh-hideout/pokeemerald-expansion/pull/7060)
* Fixes freeze during a 1v2 double battle by @AlexOn1ine in [#7075](https://github.com/rh-hideout/pokeemerald-expansion/pull/7075)
* Fixes Pursuit potentially causing both battlers to switch into the same mon by @PhallenTree in [#7084](https://github.com/rh-hideout/pokeemerald-expansion/pull/7084)
* Fixed potential mismatch between players and battlers in tests by @AsparagusEduardo in [#7101](https://github.com/rh-hideout/pokeemerald-expansion/pull/7101)
* Fixes Ally Switch in multi battles by @AlexOn1ine in [#7109](https://github.com/rh-hideout/pokeemerald-expansion/pull/7109)
* Add missing flag for Berserk Gene by @AlexOn1ine in [#7151](https://github.com/rh-hideout/pokeemerald-expansion/pull/7151)
* Fixes Neutralizing Gas leaving the field activating unsuppressable abilities again by @PhallenTree in [#7170](https://github.com/rh-hideout/pokeemerald-expansion/pull/7170)
* Fixes Enigma, Kee and Maranga Berry activation timing by @AlexOn1ine in [#7171](https://github.com/rh-hideout/pokeemerald-expansion/pull/7171)
* Fixes wrong Future Sight indexing by @AlexOn1ine in [#7198](https://github.com/rh-hideout/pokeemerald-expansion/pull/7198)
* Fixes OOB for Teatime and Flower Shield by @AlexOn1ine in [#7214](https://github.com/rh-hideout/pokeemerald-expansion/pull/7214)
* Fixes wrong assignment in TrySymbiosis by @AlexOn1ine in [#7221](https://github.com/rh-hideout/pokeemerald-expansion/pull/7221)
* Adds missing healBlockTimer for Baton Pass by @AlexOn1ine in [#7220](https://github.com/rh-hideout/pokeemerald-expansion/pull/7220)
* Jaboca berry triggers instead of being stolen by bug bite by @ghoulslash in [#7237](https://github.com/rh-hideout/pokeemerald-expansion/pull/7237)
* Fixes Scald defrosting target while asleep by @AlexOn1ine in [#7233](https://github.com/rh-hideout/pokeemerald-expansion/pull/7233)
* Fixes Emergency Exit sometimes causing an unrelated battler to become invisible by @PhallenTree in [#7241](https://github.com/rh-hideout/pokeemerald-expansion/pull/7241)
## 🤹 Moves 🤹
### Changed
* Fix ScaryFace anim for Bitter Malice by @TLM-PsIQ in [#6476](https://github.com/rh-hideout/pokeemerald-expansion/pull/6476)
### Fixed
* Fix savage spin out spider web template by @ghoulslash in [#7137](https://github.com/rh-hideout/pokeemerald-expansion/pull/7137)
## 🎭 Abilities 🎭
### Changed
* Flush textbox for Truant Popup by @ghoulslash in [#7252](https://github.com/rh-hideout/pokeemerald-expansion/pull/7252)
## 🧶 Items 🧶
### Fixed
* Fix sell price display by @cawtds in [#7123](https://github.com/rh-hideout/pokeemerald-expansion/pull/7123)
## 🤖 Battle AI 🤖
### Fixed
* Added AI_FLAG_PP_STALL_PREVENTION to AI_FLAG_SMART_TRAINER by @AlexOn1ine in [#7112](https://github.com/rh-hideout/pokeemerald-expansion/pull/7112)
* Fix incorrect function parameters used in AI damage calc by @Pawkkie in [#7130](https://github.com/rh-hideout/pokeemerald-expansion/pull/7130)
## 🧹 Other Cleanup 🧹
* Update CI to ignore allcontributors commits by @pkmnsnfrn in [#7046](https://github.com/rh-hideout/pokeemerald-expansion/pull/7046)
* Update CREDITS.md with correct line placement by @pkmnsnfrn in [#7096](https://github.com/rh-hideout/pokeemerald-expansion/pull/7096)
* Fix typos and some cleanup (mainly in battle files) by @PhallenTree in [#7107](https://github.com/rh-hideout/pokeemerald-expansion/pull/7107)
* Fix typo in INSTALL.md by @hedara90 in [#7116](https://github.com/rh-hideout/pokeemerald-expansion/pull/7116)
* Fixed description of `FORM_CHANGE_WITHDRAW` by @AsparagusEduardo in [#7152](https://github.com/rh-hideout/pokeemerald-expansion/pull/7152)
* Spruce up `FEATURES.md` by @AsparagusEduardo in [#7159](https://github.com/rh-hideout/pokeemerald-expansion/pull/7159)
* Fixes Rapid Spin description (#7178) by @grintoul1 in [#7181](https://github.com/rh-hideout/pokeemerald-expansion/pull/7181)
## 🧪 Test Runner 🧪
### Changed
* Wrote some missing tests by @AsparagusEduardo in [#7094](https://github.com/rh-hideout/pokeemerald-expansion/pull/7094)
* Fixed KNOWN_FAILING Tera test by @AsparagusEduardo in [#6949](https://github.com/rh-hideout/pokeemerald-expansion/pull/6949)
* Add some tests by @ghoulslash in [#7234](https://github.com/rh-hideout/pokeemerald-expansion/pull/7234)
* Added tests for Toxic Thread by @hedara90 in [#7244](https://github.com/rh-hideout/pokeemerald-expansion/pull/7244)
### Fixed
* Test runner fixes by @hedara90 in [#7100](https://github.com/rh-hideout/pokeemerald-expansion/pull/7100)
* Fixed Aura Wheel `KNOWN_FAILING` test by @AsparagusEduardo in [#7135](https://github.com/rh-hideout/pokeemerald-expansion/pull/7135)
* Fix AI party count calc being maintained between tests by @AsparagusEduardo in [#7200](https://github.com/rh-hideout/pokeemerald-expansion/pull/7200)
* Fix tests failing with `B_FRIENDSHIP_BOOST` being `TRUE` by @AsparagusEduardo in [#7194](https://github.com/rh-hideout/pokeemerald-expansion/pull/7194)
* Jaboca berry triggers instead of being stolen by bug bite by @ghoulslash in [#7237](https://github.com/rh-hideout/pokeemerald-expansion/pull/7237)
## 📚 Documentation 📚
* Changed trainer tutorial to take into account removed palette compression by @hedara90 in [#7044](https://github.com/rh-hideout/pokeemerald-expansion/pull/7044)
* Battle controller pret documentation by @AlexOn1ine in [#7029](https://github.com/rh-hideout/pokeemerald-expansion/pull/7029)
* Added loop iterator style by @hedara90 in [#7092](https://github.com/rh-hideout/pokeemerald-expansion/pull/7092)
* Use RGB values for DEFAULT_LIGHT_COLOR by @hedara90 in [#7133](https://github.com/rh-hideout/pokeemerald-expansion/pull/7133)
* Applied Kasen's documentation improvements by @hedara90 in [#7104](https://github.com/rh-hideout/pokeemerald-expansion/pull/7104)
* Spruce up `FEATURES.md` by @AsparagusEduardo in [#7159](https://github.com/rh-hideout/pokeemerald-expansion/pull/7159)
* Update the description of OW_OBJECT_VANILLA_SHADOWS by @pkmnsnfrn in [#7184](https://github.com/rh-hideout/pokeemerald-expansion/pull/7184)
## 📦 Branch Synchronisation 📦
### pret
* 24th of June, 2025 in [#7206](https://github.com/rh-hideout/pokeemerald-expansion/pull/7206)
* Move gTradePlatform_Tilemap to header and change to u32 by @DizzyEggg in [pret#2088](https://github.com/pret/pokeemerald/pull/2088)
* Fix wrong keep temps files directory in makefile by @DizzyEggg in [pret#2156](https://github.com/pret/pokeemerald/pull/2156)
* Fix collision comparison in PlayerNotOnBikeMoving by @GriffinRichards in [pret#2104](https://github.com/pret/pokeemerald/pull/2104)
* Match graphics declarations with externs in graphics.h by @DizzyEggg in [pret#2089](https://github.com/pret/pokeemerald/pull/2089)
## New Contributors
* @TLM-PsIQ made their first contribution in [#6476](https://github.com/rh-hideout/pokeemerald-expansion/pull/6476)
* @pablopenna made their first contribution in [#7193](https://github.com/rh-hideout/pokeemerald-expansion/pull/7193)
* @J2M2 made their first contribution in [#7177](https://github.com/rh-hideout/pokeemerald-expansion/pull/7177)
**Full Changelog**: https://github.com/rh-hideout/pokeemerald-expansion/compare/expansion/1.12.0...expansion/1.12.1
<!--Last PR: 7252-->
<!--Used to keep track of the last PR merged in case new ones come in before the changelog is done.-->

View File

@ -1,13 +1,15 @@
#ifndef GUARD_BATTLE_PYRAMID_H #ifndef GUARD_BATTLE_PYRAMID_H
#define GUARD_BATTLE_PYRAMID_H #define GUARD_BATTLE_PYRAMID_H
#include "constants/battle_pyramid.h"
void CallBattlePyramidFunction(void); void CallBattlePyramidFunction(void);
u16 LocalIdToPyramidTrainerId(u8 localId); u16 LocalIdToPyramidTrainerId(u8 localId);
bool8 GetBattlePyramidTrainerFlag(u8 eventId); bool8 GetBattlePyramidTrainerFlag(u8 eventId);
void MarkApproachingPyramidTrainersAsBattled(void); void MarkApproachingPyramidTrainersAsBattled(void);
void GenerateBattlePyramidWildMon(void); void GenerateBattlePyramidWildMon(void);
u8 GetPyramidRunMultiplier(void); u8 GetPyramidRunMultiplier(void);
u8 InBattlePyramid(void); u8 CurrentBattlePyramidLocation(void);
bool8 InBattlePyramid_(void); bool8 InBattlePyramid_(void);
void PausePyramidChallenge(void); void PausePyramidChallenge(void);
void SoftResetInBattlePyramid(void); void SoftResetInBattlePyramid(void);

View File

@ -1132,6 +1132,10 @@
// Vars // Vars
#undef B_VAR_DIFFICULTY #undef B_VAR_DIFFICULTY
#define B_VAR_DIFFICULTY TESTING_VAR_DIFFICULTY #define B_VAR_DIFFICULTY TESTING_VAR_DIFFICULTY
#undef B_VAR_STARTING_STATUS
#define B_VAR_STARTING_STATUS TESTING_VAR_STARTING_STATUS
#undef B_VAR_STARTING_STATUS_TIMER
#define B_VAR_STARTING_STATUS_TIMER TESTING_VAR_STARTING_STATUS_TIMER
// Flags // Flags
#undef B_FLAG_SLEEP_CLAUSE #undef B_FLAG_SLEEP_CLAUSE

View File

@ -43,7 +43,7 @@
#define BATTLE_PYRAMID_FUNC_SET_TRAINERS 9 #define BATTLE_PYRAMID_FUNC_SET_TRAINERS 9
#define BATTLE_PYRAMID_FUNC_SHOW_HINT_TEXT 10 #define BATTLE_PYRAMID_FUNC_SHOW_HINT_TEXT 10
#define BATTLE_PYRAMID_FUNC_UPDATE_STREAK 11 // unused #define BATTLE_PYRAMID_FUNC_UPDATE_STREAK 11 // unused
#define BATTLE_PYRAMID_FUNC_IS_IN 12 #define BATTLE_PYRAMID_FUNC_CURRENT_LOCATION 12
#define BATTLE_PYRAMID_FUNC_UPDATE_LIGHT 13 #define BATTLE_PYRAMID_FUNC_UPDATE_LIGHT 13
#define BATTLE_PYRAMID_FUNC_CLEAR_HELD_ITEMS 14 #define BATTLE_PYRAMID_FUNC_CLEAR_HELD_ITEMS 14
#define BATTLE_PYRAMID_FUNC_SET_FLOOR_PALETTE 15 #define BATTLE_PYRAMID_FUNC_SET_FLOOR_PALETTE 15
@ -62,4 +62,8 @@
#define PYRAMID_LIGHT_SET_RADIUS 0 #define PYRAMID_LIGHT_SET_RADIUS 0
#define PYRAMID_LIGHT_INCR_RADIUS 1 #define PYRAMID_LIGHT_INCR_RADIUS 1
#define PYRAMID_LOCATION_NONE 0 // Not in the Pyramid
#define PYRAMID_LOCATION_FLOOR 1
#define PYRAMID_LOCATION_TOP 2
#endif // GUARD_CONSTANTS_BATTLE_PYRAMID_H #endif // GUARD_CONSTANTS_BATTLE_PYRAMID_H

View File

@ -1,7 +1,7 @@
#ifndef GUARD_CONSTANTS_EXPANSION_H #ifndef GUARD_CONSTANTS_EXPANSION_H
#define GUARD_CONSTANTS_EXPANSION_H #define GUARD_CONSTANTS_EXPANSION_H
// Last version: 1.12.1 // Last version: 1.12.2
#define EXPANSION_VERSION_MAJOR 1 #define EXPANSION_VERSION_MAJOR 1
#define EXPANSION_VERSION_MINOR 13 #define EXPANSION_VERSION_MINOR 13
#define EXPANSION_VERSION_PATCH 0 #define EXPANSION_VERSION_PATCH 0

View File

@ -325,15 +325,15 @@
#define VAR_TEMP_TRANSFERRED_SPECIES VAR_TEMP_1 #define VAR_TEMP_TRANSFERRED_SPECIES VAR_TEMP_1
#if TESTING #if TESTING
#define TESTING_VARS_START 0x9000 #define TESTING_VARS_START 0x9000
#define TESTING_VAR_DIFFICULTY (TESTING_VARS_START + 0x0) #define TESTING_VAR_DIFFICULTY (TESTING_VARS_START + 0x0)
#define TESTING_VAR_UNUSED_1 (TESTING_VARS_START + 0x1) #define TESTING_VAR_STARTING_STATUS (TESTING_VARS_START + 0x1)
#define TESTING_VAR_UNUSED_2 (TESTING_VARS_START + 0x2) #define TESTING_VAR_STARTING_STATUS_TIMER (TESTING_VARS_START + 0x2)
#define TESTING_VAR_UNUSED_3 (TESTING_VARS_START + 0x3) #define TESTING_VAR_UNUSED_3 (TESTING_VARS_START + 0x3)
#define TESTING_VAR_UNUSED_4 (TESTING_VARS_START + 0x4) #define TESTING_VAR_UNUSED_4 (TESTING_VARS_START + 0x4)
#define TESTING_VAR_UNUSED_5 (TESTING_VARS_START + 0x5) #define TESTING_VAR_UNUSED_5 (TESTING_VARS_START + 0x5)
#define TESTING_VAR_UNUSED_6 (TESTING_VARS_START + 0x6) #define TESTING_VAR_UNUSED_6 (TESTING_VARS_START + 0x6)
#define TESTING_VAR_UNUSED_7 (TESTING_VARS_START + 0x7) #define TESTING_VAR_UNUSED_7 (TESTING_VARS_START + 0x7)
#endif // TESTING #endif // TESTING
#endif // GUARD_CONSTANTS_VARS_H #endif // GUARD_CONSTANTS_VARS_H

View File

@ -61,9 +61,9 @@ void LZ77UnCompWram(const u32 *src, void *dest);
void LZ77UnCompVram(const u32 *src, void *dest); void LZ77UnCompVram(const u32 *src, void *dest);
void RLUnCompWram(const void *src, void *dest); void RLUnCompWram(const u32 *src, void *dest);
void RLUnCompVram(const void *src, void *dest); void RLUnCompVram(const u32 *src, void *dest);
int MultiBoot(struct MultiBootParam *mp); int MultiBoot(struct MultiBootParam *mp);

View File

@ -7,19 +7,36 @@
#define MAPGRID_METATILE_ID_MASK 0x03FF // Bits 0-9 #define MAPGRID_METATILE_ID_MASK 0x03FF // Bits 0-9
#define MAPGRID_COLLISION_MASK 0x0C00 // Bits 10-11 #define MAPGRID_COLLISION_MASK 0x0C00 // Bits 10-11
#define MAPGRID_ELEVATION_MASK 0xF000 // Bits 12-15 #define MAPGRID_ELEVATION_MASK 0xF000 // Bits 12-15
#define MAPGRID_METATILE_ID_SHIFT 0
#define MAPGRID_COLLISION_SHIFT 10 #define MAPGRID_COLLISION_SHIFT 10
#define MAPGRID_ELEVATION_SHIFT 12 #define MAPGRID_ELEVATION_SHIFT 12
#define PACK_METATILE(metatileId) PACK(metatileId, MAPGRID_METATILE_ID_SHIFT, MAPGRID_METATILE_ID_MASK)
#define PACK_COLLISION(collision) PACK(collision, MAPGRID_COLLISION_SHIFT, MAPGRID_COLLISION_MASK)
#define PACK_ELEVATION(elevation) PACK(elevation, MAPGRID_ELEVATION_SHIFT, MAPGRID_ELEVATION_MASK)
#define UNPACK_METATILE(data) UNPACK(data, MAPGRID_METATILE_ID_SHIFT, MAPGRID_METATILE_ID_MASK)
#define UNPACK_COLLISION(data) UNPACK(data, MAPGRID_COLLISION_SHIFT, MAPGRID_COLLISION_MASK)
#define UNPACK_ELEVATION(data) UNPACK(data, MAPGRID_ELEVATION_SHIFT, MAPGRID_ELEVATION_MASK)
// An undefined map grid block has all metatile id bits set and nothing else // An undefined map grid block has all metatile id bits set and nothing else
#define MAPGRID_UNDEFINED MAPGRID_METATILE_ID_MASK #define MAPGRID_UNDEFINED MAPGRID_METATILE_ID_MASK
// When setting impassability manually GF sets all the collision bits
#define MAPGRID_IMPASSABLE MAPGRID_COLLISION_MASK
// Masks/shifts for metatile attributes // Masks/shifts for metatile attributes
// Metatile attributes consist of an 8 bit behavior value, 4 unused bits, and a 4 bit layer type value // Metatile attributes consist of an 8 bit behavior value, 4 unused bits, and a 4 bit layer type value
// This is the data stored in each data/tilesets/*/*/metatile_attributes.bin file // This is the data stored in each data/tilesets/*/*/metatile_attributes.bin file
#define METATILE_ATTR_BEHAVIOR_MASK 0x00FF // Bits 0-7 #define METATILE_ATTR_BEHAVIOR_MASK 0x00FF // Bits 0-7
#define METATILE_ATTR_LAYER_MASK 0xF000 // Bits 12-15 #define METATILE_ATTR_LAYER_MASK 0xF000 // Bits 12-15
#define METATILE_ATTR_BEHAVIOR_SHIFT 0
#define METATILE_ATTR_LAYER_SHIFT 12 #define METATILE_ATTR_LAYER_SHIFT 12
#define PACK_BEHAVIOR(behavior) PACK(behavior, METATILE_ATTR_BEHAVIOR_SHIFT, METATILE_ATTR_BEHAVIOR_MASK)
#define PACK_LAYER_TYPE(layerType) PACK(layerType, METATILE_ATTR_LAYER_SHIFT, METATILE_ATTR_LAYER_MASK)
#define UNPACK_BEHAVIOR(data) UNPACK(data, METATILE_ATTR_BEHAVIOR_SHIFT, METATILE_ATTR_BEHAVIOR_MASK)
#define UNPACK_LAYER_TYPE(data) UNPACK(data, METATILE_ATTR_LAYER_SHIFT, METATILE_ATTR_LAYER_MASK)
enum { enum {
METATILE_LAYER_TYPE_NORMAL, // Metatile uses middle and top bg layers METATILE_LAYER_TYPE_NORMAL, // Metatile uses middle and top bg layers
METATILE_LAYER_TYPE_COVERED, // Metatile uses bottom and middle bg layers METATILE_LAYER_TYPE_COVERED, // Metatile uses bottom and middle bg layers

View File

@ -107,6 +107,9 @@
#define T2_READ_32(ptr) ((ptr)[0] + ((ptr)[1] << 8) + ((ptr)[2] << 16) + ((ptr)[3] << 24)) #define T2_READ_32(ptr) ((ptr)[0] + ((ptr)[1] << 8) + ((ptr)[2] << 16) + ((ptr)[3] << 24))
#define T2_READ_PTR(ptr) (void *) T2_READ_32(ptr) #define T2_READ_PTR(ptr) (void *) T2_READ_32(ptr)
#define PACK(data, shift, mask) ( ((data) << (shift)) & (mask) )
#define UNPACK(data, shift, mask) ( ((data) & (mask)) >> (shift) )
// Macros for checking the joypad // Macros for checking the joypad
#define TEST_BUTTON(field, button) ((field) & (button)) #define TEST_BUTTON(field, button) ((field) & (button))
#define JOY_NEW(button) TEST_BUTTON(gMain.newKeys, button) #define JOY_NEW(button) TEST_BUTTON(gMain.newKeys, button)

View File

@ -45,26 +45,26 @@
#define EXCEPT_3(a, ...) __VA_OPT__(EXCEPT_2(__VA_ARGS__)) #define EXCEPT_3(a, ...) __VA_OPT__(EXCEPT_2(__VA_ARGS__))
#define EXCEPT_4(a, ...) __VA_OPT__(EXCEPT_3(__VA_ARGS__)) #define EXCEPT_4(a, ...) __VA_OPT__(EXCEPT_3(__VA_ARGS__))
/* 'UNPACK (x, y, z)' expands to 'x, y, z'. /* 'UNPACK_META (x, y, z)' expands to 'x, y, z'.
* Useful for passing arguments which may contain commas into a macro. */ * Useful for passing arguments which may contain commas into a macro. */
#define UNPACK(...) __VA_ARGS__ #define UNPACK_META(...) __VA_ARGS__
/* Updated version that can extract arguments from brackets as well. /* Updated version that can extract arguments from brackets as well.
* Examples: * Examples:
* *
* UNPACK_B(a, b) => a, b * UNPACK_B(a, b) => a, b
* UNPACK_B((a, b)) => a, b * UNPACK_B((a, b)) => a, b
* UNPACK_B((a)) => a * UNPACK_B((a)) => a
* *
* The simple UNPACK is used for extracting non-bracketed arguments. * The simple UNPACK is used for extracting non-bracketed arguments.
* */ * */
#define UNPACK_EXTRA(...) IF_YOU_SEE_ME_SOMETHING_IS_WRONG, __VA_ARGS__ #define UNPACK_EXTRA(...) IF_YOU_SEE_ME_SOMETHING_IS_WRONG, __VA_ARGS__
#define UNPACK_B(a) INVOKE(UNPACK_B_, a, UNPACK_EXTRA a) #define UNPACK_B(a) INVOKE_WITH_(UNPACK_B_, a, UNPACK_EXTRA a)
#define UNPACK_B_(a, b, ...) __VA_OPT__(UNPACK)a #define UNPACK_B_(a, b, ...) __VA_OPT__(UNPACK_META)a
/* Expands to 'macro(...args, ...)'. */ /* Expands to 'macro(...args, ...)'. */
#define INVOKE_WITH(macro, args, ...) INVOKE(macro, UNPACK args __VA_OPT__(, __VA_ARGS__)) #define INVOKE_WITH(macro, args, ...) INVOKE_WITH_(macro, UNPACK_META args __VA_OPT__(, __VA_ARGS__))
#define INVOKE(macro, ...) macro(__VA_ARGS__) #define INVOKE_WITH_(macro, ...) macro(__VA_ARGS__)
/* Same as INVOKE_WITH but uses UNPACK_B to unpack arguments and only applies macro to args if there are any. */ /* Same as INVOKE_WITH but uses UNPACK_B to unpack arguments and only applies macro to args if there are any. */
#define INVOKE_WITH_B(macro, args, ...) INVOKE_B(macro, UNPACK_B(args) __VA_OPT__(, __VA_ARGS__)) #define INVOKE_WITH_B(macro, args, ...) INVOKE_B(macro, UNPACK_B(args) __VA_OPT__(, __VA_ARGS__))
@ -178,7 +178,7 @@ store a number (max: 32). Sample: https://godbolt.org/z/xb4KdPMhT */
/* Will try and compress a set bit (or up to three sequential bits) into a single byte /* Will try and compress a set bit (or up to three sequential bits) into a single byte
Input must be of the form (upper << lower) where upper can be up to 7, lower up to 31 */ Input must be of the form (upper << lower) where upper can be up to 7, lower up to 31 */
#define COMPRESS_BITS(_val) COMPRESS_BITS_STEP_2 _val #define COMPRESS_BITS(_val) COMPRESS_BITS_STEP_2 _val
#define COMPRESS_BITS_STEP_2(_unpacked) INVOKE(COMPRESS_BITS_STEP_3, COMPRESS_BITS_## _unpacked) #define COMPRESS_BITS_STEP_2(_unpacked) INVOKE_WITH_(COMPRESS_BITS_STEP_3, COMPRESS_BITS_## _unpacked)
#define COMPRESS_BITS_STEP_3(upper, lower) (((upper % 8) << 5) + (BIT_INDEX(lower))) #define COMPRESS_BITS_STEP_3(upper, lower) (((upper % 8) << 5) + (BIT_INDEX(lower)))
/* Will read a compressed bit stored by COMPRESS_BIT into a single byte */ /* Will read a compressed bit stored by COMPRESS_BIT into a single byte */

View File

@ -318,7 +318,7 @@ enum {
MON_SPR_GFX_MANAGERS_COUNT MON_SPR_GFX_MANAGERS_COUNT
}; };
#define UNPACK_VOLATILE_STRUCT(_enum, _fieldName, _typeMaxValue, ...) INVOKE(UNPACK_VOLATILE_STRUCT_, _fieldName, UNPACK_B(_typeMaxValue)); #define UNPACK_VOLATILE_STRUCT(_enum, _fieldName, _typeMaxValue, ...) INVOKE_WITH_(UNPACK_VOLATILE_STRUCT_, _fieldName, UNPACK_B(_typeMaxValue));
#define UNPACK_VOLATILE_STRUCT_(_fieldName, _type, ...) _type FIRST(__VA_OPT__(_fieldName:BIT_SIZE(FIRST(__VA_ARGS__)),) _fieldName) #define UNPACK_VOLATILE_STRUCT_(_fieldName, _type, ...) _type FIRST(__VA_OPT__(_fieldName:BIT_SIZE(FIRST(__VA_ARGS__)),) _fieldName)
struct Volatiles struct Volatiles

View File

@ -904,7 +904,7 @@ void InitLinkBattleVsScreen(u8 taskId)
case 0: case 0:
if (gBattleTypeFlags & BATTLE_TYPE_MULTI) if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
{ {
for (i = 0; i < MAX_BATTLERS_COUNT; i++) for (i = 0; i < MAX_LINK_PLAYERS; i++)
{ {
name = gLinkPlayers[i].name; name = gLinkPlayers[i].name;
linkPlayer = &gLinkPlayers[i]; linkPlayer = &gLinkPlayers[i];

View File

@ -541,6 +541,7 @@ static void OpponentHandleChoosePokemon(u32 battler)
{ {
s32 chosenMonId; s32 chosenMonId;
s32 pokemonInBattle = 1; s32 pokemonInBattle = 1;
enum SwitchType switchType = SWITCH_AFTER_KO;
// Choosing Revival Blessing target // Choosing Revival Blessing target
if (gBattleResources->bufferA[battler][1] == PARTY_ACTION_CHOOSE_FAINTED_MON) if (gBattleResources->bufferA[battler][1] == PARTY_ACTION_CHOOSE_FAINTED_MON)
@ -550,7 +551,9 @@ static void OpponentHandleChoosePokemon(u32 battler)
// Switching out // Switching out
else if (gBattleStruct->AI_monToSwitchIntoId[battler] == PARTY_SIZE) else if (gBattleStruct->AI_monToSwitchIntoId[battler] == PARTY_SIZE)
{ {
chosenMonId = GetMostSuitableMonToSwitchInto(battler, SWITCH_AFTER_KO); if (IsSwitchOutEffect(GetMoveEffect(gCurrentMove)) || gAiLogicData->ejectButtonSwitch || gAiLogicData->ejectPackSwitch)
switchType = SWITCH_MID_BATTLE;
chosenMonId = GetMostSuitableMonToSwitchInto(battler, switchType);
if (chosenMonId == PARTY_SIZE) if (chosenMonId == PARTY_SIZE)
{ {
s32 battler1, battler2, firstId, lastId; s32 battler1, battler2, firstId, lastId;

View File

@ -889,7 +889,10 @@ void HandleInputChooseMove(u32 battler)
} }
else if (JOY_NEW(START_BUTTON)) else if (JOY_NEW(START_BUTTON))
{ {
if (gBattleStruct->gimmick.usableGimmick[battler] != GIMMICK_NONE && !HasTrainerUsedGimmick(battler, gBattleStruct->gimmick.usableGimmick[battler])) if (gBattleStruct->gimmick.usableGimmick[battler] != GIMMICK_NONE
&& !HasTrainerUsedGimmick(battler, gBattleStruct->gimmick.usableGimmick[battler])
&& !(gBattleStruct->gimmick.usableGimmick[battler] == GIMMICK_Z_MOVE
&& GetUsableZMove(battler, moveInfo->moves[gMoveSelectionCursor[battler]]) == MOVE_NONE))
{ {
gBattleStruct->gimmick.playerSelect ^= 1; gBattleStruct->gimmick.playerSelect ^= 1;
ReloadMoveNames(battler); ReloadMoveNames(battler);

View File

@ -81,7 +81,7 @@ static void HidePyramidItem(void);
static void SetPyramidFacilityTrainers(void); static void SetPyramidFacilityTrainers(void);
static void ShowPostBattleHintText(void); static void ShowPostBattleHintText(void);
static void UpdatePyramidWinStreak(void); static void UpdatePyramidWinStreak(void);
static void GetInBattlePyramid(void); static void GetCurrentBattlePyramidLocation(void);
static void UpdatePyramidLightRadius(void); static void UpdatePyramidLightRadius(void);
static void ClearPyramidPartyHeldItems(void); static void ClearPyramidPartyHeldItems(void);
static void SetPyramidFloorPalette(void); static void SetPyramidFloorPalette(void);
@ -805,7 +805,7 @@ static void (*const sBattlePyramidFunctions[])(void) =
[BATTLE_PYRAMID_FUNC_SET_TRAINERS] = SetPyramidFacilityTrainers, [BATTLE_PYRAMID_FUNC_SET_TRAINERS] = SetPyramidFacilityTrainers,
[BATTLE_PYRAMID_FUNC_SHOW_HINT_TEXT] = ShowPostBattleHintText, [BATTLE_PYRAMID_FUNC_SHOW_HINT_TEXT] = ShowPostBattleHintText,
[BATTLE_PYRAMID_FUNC_UPDATE_STREAK] = UpdatePyramidWinStreak, [BATTLE_PYRAMID_FUNC_UPDATE_STREAK] = UpdatePyramidWinStreak,
[BATTLE_PYRAMID_FUNC_IS_IN] = GetInBattlePyramid, [BATTLE_PYRAMID_FUNC_CURRENT_LOCATION] = GetCurrentBattlePyramidLocation,
[BATTLE_PYRAMID_FUNC_UPDATE_LIGHT] = UpdatePyramidLightRadius, [BATTLE_PYRAMID_FUNC_UPDATE_LIGHT] = UpdatePyramidLightRadius,
[BATTLE_PYRAMID_FUNC_CLEAR_HELD_ITEMS] = ClearPyramidPartyHeldItems, [BATTLE_PYRAMID_FUNC_CLEAR_HELD_ITEMS] = ClearPyramidPartyHeldItems,
[BATTLE_PYRAMID_FUNC_SET_FLOOR_PALETTE] = SetPyramidFloorPalette, [BATTLE_PYRAMID_FUNC_SET_FLOOR_PALETTE] = SetPyramidFloorPalette,
@ -1127,9 +1127,9 @@ static void UpdatePyramidWinStreak(void)
gSaveBlock2Ptr->frontier.pyramidRecordStreaks[lvlMode] = gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode]; gSaveBlock2Ptr->frontier.pyramidRecordStreaks[lvlMode] = gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode];
} }
static void GetInBattlePyramid(void) static void GetCurrentBattlePyramidLocation(void)
{ {
gSpecialVar_Result = InBattlePyramid(); gSpecialVar_Result = CurrentBattlePyramidLocation();
} }
static void UpdatePyramidLightRadius(void) static void UpdatePyramidLightRadius(void)
@ -1643,14 +1643,14 @@ u8 GetPyramidRunMultiplier(void)
return sPyramidFloorTemplates[id].runMultiplier; return sPyramidFloorTemplates[id].runMultiplier;
} }
u8 InBattlePyramid(void) u8 CurrentBattlePyramidLocation(void)
{ {
if (gMapHeader.mapLayoutId == LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_FLOOR) if (gMapHeader.mapLayoutId == LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_FLOOR)
return 1; return PYRAMID_LOCATION_FLOOR;
else if (gMapHeader.mapLayoutId == LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_TOP) else if (gMapHeader.mapLayoutId == LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_TOP)
return 2; return PYRAMID_LOCATION_TOP;
else else
return FALSE; return PYRAMID_LOCATION_NONE;
} }
bool8 InBattlePyramid_(void) bool8 InBattlePyramid_(void)
@ -1661,7 +1661,7 @@ bool8 InBattlePyramid_(void)
void PausePyramidChallenge(void) void PausePyramidChallenge(void)
{ {
if (InBattlePyramid()) if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE)
{ {
RestorePyramidPlayerParty(); RestorePyramidPlayerParty();
gSaveBlock2Ptr->frontier.challengeStatus = CHALLENGE_STATUS_PAUSED; gSaveBlock2Ptr->frontier.challengeStatus = CHALLENGE_STATUS_PAUSED;
@ -1672,7 +1672,7 @@ void PausePyramidChallenge(void)
void SoftResetInBattlePyramid(void) void SoftResetInBattlePyramid(void)
{ {
if (InBattlePyramid()) if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE)
DoSoftReset(); DoSoftReset();
} }
@ -1781,6 +1781,7 @@ void GenerateBattlePyramidFloorLayout(u16 *backupMapData, bool8 setPlayerPositio
gSaveBlock1Ptr->pos.x = (mapLayout->width * (i % PYRAMID_FLOOR_SQUARES_WIDE)) + x; gSaveBlock1Ptr->pos.x = (mapLayout->width * (i % PYRAMID_FLOOR_SQUARES_WIDE)) + x;
gSaveBlock1Ptr->pos.y = (mapLayout->height * (i / PYRAMID_FLOOR_SQUARES_WIDE)) + y; gSaveBlock1Ptr->pos.y = (mapLayout->height * (i / PYRAMID_FLOOR_SQUARES_WIDE)) + y;
} }
// Copy the elevation and collision, but overwrite the metatile ID
map[x] = (layoutMap[x] & (MAPGRID_ELEVATION_MASK | MAPGRID_COLLISION_MASK)) | METATILE_BattlePyramid_Floor; map[x] = (layoutMap[x] & (MAPGRID_ELEVATION_MASK | MAPGRID_COLLISION_MASK)) | METATILE_BattlePyramid_Floor;
} }
else else

View File

@ -1881,7 +1881,7 @@ static void Cmd_adjustdamage(void)
u8 param; u8 param;
u32 battlerDef; u32 battlerDef;
u32 rand = Random() % 100; u32 rand = Random() % 100;
u32 affectionScore = GetBattlerAffectionHearts(gBattlerTarget); u32 affectionScore;
u32 moveTarget = GetBattlerMoveTargetType(gBattlerAttacker, gCurrentMove); u32 moveTarget = GetBattlerMoveTargetType(gBattlerAttacker, gCurrentMove);
enum BattleMoveEffects moveEffect = GetMoveEffect(gCurrentMove); enum BattleMoveEffects moveEffect = GetMoveEffect(gCurrentMove);
bool32 calcSpreadMoveDamage = IsSpreadMove(moveTarget) && !IsBattleMoveStatus(gCurrentMove); bool32 calcSpreadMoveDamage = IsSpreadMove(moveTarget) && !IsBattleMoveStatus(gCurrentMove);
@ -1925,6 +1925,7 @@ static void Cmd_adjustdamage(void)
holdEffect = GetBattlerHoldEffect(battlerDef, TRUE); holdEffect = GetBattlerHoldEffect(battlerDef, TRUE);
param = GetBattlerHoldEffectParam(battlerDef); param = GetBattlerHoldEffectParam(battlerDef);
affectionScore = GetBattlerAffectionHearts(battlerDef);
gPotentialItemEffectBattler = battlerDef; gPotentialItemEffectBattler = battlerDef;
@ -6157,6 +6158,7 @@ static void Cmd_moveend(void)
{ {
BestowItem(BATTLE_PARTNER(i), i); BestowItem(BATTLE_PARTNER(i), i);
gLastUsedAbility = gBattleMons[BATTLE_PARTNER(i)].ability; gLastUsedAbility = gBattleMons[BATTLE_PARTNER(i)].ability;
gEffectBattler = i;
gBattleScripting.battler = gBattlerAbility = BATTLE_PARTNER(i); gBattleScripting.battler = gBattlerAbility = BATTLE_PARTNER(i);
gBattlerAttacker = i; gBattlerAttacker = i;
BattleScriptPushCursor(); BattleScriptPushCursor();
@ -8639,6 +8641,7 @@ static bool32 TrySymbiosis(u32 battler, u32 itemId, bool32 moveEnd)
{ {
BestowItem(BATTLE_PARTNER(battler), battler); BestowItem(BATTLE_PARTNER(battler), battler);
gLastUsedAbility = gBattleMons[BATTLE_PARTNER(battler)].ability; gLastUsedAbility = gBattleMons[BATTLE_PARTNER(battler)].ability;
gEffectBattler = battler;
gBattleScripting.battler = gBattlerAbility = BATTLE_PARTNER(battler); gBattleScripting.battler = gBattlerAbility = BATTLE_PARTNER(battler);
if (moveEnd) if (moveEnd)
BattleScriptPushCursor(); BattleScriptPushCursor();
@ -13377,7 +13380,7 @@ static void Cmd_pickup(void)
if (!InBattlePike()) // No items in Battle Pike. if (!InBattlePike()) // No items in Battle Pike.
{ {
bool32 isInPyramid = InBattlePyramid_(); bool32 isInPyramid = CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE;
for (i = 0; i < PARTY_SIZE; i++) for (i = 0; i < PARTY_SIZE; i++)
{ {
species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES_OR_EGG); species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES_OR_EGG);

View File

@ -336,7 +336,7 @@ static void DoStandardWildBattle(bool32 isDouble)
} }
else if (isDouble) else if (isDouble)
gBattleTypeFlags |= BATTLE_TYPE_DOUBLE; gBattleTypeFlags |= BATTLE_TYPE_DOUBLE;
if (InBattlePyramid()) if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE)
{ {
VarSet(VAR_TEMP_E, 0); VarSet(VAR_TEMP_E, 0);
gBattleTypeFlags |= BATTLE_TYPE_PYRAMID; gBattleTypeFlags |= BATTLE_TYPE_PYRAMID;
@ -355,7 +355,7 @@ void DoStandardWildBattle_Debug(void)
StopPlayerAvatar(); StopPlayerAvatar();
gMain.savedCallback = CB2_EndWildBattle; gMain.savedCallback = CB2_EndWildBattle;
gBattleTypeFlags = 0; gBattleTypeFlags = 0;
if (InBattlePyramid()) if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE)
{ {
VarSet(VAR_TEMP_PLAYING_PYRAMID_MUSIC, 0); VarSet(VAR_TEMP_PLAYING_PYRAMID_MUSIC, 0);
gBattleTypeFlags |= BATTLE_TYPE_PYRAMID; gBattleTypeFlags |= BATTLE_TYPE_PYRAMID;
@ -415,7 +415,7 @@ static void DoTrainerBattle(void)
static void DoBattlePyramidTrainerHillBattle(void) static void DoBattlePyramidTrainerHillBattle(void)
{ {
if (InBattlePyramid()) if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE)
CreateBattleStartTask(GetSpecialBattleTransition(B_TRANSITION_GROUP_B_PYRAMID), 0); CreateBattleStartTask(GetSpecialBattleTransition(B_TRANSITION_GROUP_B_PYRAMID), 0);
else else
CreateBattleStartTask(GetSpecialBattleTransition(B_TRANSITION_GROUP_TRAINER_HILL), 0); CreateBattleStartTask(GetSpecialBattleTransition(B_TRANSITION_GROUP_TRAINER_HILL), 0);
@ -590,7 +590,7 @@ static void CB2_EndWildBattle(void)
HealPlayerParty(); HealPlayerParty();
} }
if (IsPlayerDefeated(gBattleOutcome) == TRUE && !InBattlePyramid() && !InBattlePike()) if (IsPlayerDefeated(gBattleOutcome) == TRUE && CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE && !InBattlePike())
{ {
SetMainCallback2(CB2_WhiteOut); SetMainCallback2(CB2_WhiteOut);
} }
@ -609,7 +609,7 @@ static void CB2_EndScriptedWildBattle(void)
if (IsPlayerDefeated(gBattleOutcome) == TRUE) if (IsPlayerDefeated(gBattleOutcome) == TRUE)
{ {
if (InBattlePyramid()) if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE)
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic); SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
else else
SetMainCallback2(CB2_WhiteOut); SetMainCallback2(CB2_WhiteOut);
@ -756,14 +756,14 @@ u8 GetWildBattleTransition(void)
if (enemyLevel < playerLevel) if (enemyLevel < playerLevel)
{ {
if (InBattlePyramid()) if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE)
return B_TRANSITION_BLUR; return B_TRANSITION_BLUR;
else else
return sBattleTransitionTable_Wild[transitionType][0]; return sBattleTransitionTable_Wild[transitionType][0];
} }
else else
{ {
if (InBattlePyramid()) if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE)
return B_TRANSITION_GRID_SQUARES; return B_TRANSITION_GRID_SQUARES;
else else
return sBattleTransitionTable_Wild[transitionType][1]; return sBattleTransitionTable_Wild[transitionType][1];
@ -1143,7 +1143,7 @@ u8 GetTrainerBattleMode(void)
bool8 GetTrainerFlag(void) bool8 GetTrainerFlag(void)
{ {
if (InBattlePyramid()) if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE)
return GetBattlePyramidTrainerFlag(gSelectedObjectEvent); return GetBattlePyramidTrainerFlag(gSelectedObjectEvent);
else if (InTrainerHill()) else if (InTrainerHill())
return GetHillTrainerFlag(gSelectedObjectEvent); return GetHillTrainerFlag(gSelectedObjectEvent);
@ -1200,7 +1200,7 @@ void BattleSetup_StartTrainerBattle(void)
} }
} }
if (InBattlePyramid()) if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE)
{ {
VarSet(VAR_TEMP_PLAYING_PYRAMID_MUSIC, 0); VarSet(VAR_TEMP_PLAYING_PYRAMID_MUSIC, 0);
gBattleTypeFlags |= BATTLE_TYPE_PYRAMID; gBattleTypeFlags |= BATTLE_TYPE_PYRAMID;
@ -1240,7 +1240,7 @@ void BattleSetup_StartTrainerBattle(void)
gWhichTrainerToFaceAfterBattle = 0; gWhichTrainerToFaceAfterBattle = 0;
gMain.savedCallback = CB2_EndTrainerBattle; gMain.savedCallback = CB2_EndTrainerBattle;
if (InBattlePyramid() || InTrainerHillChallenge()) if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE || InTrainerHillChallenge())
DoBattlePyramidTrainerHillBattle(); DoBattlePyramidTrainerHillBattle();
else else
DoTrainerBattle(); DoTrainerBattle();
@ -1304,7 +1304,7 @@ static void CB2_EndTrainerBattle(void)
} }
else if (IsPlayerDefeated(gBattleOutcome) == TRUE) else if (IsPlayerDefeated(gBattleOutcome) == TRUE)
{ {
if (InBattlePyramid() || InTrainerHillChallenge() || (!NoAliveMonsForPlayer()) || FlagGet(B_FLAG_NO_WHITEOUT)) if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE || InTrainerHillChallenge() || (!NoAliveMonsForPlayer()) || FlagGet(B_FLAG_NO_WHITEOUT))
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic); SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
else else
SetMainCallback2(CB2_WhiteOut); SetMainCallback2(CB2_WhiteOut);
@ -1317,7 +1317,7 @@ static void CB2_EndTrainerBattle(void)
{ {
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic); SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
DowngradeBadPoison(); DowngradeBadPoison();
if (!InBattlePyramid() && !InTrainerHillChallenge()) if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE && !InTrainerHillChallenge())
{ {
RegisterTrainerInMatchCall(); RegisterTrainerInMatchCall();
SetBattledTrainersFlags(); SetBattledTrainersFlags();
@ -1356,7 +1356,7 @@ void BattleSetup_StartRematchBattle(void)
void ShowTrainerIntroSpeech(void) void ShowTrainerIntroSpeech(void)
{ {
if (InBattlePyramid()) if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE)
{ {
if (gNoOfApproachingTrainers == 0 || gNoOfApproachingTrainers == 1) if (gNoOfApproachingTrainers == 0 || gNoOfApproachingTrainers == 1)
CopyPyramidTrainerSpeechBefore(LocalIdToPyramidTrainerId(gSpecialVar_LastTalked)); CopyPyramidTrainerSpeechBefore(LocalIdToPyramidTrainerId(gSpecialVar_LastTalked));

View File

@ -632,7 +632,7 @@ bool32 TryRunFromBattle(u32 battler)
} }
else if (GetBattlerAbility(battler) == ABILITY_RUN_AWAY) else if (GetBattlerAbility(battler) == ABILITY_RUN_AWAY)
{ {
if (InBattlePyramid()) if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE)
{ {
gBattleStruct->runTries++; gBattleStruct->runTries++;
pyramidMultiplier = GetPyramidRunMultiplier(); pyramidMultiplier = GetPyramidRunMultiplier();
@ -665,7 +665,7 @@ bool32 TryRunFromBattle(u32 battler)
if (!IsBattlerAlive(runningFromBattler)) if (!IsBattlerAlive(runningFromBattler))
runningFromBattler |= BIT_FLANK; runningFromBattler |= BIT_FLANK;
if (InBattlePyramid()) if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE)
{ {
pyramidMultiplier = GetPyramidRunMultiplier(); pyramidMultiplier = GetPyramidRunMultiplier();
speedVar = (gBattleMons[battler].speed * pyramidMultiplier) / (gBattleMons[runningFromBattler].speed) + (gBattleStruct->runTries * 30); speedVar = (gBattleMons[battler].speed * pyramidMultiplier) / (gBattleMons[runningFromBattler].speed) + (gBattleStruct->runTries * 30);
@ -3941,6 +3941,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
BattleScriptPushCursorAndCallback(BattleScript_ActivateTeraformZero); BattleScriptPushCursorAndCallback(BattleScript_ActivateTeraformZero);
effect++; effect++;
} }
break;
case ABILITY_SCHOOLING: case ABILITY_SCHOOLING:
if (gBattleMons[battler].level < 20) if (gBattleMons[battler].level < 20)
break; break;
@ -8127,7 +8128,7 @@ static inline u32 CalcMoveBasePower(struct DamageContext *ctx)
} }
case EFFECT_ECHOED_VOICE: case EFFECT_ECHOED_VOICE:
// gBattleStruct->sameMoveTurns incremented in ppreduce // gBattleStruct->sameMoveTurns incremented in ppreduce
if (gBattleStruct->sameMoveTurns[battlerAtk] != 0) if (gBattleStruct->sameMoveTurns[battlerAtk] != 0 && GetMoveEffect(gLastResultingMoves[battlerAtk]) == EFFECT_ECHOED_VOICE)
{ {
basePower += (basePower * gBattleStruct->sameMoveTurns[battlerAtk]); basePower += (basePower * gBattleStruct->sameMoveTurns[battlerAtk]);
if (basePower > 200) if (basePower > 200)

View File

@ -81,9 +81,9 @@ void DoBrailleDigEffect(void)
MapGridSetMetatileIdAt( 9 + MAP_OFFSET, 1 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_TopLeft); MapGridSetMetatileIdAt( 9 + MAP_OFFSET, 1 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_TopLeft);
MapGridSetMetatileIdAt(10 + MAP_OFFSET, 1 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_TopMid); MapGridSetMetatileIdAt(10 + MAP_OFFSET, 1 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_TopMid);
MapGridSetMetatileIdAt(11 + MAP_OFFSET, 1 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_TopRight); MapGridSetMetatileIdAt(11 + MAP_OFFSET, 1 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_TopRight);
MapGridSetMetatileIdAt( 9 + MAP_OFFSET, 2 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_BottomLeft | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt( 9 + MAP_OFFSET, 2 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_BottomLeft | MAPGRID_IMPASSABLE);
MapGridSetMetatileIdAt(10 + MAP_OFFSET, 2 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_BottomMid); MapGridSetMetatileIdAt(10 + MAP_OFFSET, 2 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_BottomMid);
MapGridSetMetatileIdAt(11 + MAP_OFFSET, 2 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_BottomRight | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(11 + MAP_OFFSET, 2 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_BottomRight | MAPGRID_IMPASSABLE);
DrawWholeMapView(); DrawWholeMapView();
PlaySE(SE_BANG); PlaySE(SE_BANG);
FlagSet(FLAG_SYS_BRAILLE_DIG); FlagSet(FLAG_SYS_BRAILLE_DIG);
@ -207,9 +207,9 @@ static void DoBrailleRegirockEffect(void)
MapGridSetMetatileIdAt(7 + MAP_OFFSET, 19 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_TopLeft); MapGridSetMetatileIdAt(7 + MAP_OFFSET, 19 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_TopLeft);
MapGridSetMetatileIdAt(8 + MAP_OFFSET, 19 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_TopMid); MapGridSetMetatileIdAt(8 + MAP_OFFSET, 19 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_TopMid);
MapGridSetMetatileIdAt(9 + MAP_OFFSET, 19 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_TopRight); MapGridSetMetatileIdAt(9 + MAP_OFFSET, 19 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_TopRight);
MapGridSetMetatileIdAt(7 + MAP_OFFSET, 20 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_BottomLeft | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(7 + MAP_OFFSET, 20 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_BottomLeft | MAPGRID_IMPASSABLE);
MapGridSetMetatileIdAt(8 + MAP_OFFSET, 20 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_BottomMid); MapGridSetMetatileIdAt(8 + MAP_OFFSET, 20 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_BottomMid);
MapGridSetMetatileIdAt(9 + MAP_OFFSET, 20 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_BottomRight | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(9 + MAP_OFFSET, 20 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_BottomRight | MAPGRID_IMPASSABLE);
DrawWholeMapView(); DrawWholeMapView();
PlaySE(SE_BANG); PlaySE(SE_BANG);
FlagSet(FLAG_SYS_REGIROCK_PUZZLE_COMPLETED); FlagSet(FLAG_SYS_REGIROCK_PUZZLE_COMPLETED);
@ -247,9 +247,9 @@ static void DoBrailleRegisteelEffect(void)
MapGridSetMetatileIdAt(7 + MAP_OFFSET, 19 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_TopLeft); MapGridSetMetatileIdAt(7 + MAP_OFFSET, 19 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_TopLeft);
MapGridSetMetatileIdAt(8 + MAP_OFFSET, 19 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_TopMid); MapGridSetMetatileIdAt(8 + MAP_OFFSET, 19 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_TopMid);
MapGridSetMetatileIdAt(9 + MAP_OFFSET, 19 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_TopRight); MapGridSetMetatileIdAt(9 + MAP_OFFSET, 19 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_TopRight);
MapGridSetMetatileIdAt(7 + MAP_OFFSET, 20 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_BottomLeft | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(7 + MAP_OFFSET, 20 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_BottomLeft | MAPGRID_IMPASSABLE);
MapGridSetMetatileIdAt(8 + MAP_OFFSET, 20 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_BottomMid); MapGridSetMetatileIdAt(8 + MAP_OFFSET, 20 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_BottomMid);
MapGridSetMetatileIdAt(9 + MAP_OFFSET, 20 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_BottomRight | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(9 + MAP_OFFSET, 20 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_BottomRight | MAPGRID_IMPASSABLE);
DrawWholeMapView(); DrawWholeMapView();
PlaySE(SE_BANG); PlaySE(SE_BANG);
FlagSet(FLAG_SYS_REGISTEEL_PUZZLE_COMPLETED); FlagSet(FLAG_SYS_REGISTEEL_PUZZLE_COMPLETED);

View File

@ -69,19 +69,19 @@ extern const u8 gContestPaintingTough1[];
extern const u8 gContestPaintingTough2[]; extern const u8 gContestPaintingTough2[];
extern const u8 gContestPaintingTough3[]; extern const u8 gContestPaintingTough3[];
static const u16 sPictureFramePalettes[] = INCBIN_U16("graphics/picture_frame/bg.gbapal"); static const u16 sPictureFramePalettes[] = INCBIN_U16("graphics/picture_frame/bg.gbapal");
static const u8 sPictureFrameTiles_Cool[] = INCBIN_U8("graphics/picture_frame/cool.4bpp.rl"); static const u32 sPictureFrameTiles_Cool[] = INCBIN_U32("graphics/picture_frame/cool.4bpp.rl");
static const u8 sPictureFrameTiles_Beauty[] = INCBIN_U8("graphics/picture_frame/beauty.4bpp.rl"); static const u32 sPictureFrameTiles_Beauty[] = INCBIN_U32("graphics/picture_frame/beauty.4bpp.rl");
static const u8 sPictureFrameTiles_Cute[] = INCBIN_U8("graphics/picture_frame/cute.4bpp.rl"); static const u32 sPictureFrameTiles_Cute[] = INCBIN_U32("graphics/picture_frame/cute.4bpp.rl");
static const u8 sPictureFrameTiles_Smart[] = INCBIN_U8("graphics/picture_frame/smart.4bpp.rl"); static const u32 sPictureFrameTiles_Smart[] = INCBIN_U32("graphics/picture_frame/smart.4bpp.rl");
static const u8 sPictureFrameTiles_Tough[] = INCBIN_U8("graphics/picture_frame/tough.4bpp.rl"); static const u32 sPictureFrameTiles_Tough[] = INCBIN_U32("graphics/picture_frame/tough.4bpp.rl");
static const u8 sPictureFrameTiles_HallLobby[] = INCBIN_U8("graphics/picture_frame/lobby.4bpp.rl"); static const u32 sPictureFrameTiles_HallLobby[] = INCBIN_U32("graphics/picture_frame/lobby.4bpp.rl");
static const u8 sPictureFrameTilemap_Cool[] = INCBIN_U8("graphics/picture_frame/cool_map.bin.rl"); static const u32 sPictureFrameTilemap_Cool[] = INCBIN_U32("graphics/picture_frame/cool_map.bin.rl");
static const u8 sPictureFrameTilemap_Beauty[] = INCBIN_U8("graphics/picture_frame/beauty_map.bin.rl"); static const u32 sPictureFrameTilemap_Beauty[] = INCBIN_U32("graphics/picture_frame/beauty_map.bin.rl");
static const u8 sPictureFrameTilemap_Cute[] = INCBIN_U8("graphics/picture_frame/cute_map.bin.rl"); static const u32 sPictureFrameTilemap_Cute[] = INCBIN_U32("graphics/picture_frame/cute_map.bin.rl");
static const u8 sPictureFrameTilemap_Smart[] = INCBIN_U8("graphics/picture_frame/smart_map.bin.rl"); static const u32 sPictureFrameTilemap_Smart[] = INCBIN_U32("graphics/picture_frame/smart_map.bin.rl");
static const u8 sPictureFrameTilemap_Tough[] = INCBIN_U8("graphics/picture_frame/tough_map.bin.rl"); static const u32 sPictureFrameTilemap_Tough[] = INCBIN_U32("graphics/picture_frame/tough_map.bin.rl");
static const u8 sPictureFrameTilemap_HallLobby[] = INCBIN_U8("graphics/picture_frame/lobby_map.bin.rl"); static const u32 sPictureFrameTilemap_HallLobby[] = INCBIN_U32("graphics/picture_frame/lobby_map.bin.rl");
static const u8 *const sContestCategoryNames_Unused[] = static const u8 *const sContestCategoryNames_Unused[] =
{ {

File diff suppressed because it is too large Load Diff

View File

@ -19,9 +19,33 @@ static const u8 sMapName_{{ cleanString(map_section.name) }}_Clone[] = _("{{ map
const struct RegionMapLocation gRegionMapEntries[] = { const struct RegionMapLocation gRegionMapEntries[] = {
## for map_section in map_sections ## for map_section in map_sections
{% if existsIn(map_section, "x") and existsIn(map_section, "y") and existsIn(map_section, "width") and existsIn(map_section, "height") and existsIn(map_section, "name") %} [{{ map_section.id }}] = {
[{{ map_section.id }}] = { {{ map_section.x }}, {{ map_section.y }}, {{ map_section.width }}, {{ map_section.height }}, sMapName_{{ cleanString(map_section.name) }}{% if existsIn(map_section, "name_clone") %}_Clone{% endif %} }, {% if existsIn(map_section, "x") %}
.x = {{ map_section.x }},
{% else %}
.x = 0,
{% endif %} {% endif %}
{% if existsIn(map_section, "y") %}
.y = {{ map_section.y }},
{% else %}
.y = 0,
{% endif %}
{% if existsIn(map_section, "width") %}
.width = {{ map_section.width }},
{% else %}
.width = 1,
{% endif %}
{% if existsIn(map_section, "height") %}
.height = {{ map_section.height }},
{% else %}
.height = 1,
{% endif %}
{% if existsIn(map_section, "name") %}
.name = sMapName_{{ cleanString(map_section.name) }}{% if existsIn(map_section, "name_clone") %}_Clone{% endif %},
{% else %}
.name = (const u8[])_(""),
{% endif %}
},
## endfor ## endfor
}; };

View File

@ -1227,9 +1227,9 @@ static void ShowDecorationOnMap_(u16 mapX, u16 mapY, u8 decWidth, u8 decHeight,
{ {
x = mapX + i; x = mapX + i;
attributes = GetMetatileAttributesById(NUM_TILES_IN_PRIMARY + gDecorations[decoration].tiles[j * decWidth + i]); attributes = GetMetatileAttributesById(NUM_TILES_IN_PRIMARY + gDecorations[decoration].tiles[j * decWidth + i]);
if (MetatileBehavior_IsSecretBaseImpassable(attributes & METATILE_ATTR_BEHAVIOR_MASK) == TRUE if (MetatileBehavior_IsSecretBaseImpassable(UNPACK_BEHAVIOR(attributes)) == TRUE
|| (gDecorations[decoration].permission != DECORPERM_PASS_FLOOR && (attributes >> METATILE_ATTR_LAYER_SHIFT) != METATILE_LAYER_TYPE_NORMAL)) || (gDecorations[decoration].permission != DECORPERM_PASS_FLOOR && (attributes >> METATILE_ATTR_LAYER_SHIFT) != METATILE_LAYER_TYPE_NORMAL))
impassableFlag = MAPGRID_COLLISION_MASK; impassableFlag = MAPGRID_IMPASSABLE;
else else
impassableFlag = 0; impassableFlag = 0;
@ -1521,6 +1521,17 @@ static bool8 IsFloorOrBoardAndHole(u16 behaviorAt, const struct Decoration *deco
return FALSE; return FALSE;
} }
#ifdef BUGFIX
#define GetLayerType(tileId) UNPACK_LAYER_TYPE(GetMetatileAttributesById(tileId))
#else
// This incompletely extracts the layer type data. The result is that comparisons against any nonzero
// value in the valid range always have the same result.
// Because GF only compares against 0 (METATILE_LAYER_TYPE_NORMAL) there are no ill effects and it's possible this
// is what they intended. We use the named constant for the comparisons, which implies you can use nonzero constants at
// those locations (which you can't), so to avoid this trap and keep the better documentation this is included as a bug fix.
#define GetLayerType(tileId) GetMetatileAttributesById(tileId) & METATILE_ATTR_LAYER_MASK
#endif
static bool8 CanPlaceDecoration(u8 taskId, const struct Decoration *decoration) static bool8 CanPlaceDecoration(u8 taskId, const struct Decoration *decoration)
{ {
u8 i; u8 i;
@ -1545,7 +1556,7 @@ static bool8 CanPlaceDecoration(u8 taskId, const struct Decoration *decoration)
{ {
curX = gTasks[taskId].tCursorX + j; curX = gTasks[taskId].tCursorX + j;
behaviorAt = MapGridGetMetatileBehaviorAt(curX, curY); behaviorAt = MapGridGetMetatileBehaviorAt(curX, curY);
layerType = GetMetatileAttributesById(NUM_TILES_IN_PRIMARY + decoration->tiles[(mapY - 1 - i) * mapX + j]) & METATILE_ATTR_LAYER_MASK; layerType = GetLayerType(NUM_TILES_IN_PRIMARY + decoration->tiles[(mapY - 1 - i) * mapX + j]);
if (!IsFloorOrBoardAndHole(behaviorAt, decoration)) if (!IsFloorOrBoardAndHole(behaviorAt, decoration))
return FALSE; return FALSE;
@ -1566,7 +1577,7 @@ static bool8 CanPlaceDecoration(u8 taskId, const struct Decoration *decoration)
{ {
curX = gTasks[taskId].tCursorX + j; curX = gTasks[taskId].tCursorX + j;
behaviorAt = MapGridGetMetatileBehaviorAt(curX, curY); behaviorAt = MapGridGetMetatileBehaviorAt(curX, curY);
layerType = GetMetatileAttributesById(NUM_TILES_IN_PRIMARY + decoration->tiles[(mapY - 1 - i) * mapX + j]) & METATILE_ATTR_LAYER_MASK; layerType = GetLayerType(NUM_TILES_IN_PRIMARY + decoration->tiles[(mapY - 1 - i) * mapX + j]);
if (!MetatileBehavior_IsNormal(behaviorAt) && !IsSecretBaseTrainerSpot(behaviorAt, layerType)) if (!MetatileBehavior_IsNormal(behaviorAt) && !IsSecretBaseTrainerSpot(behaviorAt, layerType))
return FALSE; return FALSE;
@ -1583,7 +1594,7 @@ static bool8 CanPlaceDecoration(u8 taskId, const struct Decoration *decoration)
{ {
curX = gTasks[taskId].tCursorX + j; curX = gTasks[taskId].tCursorX + j;
behaviorAt = MapGridGetMetatileBehaviorAt(curX, curY); behaviorAt = MapGridGetMetatileBehaviorAt(curX, curY);
layerType = GetMetatileAttributesById(NUM_TILES_IN_PRIMARY + decoration->tiles[j]) & METATILE_ATTR_LAYER_MASK; layerType = GetLayerType(NUM_TILES_IN_PRIMARY + decoration->tiles[j]);
if (!MetatileBehavior_IsNormal(behaviorAt) && !MetatileBehavior_IsSecretBaseNorthWall(behaviorAt)) if (!MetatileBehavior_IsNormal(behaviorAt) && !MetatileBehavior_IsSecretBaseNorthWall(behaviorAt))
return FALSE; return FALSE;

View File

@ -1480,7 +1480,7 @@ u8 Unref_TryInitLocalObjectEvent(u8 localId)
if (gMapHeader.events != NULL) if (gMapHeader.events != NULL)
{ {
if (InBattlePyramid()) if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE)
objectEventCount = GetNumBattlePyramidObjectEvents(); objectEventCount = GetNumBattlePyramidObjectEvents();
else if (InTrainerHill()) else if (InTrainerHill())
objectEventCount = HILL_TRAINERS_PER_FLOOR; objectEventCount = HILL_TRAINERS_PER_FLOOR;
@ -2723,7 +2723,7 @@ void TrySpawnLightSprites(s16 camX, s16 camY)
if (gMapHeader.events == NULL) if (gMapHeader.events == NULL)
return; return;
if (InBattlePyramid()) if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE)
objectCount = GetNumBattlePyramidObjectEvents(); objectCount = GetNumBattlePyramidObjectEvents();
else if (InTrainerHill()) else if (InTrainerHill())
objectCount = 2; objectCount = 2;
@ -2755,7 +2755,7 @@ void TrySpawnObjectEvents(s16 cameraX, s16 cameraY)
s16 top = gSaveBlock1Ptr->pos.y; s16 top = gSaveBlock1Ptr->pos.y;
s16 bottom = gSaveBlock1Ptr->pos.y + MAP_OFFSET_H + 2; s16 bottom = gSaveBlock1Ptr->pos.y + MAP_OFFSET_H + 2;
if (InBattlePyramid()) if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE)
objectCount = GetNumBattlePyramidObjectEvents(); objectCount = GetNumBattlePyramidObjectEvents();
else if (InTrainerHill()) else if (InTrainerHill())
objectCount = HILL_TRAINERS_PER_FLOOR; objectCount = HILL_TRAINERS_PER_FLOOR;

View File

@ -94,9 +94,9 @@ static void Task_TryFieldPoisonWhiteOut(u8 taskId)
{ {
// Battle facilities have their own white out script to handle the challenge loss // Battle facilities have their own white out script to handle the challenge loss
#ifdef BUGFIX #ifdef BUGFIX
if (InBattlePyramid() || InBattlePike() || InTrainerHillChallenge()) if (CurrentBattlePyramidLocation() || InBattlePike() || InTrainerHillChallenge())
#else #else
if (InBattlePyramid() | InBattlePike() || InTrainerHillChallenge()) if (CurrentBattlePyramidLocation() | InBattlePike() || InTrainerHillChallenge())
#endif #endif
gSpecialVar_Result = FLDPSN_FRONTIER_WHITEOUT; gSpecialVar_Result = FLDPSN_FRONTIER_WHITEOUT;
else else

View File

@ -680,10 +680,10 @@ void MauvilleGymSetDefaultBarriers(void)
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH2_On); MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH2_On);
break; break;
case METATILE_MauvilleGym_GreenBeamH3_Off: case METATILE_MauvilleGym_GreenBeamH3_Off:
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH3_On | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH3_On | MAPGRID_IMPASSABLE);
break; break;
case METATILE_MauvilleGym_GreenBeamH4_Off: case METATILE_MauvilleGym_GreenBeamH4_Off:
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH4_On | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH4_On | MAPGRID_IMPASSABLE);
break; break;
case METATILE_MauvilleGym_RedBeamH1_On: case METATILE_MauvilleGym_RedBeamH1_On:
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH1_Off); MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH1_Off);
@ -704,37 +704,37 @@ void MauvilleGymSetDefaultBarriers(void)
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH2_On); MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH2_On);
break; break;
case METATILE_MauvilleGym_RedBeamH3_Off: case METATILE_MauvilleGym_RedBeamH3_Off:
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH3_On | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH3_On | MAPGRID_IMPASSABLE);
break; break;
case METATILE_MauvilleGym_RedBeamH4_Off: case METATILE_MauvilleGym_RedBeamH4_Off:
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH4_On | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH4_On | MAPGRID_IMPASSABLE);
break; break;
case METATILE_MauvilleGym_GreenBeamV1_On: case METATILE_MauvilleGym_GreenBeamV1_On:
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleBottom_On | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleBottom_On | MAPGRID_IMPASSABLE);
break; break;
case METATILE_MauvilleGym_GreenBeamV2_On: case METATILE_MauvilleGym_GreenBeamV2_On:
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_FloorTile); MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_FloorTile);
break; break;
case METATILE_MauvilleGym_RedBeamV1_On: case METATILE_MauvilleGym_RedBeamV1_On:
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleBottom_Off | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleBottom_Off | MAPGRID_IMPASSABLE);
break; break;
case METATILE_MauvilleGym_RedBeamV2_On: case METATILE_MauvilleGym_RedBeamV2_On:
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_FloorTile); MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_FloorTile);
break; break;
case METATILE_MauvilleGym_PoleBottom_On: case METATILE_MauvilleGym_PoleBottom_On:
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamV1_On | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamV1_On | MAPGRID_IMPASSABLE);
break; break;
case METATILE_MauvilleGym_FloorTile: case METATILE_MauvilleGym_FloorTile:
if (MapGridGetMetatileIdAt(x, y - 1) == METATILE_MauvilleGym_GreenBeamV1_On) if (MapGridGetMetatileIdAt(x, y - 1) == METATILE_MauvilleGym_GreenBeamV1_On)
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamV2_On | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamV2_On | MAPGRID_IMPASSABLE);
else else
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamV2_On | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamV2_On | MAPGRID_IMPASSABLE);
break; break;
case METATILE_MauvilleGym_PoleBottom_Off: case METATILE_MauvilleGym_PoleBottom_Off:
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamV1_On | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamV1_On | MAPGRID_IMPASSABLE);
break; break;
case METATILE_MauvilleGym_PoleTop_Off: case METATILE_MauvilleGym_PoleTop_Off:
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleTop_On | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleTop_On | MAPGRID_IMPASSABLE);
break; break;
case METATILE_MauvilleGym_PoleTop_On: case METATILE_MauvilleGym_PoleTop_On:
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleTop_Off); MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleTop_Off);
@ -785,10 +785,10 @@ void MauvilleGymDeactivatePuzzle(void)
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH4_Off); MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH4_Off);
break; break;
case METATILE_MauvilleGym_GreenBeamV1_On: case METATILE_MauvilleGym_GreenBeamV1_On:
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleBottom_On | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleBottom_On | MAPGRID_IMPASSABLE);
break; break;
case METATILE_MauvilleGym_RedBeamV1_On: case METATILE_MauvilleGym_RedBeamV1_On:
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleBottom_Off | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleBottom_Off | MAPGRID_IMPASSABLE);
break; break;
case METATILE_MauvilleGym_GreenBeamV2_On: case METATILE_MauvilleGym_GreenBeamV2_On:
case METATILE_MauvilleGym_RedBeamV2_On: case METATILE_MauvilleGym_RedBeamV2_On:
@ -897,8 +897,8 @@ static void PetalburgGymSetDoorMetatiles(u8 roomNumber, u16 metatileId)
} }
for (i = 0; i < nDoors; i++) for (i = 0; i < nDoors; i++)
{ {
MapGridSetMetatileIdAt(doorCoordsX[i] + MAP_OFFSET, doorCoordsY[i] + MAP_OFFSET, metatileId | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(doorCoordsX[i] + MAP_OFFSET, doorCoordsY[i] + MAP_OFFSET, metatileId | MAPGRID_IMPASSABLE);
MapGridSetMetatileIdAt(doorCoordsX[i] + MAP_OFFSET, doorCoordsY[i] + MAP_OFFSET + 1, (metatileId + METATILE_ROW_WIDTH) | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(doorCoordsX[i] + MAP_OFFSET, doorCoordsY[i] + MAP_OFFSET + 1, (metatileId + METATILE_ROW_WIDTH) | MAPGRID_IMPASSABLE);
} }
DrawWholeMapView(); DrawWholeMapView();
} }
@ -1098,7 +1098,7 @@ static void PCTurnOnEffect_SetMetatile(s16 isScreenOn, s8 dx, s8 dy)
else if (gSpecialVar_0x8004 == PC_LOCATION_MAYS_HOUSE) else if (gSpecialVar_0x8004 == PC_LOCATION_MAYS_HOUSE)
metatileId = METATILE_BrendansMaysHouse_MayPC_On; metatileId = METATILE_BrendansMaysHouse_MayPC_On;
} }
MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + MAP_OFFSET, gSaveBlock1Ptr->pos.y + dy + MAP_OFFSET, metatileId | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + MAP_OFFSET, gSaveBlock1Ptr->pos.y + dy + MAP_OFFSET, metatileId | MAPGRID_IMPASSABLE);
} }
// For this special, gSpecialVar_0x8004 is expected to be some PC_LOCATION_* value. // For this special, gSpecialVar_0x8004 is expected to be some PC_LOCATION_* value.
@ -1141,7 +1141,7 @@ static void PCTurnOffEffect(void)
else if (gSpecialVar_0x8004 == PC_LOCATION_MAYS_HOUSE) else if (gSpecialVar_0x8004 == PC_LOCATION_MAYS_HOUSE)
metatileId = METATILE_BrendansMaysHouse_MayPC_Off; metatileId = METATILE_BrendansMaysHouse_MayPC_Off;
MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + MAP_OFFSET, gSaveBlock1Ptr->pos.y + dy + MAP_OFFSET, metatileId | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + MAP_OFFSET, gSaveBlock1Ptr->pos.y + dy + MAP_OFFSET, metatileId | MAPGRID_IMPASSABLE);
DrawWholeMapView(); DrawWholeMapView();
} }
@ -1173,14 +1173,14 @@ static void LotteryCornerComputerEffect(struct Task *task)
if (task->tIsScreenOn) if (task->tIsScreenOn)
{ {
// Screen is on, set it off // Screen is on, set it off
MapGridSetMetatileIdAt(11 + MAP_OFFSET, 1 + MAP_OFFSET, METATILE_Shop_Laptop1_Normal | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(11 + MAP_OFFSET, 1 + MAP_OFFSET, METATILE_Shop_Laptop1_Normal | MAPGRID_IMPASSABLE);
MapGridSetMetatileIdAt(11 + MAP_OFFSET, 2 + MAP_OFFSET, METATILE_Shop_Laptop2_Normal | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(11 + MAP_OFFSET, 2 + MAP_OFFSET, METATILE_Shop_Laptop2_Normal | MAPGRID_IMPASSABLE);
} }
else else
{ {
// Screen is off, set it on // Screen is off, set it on
MapGridSetMetatileIdAt(11 + MAP_OFFSET, 1 + MAP_OFFSET, METATILE_Shop_Laptop1_Flash | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(11 + MAP_OFFSET, 1 + MAP_OFFSET, METATILE_Shop_Laptop1_Flash | MAPGRID_IMPASSABLE);
MapGridSetMetatileIdAt(11 + MAP_OFFSET, 2 + MAP_OFFSET, METATILE_Shop_Laptop2_Flash | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(11 + MAP_OFFSET, 2 + MAP_OFFSET, METATILE_Shop_Laptop2_Flash | MAPGRID_IMPASSABLE);
} }
DrawWholeMapView(); DrawWholeMapView();
@ -1195,8 +1195,8 @@ static void LotteryCornerComputerEffect(struct Task *task)
void EndLotteryCornerComputerEffect(void) void EndLotteryCornerComputerEffect(void)
{ {
MapGridSetMetatileIdAt(11 + MAP_OFFSET, 1 + MAP_OFFSET, METATILE_Shop_Laptop1_Normal | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(11 + MAP_OFFSET, 1 + MAP_OFFSET, METATILE_Shop_Laptop1_Normal | MAPGRID_IMPASSABLE);
MapGridSetMetatileIdAt(11 + MAP_OFFSET, 2 + MAP_OFFSET, METATILE_Shop_Laptop2_Normal | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(11 + MAP_OFFSET, 2 + MAP_OFFSET, METATILE_Shop_Laptop2_Normal | MAPGRID_IMPASSABLE);
DrawWholeMapView(); DrawWholeMapView();
} }
@ -1976,7 +1976,7 @@ static void Task_MoveElevatorWindowLights(u8 taskId)
for (y = 0; y < ELEVATOR_WINDOW_HEIGHT; y++) for (y = 0; y < ELEVATOR_WINDOW_HEIGHT; y++)
{ {
for (x = 0; x < ELEVATOR_WINDOW_WIDTH; x++) for (x = 0; x < ELEVATOR_WINDOW_WIDTH; x++)
MapGridSetMetatileIdAt(x + MAP_OFFSET + 1, y + MAP_OFFSET, sElevatorWindowTiles_Ascending[y][tMoveCounter % ELEVATOR_LIGHT_STAGES] | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(x + MAP_OFFSET + 1, y + MAP_OFFSET, sElevatorWindowTiles_Ascending[y][tMoveCounter % ELEVATOR_LIGHT_STAGES] | MAPGRID_IMPASSABLE);
} }
} }
else else
@ -1985,7 +1985,7 @@ static void Task_MoveElevatorWindowLights(u8 taskId)
for (y = 0; y < ELEVATOR_WINDOW_HEIGHT; y++) for (y = 0; y < ELEVATOR_WINDOW_HEIGHT; y++)
{ {
for (x = 0; x < ELEVATOR_WINDOW_WIDTH; x++) for (x = 0; x < ELEVATOR_WINDOW_WIDTH; x++)
MapGridSetMetatileIdAt(x + MAP_OFFSET + 1, y + MAP_OFFSET, sElevatorWindowTiles_Descending[y][tMoveCounter % ELEVATOR_LIGHT_STAGES] | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(x + MAP_OFFSET + 1, y + MAP_OFFSET, sElevatorWindowTiles_Descending[y][tMoveCounter % ELEVATOR_LIGHT_STAGES] | MAPGRID_IMPASSABLE);
} }
} }
DrawWholeMapView(); DrawWholeMapView();

View File

@ -52,7 +52,7 @@ static inline u16 GetBorderBlockAt(int x, int y)
{ {
int i = (x + 1) & 1; int i = (x + 1) & 1;
i += ((y + 1) & 1) * 2; i += ((y + 1) & 1) * 2;
return gMapHeader.mapLayout->border[i] | MAPGRID_COLLISION_MASK; return gMapHeader.mapLayout->border[i] | MAPGRID_IMPASSABLE;
} }
#define AreCoordsWithinMapGridBounds(x, y) (x >= 0 && x < gBackupMapLayout.width && y >= 0 && y < gBackupMapLayout.height) #define AreCoordsWithinMapGridBounds(x, y) (x >= 0 && x < gBackupMapLayout.width && y >= 0 && y < gBackupMapLayout.height)
@ -345,7 +345,7 @@ u8 MapGridGetElevationAt(int x, int y)
if (block == MAPGRID_UNDEFINED) if (block == MAPGRID_UNDEFINED)
return 0; return 0;
return block >> MAPGRID_ELEVATION_SHIFT; return UNPACK_ELEVATION(block);
} }
u8 MapGridGetCollisionAt(int x, int y) u8 MapGridGetCollisionAt(int x, int y)
@ -355,7 +355,7 @@ u8 MapGridGetCollisionAt(int x, int y)
if (block == MAPGRID_UNDEFINED) if (block == MAPGRID_UNDEFINED)
return TRUE; return TRUE;
return (block & MAPGRID_COLLISION_MASK) >> MAPGRID_COLLISION_SHIFT; return UNPACK_COLLISION(block);
} }
u32 MapGridGetMetatileIdAt(int x, int y) u32 MapGridGetMetatileIdAt(int x, int y)
@ -363,21 +363,21 @@ u32 MapGridGetMetatileIdAt(int x, int y)
u16 block = GetMapGridBlockAt(x, y); u16 block = GetMapGridBlockAt(x, y);
if (block == MAPGRID_UNDEFINED) if (block == MAPGRID_UNDEFINED)
return GetBorderBlockAt(x, y) & MAPGRID_METATILE_ID_MASK; return UNPACK_METATILE(GetBorderBlockAt(x, y));
return block & MAPGRID_METATILE_ID_MASK; return UNPACK_METATILE(block);
} }
u32 MapGridGetMetatileBehaviorAt(int x, int y) u32 MapGridGetMetatileBehaviorAt(int x, int y)
{ {
u16 metatile = MapGridGetMetatileIdAt(x, y); u16 metatile = MapGridGetMetatileIdAt(x, y);
return GetMetatileAttributesById(metatile) & METATILE_ATTR_BEHAVIOR_MASK; return UNPACK_BEHAVIOR(GetMetatileAttributesById(metatile));
} }
u8 MapGridGetMetatileLayerTypeAt(int x, int y) u8 MapGridGetMetatileLayerTypeAt(int x, int y)
{ {
u16 metatile = MapGridGetMetatileIdAt(x, y); u16 metatile = MapGridGetMetatileIdAt(x, y);
return (GetMetatileAttributesById(metatile) & METATILE_ATTR_LAYER_MASK) >> METATILE_ATTR_LAYER_SHIFT; return UNPACK_LAYER_TYPE(GetMetatileAttributesById(metatile));
} }
void MapGridSetMetatileIdAt(int x, int y, u16 metatile) void MapGridSetMetatileIdAt(int x, int y, u16 metatile)
@ -386,6 +386,8 @@ void MapGridSetMetatileIdAt(int x, int y, u16 metatile)
if (AreCoordsWithinMapGridBounds(x, y)) if (AreCoordsWithinMapGridBounds(x, y))
{ {
i = x + y * gBackupMapLayout.width; i = x + y * gBackupMapLayout.width;
// Elevation is ignored in the argument, but copy metatile ID and collision
gBackupMapLayout.map[i] = (gBackupMapLayout.map[i] & MAPGRID_ELEVATION_MASK) | (metatile & ~MAPGRID_ELEVATION_MASK); gBackupMapLayout.map[i] = (gBackupMapLayout.map[i] & MAPGRID_ELEVATION_MASK) | (metatile & ~MAPGRID_ELEVATION_MASK);
} }
} }
@ -839,7 +841,7 @@ static bool8 SkipCopyingMetatileFromSavedMap(u16 *mapBlock, u16 mapWidth, u8 yMo
else else
mapBlock += mapWidth; mapBlock += mapWidth;
if (IsLargeBreakableDecoration(*mapBlock & MAPGRID_METATILE_ID_MASK, yMode) == TRUE) if (IsLargeBreakableDecoration(UNPACK_METATILE(*mapBlock), yMode) == TRUE)
return TRUE; return TRUE;
return FALSE; return FALSE;
} }

View File

@ -126,13 +126,13 @@ static void Task_DrawEscalator(u8 taskId)
SetEscalatorMetatile(taskId, sEscalatorMetatiles_1F_1, 0); SetEscalatorMetatile(taskId, sEscalatorMetatiles_1F_1, 0);
break; break;
case 2: case 2:
SetEscalatorMetatile(taskId, sEscalatorMetatiles_1F_2, MAPGRID_COLLISION_MASK); SetEscalatorMetatile(taskId, sEscalatorMetatiles_1F_2, MAPGRID_IMPASSABLE);
break; break;
case 3: case 3:
SetEscalatorMetatile(taskId, sEscalatorMetatiles_1F_3, 0); SetEscalatorMetatile(taskId, sEscalatorMetatiles_1F_3, 0);
break; break;
case 4: case 4:
SetEscalatorMetatile(taskId, sEscalatorMetatiles_2F_0, MAPGRID_COLLISION_MASK); SetEscalatorMetatile(taskId, sEscalatorMetatiles_2F_0, MAPGRID_IMPASSABLE);
break; break;
case 5: case 5:
SetEscalatorMetatile(taskId, sEscalatorMetatiles_2F_1, 0); SetEscalatorMetatile(taskId, sEscalatorMetatiles_2F_1, 0);

View File

@ -840,9 +840,9 @@ void DoSecretBasePCTurnOffEffect(void)
PlaySE(SE_PC_OFF); PlaySE(SE_PC_OFF);
if (!VarGet(VAR_CURRENT_SECRET_BASE)) if (!VarGet(VAR_CURRENT_SECRET_BASE))
MapGridSetMetatileIdAt(x, y, METATILE_SecretBase_PC | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(x, y, METATILE_SecretBase_PC | MAPGRID_IMPASSABLE);
else else
MapGridSetMetatileIdAt(x, y, METATILE_SecretBase_RegisterPC | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(x, y, METATILE_SecretBase_RegisterPC | MAPGRID_IMPASSABLE);
CurrentMapDrawMetatileAt(x, y); CurrentMapDrawMetatileAt(x, y);
} }
@ -1083,7 +1083,7 @@ static void SpriteCB_SandPillar_BreakTop(struct Sprite *sprite)
PlaySE(SE_M_ROCK_THROW); PlaySE(SE_M_ROCK_THROW);
if (MapGridGetMetatileIdAt(gFieldEffectArguments[5], gFieldEffectArguments[6] - 1) == METATILE_SecretBase_SandOrnament_TopWall) if (MapGridGetMetatileIdAt(gFieldEffectArguments[5], gFieldEffectArguments[6] - 1) == METATILE_SecretBase_SandOrnament_TopWall)
MapGridSetMetatileIdAt(gFieldEffectArguments[5], gFieldEffectArguments[6] - 1, METATILE_SecretBase_Wall_TopMid | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(gFieldEffectArguments[5], gFieldEffectArguments[6] - 1, METATILE_SecretBase_Wall_TopMid | MAPGRID_IMPASSABLE);
else else
MapGridSetMetatileIdAt(gFieldEffectArguments[5], gFieldEffectArguments[6] - 1, METATILE_SecretBase_SandOrnament_BrokenTop); MapGridSetMetatileIdAt(gFieldEffectArguments[5], gFieldEffectArguments[6] - 1, METATILE_SecretBase_SandOrnament_BrokenTop);
@ -1103,7 +1103,7 @@ static void SpriteCB_SandPillar_BreakBase(struct Sprite *sprite)
} }
else else
{ {
MapGridSetMetatileIdAt(gFieldEffectArguments[5], gFieldEffectArguments[6], METATILE_SecretBase_SandOrnament_BrokenBase | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(gFieldEffectArguments[5], gFieldEffectArguments[6], METATILE_SecretBase_SandOrnament_BrokenBase | MAPGRID_IMPASSABLE);
CurrentMapDrawMetatileAt(gFieldEffectArguments[5], gFieldEffectArguments[6]); CurrentMapDrawMetatileAt(gFieldEffectArguments[5], gFieldEffectArguments[6]);
sprite->data[0] = 0; sprite->data[0] = 0;
sprite->callback = SpriteCB_SandPillar_End; sprite->callback = SpriteCB_SandPillar_End;

View File

@ -917,12 +917,12 @@ static void CB2_ReturnFromRecord(void)
sPassData->cursorX = sSavedPassData.cursorX; sPassData->cursorX = sSavedPassData.cursorX;
sPassData->cursorY = sSavedPassData.cursorY; sPassData->cursorY = sSavedPassData.cursorY;
memset(&sSavedPassData, 0, sizeof(sSavedPassData)); memset(&sSavedPassData, 0, sizeof(sSavedPassData));
switch (InBattlePyramid()) switch (CurrentBattlePyramidLocation())
{ {
case 1: case PYRAMID_LOCATION_FLOOR:
PlayBGM(MUS_B_PYRAMID); PlayBGM(MUS_B_PYRAMID);
break; break;
case 2: case PYRAMID_LOCATION_TOP:
PlayBGM(MUS_B_PYRAMID_TOP); PlayBGM(MUS_B_PYRAMID_TOP);
break; break;
default: default:

View File

@ -8,7 +8,7 @@
#define EMPTY_SLOT 0xFF #define EMPTY_SLOT 0xFF
static u8 sGpuRegBuffer[GPU_REG_BUF_SIZE]; static ALIGNED(2) u8 sGpuRegBuffer[GPU_REG_BUF_SIZE]; // sGpuRegBuffer is read as u16 so it needs to be properly aligned
static u8 sGpuRegWaitingList[GPU_REG_BUF_SIZE]; static u8 sGpuRegWaitingList[GPU_REG_BUF_SIZE];
static volatile bool8 sGpuRegBufferLocked; static volatile bool8 sGpuRegBufferLocked;
static volatile bool8 sShouldSyncRegIE; static volatile bool8 sShouldSyncRegIE;

View File

@ -216,7 +216,7 @@ bool32 CheckBagHasItem(u16 itemId, u16 count)
{ {
if (GetItemPocket(itemId) >= POCKETS_COUNT) if (GetItemPocket(itemId) >= POCKETS_COUNT)
return FALSE; return FALSE;
if (InBattlePyramid() || FlagGet(FLAG_STORING_ITEMS_IN_PYRAMID_BAG) == TRUE) if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE || FlagGet(FLAG_STORING_ITEMS_IN_PYRAMID_BAG) == TRUE)
return CheckPyramidBagHasItem(itemId, count); return CheckPyramidBagHasItem(itemId, count);
return BagPocket_CheckHasItem(&gBagPockets[GetItemPocket(itemId)], itemId, count); return BagPocket_CheckHasItem(&gBagPockets[GetItemPocket(itemId)], itemId, count);
@ -247,7 +247,7 @@ bool32 CheckBagHasSpace(u16 itemId, u16 count)
if (GetItemPocket(itemId) >= POCKETS_COUNT) if (GetItemPocket(itemId) >= POCKETS_COUNT)
return FALSE; return FALSE;
if (InBattlePyramid() || FlagGet(FLAG_STORING_ITEMS_IN_PYRAMID_BAG) == TRUE) if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE || FlagGet(FLAG_STORING_ITEMS_IN_PYRAMID_BAG) == TRUE)
return CheckPyramidBagHasSpace(itemId, count); return CheckPyramidBagHasSpace(itemId, count);
return GetFreeSpaceForItemInBag(itemId) >= count; return GetFreeSpaceForItemInBag(itemId) >= count;
@ -348,7 +348,7 @@ bool32 AddBagItem(u16 itemId, u16 count)
return FALSE; return FALSE;
// check Battle Pyramid Bag // check Battle Pyramid Bag
if (InBattlePyramid() || FlagGet(FLAG_STORING_ITEMS_IN_PYRAMID_BAG) == TRUE) if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE || FlagGet(FLAG_STORING_ITEMS_IN_PYRAMID_BAG) == TRUE)
return AddPyramidBagItem(itemId, count); return AddPyramidBagItem(itemId, count);
return BagPocket_AddItem(&gBagPockets[GetItemPocket(itemId)], itemId, count); return BagPocket_AddItem(&gBagPockets[GetItemPocket(itemId)], itemId, count);
@ -401,7 +401,7 @@ bool32 RemoveBagItem(u16 itemId, u16 count)
return FALSE; return FALSE;
// check Battle Pyramid Bag // check Battle Pyramid Bag
if (InBattlePyramid() || FlagGet(FLAG_STORING_ITEMS_IN_PYRAMID_BAG) == TRUE) if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE || FlagGet(FLAG_STORING_ITEMS_IN_PYRAMID_BAG) == TRUE)
return RemovePyramidBagItem(itemId, count); return RemovePyramidBagItem(itemId, count);
return BagPocket_RemoveItem(&gBagPockets[GetItemPocket(itemId)], itemId, count); return BagPocket_RemoveItem(&gBagPockets[GetItemPocket(itemId)], itemId, count);

View File

@ -595,7 +595,7 @@ void CB2_BagMenuFromStartMenu(void)
void CB2_BagMenuFromBattle(void) void CB2_BagMenuFromBattle(void)
{ {
if (!InBattlePyramid()) if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE)
GoToBagMenu(ITEMMENULOCATION_BATTLE, POCKETS_COUNT, CB2_SetUpReshowBattleScreenAfterMenu2); GoToBagMenu(ITEMMENULOCATION_BATTLE, POCKETS_COUNT, CB2_SetUpReshowBattleScreenAfterMenu2);
else else
GoToBattlePyramidBagMenu(PYRAMIDBAG_LOC_BATTLE, CB2_SetUpReshowBattleScreenAfterMenu2); GoToBattlePyramidBagMenu(PYRAMIDBAG_LOC_BATTLE, CB2_SetUpReshowBattleScreenAfterMenu2);
@ -2125,7 +2125,7 @@ bool8 UseRegisteredKeyItemOnField(void)
{ {
u8 taskId; u8 taskId;
if (InUnionRoom() == TRUE || InBattlePyramid() || InBattlePike() || InMultiPartnerRoom() == TRUE) if (InUnionRoom() == TRUE || CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE || InBattlePike() || InMultiPartnerRoom() == TRUE)
return FALSE; return FALSE;
HideMapNamePopUpWindow(); HideMapNamePopUpWindow();
ChangeBgY_ScreenOff(0, 0, BG_COORD_SET); ChangeBgY_ScreenOff(0, 0, BG_COORD_SET);

View File

@ -127,7 +127,7 @@ static void SetUpItemUseCallback(u8 taskId)
type = gTasks[taskId].tEnigmaBerryType - 1; type = gTasks[taskId].tEnigmaBerryType - 1;
else else
type = GetItemType(gSpecialVar_ItemId) - 1; type = GetItemType(gSpecialVar_ItemId) - 1;
if (!InBattlePyramid()) if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE)
{ {
gBagMenu->newScreenCallback = sItemUseCallbacks[type]; gBagMenu->newScreenCallback = sItemUseCallbacks[type];
Task_FadeAndCloseBagMenu(taskId); Task_FadeAndCloseBagMenu(taskId);
@ -169,7 +169,7 @@ static void DisplayCannotUseItemMessage(u8 taskId, bool8 isUsingRegisteredKeyIte
StringExpandPlaceholders(gStringVar4, str); StringExpandPlaceholders(gStringVar4, str);
if (!isUsingRegisteredKeyItemOnField) if (!isUsingRegisteredKeyItemOnField)
{ {
if (!InBattlePyramid()) if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE)
DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, CloseItemMessage); DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, CloseItemMessage);
else else
DisplayItemMessageInBattlePyramid(taskId, gText_DadsAdvice, Task_CloseBattlePyramidBagMessage); DisplayItemMessageInBattlePyramid(taskId, gText_DadsAdvice, Task_CloseBattlePyramidBagMessage);
@ -922,7 +922,7 @@ static void RemoveUsedItem(void)
RemoveBagItem(gSpecialVar_ItemId, 1); RemoveBagItem(gSpecialVar_ItemId, 1);
CopyItemName(gSpecialVar_ItemId, gStringVar2); CopyItemName(gSpecialVar_ItemId, gStringVar2);
StringExpandPlaceholders(gStringVar4, gText_PlayerUsedVar2); StringExpandPlaceholders(gStringVar4, gText_PlayerUsedVar2);
if (!InBattlePyramid()) if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE)
{ {
UpdatePocketItemList(GetItemPocket(gSpecialVar_ItemId)); UpdatePocketItemList(GetItemPocket(gSpecialVar_ItemId));
UpdatePocketListPosition(GetItemPocket(gSpecialVar_ItemId)); UpdatePocketListPosition(GetItemPocket(gSpecialVar_ItemId));
@ -938,7 +938,7 @@ void ItemUseOutOfBattle_Repel(u8 taskId)
{ {
if (REPEL_STEP_COUNT == 0) if (REPEL_STEP_COUNT == 0)
gTasks[taskId].func = Task_StartUseRepel; gTasks[taskId].func = Task_StartUseRepel;
else if (!InBattlePyramid()) else if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE)
DisplayItemMessage(taskId, FONT_NORMAL, gText_RepelEffectsLingered, CloseItemMessage); DisplayItemMessage(taskId, FONT_NORMAL, gText_RepelEffectsLingered, CloseItemMessage);
else else
DisplayItemMessageInBattlePyramid(taskId, gText_RepelEffectsLingered, Task_CloseBattlePyramidBagMessage); DisplayItemMessageInBattlePyramid(taskId, gText_RepelEffectsLingered, Task_CloseBattlePyramidBagMessage);
@ -965,7 +965,7 @@ static void Task_UseRepel(u8 taskId)
VarSet(VAR_LAST_REPEL_LURE_USED, gSpecialVar_ItemId); VarSet(VAR_LAST_REPEL_LURE_USED, gSpecialVar_ItemId);
#endif #endif
RemoveUsedItem(); RemoveUsedItem();
if (!InBattlePyramid()) if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE)
DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, CloseItemMessage); DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, CloseItemMessage);
else else
DisplayItemMessageInBattlePyramid(taskId, gStringVar4, Task_CloseBattlePyramidBagMessage); DisplayItemMessageInBattlePyramid(taskId, gStringVar4, Task_CloseBattlePyramidBagMessage);
@ -982,7 +982,7 @@ void ItemUseOutOfBattle_Lure(u8 taskId)
{ {
if (LURE_STEP_COUNT == 0) if (LURE_STEP_COUNT == 0)
gTasks[taskId].func = Task_StartUseLure; gTasks[taskId].func = Task_StartUseLure;
else if (!InBattlePyramid()) else if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE)
DisplayItemMessage(taskId, FONT_NORMAL, gText_LureEffectsLingered, CloseItemMessage); DisplayItemMessage(taskId, FONT_NORMAL, gText_LureEffectsLingered, CloseItemMessage);
else else
DisplayItemMessageInBattlePyramid(taskId, gText_LureEffectsLingered, Task_CloseBattlePyramidBagMessage); DisplayItemMessageInBattlePyramid(taskId, gText_LureEffectsLingered, Task_CloseBattlePyramidBagMessage);
@ -1009,7 +1009,7 @@ static void Task_UseLure(u8 taskId)
VarSet(VAR_LAST_REPEL_LURE_USED, gSpecialVar_ItemId); VarSet(VAR_LAST_REPEL_LURE_USED, gSpecialVar_ItemId);
#endif #endif
RemoveUsedItem(); RemoveUsedItem();
if (!InBattlePyramid()) if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE)
DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, CloseItemMessage); DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, CloseItemMessage);
else else
DisplayItemMessageInBattlePyramid(taskId, gStringVar4, Task_CloseBattlePyramidBagMessage); DisplayItemMessageInBattlePyramid(taskId, gStringVar4, Task_CloseBattlePyramidBagMessage);
@ -1028,7 +1028,7 @@ static void Task_UsedBlackWhiteFlute(u8 taskId)
if(++gTasks[taskId].data[8] > 7) if(++gTasks[taskId].data[8] > 7)
{ {
PlaySE(SE_GLASS_FLUTE); PlaySE(SE_GLASS_FLUTE);
if (!InBattlePyramid()) if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE)
DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, CloseItemMessage); DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, CloseItemMessage);
else else
DisplayItemMessageInBattlePyramid(taskId, gStringVar4, Task_CloseBattlePyramidBagMessage); DisplayItemMessageInBattlePyramid(taskId, gStringVar4, Task_CloseBattlePyramidBagMessage);
@ -1133,31 +1133,31 @@ void ItemUseInBattle_PokeBall(u8 taskId)
case BALL_THROW_ABLE: case BALL_THROW_ABLE:
default: default:
RemoveBagItem(gSpecialVar_ItemId, 1); RemoveBagItem(gSpecialVar_ItemId, 1);
if (!InBattlePyramid()) if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE)
Task_FadeAndCloseBagMenu(taskId); Task_FadeAndCloseBagMenu(taskId);
else else
CloseBattlePyramidBag(taskId); CloseBattlePyramidBag(taskId);
break; break;
case BALL_THROW_UNABLE_TWO_MONS: case BALL_THROW_UNABLE_TWO_MONS:
if (!InBattlePyramid()) if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE)
DisplayItemMessage(taskId, FONT_NORMAL, sText_CantThrowPokeBall_TwoMons, CloseItemMessage); DisplayItemMessage(taskId, FONT_NORMAL, sText_CantThrowPokeBall_TwoMons, CloseItemMessage);
else else
DisplayItemMessageInBattlePyramid(taskId, sText_CantThrowPokeBall_TwoMons, Task_CloseBattlePyramidBagMessage); DisplayItemMessageInBattlePyramid(taskId, sText_CantThrowPokeBall_TwoMons, Task_CloseBattlePyramidBagMessage);
break; break;
case BALL_THROW_UNABLE_NO_ROOM: case BALL_THROW_UNABLE_NO_ROOM:
if (!InBattlePyramid()) if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE)
DisplayItemMessage(taskId, FONT_NORMAL, gText_BoxFull, CloseItemMessage); DisplayItemMessage(taskId, FONT_NORMAL, gText_BoxFull, CloseItemMessage);
else else
DisplayItemMessageInBattlePyramid(taskId, gText_BoxFull, Task_CloseBattlePyramidBagMessage); DisplayItemMessageInBattlePyramid(taskId, gText_BoxFull, Task_CloseBattlePyramidBagMessage);
break; break;
case BALL_THROW_UNABLE_SEMI_INVULNERABLE: case BALL_THROW_UNABLE_SEMI_INVULNERABLE:
if (!InBattlePyramid()) if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE)
DisplayItemMessage(taskId, FONT_NORMAL, sText_CantThrowPokeBall_SemiInvulnerable, CloseItemMessage); DisplayItemMessage(taskId, FONT_NORMAL, sText_CantThrowPokeBall_SemiInvulnerable, CloseItemMessage);
else else
DisplayItemMessageInBattlePyramid(taskId, sText_CantThrowPokeBall_SemiInvulnerable, Task_CloseBattlePyramidBagMessage); DisplayItemMessageInBattlePyramid(taskId, sText_CantThrowPokeBall_SemiInvulnerable, Task_CloseBattlePyramidBagMessage);
break; break;
case BALL_THROW_UNABLE_DISABLED_FLAG: case BALL_THROW_UNABLE_DISABLED_FLAG:
if (!InBattlePyramid()) if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE)
DisplayItemMessage(taskId, FONT_NORMAL, sText_CantThrowPokeBall_Disabled, CloseItemMessage); DisplayItemMessage(taskId, FONT_NORMAL, sText_CantThrowPokeBall_Disabled, CloseItemMessage);
else else
DisplayItemMessageInBattlePyramid(taskId, sText_CantThrowPokeBall_Disabled, Task_CloseBattlePyramidBagMessage); DisplayItemMessageInBattlePyramid(taskId, sText_CantThrowPokeBall_Disabled, Task_CloseBattlePyramidBagMessage);
@ -1167,7 +1167,7 @@ void ItemUseInBattle_PokeBall(u8 taskId)
static void ItemUseInBattle_ShowPartyMenu(u8 taskId) static void ItemUseInBattle_ShowPartyMenu(u8 taskId)
{ {
if (!InBattlePyramid()) if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE)
{ {
gBagMenu->newScreenCallback = ChooseMonForInBattleItem; gBagMenu->newScreenCallback = ChooseMonForInBattleItem;
Task_FadeAndCloseBagMenu(taskId); Task_FadeAndCloseBagMenu(taskId);
@ -1328,7 +1328,7 @@ void ItemUseInBattle_BagMenu(u8 taskId)
{ {
if (CannotUseItemsInBattle(gSpecialVar_ItemId, NULL)) if (CannotUseItemsInBattle(gSpecialVar_ItemId, NULL))
{ {
if (!InBattlePyramid()) if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE)
DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, CloseItemMessage); DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, CloseItemMessage);
else else
DisplayItemMessageInBattlePyramid(taskId, gStringVar4, Task_CloseBattlePyramidBagMessage); DisplayItemMessageInBattlePyramid(taskId, gStringVar4, Task_CloseBattlePyramidBagMessage);
@ -1339,7 +1339,7 @@ void ItemUseInBattle_BagMenu(u8 taskId)
if (!GetItemImportance(gSpecialVar_ItemId) && !(B_TRY_CATCH_TRAINER_BALL >= GEN_4 && (GetItemBattleUsage(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(); RemoveUsedItem();
ScheduleBgCopyTilemapToVram(2); ScheduleBgCopyTilemapToVram(2);
if (!InBattlePyramid()) if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE)
gTasks[taskId].func = Task_FadeAndCloseBagMenu; gTasks[taskId].func = Task_FadeAndCloseBagMenu;
else else
gTasks[taskId].func = CloseBattlePyramidBag; gTasks[taskId].func = CloseBattlePyramidBag;

View File

@ -526,7 +526,7 @@ static void ShowMapNamePopUpWindow(void)
const u8 *mapDisplayHeaderSource; const u8 *mapDisplayHeaderSource;
u8 mapNamePopUpWindowId, secondaryPopUpWindowId; u8 mapNamePopUpWindowId, secondaryPopUpWindowId;
if (InBattlePyramid()) if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE)
{ {
if (gMapHeader.mapLayoutId == LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_TOP) if (gMapHeader.mapLayoutId == LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_TOP)
{ {

View File

@ -23,7 +23,7 @@ static void SpriteCB_Cursor(struct Sprite *);
static struct Sprite *CreateMarkingComboSprite(u16, u16, const u16 *, u16); static struct Sprite *CreateMarkingComboSprite(u16, u16, const u16 *, u16);
static const u16 sMonMarkings_Pal[] = INCBIN_U16("graphics/interface/mon_markings.gbapal"); static const u16 sMonMarkings_Pal[] = INCBIN_U16("graphics/interface/mon_markings.gbapal");
static const u8 sMonMarkings_Gfx[] = INCBIN_U8("graphics/interface/mon_markings.4bpp"); static const ALIGNED(4) u8 sMonMarkings_Gfx[] = INCBIN_U8("graphics/interface/mon_markings.4bpp"); // Alignment needed for dma copy
static const struct OamData sOamData_MenuWindow = static const struct OamData sOamData_MenuWindow =
{ {

View File

@ -3320,7 +3320,7 @@ static void CursorCb_Give(u8 taskId)
static void CB2_SelectBagItemToGive(void) static void CB2_SelectBagItemToGive(void)
{ {
if (InBattlePyramid() == FALSE) if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE)
GoToBagMenu(ITEMMENULOCATION_PARTY, POCKETS_COUNT, CB2_GiveHoldItem); GoToBagMenu(ITEMMENULOCATION_PARTY, POCKETS_COUNT, CB2_GiveHoldItem);
else else
GoToBattlePyramidBagMenu(PYRAMIDBAG_LOC_PARTY, CB2_GiveHoldItem); GoToBattlePyramidBagMenu(PYRAMIDBAG_LOC_PARTY, CB2_GiveHoldItem);
@ -4560,7 +4560,7 @@ void CB2_ShowPartyMenuForItemUse(void)
static void CB2_ReturnToBagMenu(void) static void CB2_ReturnToBagMenu(void)
{ {
if (InBattlePyramid() == FALSE) if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE)
GoToBagMenu(ITEMMENULOCATION_LAST, POCKETS_COUNT, NULL); GoToBagMenu(ITEMMENULOCATION_LAST, POCKETS_COUNT, NULL);
else else
GoToBattlePyramidBagMenu(PYRAMIDBAG_LOC_PREV, gPyramidBagMenuState.exitCallback); GoToBattlePyramidBagMenu(PYRAMIDBAG_LOC_PREV, gPyramidBagMenuState.exitCallback);
@ -6822,7 +6822,7 @@ void CB2_PartyMenuFromStartMenu(void)
// As opposted to by selecting Give in the party menu, which is handled by CursorCb_Give // As opposted to by selecting Give in the party menu, which is handled by CursorCb_Give
void CB2_ChooseMonToGiveItem(void) void CB2_ChooseMonToGiveItem(void)
{ {
MainCallback callback = (InBattlePyramid() == FALSE) ? CB2_ReturnToBagMenu : CB2_ReturnToPyramidBagMenu; MainCallback callback = (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE) ? CB2_ReturnToBagMenu : CB2_ReturnToPyramidBagMenu;
InitPartyMenu(PARTY_MENU_TYPE_FIELD, PARTY_LAYOUT_SINGLE, PARTY_ACTION_GIVE_ITEM, FALSE, PARTY_MSG_GIVE_TO_WHICH_MON, Task_HandleChooseMonInput, callback); InitPartyMenu(PARTY_MENU_TYPE_FIELD, PARTY_LAYOUT_SINGLE, PARTY_ACTION_GIVE_ITEM, FALSE, PARTY_MSG_GIVE_TO_WHICH_MON, Task_HandleChooseMonInput, callback);
gPartyMenu.bagItem = gSpecialVar_ItemId; gPartyMenu.bagItem = gSpecialVar_ItemId;
} }

View File

@ -1075,7 +1075,7 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV,
{ {
isShiny = TRUE; isShiny = TRUE;
} }
else if (P_ONLY_OBTAINABLE_SHINIES && (InBattlePyramid() || (B_FLAG_NO_CATCHING != 0 && FlagGet(B_FLAG_NO_CATCHING)))) else if (P_ONLY_OBTAINABLE_SHINIES && (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE || (B_FLAG_NO_CATCHING != 0 && FlagGet(B_FLAG_NO_CATCHING))))
{ {
isShiny = FALSE; isShiny = FALSE;
} }
@ -5175,7 +5175,7 @@ u8 GetTrainerEncounterMusicId(u16 trainerOpponentId)
u32 sanitizedTrainerId = SanitizeTrainerId(trainerOpponentId); u32 sanitizedTrainerId = SanitizeTrainerId(trainerOpponentId);
enum DifficultyLevel difficulty = GetTrainerDifficultyLevel(sanitizedTrainerId); enum DifficultyLevel difficulty = GetTrainerDifficultyLevel(sanitizedTrainerId);
if (InBattlePyramid()) if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE)
return GetTrainerEncounterMusicIdInBattlePyramid(trainerOpponentId); return GetTrainerEncounterMusicIdInBattlePyramid(trainerOpponentId);
else if (InTrainerHillChallenge()) else if (InTrainerHillChallenge())
return GetTrainerEncounterMusicIdInTrainerHill(trainerOpponentId); return GetTrainerEncounterMusicIdInTrainerHill(trainerOpponentId);
@ -6346,7 +6346,7 @@ static bool8 ShouldSkipFriendshipChange(void)
{ {
if (gMain.inBattle && gBattleTypeFlags & (BATTLE_TYPE_FRONTIER)) if (gMain.inBattle && gBattleTypeFlags & (BATTLE_TYPE_FRONTIER))
return TRUE; return TRUE;
if (!gMain.inBattle && (InBattlePike() || InBattlePyramid())) if (!gMain.inBattle && (InBattlePike() || CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE))
return TRUE; return TRUE;
return FALSE; return FALSE;
} }

View File

@ -32,7 +32,7 @@ struct Pokenav_MainMenu
// Needed to match LoadLeftHeaderGfxForSubMenu. // Needed to match LoadLeftHeaderGfxForSubMenu.
struct CompressedSpriteSheetNoSize struct CompressedSpriteSheetNoSize
{ {
const u32 *data; // LZ77 compressed palette data const u32 *data; // Compressed sprite data
u32 tag; u32 tag;
}; };

View File

@ -2735,7 +2735,7 @@ bool8 ScrCmd_setmetatile(struct ScriptContext *ctx)
if (!isImpassable) if (!isImpassable)
MapGridSetMetatileIdAt(x, y, metatileId); MapGridSetMetatileIdAt(x, y, metatileId);
else else
MapGridSetMetatileIdAt(x, y, metatileId | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(x, y, metatileId | MAPGRID_IMPASSABLE);
return FALSE; return FALSE;
} }

View File

@ -331,7 +331,7 @@ void ToggleSecretBaseEntranceMetatile(void)
{ {
if (sSecretBaseEntranceMetatiles[i].closedMetatileId == metatileId) if (sSecretBaseEntranceMetatiles[i].closedMetatileId == metatileId)
{ {
MapGridSetMetatileIdAt(x, y, sSecretBaseEntranceMetatiles[i].openMetatileId | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(x, y, sSecretBaseEntranceMetatiles[i].openMetatileId | MAPGRID_IMPASSABLE);
CurrentMapDrawMetatileAt(x, y); CurrentMapDrawMetatileAt(x, y);
return; return;
} }
@ -342,7 +342,7 @@ void ToggleSecretBaseEntranceMetatile(void)
{ {
if (sSecretBaseEntranceMetatiles[i].openMetatileId == metatileId) if (sSecretBaseEntranceMetatiles[i].openMetatileId == metatileId)
{ {
MapGridSetMetatileIdAt(x, y, sSecretBaseEntranceMetatiles[i].closedMetatileId | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(x, y, sSecretBaseEntranceMetatiles[i].closedMetatileId | MAPGRID_IMPASSABLE);
CurrentMapDrawMetatileAt(x, y); CurrentMapDrawMetatileAt(x, y);
return; return;
} }
@ -397,7 +397,7 @@ void SetOccupiedSecretBaseEntranceMetatiles(struct MapEvents const *events)
{ {
if (sSecretBaseEntranceMetatiles[i].closedMetatileId == tile_id) if (sSecretBaseEntranceMetatiles[i].closedMetatileId == tile_id)
{ {
MapGridSetMetatileIdAt(x, y, sSecretBaseEntranceMetatiles[i].openMetatileId | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(x, y, sSecretBaseEntranceMetatiles[i].openMetatileId | MAPGRID_IMPASSABLE);
break; break;
} }
} }
@ -476,7 +476,7 @@ static void EnterNewlyCreatedSecretBase_StartFadeIn(void)
FindMetatileIdMapCoords(&x, &y, METATILE_SecretBase_PC); FindMetatileIdMapCoords(&x, &y, METATILE_SecretBase_PC);
x += MAP_OFFSET; x += MAP_OFFSET;
y += MAP_OFFSET; y += MAP_OFFSET;
MapGridSetMetatileIdAt(x, y, METATILE_SecretBase_PC | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(x, y, METATILE_SecretBase_PC | MAPGRID_IMPASSABLE);
CurrentMapDrawMetatileAt(x, y); CurrentMapDrawMetatileAt(x, y);
FadeInFromBlack(); FadeInFromBlack();
CreateTask(EnterNewlyCreatedSecretBase_WaitFadeIn, 0); CreateTask(EnterNewlyCreatedSecretBase_WaitFadeIn, 0);
@ -537,13 +537,13 @@ void InitSecretBaseAppearance(bool8 hidePC)
{ {
// Another player's secret base. Change PC type to the "Register" PC. // Another player's secret base. Change PC type to the "Register" PC.
FindMetatileIdMapCoords(&x, &y, METATILE_SecretBase_PC); FindMetatileIdMapCoords(&x, &y, METATILE_SecretBase_PC);
MapGridSetMetatileIdAt(x + MAP_OFFSET, y + MAP_OFFSET, METATILE_SecretBase_RegisterPC | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(x + MAP_OFFSET, y + MAP_OFFSET, METATILE_SecretBase_RegisterPC | MAPGRID_IMPASSABLE);
} }
else if (hidePC == TRUE && VarGet(VAR_SECRET_BASE_INITIALIZED) == 1) else if (hidePC == TRUE && VarGet(VAR_SECRET_BASE_INITIALIZED) == 1)
{ {
// Change PC to regular ground tile. // Change PC to regular ground tile.
FindMetatileIdMapCoords(&x, &y, METATILE_SecretBase_PC); FindMetatileIdMapCoords(&x, &y, METATILE_SecretBase_PC);
MapGridSetMetatileIdAt(x + MAP_OFFSET, y + MAP_OFFSET, METATILE_SecretBase_Ground | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(x + MAP_OFFSET, y + MAP_OFFSET, METATILE_SecretBase_Ground | MAPGRID_IMPASSABLE);
} }
} }
} }
@ -839,7 +839,7 @@ static void ClosePlayerSecretBaseEntrance(void)
{ {
MapGridSetMetatileIdAt(events->bgEvents[i].x + MAP_OFFSET, MapGridSetMetatileIdAt(events->bgEvents[i].x + MAP_OFFSET,
events->bgEvents[i].y + MAP_OFFSET, events->bgEvents[i].y + MAP_OFFSET,
sSecretBaseEntranceMetatiles[j].closedMetatileId | MAPGRID_COLLISION_MASK); sSecretBaseEntranceMetatiles[j].closedMetatileId | MAPGRID_IMPASSABLE);
break; break;
} }
} }

View File

@ -45,6 +45,7 @@
#define TAG_ITEM_ICON_BASE 9110 // immune to time blending #define TAG_ITEM_ICON_BASE 9110 // immune to time blending
#define MAX_ITEMS_SHOWN 8 #define MAX_ITEMS_SHOWN 8
#define SHOP_MENU_PALETTE_ID 12
enum { enum {
WIN_BUY_SELL_QUIT, WIN_BUY_SELL_QUIT,
@ -746,7 +747,7 @@ static void BuyMenuDecompressBgGraphics(void)
{ {
DecompressAndCopyTileDataToVram(1, gShopMenu_Gfx, 0x3A0, 0x3E3, 0); DecompressAndCopyTileDataToVram(1, gShopMenu_Gfx, 0x3A0, 0x3E3, 0);
DecompressDataWithHeaderWram(gShopMenu_Tilemap, sShopData->tilemapBuffers[0]); DecompressDataWithHeaderWram(gShopMenu_Tilemap, sShopData->tilemapBuffers[0]);
LoadPalette(gShopMenu_Pal, BG_PLTT_ID(12), PLTT_SIZE_4BPP); LoadPalette(gShopMenu_Pal, BG_PLTT_ID(SHOP_MENU_PALETTE_ID), PLTT_SIZE_4BPP);
} }
static void BuyMenuInitWindows(void) static void BuyMenuInitWindows(void)
@ -956,7 +957,7 @@ static void BuyMenuCopyMenuBgToBg1TilemapBuffer(void)
for (i = 0; i < 1024; i++) for (i = 0; i < 1024; i++)
{ {
if (src[i] != 0) if (src[i] != 0)
dest[i] = src[i] + 0xC3E3; dest[i] = src[i] + ((SHOP_MENU_PALETTE_ID << 12) | 0x3E3);
} }
} }

View File

@ -306,7 +306,7 @@ static void BuildStartMenuActions(void)
{ {
BuildBattlePikeStartMenu(); BuildBattlePikeStartMenu();
} }
else if (InBattlePyramid()) else if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE)
{ {
BuildBattlePyramidStartMenu(); BuildBattlePyramidStartMenu();
} }
@ -468,7 +468,7 @@ static void RemoveExtraStartMenuWindows(void)
CopyWindowToVram(sSafariBallsWindowId, COPYWIN_GFX); CopyWindowToVram(sSafariBallsWindowId, COPYWIN_GFX);
RemoveWindow(sSafariBallsWindowId); RemoveWindow(sSafariBallsWindowId);
} }
if (InBattlePyramid()) if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE)
{ {
ClearStdWindowAndFrameToTransparent(sBattlePyramidFloorWindowId, FALSE); ClearStdWindowAndFrameToTransparent(sBattlePyramidFloorWindowId, FALSE);
RemoveWindow(sBattlePyramidFloorWindowId); RemoveWindow(sBattlePyramidFloorWindowId);
@ -528,7 +528,7 @@ static bool32 InitStartMenuStep(void)
case 3: case 3:
if (GetSafariZoneFlag()) if (GetSafariZoneFlag())
ShowSafariBallsWindow(); ShowSafariBallsWindow();
if (InBattlePyramid()) if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE)
ShowPyramidFloorWindow(); ShowPyramidFloorWindow();
sInitStartMenuData[0]++; sInitStartMenuData[0]++;
break; break;
@ -753,7 +753,7 @@ static bool8 StartMenuPlayerNameCallback(void)
static bool8 StartMenuSaveCallback(void) static bool8 StartMenuSaveCallback(void)
{ {
if (InBattlePyramid()) if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE)
RemoveExtraStartMenuWindows(); RemoveExtraStartMenuWindows();
gMenuCallback = SaveStartCallback; // Display save menu gMenuCallback = SaveStartCallback; // Display save menu
@ -1035,7 +1035,7 @@ static u8 SaveConfirmSaveCallback(void)
RemoveStartMenuWindow(); RemoveStartMenuWindow();
ShowSaveInfoWindow(); ShowSaveInfoWindow();
if (InBattlePyramid()) if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE)
{ {
ShowSaveMessage(gText_BattlePyramidConfirmRest, SaveYesNoCallback); ShowSaveMessage(gText_BattlePyramidConfirmRest, SaveYesNoCallback);
} }

View File

@ -707,17 +707,17 @@ bool32 LoadTrainerHillFloorObjectEventScripts(void)
return TRUE; return TRUE;
} }
static u16 GetMetatileForFloor(u8 floorId, u32 x, u32 y, u32 floorWidth) // floorWidth is always 16 static u16 GetMapDataForFloor(u8 floorId, u32 x, u32 y, u32 floorWidth) // floorWidth is always 16
{ {
bool8 impassable; bool8 impassable;
u16 metatile; u16 metatileId;
u16 elevation; u16 elevation;
impassable = (sHillData->floors[floorId].map.collisionData[y] >> (15 - x) & 1); impassable = (sHillData->floors[floorId].map.collisionData[y] >> (15 - x) & 1);
metatile = sHillData->floors[floorId].map.metatileData[floorWidth * y + x] + NUM_METATILES_IN_PRIMARY; metatileId = sHillData->floors[floorId].map.metatileData[floorWidth * y + x] + NUM_METATILES_IN_PRIMARY;
elevation = 3 << MAPGRID_ELEVATION_SHIFT; elevation = PACK_ELEVATION(3);
return ((impassable << MAPGRID_COLLISION_SHIFT) & MAPGRID_COLLISION_MASK) | elevation | (metatile & MAPGRID_METATILE_ID_MASK); return PACK_COLLISION(impassable) | elevation | PACK_METATILE(metatileId);
} }
void GenerateTrainerHillFloorLayout(u16 *mapArg) void GenerateTrainerHillFloorLayout(u16 *mapArg)
@ -762,7 +762,7 @@ void GenerateTrainerHillFloorLayout(u16 *mapArg)
for (y = 0; y < HILL_FLOOR_HEIGHT_MAIN; y++) for (y = 0; y < HILL_FLOOR_HEIGHT_MAIN; y++)
{ {
for (x = 0; x < HILL_FLOOR_WIDTH; x++) for (x = 0; x < HILL_FLOOR_WIDTH; x++)
dst[x] = GetMetatileForFloor(mapId, x, y, HILL_FLOOR_WIDTH); dst[x] = GetMapDataForFloor(mapId, x, y, HILL_FLOOR_WIDTH);
dst += 31; dst += 31;
} }

View File

@ -457,7 +457,7 @@ static u8 CheckTrainer(u8 objectEventId)
} }
} }
if (InBattlePyramid()) if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE)
{ {
if (GetBattlePyramidTrainerFlag(objectEventId)) if (GetBattlePyramidTrainerFlag(objectEventId))
return 0; return 0;

View File

@ -411,7 +411,7 @@ enum TimeOfDay GetTimeOfDayForEncounters(u32 headerId, enum WildPokemonArea area
if (!OW_TIME_OF_DAY_ENCOUNTERS) if (!OW_TIME_OF_DAY_ENCOUNTERS)
return TIME_OF_DAY_DEFAULT; return TIME_OF_DAY_DEFAULT;
if (InBattlePike() || InBattlePyramid()) if (InBattlePike() || CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE)
{ {
return OW_TIME_OF_DAY_FALLBACK; return OW_TIME_OF_DAY_FALLBACK;
} }
@ -1071,7 +1071,7 @@ bool8 UpdateRepelCounter(void)
u16 steps = REPEL_LURE_STEPS(repelLureVar); u16 steps = REPEL_LURE_STEPS(repelLureVar);
bool32 isLure = IS_LAST_USED_LURE(repelLureVar); bool32 isLure = IS_LAST_USED_LURE(repelLureVar);
if (InBattlePike() || InBattlePyramid()) if (InBattlePike() || CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE)
return FALSE; return FALSE;
if (InUnionRoom() == TRUE) if (InUnionRoom() == TRUE)
return FALSE; return FALSE;

View File

@ -99,7 +99,6 @@ SINGLE_BATTLE_TEST("Effect Spore will check if it can inflict status onto attack
OPPONENT(SPECIES_BRELOOM) { Status1(STATUS1_BURN); Ability(ABILITY_EFFECT_SPORE); } OPPONENT(SPECIES_BRELOOM) { Status1(STATUS1_BURN); Ability(ABILITY_EFFECT_SPORE); }
} WHEN { } WHEN {
TURN { MOVE(player, MOVE_SCRATCH); } TURN { MOVE(player, MOVE_SCRATCH); }
TURN {}
} SCENE { } SCENE {
ABILITY_POPUP(opponent, ABILITY_EFFECT_SPORE); ABILITY_POPUP(opponent, ABILITY_EFFECT_SPORE);
ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, player); ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, player);

View File

@ -1269,6 +1269,21 @@ AI_SINGLE_BATTLE_TEST("AI_FLAG_SMART_SWITCHING: AI considers 0 hits to KO as los
} }
} }
AI_SINGLE_BATTLE_TEST("AI_FLAG_SMART_MON_CHOICES: AI sees Echoed Voice damage correctly")
{
GIVEN {
AI_FLAGS(AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_CHECK_VIABILITY | AI_FLAG_TRY_TO_FAINT | AI_FLAG_SMART_MON_CHOICES | AI_FLAG_OMNISCIENT);
PLAYER(SPECIES_WOBBUFFET) { Speed(5); Moves(MOVE_SCRATCH, MOVE_ECHOED_VOICE); }
OPPONENT(SPECIES_ZIGZAGOON) { Speed(4); Level(55); Moves(MOVE_CELEBRATE); }
OPPONENT(SPECIES_DRAPION) { Speed(4); SpDefense(25); Moves(MOVE_WICKED_BLOW); Ability(ABILITY_SNIPER); }
OPPONENT(SPECIES_GASTLY) { Speed(4); Level(1); Moves(MOVE_TACKLE); }
} WHEN {
TURN { MOVE(player, MOVE_SCRATCH); EXPECT_MOVE(opponent, MOVE_CELEBRATE); }
TURN { MOVE(player, MOVE_SCRATCH); EXPECT_MOVE(opponent, MOVE_CELEBRATE); }
TURN { MOVE(player, MOVE_SCRATCH); EXPECT_MOVE(opponent, MOVE_CELEBRATE); EXPECT_SEND_OUT(opponent, 1); }
}
}
AI_SINGLE_BATTLE_TEST("AI_SMART_MON_CHOICES: AI sees its own weather setting ability when considering switchin candidates") AI_SINGLE_BATTLE_TEST("AI_SMART_MON_CHOICES: AI sees its own weather setting ability when considering switchin candidates")
{ {
u32 ability = ABILITY_NONE; u32 ability = ABILITY_NONE;

View File

@ -232,3 +232,21 @@ DOUBLE_BATTLE_TEST("Eject Button activation will not trigger an attack from the
} }
} }
} }
SINGLE_BATTLE_TEST("Eject Button activates after Wandring Spirit")
{
GIVEN {
PLAYER(SPECIES_EKANS) { Ability(ABILITY_INTIMIDATE); }
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_YAMASK_GALAR) { Item(ITEM_EJECT_BUTTON); Ability(ABILITY_WANDERING_SPIRIT); }
} WHEN {
TURN {
SWITCH(opponent, 1);
MOVE(player, MOVE_DRAGON_CLAW);
SEND_OUT(opponent, 0);
}
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_DRAGON_CLAW, player);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponent);
}
}

View File

@ -35,3 +35,5 @@ DOUBLE_BATTLE_TEST("Magic Room prevents item hold effects")
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponentRight); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponentRight);
} }
} }
TO_DO_BATTLE_TEST("TODO: Write Magic Room (Move Effect) test titles")

View File

@ -1,4 +1,57 @@
#include "global.h" #include "global.h"
#include "test/battle.h" #include "test/battle.h"
TO_DO_BATTLE_TEST("TODO: Write Magic Room (Move Effect) test titles") ASSUMPTIONS
{
ASSUME(GetMoveEffect(MOVE_MAGNET_RISE) == EFFECT_MAGNET_RISE);
}
SINGLE_BATTLE_TEST("Magnet Rise rises the user into the air, avoiding Ground-type attacks")
{
GIVEN {
ASSUME(GetMoveType(MOVE_EARTHQUAKE) == TYPE_GROUND);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WYNAUT);
} WHEN {
TURN { MOVE(player, MOVE_MAGNET_RISE); MOVE(opponent, MOVE_EARTHQUAKE); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_MAGNET_RISE, player);
NONE_OF {
ANIMATION(ANIM_TYPE_MOVE, MOVE_EARTHQUAKE, opponent);
HP_BAR(player);
}
}
}
SINGLE_BATTLE_TEST("Magnet Rise fails if the user is Rooted")
{
GIVEN {
ASSUME(GetMoveEffect(MOVE_INGRAIN) == EFFECT_INGRAIN);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WYNAUT);
} WHEN {
TURN { MOVE(player, MOVE_INGRAIN); }
TURN { MOVE(player, MOVE_MAGNET_RISE); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_INGRAIN, player);
NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_MAGNET_RISE, player);
}
}
SINGLE_BATTLE_TEST("Magnet Rise fails if the user is Grounded by Smack Down")
{
GIVEN {
ASSUME(GetMoveEffect(MOVE_SMACK_DOWN) == EFFECT_SMACK_DOWN);
ASSUME(gSpeciesInfo[SPECIES_XATU].types[0] == TYPE_FLYING || gSpeciesInfo[SPECIES_XATU].types[1] == TYPE_FLYING);
PLAYER(SPECIES_XATU);
OPPONENT(SPECIES_WYNAUT);
} WHEN {
TURN { MOVE(opponent, MOVE_SMACK_DOWN); MOVE(player, MOVE_MAGNET_RISE); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_SMACK_DOWN, opponent);
MESSAGE("Xatu fell straight down!");
NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_MAGNET_RISE, player);
}
}
TO_DO_BATTLE_TEST("TODO: Write Magnet Rise (Move Effect) test titles")

View File

@ -200,11 +200,11 @@ SINGLE_BATTLE_TEST("Protect: Baneful Bunker can't poison pokemon if they are alr
PLAYER(SPECIES_WOBBUFFET); PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET);
} WHEN { } WHEN {
TURN { MOVE(opponent, MOVE_NUZZLE); } TURN { MOVE(opponent, MOVE_WILL_O_WISP); }
TURN { MOVE(opponent, MOVE_BANEFUL_BUNKER); MOVE(player, MOVE_SCRATCH); } TURN { MOVE(opponent, MOVE_BANEFUL_BUNKER); MOVE(player, MOVE_SCRATCH); }
TURN {}
} SCENE { } SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_NUZZLE, opponent); ANIMATION(ANIM_TYPE_MOVE, MOVE_WILL_O_WISP, opponent);
STATUS_ICON(player, STATUS1_BURN);
ANIMATION(ANIM_TYPE_MOVE, MOVE_BANEFUL_BUNKER, opponent); ANIMATION(ANIM_TYPE_MOVE, MOVE_BANEFUL_BUNKER, opponent);
NONE_OF { NONE_OF {
ANIMATION(ANIM_TYPE_MOVE, MOVE_SCRATCH, player); ANIMATION(ANIM_TYPE_MOVE, MOVE_SCRATCH, player);
@ -252,11 +252,11 @@ SINGLE_BATTLE_TEST("Protect: Burning Bulwark can't burn pokemon if they are alre
PLAYER(SPECIES_WOBBUFFET); PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET);
} WHEN { } WHEN {
TURN { MOVE(opponent, MOVE_NUZZLE); } TURN { MOVE(opponent, MOVE_TOXIC); }
TURN { MOVE(opponent, MOVE_BURNING_BULWARK); MOVE(player, MOVE_SCRATCH); } TURN { MOVE(opponent, MOVE_BURNING_BULWARK); MOVE(player, MOVE_SCRATCH); }
TURN {}
} SCENE { } SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_NUZZLE, opponent); ANIMATION(ANIM_TYPE_MOVE, MOVE_TOXIC, opponent);
STATUS_ICON(player, STATUS1_TOXIC_POISON);
ANIMATION(ANIM_TYPE_MOVE, MOVE_BURNING_BULWARK, opponent); ANIMATION(ANIM_TYPE_MOVE, MOVE_BURNING_BULWARK, opponent);
NONE_OF { NONE_OF {
ANIMATION(ANIM_TYPE_MOVE, MOVE_SCRATCH, player); ANIMATION(ANIM_TYPE_MOVE, MOVE_SCRATCH, player);

View File

@ -67,6 +67,36 @@ SINGLE_BATTLE_TEST("Razor Wind doesn't need to charge with Power Herb")
} }
} }
DOUBLE_BATTLE_TEST("Razor Wind successfully KOs both opponents")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_POWER_HERB); }
PLAYER(SPECIES_WYNAUT);
OPPONENT(SPECIES_WOBBUFFET) { HP(1); }
OPPONENT(SPECIES_WYNAUT) { HP(1); }
} WHEN {
TURN { MOVE(playerLeft, MOVE_RAZOR_WIND); }
} SCENE {
if (B_UPDATED_MOVE_DATA >= GEN_5) {
NOT MESSAGE("Wobbuffet whipped up a whirlwind!");
MESSAGE("Wobbuffet used Razor Wind!");
} else
ANIMATION(ANIM_TYPE_MOVE, MOVE_RAZOR_WIND, playerLeft);
if (B_UPDATED_MOVE_DATA < GEN_5)
MESSAGE("Wobbuffet whipped up a whirlwind!");
else
ANIMATION(ANIM_TYPE_MOVE, MOVE_RAZOR_WIND, playerLeft);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, playerLeft);
MESSAGE("Wobbuffet became fully charged due to its Power Herb!");
if (B_UPDATED_MOVE_DATA < GEN_5)
MESSAGE("Wobbuffet used Razor Wind!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_RAZOR_WIND, playerLeft);
HP_BAR(opponentLeft);
MESSAGE("The opposing Wobbuffet fainted!");
MESSAGE("The opposing Wynaut fainted!");
}
}
SINGLE_BATTLE_TEST("Skull Bash needs a charging turn") SINGLE_BATTLE_TEST("Skull Bash needs a charging turn")
{ {
GIVEN { GIVEN {

View File

@ -1,4 +0,0 @@
#include "global.h"
#include "test/battle.h"
TO_DO_BATTLE_TEST("TODO: Write Will-O-Wisp (Move Effect) test titles")

View File

@ -29,19 +29,20 @@ SINGLE_BATTLE_TEST("B_VAR_STARTING_STATUS starts a chosen terrain at the beginni
TURN { ; } TURN { ; }
TURN { ; } TURN { ; }
} SCENE { } SCENE {
switch (terrain) { switch (terrain)
case STARTING_STATUS_GRASSY_TERRAIN: {
MESSAGE("Grass grew to cover the battlefield!"); case STARTING_STATUS_GRASSY_TERRAIN:
break; MESSAGE("The battlefield is covered with grass!");
case STARTING_STATUS_PSYCHIC_TERRAIN: break;
MESSAGE("The battlefield got weird!"); case STARTING_STATUS_PSYCHIC_TERRAIN:
break; MESSAGE("The battlefield seems weird!");
case STARTING_STATUS_MISTY_TERRAIN: break;
MESSAGE("Mist swirled around the battlefield!"); case STARTING_STATUS_MISTY_TERRAIN:
break; MESSAGE("Mist swirls around the battlefield!");
case STARTING_STATUS_ELECTRIC_TERRAIN: break;
MESSAGE("An electric current is running across the battlefield!"); case STARTING_STATUS_ELECTRIC_TERRAIN:
break; MESSAGE("An electric current is running across the battlefield!");
break;
} }
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_RESTORE_BG); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_RESTORE_BG);
NONE_OF { NONE_OF {

View File

@ -333,6 +333,9 @@ void HandleJascToGbaPaletteCommand(char *inputPath, char *outputPath, int argc,
if (numColors < 1) if (numColors < 1)
FATAL_ERROR("Number of colors must be positive.\n"); FATAL_ERROR("Number of colors must be positive.\n");
if (numColors > 255)
FATAL_ERROR("Number of colors must be less than 256.\n");
} }
else else
{ {

View File

@ -724,7 +724,7 @@ void AsmFile::RaiseWarning(const char* format, ...)
int AsmFile::SkipWhitespaceAndEol() int AsmFile::SkipWhitespaceAndEol()
{ {
int newlines = 0; int newlines = 0;
while (m_buffer[m_pos] == '\t' || m_buffer[m_pos] == ' ' || m_buffer[m_pos] == '\n') while (m_buffer[m_pos] == '\t' || m_buffer[m_pos] == ' ' || m_buffer[m_pos] == '\r' || m_buffer[m_pos] == '\n')
{ {
if (m_buffer[m_pos] == '\n') if (m_buffer[m_pos] == '\n')
newlines++; newlines++;

View File

@ -26,6 +26,11 @@
#include "c_file.h" #include "c_file.h"
#include "charmap.h" #include "charmap.h"
#ifdef _WIN32
#include <io.h>
#include <fcntl.h>
#endif
static void UsageAndExit(const char *program); static void UsageAndExit(const char *program);
Charmap* g_charmap; Charmap* g_charmap;
@ -179,6 +184,11 @@ int main(int argc, char **argv)
g_charmap = new Charmap(charmap); g_charmap = new Charmap(charmap);
#ifdef _WIN32
// On Windows, piping from stdout can break newlines. Treat stdout as binary stream to avoid this.
_setmode(_fileno(stdout), _O_BINARY);
#endif
const char* extension = GetFileExtension(source); const char* extension = GetFileExtension(source);
if (!extension) if (!extension)