Merge branch 'RHH/upcoming' into RHH/pr/upcoming/cleanup/customTrainer

# Conflicts:
#	src/battle_main.c
#	src/battle_tower.c
#	src/match_call.c
This commit is contained in:
Eduardo Quezada 2023-08-11 11:41:44 -04:00
commit f026b51b48
288 changed files with 8197 additions and 4294 deletions

View File

@ -1,49 +1,50 @@
name: ⚔️ Battle Engine mechanical bugs 🐛
description: File a bug report related to battle mechanic, be it moves, abilities and/or items.
labels: ["bug", "status: unconfirmed", "category: battle-mechanic"]
body:
- type: markdown
attributes:
value: |
Please fill in all required fields with as many details as possible.
- type: textarea
id: description
attributes:
label: Description
description: |
Describe the issue you are experiencing.
Attach images/videos if possible.
placeholder: |
Please enter a description of the issue. Here you can also attach log screenshots, gifs or a video
validations:
required: true
- type: dropdown
id: version
attributes:
label: Version
description: What version of pokeemerald-expansion are you using as a base?
options:
- 1.5.0 (Default)
- upcoming (Edge)
- 1.4.3
- 1.4.2
- 1.4.1
- 1.4.0
- pre-1.4.0
validations:
required: true
- type: input
id: upcomingversion
attributes:
label: Upcoming Version
description: If you're using the upcoming branch, please specify what was the commit hash you pulled from.
validations:
required: false
- type: input
id: contact
attributes:
label: Discord contact info
description: Provide your Discord tag here so we can contact you in case we need more details. Be sure to join our server ([here](https://discord.gg/6CzjAG6GZk)).
placeholder: ex. Lunos#4026
validations:
required: false
name: ⚔️ Battle Engine mechanical bugs 🐛
description: File a bug report related to battle mechanic, be it moves, abilities and/or items.
labels: ["bug", "status: unconfirmed", "category: battle-mechanic"]
body:
- type: markdown
attributes:
value: |
Please fill in all required fields with as many details as possible.
- type: textarea
id: description
attributes:
label: Description
description: |
Describe the issue you are experiencing.
Attach images/videos if possible.
placeholder: |
Please enter a description of the issue. Here you can also attach log screenshots, gifs or a video
validations:
required: true
- type: dropdown
id: version
attributes:
label: Version
description: What version of pokeemerald-expansion are you using as a base?
options:
- 1.5.1 (Default)
- upcoming (Edge)
- 1.5.0
- 1.4.3
- 1.4.2
- 1.4.1
- 1.4.0
- pre-1.4.0
validations:
required: true
- type: input
id: upcomingversion
attributes:
label: Upcoming Version
description: If you're using the upcoming branch, please specify what was the commit hash you pulled from.
validations:
required: false
- type: input
id: contact
attributes:
label: Discord contact info
description: Provide your Discord tag here so we can contact you in case we need more details. Be sure to join our server ([here](https://discord.gg/6CzjAG6GZk)).
placeholder: ex. Lunos#4026
validations:
required: false

View File

@ -1,49 +1,50 @@
name: 🧠 Battle AI bugs 🐛
description: File a bug report related to battle AI.
labels: ["bug", "status: unconfirmed", "category: battle-ai"]
body:
- type: markdown
attributes:
value: |
Please fill in all required fields with as many details as possible.
- type: textarea
id: description
attributes:
label: Description
description: |
Describe the issue you are experiencing.
Attach images/videos if possible.
placeholder: |
Please enter a description of the issue. Here you can also attach log screenshots, gifs or a video
validations:
required: true
- type: dropdown
id: version
attributes:
label: Version
description: What version of pokeemerald-expansion are you using as a base?
options:
- 1.5.0 (Default)
- upcoming (Edge)
- 1.4.3
- 1.4.2
- 1.4.1
- 1.4.0
- pre-1.4.0
validations:
required: true
- type: input
id: upcomingversion
attributes:
label: Upcoming Version
description: If you're using the upcoming branch, please specify what was the commit hash you pulled from.
validations:
required: false
- type: input
id: contact
attributes:
label: Discord contact info
description: Provide your Discord tag here so we can contact you in case we need more details. Be sure to join our server ([here](https://discord.gg/6CzjAG6GZk)).
placeholder: ex. Lunos#4026
validations:
required: false
name: 🧠 Battle AI bugs 🐛
description: File a bug report related to battle AI.
labels: ["bug", "status: unconfirmed", "category: battle-ai"]
body:
- type: markdown
attributes:
value: |
Please fill in all required fields with as many details as possible.
- type: textarea
id: description
attributes:
label: Description
description: |
Describe the issue you are experiencing.
Attach images/videos if possible.
placeholder: |
Please enter a description of the issue. Here you can also attach log screenshots, gifs or a video
validations:
required: true
- type: dropdown
id: version
attributes:
label: Version
description: What version of pokeemerald-expansion are you using as a base?
options:
- 1.5.1 (Default)
- upcoming (Edge)
- 1.5.0
- 1.4.3
- 1.4.2
- 1.4.1
- 1.4.0
- pre-1.4.0
validations:
required: true
- type: input
id: upcomingversion
attributes:
label: Upcoming Version
description: If you're using the upcoming branch, please specify what was the commit hash you pulled from.
validations:
required: false
- type: input
id: contact
attributes:
label: Discord contact info
description: Provide your Discord tag here so we can contact you in case we need more details. Be sure to join our server ([here](https://discord.gg/6CzjAG6GZk)).
placeholder: ex. Lunos#4026
validations:
required: false

View File

@ -1,27 +1,27 @@
name: 🙏 Feature Request 🙏
description: Do you want a feature to be added to the Expansion? Let us know!
labels: ["feature-request"]
body:
- type: markdown
attributes:
value: |
Please fill in all required fields with as many details as possible.
- type: textarea
id: description
attributes:
label: Description
description: |
Describe the issue you are experiencing.
Attach images/videos if possible.
placeholder: |
Please enter a description of the issue. Here you can also attach log screenshots, gifs or a video
validations:
required: true
- type: input
id: contact
attributes:
label: Discord contact info
description: Provide your Discord tag here so we can contact you in case we need more details. Be sure to join our server ([here](https://discord.gg/6CzjAG6GZk)).
placeholder: ex. Lunos#4026
validations:
required: false
name: 🙏 Feature Request 🙏
description: Do you want a feature to be added to the Expansion? Let us know!
labels: ["feature-request"]
body:
- type: markdown
attributes:
value: |
Please fill in all required fields with as many details as possible.
- type: textarea
id: description
attributes:
label: Description
description: |
Describe the issue you are experiencing.
Attach images/videos if possible.
placeholder: |
Please enter a description of the issue. Here you can also attach log screenshots, gifs or a video
validations:
required: true
- type: input
id: contact
attributes:
label: Discord contact info
description: Provide your Discord tag here so we can contact you in case we need more details. Be sure to join our server ([here](https://discord.gg/6CzjAG6GZk)).
placeholder: ex. Lunos#4026
validations:
required: false

View File

@ -1,49 +1,50 @@
name: 💾 Other errors 🖥️
description: Everything else that doesn't fit in the above categories.
labels: ["bug", "status: unconfirmed"]
body:
- type: markdown
attributes:
value: |
Please fill in all required fields with as many details as possible.
- type: textarea
id: description
attributes:
label: Description
description: |
Describe the issue you are experiencing.
Attach images/videos if possible.
placeholder: |
Please enter a description of the issue. Here you can also attach log screenshots, gifs or a video
validations:
required: true
- type: dropdown
id: version
attributes:
label: Version
description: What version of pokeemerald-expansion are you using as a base?
options:
- 1.5.0 (Default)
- upcoming (Edge)
- 1.4.3
- 1.4.2
- 1.4.1
- 1.4.0
- pre-1.4.0
validations:
required: true
- type: input
id: upcomingversion
attributes:
label: Upcoming Version
description: If you're using the upcoming branch, please specify what was the commit hash you pulled from.
validations:
required: false
- type: input
id: contact
attributes:
label: Discord contact info
description: Provide your Discord tag here so we can contact you in case we need more details. Be sure to join our server ([here](https://discord.gg/6CzjAG6GZk)).
placeholder: ex. Lunos#4026
validations:
required: false
name: 💾 Other errors 🖥️
description: Everything else that doesn't fit in the above categories.
labels: ["bug", "status: unconfirmed"]
body:
- type: markdown
attributes:
value: |
Please fill in all required fields with as many details as possible.
- type: textarea
id: description
attributes:
label: Description
description: |
Describe the issue you are experiencing.
Attach images/videos if possible.
placeholder: |
Please enter a description of the issue. Here you can also attach log screenshots, gifs or a video
validations:
required: true
- type: dropdown
id: version
attributes:
label: Version
description: What version of pokeemerald-expansion are you using as a base?
options:
- 1.5.1 (Default)
- upcoming (Edge)
- 1.5.0
- 1.4.3
- 1.4.2
- 1.4.1
- 1.4.0
- pre-1.4.0
validations:
required: true
- type: input
id: upcomingversion
attributes:
label: Upcoming Version
description: If you're using the upcoming branch, please specify what was the commit hash you pulled from.
validations:
required: false
- type: input
id: contact
attributes:
label: Discord contact info
description: Provide your Discord tag here so we can contact you in case we need more details. Be sure to join our server ([here](https://discord.gg/6CzjAG6GZk)).
placeholder: ex. Lunos#4026
validations:
required: false

View File

@ -4,9 +4,7 @@ on:
push:
branches:
- master
- battle_engine
- pokemon_expansion
- item_expansion
- upcoming
pull_request:
jobs:

View File

@ -1,16 +0,0 @@
name: Close issues related to a merged pull request based on master branch.
on:
pull_request:
types: [closed]
branches:
- upcoming
jobs:
closeIssueOnPrMergeTrigger:
runs-on: ubuntu-latest
steps:
- name: Closes issues related to a merged pull request.
uses: ldez/gha-mjolnir@v1.0.3

View File

@ -125,19 +125,53 @@ Otherwise, ask for help on Discord or IRC (see [README.md](README.md)), or conti
Note that in msys2, Copy is Ctrl+Insert and Paste is Shift+Insert.
1. Open msys2 at C:\devkitPro\msys2\mingw64.exe or run `C:\devkitPro\msys2\msys2_shell.bat -mingw64`.
1. Open msys2 at C:\devkitPro\msys2\msys2_shell.bat.
2. Certain packages are required to build pokeemerald. Install these by running the following command:
2. Certain packages are required to build pokeemerald. Install these by running the following two commands:
```bash
pacman -S make zlib-devel git mingw-w64-x86_64-gcc mingw-w64-x86_64-libpng
pacman -Sy msys2-keyring
pacman -S make gcc zlib-devel git
```
<details>
<summary><i>Note...</i></summary>
> This command will ask for confirmation, just enter the yes action when prompted.
> The commands will ask for confirmation, just enter the yes action when prompted.
</details>
3. Download [libpng](https://sourceforge.net/projects/libpng/files/libpng16/1.6.37/libpng-1.6.37.tar.xz/download).
4. Change directory to where libpng was downloaded. By default, msys2 will start in the current user's profile folder, located at **C:\Users\\&#8288;_\<user>_**, where *\<user>* is your Windows username. In most cases, libpng should be saved within a subfolder of the profile folder. For example, if libpng was saved to **C:\Users\\_\<user>_\Downloads** (the Downloads location for most users), enter this command:
```bash
cd Downloads
```
<details>
<summary><i>Notes...</i></summary>
> Note 1: While not shown, msys uses forward slashes `/` instead of backwards slashes `\` as the directory separator.
> Note 2: If the path has spaces, then the path must be wrapped with quotations, e.g. `cd "Downloads/My Downloads"`.
> Note 3: Windows path names are case-insensitive so adhering to capitalization isnt needed.
> Note 4: If libpng was saved elsewhere, you will need to specify the full path to where libpng was downloaded, e.g. `cd c:/devkitpro/msys2` if it was saved there.
</details>
5. Run the following commands to uncompress and install libpng.
```bash
tar xf libpng-1.6.37.tar.xz
cd libpng-1.6.37
./configure --prefix=/usr
make check
make install
```
6. Then finally, run the following command to change back to the user profile folder.
```bash
cd
```
### Choosing where to store pokeemerald (msys2)
At this point, you can choose a folder to store pokeemerald into. If you're okay with storing pokeemerald in the user profile folder, then proceed to [Installation](#installation). Otherwise, you'll need to account for where pokeemerald is stored when changing directory to the pokeemerald folder.

View File

@ -28,7 +28,7 @@ LD := $(PREFIX)ld
# note: the makefile must be set up so MODERNCC is never called
# if MODERN=0
MODERNCC := $(PREFIX)gcc
PATH_MODERNCC := PATH=$(TOOLCHAIN)/bin:PATH $(MODERNCC)
PATH_MODERNCC := PATH="$(PATH)" $(MODERNCC)
ifeq ($(OS),Windows_NT)
EXE := .exe
@ -118,7 +118,7 @@ LIBPATH := -L ../../tools/agbcc/lib
LIB := $(LIBPATH) -lgcc -lc -L../../libagbsyscall -lagbsyscall
else
CC1 = $(shell $(PATH_MODERNCC) --print-prog-name=cc1) -quiet
override CFLAGS += -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder -Wno-pointer-to-int-cast
override CFLAGS += -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder -Wno-pointer-to-int-cast -std=gnu17 -fanalyzer
ROM := $(MODERN_ROM_NAME)
OBJ_DIR := $(MODERN_OBJ_DIR_NAME)
LIBPATH := -L "$(dir $(shell $(PATH_MODERNCC) -mthumb -print-file-name=libgcc.a))" -L "$(dir $(shell $(PATH_MODERNCC) -mthumb -print-file-name=libnosys.a))" -L "$(dir $(shell $(PATH_MODERNCC) -mthumb -print-file-name=libc.a))"

View File

@ -1053,8 +1053,9 @@
.byte 0xca
.endm
.macro setcharge
.macro setcharge battler:req
.byte 0xcb
.byte \battler
.endm
.macro callterrainattack
@ -1380,6 +1381,12 @@
.byte \counter
.4byte \ptr
.endm
.macro jumpifcantloseitem battler:req, ptr:req
callnative BS_JumpIfCantLoseItem
.byte \battler
.4byte \ptr
.endm
@ various command changed to more readable macros
.macro cancelmultiturnmoves battler:req

File diff suppressed because it is too large Load Diff

View File

@ -432,6 +432,57 @@ gBattleScriptsForMoveEffects::
.4byte BattleScript_EffectInfernalParade @ EFFECT_INFERNAL_PARADE
.4byte BattleScript_EffectTakeHeart @ EFFECT_TAKE_HEART
.4byte BattleScript_EffectAxeKick @ EFFECT_AXE_KICK
.4byte BattleScript_EffectHit @ EFFECT_COLLISION_COURSE
.4byte BattleScript_EffectSpinOut @ EFFECT_SPIN_OUT
.4byte BattleScript_EffectMakeItRain @ EFFECT_MAKE_IT_RAIN
.4byte BattleScript_EffectCorrosiveGas @ EFFECT_CORROSIVE_GAS
.4byte BattleScript_EffectHit @ EFFECT_POPULATION_BOMB
.4byte BattleScript_EffectMortalSpin @ EFFECT_MORTAL_SPIN
BattleScript_EffectMortalSpin:
call BattleScript_EffectHit_Ret
rapidspinfree
setmoveeffect MOVE_EFFECT_POISON
seteffectwithchance
tryfaintmon BS_TARGET
moveendall
end
BattleScript_EffectCorrosiveGas:
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
ppreduce
jumpifsubstituteblocks BattleScript_CorrosiveGasFail
jumpifcantloseitem BS_TARGET, BattleScript_CorrosiveGasFail
attackanimation
waitanimation
jumpifability BS_TARGET, ABILITY_STICKY_HOLD, BattleScript_StickyHoldActivates
setlastuseditem BS_TARGET
removeitem BS_TARGET
printstring STRINGID_PKMNITEMMELTED
waitmessage B_WAIT_TIME_LONG
goto BattleScript_MoveEnd
BattleScript_CorrosiveGasFail:
pause B_WAIT_TIME_SHORT
orhalfword gMoveResultFlags, MOVE_RESULT_FAILED
printstring STRINGID_NOEFFECTONTARGET
waitmessage B_WAIT_TIME_LONG
goto BattleScript_MoveEnd
BattleScript_EffectMakeItRain:
setmoveeffect MOVE_EFFECT_PAYDAY
call BattleScript_EffectHit_Ret
seteffectwithchance
tryfaintmon BS_TARGET
setmoveeffect MOVE_EFFECT_SP_ATK_MINUS_1 | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN
seteffectprimary
goto BattleScript_MoveEnd
BattleScript_EffectSpinOut::
setmoveeffect MOVE_EFFECT_SPD_MINUS_2 | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN
goto BattleScript_EffectHit
BattleScript_EffectAxeKick::
setmoveeffect MOVE_EFFECT_CONFUSION
@ -1121,24 +1172,7 @@ BattleScript_HyperspaceFuryRemoveProtect::
return
BattleScript_EffectPlasmaFists:
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
ppreduce
critcalc
damagecalc
adjustdamage
attackanimation
waitanimation
effectivenesssound
hitanimation BS_TARGET
waitstate
healthbarupdate BS_TARGET
datahpupdate BS_TARGET
critmessage
waitmessage B_WAIT_TIME_LONG
resultmessage
waitmessage B_WAIT_TIME_LONG
call BattleScript_EffectHit_Ret
seteffectwithchance
tryfaintmon BS_TARGET
applyplasmafists
@ -1147,24 +1181,7 @@ BattleScript_EffectPlasmaFists:
goto BattleScript_MoveEnd
BattleScript_EffectSparklySwirl:
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
ppreduce
critcalc
damagecalc
adjustdamage
attackanimation
waitanimation
effectivenesssound
hitanimation BS_TARGET
waitstate
healthbarupdate BS_TARGET
datahpupdate BS_TARGET
critmessage
waitmessage B_WAIT_TIME_LONG
resultmessage
waitmessage B_WAIT_TIME_LONG
call BattleScript_EffectHit_Ret
tryfaintmon BS_TARGET
healpartystatus
waitstate
@ -1173,24 +1190,7 @@ BattleScript_EffectSparklySwirl:
goto BattleScript_MoveEnd
BattleScript_EffectFreezyFrost:
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
ppreduce
critcalc
damagecalc
adjustdamage
attackanimation
waitanimation
effectivenesssound
hitanimation BS_TARGET
waitstate
healthbarupdate BS_TARGET
datahpupdate BS_TARGET
critmessage
waitmessage B_WAIT_TIME_LONG
resultmessage
waitmessage B_WAIT_TIME_LONG
call BattleScript_EffectHit_Ret
tryfaintmon BS_TARGET
normalisebuffs
printstring STRINGID_STATCHANGESGONE
@ -1199,24 +1199,7 @@ BattleScript_EffectFreezyFrost:
BattleScript_EffectSappySeed:
jumpifstatus3 BS_TARGET, STATUS3_LEECHSEED, BattleScript_EffectHit
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
ppreduce
critcalc
damagecalc
adjustdamage
attackanimation
waitanimation
effectivenesssound
hitanimation BS_TARGET
waitstate
healthbarupdate BS_TARGET
datahpupdate BS_TARGET
critmessage
waitmessage B_WAIT_TIME_LONG
resultmessage
waitmessage B_WAIT_TIME_LONG
call BattleScript_EffectHit_Ret
tryfaintmon BS_TARGET
jumpifhasnohp BS_TARGET, BattleScript_MoveEnd
setseeded
@ -1226,24 +1209,7 @@ BattleScript_EffectSappySeed:
BattleScript_EffectBaddyBad:
jumpifsideaffecting BS_ATTACKER, SIDE_STATUS_REFLECT, BattleScript_EffectHit
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
ppreduce
critcalc
damagecalc
adjustdamage
attackanimation
waitanimation
effectivenesssound
hitanimation BS_TARGET
waitstate
healthbarupdate BS_TARGET
datahpupdate BS_TARGET
critmessage
waitmessage B_WAIT_TIME_LONG
resultmessage
waitmessage B_WAIT_TIME_LONG
call BattleScript_EffectHit_Ret
tryfaintmon BS_TARGET
setreflect
printfromtable gReflectLightScreenSafeguardStringIds
@ -1252,24 +1218,7 @@ BattleScript_EffectBaddyBad:
BattleScript_EffectGlitzyGlow:
jumpifsideaffecting BS_ATTACKER, SIDE_STATUS_LIGHTSCREEN, BattleScript_EffectHit
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
ppreduce
critcalc
damagecalc
adjustdamage
attackanimation
waitanimation
effectivenesssound
hitanimation BS_TARGET
waitstate
healthbarupdate BS_TARGET
datahpupdate BS_TARGET
critmessage
waitmessage B_WAIT_TIME_LONG
resultmessage
waitmessage B_WAIT_TIME_LONG
call BattleScript_EffectHit_Ret
tryfaintmon BS_TARGET
setlightscreen
printfromtable gReflectLightScreenSafeguardStringIds
@ -1430,24 +1379,7 @@ BattleScript_NoMoveEffect:
BattleScript_EffectRelicSong:
setmoveeffect MOVE_EFFECT_RELIC_SONG | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
ppreduce
critcalc
damagecalc
adjustdamage
attackanimation
waitanimation
effectivenesssound
hitanimation BS_TARGET
waitstate
healthbarupdate BS_TARGET
datahpupdate BS_TARGET
critmessage
waitmessage B_WAIT_TIME_LONG
resultmessage
waitmessage B_WAIT_TIME_LONG
call BattleScript_EffectHit_Ret
seteffectwithchance
argumentstatuseffect
tryfaintmon BS_TARGET
@ -2214,24 +2146,7 @@ BattleScript_EffectFinalGambit:
goto BattleScript_MoveEnd
BattleScript_EffectHitSwitchTarget:
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
ppreduce
critcalc
damagecalc
adjustdamage
attackanimation
waitanimation
effectivenesssound
hitanimation BS_TARGET
waitstate
healthbarupdate BS_TARGET
datahpupdate BS_TARGET
critmessage
waitmessage B_WAIT_TIME_LONG
resultmessage
waitmessage B_WAIT_TIME_LONG
call BattleScript_EffectHit_Ret
tryfaintmon BS_TARGET
moveendall
jumpifability BS_TARGET, ABILITY_SUCTION_CUPS, BattleScript_AbilityPreventsPhasingOut
@ -3115,12 +3030,9 @@ BattleScript_TryTailwindAbilitiesLoop_WindRider:
BattleScript_TryTailwindAbilitiesLoop_WindPower:
call BattleScript_AbilityPopUp
copybyte sSAVED_BATTLER, gBattlerAttacker
copybyte gBattlerAttacker, gBattlerTarget
setcharge
setcharge BS_TARGET
printstring STRINGID_BEINGHITCHARGEDPKMNWITHPOWER
waitmessage B_WAIT_TIME_LONG
copybyte gBattlerAttacker, sSAVED_BATTLER
goto BattleScript_TryTailwindAbilitiesLoop_Increment
BattleScript_EffectMircleEye:
@ -3191,24 +3103,7 @@ BattleScript_EffectThroatChop:
goto BattleScript_EffectHit
BattleScript_EffectHitEscape:
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
ppreduce
critcalc
damagecalc
adjustdamage
attackanimation
waitanimation
effectivenesssound
hitanimation BS_TARGET
waitstate
healthbarupdate BS_TARGET
datahpupdate BS_TARGET
critmessage
waitmessage B_WAIT_TIME_LONG
resultmessage
waitmessage B_WAIT_TIME_LONG
call BattleScript_EffectHit_Ret
jumpifmovehadnoeffect BattleScript_MoveEnd
jumpifability BS_TARGET, ABILITY_GUARD_DOG, BattleScript_MoveEnd
seteffectwithchance
@ -3280,6 +3175,27 @@ BattleScript_MoveEnd::
moveendall
end
BattleScript_EffectHit_Ret::
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
ppreduce
critcalc
damagecalc
adjustdamage
attackanimation
waitanimation
effectivenesssound
hitanimation BS_TARGET
waitstate
healthbarupdate BS_TARGET
datahpupdate BS_TARGET
critmessage
waitmessage B_WAIT_TIME_LONG
resultmessage
waitmessage B_WAIT_TIME_LONG
return
BattleScript_EffectNaturalGift:
attackcanceler
attackstring
@ -3471,24 +3387,7 @@ BattleScript_EffectPoisonHit:
goto BattleScript_EffectHit
BattleScript_EffectAbsorb::
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
ppreduce
critcalc
damagecalc
adjustdamage
attackanimation
waitanimation
effectivenesssound
hitanimation BS_TARGET
waitstate
healthbarupdate BS_TARGET
datahpupdate BS_TARGET
critmessage
waitmessage B_WAIT_TIME_LONG
resultmessage
waitmessage B_WAIT_TIME_LONG
call BattleScript_EffectHit_Ret
jumpifstatus3 BS_ATTACKER, STATUS3_HEAL_BLOCK, BattleScript_AbsorbHealBlock
setdrainedhp
manipulatedamage DMG_BIG_ROOT
@ -3917,24 +3816,7 @@ BattleScript_EffectFlinchHit::
BattleScript_EffectFlinchStatus:
setmoveeffect MOVE_EFFECT_FLINCH
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
ppreduce
critcalc
damagecalc
adjustdamage
attackanimation
waitanimation
effectivenesssound
hitanimation BS_TARGET
waitstate
healthbarupdate BS_TARGET
datahpupdate BS_TARGET
critmessage
waitmessage B_WAIT_TIME_LONG
resultmessage
waitmessage B_WAIT_TIME_LONG
call BattleScript_EffectHit_Ret
seteffectwithchance
argumentstatuseffect
tryfaintmon BS_TARGET
@ -5167,24 +5049,7 @@ BattleScript_EffectBatonPass::
BattleScript_EffectRapidSpin::
.if B_SPEED_BUFFING_RAPID_SPIN == GEN_8
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
ppreduce
critcalc
damagecalc
adjustdamage
attackanimation
waitanimation
effectivenesssound
hitanimation BS_TARGET
waitstate
healthbarupdate BS_TARGET
datahpupdate BS_TARGET
critmessage
waitmessage B_WAIT_TIME_LONG
resultmessage
waitmessage B_WAIT_TIME_LONG
call BattleScript_EffectHit_Ret
jumpifhalfword CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_DOESNT_AFFECT_FOE, BattleScript_MoveEnd
setmoveeffect MOVE_EFFECT_RAPIDSPIN | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN
seteffectwithchance
@ -5903,7 +5768,7 @@ BattleScript_EffectCharge::
attackcanceler
attackstring
ppreduce
setcharge
setcharge BS_ATTACKER
attackanimation
waitanimation
.if B_CHARGE_SPDEF_RAISE >= GEN_5
@ -6801,9 +6666,6 @@ BattleScript_DoSwitchOut::
hidepartystatussummary BS_ATTACKER
switchinanim BS_ATTACKER, FALSE
waitstate
jumpifcantreverttoprimal BattleScript_DoSwitchOut2
call BattleScript_PrimalReversionRet
BattleScript_DoSwitchOut2:
switchineffects BS_ATTACKER
moveendcase MOVEEND_STATUS_IMMUNITY_ABILITIES
moveendcase MOVEEND_MIRROR_MOVE
@ -6942,14 +6804,14 @@ BattleScript_SunlightFaded::
BattleScript_OverworldWeatherStarts::
printfromtable gWeatherStartsStringIds
waitmessage B_WAIT_TIME_LONG
playanimation_var BS_ATTACKER, sB_ANIM_ARG1
playanimation_var BS_BATTLER_0, sB_ANIM_ARG1
call BattleScript_ActivateWeatherAbilities
end3
BattleScript_OverworldTerrain::
printfromtable gTerrainStringIds
waitmessage B_WAIT_TIME_LONG
playanimation BS_SCRIPTING, B_ANIM_RESTORE_BG
playanimation BS_BATTLER_0, B_ANIM_RESTORE_BG
call BattleScript_ActivateTerrainEffects
end3
@ -6973,27 +6835,6 @@ BattleScript_TailwindEnds::
waitmessage B_WAIT_TIME_LONG
end2
BattleScript_WindPowerActivatesEnd2::
setbyte gBattlerAttacker, 0
BattleScript_WindPowerLoop:
printstring STRINGID_EMPTYSTRING3
jumpifability BS_ATTACKER, ABILITY_WIND_POWER, BattleScript_WindPowerLoop_Cont
goto BattleScript_WindPowerIncrement
BattleScript_WindPowerLoop_Cont:
jumpifstatus3 BS_ATTACKER, STATUS3_CHARGED_UP, BattleScript_WindPowerIncrement
goto BattleScript_WindPower_Activate
BattleScript_WindPower_Activate:
call BattleScript_AbilityPopUp
setcharge
printstring STRINGID_BEINGHITCHARGEDPKMNWITHPOWER
waitmessage B_WAIT_TIME_LONG
BattleScript_WindPowerIncrement:
addbyte gBattlerAttacker, 1
jumpifbytenotequal gBattlerAttacker, gBattlersCount, BattleScript_WindPowerLoop
BattleScript_WindPowerEnd:
destroyabilitypopup
end2
BattleScript_TrickRoomEnds::
printstring STRINGID_TRICKROOMENDS
waitmessage B_WAIT_TIME_LONG
@ -7455,11 +7296,8 @@ BattleScript_AngerShellRet:
return
BattleScript_WindPowerActivates::
.if B_CHECK_IF_CHARGED_UP == TRUE
jumpifstatus3 BS_ATTACKER, STATUS3_CHARGED_UP, BattleScript_WindPowerActivates_Ret
.endif
call BattleScript_AbilityPopUp
setcharge
setcharge BS_TARGET
printstring STRINGID_BEINGHITCHARGEDPKMNWITHPOWER
waitmessage B_WAIT_TIME_LONG
BattleScript_WindPowerActivates_Ret:
@ -7958,17 +7796,12 @@ BattleScript_WishMegaEvolution::
goto BattleScript_MegaEvolutionAfterString
BattleScript_PrimalReversion::
printstring STRINGID_EMPTYSTRING3
waitmessage 1
setbyte gIsCriticalHit, 0
handleprimalreversion BS_ATTACKER, 0
handleprimalreversion BS_ATTACKER, 1
playanimation BS_ATTACKER, B_ANIM_PRIMAL_REVERSION
waitanimation
handleprimalreversion BS_ATTACKER, 2
printstring STRINGID_PKMNREVERTEDTOPRIMAL
waitmessage B_WAIT_TIME_LONG
switchinabilities BS_ATTACKER
call BattleScript_PrimalReversionRet
end2
BattleScript_PrimalReversionRestoreAttacker::
call BattleScript_PrimalReversionRet
copybyte gBattlerAttacker, sSAVED_BATTLER
end2
BattleScript_PrimalReversionRet::
@ -7982,6 +7815,7 @@ BattleScript_PrimalReversionRet::
handleprimalreversion BS_ATTACKER, 2
printstring STRINGID_PKMNREVERTEDTOPRIMAL
waitmessage B_WAIT_TIME_LONG
switchinabilities BS_ATTACKER
return
BattleScript_AttackerFormChange::
@ -8822,15 +8656,14 @@ BattleScript_DesolateLandActivates::
call BattleScript_ActivateWeatherAbilities
end3
BattleScript_DesolateLandEvaporatesWaterTypeMoves::
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
BattleScript_PrimalWeatherBlocksMove::
jumpifword CMP_COMMON_BITS, gHitMarker, HITMARKER_ATTACKSTRING_PRINTED, BattleScript_MoveEnd @in case of multi-target moves, if move fails once, no point in printing the message twice
accuracycheck BattleScript_PrintMoveMissed, NO_ACC_CALC_CHECK_LOCK_ON
attackstring
pause B_WAIT_TIME_SHORT
ppreduce
jumpifword CMP_COMMON_BITS, gHitMarker, HITMARKER_STRING_PRINTED, BattleScript_MoveEnd
printstring STRINGID_MOVEEVAPORATEDINTHEHARSHSUNLIGHT
printfromtable gPrimalWeatherBlocksStringIds
waitmessage B_WAIT_TIME_LONG
orword gHitMarker, HITMARKER_STRING_PRINTED
goto BattleScript_MoveEnd
BattleScript_PrimordialSeaActivates::
@ -8842,17 +8675,6 @@ BattleScript_PrimordialSeaActivates::
call BattleScript_ActivateWeatherAbilities
end3
BattleScript_PrimordialSeaFizzlesOutFireTypeMoves::
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
pause B_WAIT_TIME_SHORT
ppreduce
jumpifword CMP_COMMON_BITS, gHitMarker, HITMARKER_STRING_PRINTED, BattleScript_MoveEnd
printstring STRINGID_MOVEFIZZLEDOUTINTHEHEAVYRAIN
waitmessage B_WAIT_TIME_LONG
orword gHitMarker, HITMARKER_STRING_PRINTED
goto BattleScript_MoveEnd
BattleScript_DeltaStreamActivates::
pause B_WAIT_TIME_SHORT
call BattleScript_AbilityPopUp
@ -8990,16 +8812,7 @@ BattleScript_PsychicSurgeActivates::
call BattleScript_ActivateTerrainEffects
end3
BattleScript_HurtTarget_NoString:
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE
healthbarupdate BS_TARGET
datahpupdate BS_TARGET
tryfaintmon BS_TARGET
return
BattleScript_BadDreamsActivates::
call BattleScript_AbilityPopUp
setbyte sFIXED_ABILITY_POPUP, TRUE
setbyte gBattlerTarget, 0
BattleScript_BadDreamsLoop:
jumpiftargetally BattleScript_BadDreamsIncrement
@ -9008,16 +8821,32 @@ BattleScript_BadDreamsLoop:
jumpifstatus BS_TARGET, STATUS1_SLEEP, BattleScript_BadDreams_Dmg
goto BattleScript_BadDreamsIncrement
BattleScript_BadDreams_Dmg:
jumpifbyteequal sFIXED_ABILITY_POPUP, sZero, BattleScript_BadDreams_ShowPopUp
BattleScript_BadDreams_DmgAfterPopUp:
printstring STRINGID_BADDREAMSDMG
waitmessage B_WAIT_TIME_LONG
dmg_1_8_targethp
call BattleScript_HurtTarget_NoString
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE
healthbarupdate BS_TARGET
datahpupdate BS_TARGET
jumpifhasnohp BS_TARGET, BattleScript_BadDreams_HidePopUp
BattleScript_BadDreamsIncrement:
addbyte gBattlerTarget, 1
jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_BadDreamsLoop
BattleScript_BadDreamsEnd:
jumpifbyteequal sFIXED_ABILITY_POPUP, sZero, BattleScript_BadDreamsEnd
destroyabilitypopup
pause 15
BattleScript_BadDreamsEnd:
end3
BattleScript_BadDreams_ShowPopUp:
copybyte gBattlerAbility, gBattlerAttacker
call BattleScript_AbilityPopUp
setbyte sFIXED_ABILITY_POPUP, TRUE
goto BattleScript_BadDreams_DmgAfterPopUp
BattleScript_BadDreams_HidePopUp:
destroyabilitypopup
tryfaintmon BS_TARGET
goto BattleScript_BadDreamsIncrement
BattleScript_TookAttack::
attackstring
@ -10294,24 +10123,7 @@ BattleScript_ExtremeEvoboostEnd::
goto BattleScript_MoveEnd
BattleScript_EffectHitSetRemoveTerrain:
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
ppreduce
critcalc
damagecalc
adjustdamage
attackanimation
waitanimation
effectivenesssound
hitanimation BS_TARGET
waitstate
healthbarupdate BS_TARGET
datahpupdate BS_TARGET
critmessage
waitmessage B_WAIT_TIME_LONG
resultmessage
waitmessage B_WAIT_TIME_LONG
call BattleScript_EffectHit_Ret
setterrain BattleScript_TryFaint
playanimation BS_ATTACKER, B_ANIM_RESTORE_BG
printfromtable gTerrainStringIds
@ -10494,6 +10306,7 @@ BattleScript_SymbiosisActivates::
return
BattleScript_TargetAbilityStatRaiseRet::
copybyte sSAVED_BATTLER, gBattlerAttacker
copybyte gBattlerAbility, gEffectBattler
copybyte gBattlerAttacker, gBattlerTarget
call BattleScript_AbilityPopUp
@ -10501,6 +10314,7 @@ BattleScript_TargetAbilityStatRaiseRet::
setgraphicalstatchangevalues
call BattleScript_StatUp
BattleScript_TargetAbilityStatRaiseRet_End:
copybyte gBattlerAttacker, sSAVED_BATTLER
return
BattleScript_PokemonCantUseTheMove::

View File

@ -421,7 +421,12 @@ BattleFrontier_BattleTowerLobby_EventScript_SaveBeforeLinkMultisChallenge::
call Common_EventScript_SaveGame
setvar VAR_TEMP_0, 255
goto_if_eq VAR_RESULT, 0, BattleFrontier_BattleTowerLobby_EventScript_CancelChallengeSaveFailed
@ GAME_STAT_ENTERED_BATTLE_TOWER should not be incremented here, for two reasons:
@ 1. It is incremented again in BattleFrontier_BattleTowerLobby_EventScript_CableLinkSuccessful or BattleFrontier_BattleTowerLobby_EventScript_WirelessLinkSuccessful
@ 2. If the player tries to save, but fails, the counter will still be incremented even if the player never enters the tower.
.ifndef BUGFIX
incrementgamestat GAME_STAT_ENTERED_BATTLE_TOWER
.endif
specialvar VAR_RESULT, IsWirelessAdapterConnected
goto_if_eq VAR_RESULT, TRUE, BattleFrontier_BattleTowerLobby_EventScript_TryWirelessLink
goto BattleFrontier_BattleTowerLobby_EventScript_TryCableLink

View File

@ -1,14 +1,15 @@
.if DEBUG_OVERWORLD_MENU == TRUE
Debug_ShowFieldMessageStringVar4::
special ShowFieldMessageStringVar4
Debug_MessageEnd:
waitmessage
waitbuttonpress
releaseall
end
Debug_ShowFieldMessageStringVar4::
special ShowFieldMessageStringVar4
goto Debug_MessageEnd
Debug_CheatStart::
lockall
setflag FLAG_SYS_POKEMON_GET
setflag FLAG_RESCUED_BIRCH
setflag FLAG_HIDE_ROUTE_101_BIRCH_ZIGZAGOON_BATTLE
@ -44,12 +45,8 @@ Debug_CheatStart::
end
Debug_FlagsNotSetOverworldConfigMessage::
lockall
message Debug_FlagsNotSetOverworldConfigMessage_Text
waitmessage
waitbuttonpress
releaseall
end
goto Debug_MessageEnd
Debug_FlagsNotSetOverworldConfigMessage_Text:
.string "Feature unavailable!\n"
@ -57,18 +54,21 @@ Debug_FlagsNotSetOverworldConfigMessage_Text:
.string "'include/config/overworld.h'!$"
Debug_FlagsNotSetBattleConfigMessage::
lockall
message Debug_FlagsNotSetBattleConfigMessage_Text
waitmessage
waitbuttonpress
releaseall
end
goto Debug_MessageEnd
Debug_FlagsNotSetBattleConfigMessage_Text:
.string "Feature unavailable!\n"
.string "Please define a usable flag in:\l"
.string "'include/config/battle.h'!$"
Debug_BoxFilledMessage::
message Debug_BoxFilledMessage_Text
goto Debug_MessageEnd
Debug_BoxFilledMessage_Text:
.string "Storage boxes filled!$"
Debug_Script_1::
end
@ -112,4 +112,35 @@ Debug_SaveBlock2Size::
Debug_PokemonStorageSize::
.string "{PKMN}Storage size: {STR_VAR_1}/{STR_VAR_2}.$"
Debug_HatchAnEgg::
lockall
getpartysize
goto_if_eq VAR_RESULT, 0, Debug_HatchAnEgg_NoPokemon
special ChoosePartyMon
waitstate
goto_if_ge VAR_0x8004, PARTY_SIZE, Debug_HatchAnEgg_End
specialvar VAR_RESULT, ScriptGetPartyMonSpecies
goto_if_ne VAR_RESULT, SPECIES_EGG, DebugScript_HatchAnEgg_CantForceHatch
special EggHatch
waitstate
Debug_HatchAnEgg_End::
releaseall
end
Debug_HatchAnEgg_NoPokemon::
msgbox DebugScript_HatchAnEgg_Text_EmptyParty, MSGBOX_DEFAULT
releaseall
end
DebugScript_HatchAnEgg_CantForceHatch::
msgbox DebugScript_HatchAnEgg_Text_NotAnEgg, MSGBOX_DEFAULT
releaseall
end
DebugScript_HatchAnEgg_Text_EmptyParty::
.string "You have no Pokémon nor Eggs.$"
DebugScript_HatchAnEgg_Text_NotAnEgg::
.string "That's not a Pokémon Egg.$"
.endif

View File

@ -48,11 +48,7 @@ struct OamDimensions
s8 height;
};
static void UpdateOamCoords(void);
static void BuildSpritePriorities(void);
static void SortSprites(void);
static void CopyMatricesToOamBuffer(void);
static void AddSpritesToOamBuffer(void);
static void SortSprites(u32 *spritePriorities, s32 n);
static u8 CreateSpriteAt(u8 index, const struct SpriteTemplate *template, s16 x, s16 y, u8 subpriority);
static void ResetOamMatrices(void);
static void ResetSprite(struct Sprite *sprite);
@ -280,12 +276,12 @@ u32 gOamMatrixAllocBitmap;
u8 gReservedSpritePaletteCount;
EWRAM_DATA struct Sprite gSprites[MAX_SPRITES + 1] = {0};
EWRAM_DATA static u16 sSpritePriorities[MAX_SPRITES] = {0};
EWRAM_DATA static u8 sSpriteOrder[MAX_SPRITES] = {0};
EWRAM_DATA static bool8 sShouldProcessSpriteCopyRequests = 0;
EWRAM_DATA static u8 sSpriteCopyRequestCount = 0;
EWRAM_DATA static struct SpriteCopyRequest sSpriteCopyRequests[MAX_SPRITES] = {0};
EWRAM_DATA u8 gOamLimit = 0;
static EWRAM_DATA u8 gOamDummyIndex = 0;
EWRAM_DATA u16 gReservedSpriteTileCount = 0;
EWRAM_DATA static u8 sSpriteTileAllocBitmap[128] = {0};
EWRAM_DATA s16 gSpriteCoordOffsetX = 0;
@ -296,6 +292,7 @@ EWRAM_DATA bool8 gAffineAnimsDisabled = FALSE;
void ResetSpriteData(void)
{
ResetOamRange(0, 128);
gOamDummyIndex = 0;
ResetAllSprites();
ClearSpriteCopyRequests();
ResetAffineAnimData();
@ -326,179 +323,128 @@ void AnimateSprites(void)
void BuildOamBuffer(void)
{
u8 temp;
UpdateOamCoords();
BuildSpritePriorities();
SortSprites();
temp = gMain.oamLoadDisabled;
bool32 oamLoadDisabled;
u32 i, stride;
u8 oamIndex;
// All attributes which affect sorting packed into a single u32:
// { priority:2, subpriority:8, y:9, :5, index:8 }.
// Index has its own byte even though it only needs 6 bits so that
// we can load it with a ldrb instead of having to mask out the
// bottom 6 bits.
u32 spritePriorities[MAX_SPRITES];
s32 toSort = 0;
u8 skippedSprites[MAX_SPRITES];
u32 skippedSpritesN = 0;
u32 matrices = 0;
for (i = 0; i < MAX_SPRITES; i++)
{
// Reuse existing sSpriteOrder because we expect the order to be
// relatively stable between frames.
u32 index = sSpriteOrder[i];
struct Sprite *sprite = &gSprites[index];
s32 y;
if (!sprite->inUse || sprite->invisible)
{
skippedSprites[skippedSpritesN++] = index;
continue;
}
if (sprite->oam.affineMode & ST_OAM_AFFINE_ON_MASK)
matrices |= 1 << sprite->oam.matrixNum;
if (sprite->coordOffsetEnabled)
{
sprite->oam.x = sprite->x + sprite->x2 + sprite->centerToCornerVecX + gSpriteCoordOffsetX;
sprite->oam.y = sprite->y + sprite->y2 + sprite->centerToCornerVecY + gSpriteCoordOffsetY;
}
else
{
sprite->oam.x = sprite->x + sprite->x2 + sprite->centerToCornerVecX;
sprite->oam.y = sprite->y + sprite->y2 + sprite->centerToCornerVecY;
}
y = sprite->oam.y;
if (y >= DISPLAY_HEIGHT)
{
y -= 256;
}
else if (sprite->oam.affineMode == ST_OAM_AFFINE_DOUBLE
&& sprite->oam.size == ST_OAM_SIZE_3)
{
u32 shape = sprite->oam.shape;
if (shape == ST_OAM_SQUARE || shape == ST_OAM_V_RECTANGLE)
{
if (y > 128)
y -= 256;
}
}
// y in [-128...159], so (159 - y) in [0..287].
spritePriorities[toSort++]
= (sprite->oam.priority << 30)
| (sprite->subpriority << 22)
| (((159 - y) & 0x1FF) << 13)
| (index << 0);
}
SortSprites(spritePriorities, toSort);
for (i = 0; i < toSort; i++)
sSpriteOrder[i] = spritePriorities[i] & 0xFF;
for (i = 0; i < skippedSpritesN; i++)
sSpriteOrder[toSort + i] = skippedSprites[i];
oamLoadDisabled = gMain.oamLoadDisabled;
gMain.oamLoadDisabled = TRUE;
AddSpritesToOamBuffer();
CopyMatricesToOamBuffer();
gMain.oamLoadDisabled = temp;
for (i = 0, oamIndex = 0; i < toSort; i++)
{
if (AddSpriteToOamBuffer(&gSprites[spritePriorities[i] & 0xFF], &oamIndex))
break;
}
for (i = oamIndex; i < gOamDummyIndex; i++)
gMain.oamBuffer[i] = gDummyOamData;
gOamDummyIndex = oamIndex;
for (i = 0; matrices != 0; i++, matrices >>= 1)
{
if (matrices & 1)
{
u32 base = 4 * i;
gMain.oamBuffer[base + 0].affineParam = gOamMatrices[i].a;
gMain.oamBuffer[base + 1].affineParam = gOamMatrices[i].b;
gMain.oamBuffer[base + 2].affineParam = gOamMatrices[i].c;
gMain.oamBuffer[base + 3].affineParam = gOamMatrices[i].d;
}
}
gMain.oamLoadDisabled = oamLoadDisabled;
sShouldProcessSpriteCopyRequests = TRUE;
}
void UpdateOamCoords(void)
static inline void InsertionSort(u32 *spritePriorities, s32 n)
{
u8 i;
for (i = 0; i < MAX_SPRITES; i++)
s32 i = 1;
while (i < n)
{
struct Sprite *sprite = &gSprites[i];
if (sprite->inUse && !sprite->invisible)
u32 x = spritePriorities[i];
s32 j = i - 1;
while (j >= 0 && spritePriorities[j] > x)
{
if (sprite->coordOffsetEnabled)
{
sprite->oam.x = sprite->x + sprite->x2 + sprite->centerToCornerVecX + gSpriteCoordOffsetX;
sprite->oam.y = sprite->y + sprite->y2 + sprite->centerToCornerVecY + gSpriteCoordOffsetY;
}
else
{
sprite->oam.x = sprite->x + sprite->x2 + sprite->centerToCornerVecX;
sprite->oam.y = sprite->y + sprite->y2 + sprite->centerToCornerVecY;
}
}
}
}
void BuildSpritePriorities(void)
{
u16 i;
for (i = 0; i < MAX_SPRITES; i++)
{
struct Sprite *sprite = &gSprites[i];
u16 priority = sprite->subpriority | (sprite->oam.priority << 8);
sSpritePriorities[i] = priority;
}
}
void SortSprites(void)
{
u8 i;
for (i = 1; i < MAX_SPRITES; i++)
{
u8 j = i;
struct Sprite *sprite1 = &gSprites[sSpriteOrder[i - 1]];
struct Sprite *sprite2 = &gSprites[sSpriteOrder[i]];
u16 sprite1Priority = sSpritePriorities[sSpriteOrder[i - 1]];
u16 sprite2Priority = sSpritePriorities[sSpriteOrder[i]];
s16 sprite1Y = sprite1->oam.y;
s16 sprite2Y = sprite2->oam.y;
if (sprite1Y >= DISPLAY_HEIGHT)
sprite1Y = sprite1Y - 256;
if (sprite2Y >= DISPLAY_HEIGHT)
sprite2Y = sprite2Y - 256;
if (sprite1->oam.affineMode == ST_OAM_AFFINE_DOUBLE
&& sprite1->oam.size == ST_OAM_SIZE_3)
{
u32 shape = sprite1->oam.shape;
if (shape == ST_OAM_SQUARE || shape == ST_OAM_V_RECTANGLE)
{
if (sprite1Y > 128)
sprite1Y = sprite1Y - 256;
}
}
if (sprite2->oam.affineMode == ST_OAM_AFFINE_DOUBLE
&& sprite2->oam.size == ST_OAM_SIZE_3)
{
u32 shape = sprite2->oam.shape;
if (shape == ST_OAM_SQUARE || shape == ST_OAM_V_RECTANGLE)
{
if (sprite2Y > 128)
sprite2Y = sprite2Y - 256;
}
}
while (j > 0
&& ((sprite1Priority > sprite2Priority)
|| (sprite1Priority == sprite2Priority && sprite1Y < sprite2Y)))
{
u8 temp = sSpriteOrder[j];
sSpriteOrder[j] = sSpriteOrder[j - 1];
sSpriteOrder[j - 1] = temp;
// UB: If j equals 1, then j-- makes j equal 0.
// Then, sSpriteOrder[-1] gets accessed below.
// Although this doesn't result in a bug in the ROM,
// the behavior is undefined.
spritePriorities[j + 1] = spritePriorities[j];
j--;
#ifdef UBFIX
if (j == 0)
break;
#endif
sprite1 = &gSprites[sSpriteOrder[j - 1]];
sprite2 = &gSprites[sSpriteOrder[j]];
sprite1Priority = sSpritePriorities[sSpriteOrder[j - 1]];
sprite2Priority = sSpritePriorities[sSpriteOrder[j]];
sprite1Y = sprite1->oam.y;
sprite2Y = sprite2->oam.y;
if (sprite1Y >= DISPLAY_HEIGHT)
sprite1Y = sprite1Y - 256;
if (sprite2Y >= DISPLAY_HEIGHT)
sprite2Y = sprite2Y - 256;
if (sprite1->oam.affineMode == ST_OAM_AFFINE_DOUBLE
&& sprite1->oam.size == ST_OAM_SIZE_3)
{
u32 shape = sprite1->oam.shape;
if (shape == ST_OAM_SQUARE || shape == ST_OAM_V_RECTANGLE)
{
if (sprite1Y > 128)
sprite1Y = sprite1Y - 256;
}
}
if (sprite2->oam.affineMode == ST_OAM_AFFINE_DOUBLE
&& sprite2->oam.size == ST_OAM_SIZE_3)
{
u32 shape = sprite2->oam.shape;
if (shape == ST_OAM_SQUARE || shape == ST_OAM_V_RECTANGLE)
{
if (sprite2Y > 128)
sprite2Y = sprite2Y - 256;
}
}
}
}
}
void CopyMatricesToOamBuffer(void)
{
u8 i;
for (i = 0; i < OAM_MATRIX_COUNT; i++)
{
u32 base = 4 * i;
gMain.oamBuffer[base + 0].affineParam = gOamMatrices[i].a;
gMain.oamBuffer[base + 1].affineParam = gOamMatrices[i].b;
gMain.oamBuffer[base + 2].affineParam = gOamMatrices[i].c;
gMain.oamBuffer[base + 3].affineParam = gOamMatrices[i].d;
}
}
void AddSpritesToOamBuffer(void)
{
u8 i = 0;
u8 oamIndex = 0;
while (i < MAX_SPRITES)
{
struct Sprite *sprite = &gSprites[sSpriteOrder[i]];
if (sprite->inUse && !sprite->invisible && AddSpriteToOamBuffer(sprite, &oamIndex))
return;
spritePriorities[j + 1] = x;
i++;
}
}
while (oamIndex < gOamLimit)
{
gMain.oamBuffer[oamIndex] = gDummyOamData;
oamIndex++;
}
static void SortSprites(u32 *spritePriorities, s32 n)
{
InsertionSort(spritePriorities, n);
}
u8 CreateSprite(const struct SpriteTemplate *template, s16 x, s16 y, u8 subpriority)
@ -849,7 +795,7 @@ void CopyToSprites(u8 *src)
void ResetAllSprites(void)
{
u8 i;
u32 i;
for (i = 0; i < MAX_SPRITES; i++)
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 400 B

View File

@ -1,19 +0,0 @@
JASC-PAL
0100
16
230 246 255
82 180 172
82 205 189
156 156 131
106 156 148
123 123 98
189 172 98
189 189 139
74 172 156
172 172 131
74 156 123
115 115 82
139 139 106
164 164 115
197 197 148
230 246 255

View File

@ -1,19 +0,0 @@
JASC-PAL
0100
16
230 246 255
246 246 222
230 230 180
139 238 139
246 246 189
197 246 164
246 230 197
230 246 255
230 213 180
205 197 164
148 222 148
222 238 255
139 205 139
213 238 246
222 246 255
213 205 164

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -10,7 +10,7 @@ JASC-PAL
168 144 120
192 192 176
248 248 248
56 48 40
98 82 57
232 64 32
176 24 16
64 56 48

Binary file not shown.

Before

Width:  |  Height:  |  Size: 781 B

After

Width:  |  Height:  |  Size: 741 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 504 B

After

Width:  |  Height:  |  Size: 466 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 596 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 652 B

After

Width:  |  Height:  |  Size: 602 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 652 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 374 B

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 386 B

View File

@ -1,19 +1,19 @@
JASC-PAL
0100
16
248 160 176
197 197 148
90 82 82
205 189 189
230 222 222
246 246 238
81 81 93
176 183 186
210 217 219
221 232 233
0 0 0
255 255 255
222 222 246
0 0 0
245 153 185
200 65 142
0 0 0
0 0 0
148 148 148
74 82 74
75 76 83
255 255 255
24 24 24

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 468 B

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 506 B

View File

@ -1,19 +1,19 @@
JASC-PAL
0100
16
248 160 176
197 197 148
57 65 90
98 115 189
115 139 213
148 180 205
205 238 246
180 197 222
139 205 222
131 180 197
82 98 131
197 197 197
148 139 148
90 90 82
82 101 183
98 146 208
120 182 232
238 160 209
203 238 246
173 196 230
167 217 230
130 167 196
82 90 132
191 200 202
138 138 147
82 83 91
255 255 255
24 24 24

View File

@ -1,19 +1,19 @@
JASC-PAL
0100
16
248 160 176
197 197 148
57 65 90
98 115 189
115 139 213
148 180 205
205 238 246
180 197 222
139 205 222
131 180 197
82 98 131
197 197 197
148 139 148
90 90 82
58 77 90
66 133 158
59 186 164
170 228 208
238 160 209
148 251 101
67 203 125
123 220 239
112 158 194
72 88 142
175 213 218
110 136 175
77 79 96
255 255 255
24 24 24

View File

@ -1,19 +1,19 @@
JASC-PAL
0100
16
248 160 176
197 197 148
98 90 90
205 164 189
230 197 222
88 74 115
192 163 204
226 198 231
255 222 255
0 0 0
255 246 65
230 180 32
242 236 110
235 196 76
245 153 185
200 65 151
0 0 0
0 0 0
0 0 0
148 148 148
74 82 74
161 116 180
75 66 92
255 255 255
24 24 24

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 596 B

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 665 B

View File

@ -1,19 +1,19 @@
JASC-PAL
0100
16
248 160 176
197 197 148
41 82 57
123 82 189
139 115 213
148 180 205
222 84 195
242 156 214
197 180 255
156 156 197
139 205 172
115 164 139
172 221 198
124 182 168
98 74 115
189 230 230
82 115 106
74 82 74
214 245 229
83 113 116
75 83 81
255 255 255
24 24 24

View File

@ -1,19 +1,19 @@
JASC-PAL
0100
16
248 160 176
197 197 148
41 82 57
123 82 189
139 115 213
148 180 205
197 180 255
156 156 197
139 205 172
115 164 139
98 74 115
189 230 230
82 115 106
41 41 81
88 81 189
103 164 224
222 84 195
242 156 214
246 255 178
211 198 141
170 201 212
153 160 168
74 74 115
200 234 234
110 120 135
74 82 74
255 255 255
24 24 24

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 553 B

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 607 B

View File

@ -1,19 +1,19 @@
JASC-PAL
0100
16
248 160 176
197 197 148
98 49 41
205 90 74
238 123 74
255 156 65
0 0 0
206 75 75
238 101 73
255 163 77
245 151 182
255 246 106
230 213 106
255 156 98
213 131 74
148 90 65
213 205 230
90 90 82
234 196 83
255 192 66
222 128 33
135 76 59
206 210 222
228 238 242
87 82 91
255 255 255
24 24 24

View File

@ -1,19 +1,19 @@
JASC-PAL
0100
16
248 160 176
197 197 148
98 49 41
205 90 74
238 123 74
255 156 65
0 0 0
255 246 106
230 213 106
255 156 98
213 131 74
191 64 100
238 73 103
255 122 122
245 151 182
255 165 133
230 107 107
255 206 107
222 138 63
148 90 65
213 205 230
213 174 214
238 211 231
90 90 82
255 255 255
24 24 24

Binary file not shown.

Before

Width:  |  Height:  |  Size: 533 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 599 B

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 599 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 798 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 520 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 686 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 647 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 641 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 612 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 431 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 963 B

After

Width:  |  Height:  |  Size: 928 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 974 B

After

Width:  |  Height:  |  Size: 941 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 562 B

After

Width:  |  Height:  |  Size: 519 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 759 B

After

Width:  |  Height:  |  Size: 722 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 696 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 658 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 768 B

View File

@ -15,5 +15,5 @@ JASC-PAL
144 56 80
72 72 112
168 56 80
0 0 0
255 255 255
0 0 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 712 B

After

Width:  |  Height:  |  Size: 696 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 672 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 794 B

After

Width:  |  Height:  |  Size: 748 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 763 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 601 B

After

Width:  |  Height:  |  Size: 554 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 601 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 811 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 435 B

After

Width:  |  Height:  |  Size: 410 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 423 B

After

Width:  |  Height:  |  Size: 399 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 313 B

After

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 649 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 736 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 789 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 906 B

After

Width:  |  Height:  |  Size: 860 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 901 B

After

Width:  |  Height:  |  Size: 853 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 669 B

After

Width:  |  Height:  |  Size: 633 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 666 B

After

Width:  |  Height:  |  Size: 626 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 987 B

Some files were not shown because too many files have changed in this diff Show More